index.js 114 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (factory());
  5. }(this, (function () { 'use strict';
  6. function unwrapExports (x) {
  7. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  8. }
  9. function createCommonjsModule(fn, module) {
  10. return module = { exports: {} }, fn(module, module.exports), module.exports;
  11. }
  12. var _global = createCommonjsModule(function (module) {
  13. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  14. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  15. ? window : typeof self != 'undefined' && self.Math == Math ? self
  16. // eslint-disable-next-line no-new-func
  17. : Function('return this')();
  18. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  19. });
  20. var _core = createCommonjsModule(function (module) {
  21. var core = module.exports = { version: '2.5.7' };
  22. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  23. });
  24. var _core_1 = _core.version;
  25. var _aFunction = function (it) {
  26. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  27. return it;
  28. };
  29. // optional / simple context binding
  30. var _ctx = function (fn, that, length) {
  31. _aFunction(fn);
  32. if (that === undefined) return fn;
  33. switch (length) {
  34. case 1: return function (a) {
  35. return fn.call(that, a);
  36. };
  37. case 2: return function (a, b) {
  38. return fn.call(that, a, b);
  39. };
  40. case 3: return function (a, b, c) {
  41. return fn.call(that, a, b, c);
  42. };
  43. }
  44. return function (/* ...args */) {
  45. return fn.apply(that, arguments);
  46. };
  47. };
  48. var _isObject = function (it) {
  49. return typeof it === 'object' ? it !== null : typeof it === 'function';
  50. };
  51. var _anObject = function (it) {
  52. if (!_isObject(it)) throw TypeError(it + ' is not an object!');
  53. return it;
  54. };
  55. var _fails = function (exec) {
  56. try {
  57. return !!exec();
  58. } catch (e) {
  59. return true;
  60. }
  61. };
  62. // Thank's IE8 for his funny defineProperty
  63. var _descriptors = !_fails(function () {
  64. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  65. });
  66. var document = _global.document;
  67. // typeof document.createElement is 'object' in old IE
  68. var is = _isObject(document) && _isObject(document.createElement);
  69. var _domCreate = function (it) {
  70. return is ? document.createElement(it) : {};
  71. };
  72. var _ie8DomDefine = !_descriptors && !_fails(function () {
  73. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  74. });
  75. // 7.1.1 ToPrimitive(input [, PreferredType])
  76. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  77. // and the second argument - flag - preferred type is a string
  78. var _toPrimitive = function (it, S) {
  79. if (!_isObject(it)) return it;
  80. var fn, val;
  81. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  82. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
  83. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  84. throw TypeError("Can't convert object to primitive value");
  85. };
  86. var dP = Object.defineProperty;
  87. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  88. _anObject(O);
  89. P = _toPrimitive(P, true);
  90. _anObject(Attributes);
  91. if (_ie8DomDefine) try {
  92. return dP(O, P, Attributes);
  93. } catch (e) { /* empty */ }
  94. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  95. if ('value' in Attributes) O[P] = Attributes.value;
  96. return O;
  97. };
  98. var _objectDp = {
  99. f: f
  100. };
  101. var _propertyDesc = function (bitmap, value) {
  102. return {
  103. enumerable: !(bitmap & 1),
  104. configurable: !(bitmap & 2),
  105. writable: !(bitmap & 4),
  106. value: value
  107. };
  108. };
  109. var _hide = _descriptors ? function (object, key, value) {
  110. return _objectDp.f(object, key, _propertyDesc(1, value));
  111. } : function (object, key, value) {
  112. object[key] = value;
  113. return object;
  114. };
  115. var hasOwnProperty = {}.hasOwnProperty;
  116. var _has = function (it, key) {
  117. return hasOwnProperty.call(it, key);
  118. };
  119. var PROTOTYPE = 'prototype';
  120. var $export = function (type, name, source) {
  121. var IS_FORCED = type & $export.F;
  122. var IS_GLOBAL = type & $export.G;
  123. var IS_STATIC = type & $export.S;
  124. var IS_PROTO = type & $export.P;
  125. var IS_BIND = type & $export.B;
  126. var IS_WRAP = type & $export.W;
  127. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  128. var expProto = exports[PROTOTYPE];
  129. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
  130. var key, own, out;
  131. if (IS_GLOBAL) source = name;
  132. for (key in source) {
  133. // contains in native
  134. own = !IS_FORCED && target && target[key] !== undefined;
  135. if (own && _has(exports, key)) continue;
  136. // export native or passed
  137. out = own ? target[key] : source[key];
  138. // prevent global pollution for namespaces
  139. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  140. // bind timers to global for call from export context
  141. : IS_BIND && own ? _ctx(out, _global)
  142. // wrap global constructors for prevent change them in library
  143. : IS_WRAP && target[key] == out ? (function (C) {
  144. var F = function (a, b, c) {
  145. if (this instanceof C) {
  146. switch (arguments.length) {
  147. case 0: return new C();
  148. case 1: return new C(a);
  149. case 2: return new C(a, b);
  150. } return new C(a, b, c);
  151. } return C.apply(this, arguments);
  152. };
  153. F[PROTOTYPE] = C[PROTOTYPE];
  154. return F;
  155. // make static versions for prototype methods
  156. })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  157. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  158. if (IS_PROTO) {
  159. (exports.virtual || (exports.virtual = {}))[key] = out;
  160. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  161. if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
  162. }
  163. }
  164. };
  165. // type bitmap
  166. $export.F = 1; // forced
  167. $export.G = 2; // global
  168. $export.S = 4; // static
  169. $export.P = 8; // proto
  170. $export.B = 16; // bind
  171. $export.W = 32; // wrap
  172. $export.U = 64; // safe
  173. $export.R = 128; // real proto method for `library`
  174. var _export = $export;
  175. var toString$1 = {}.toString;
  176. var _cof = function (it) {
  177. return toString$1.call(it).slice(8, -1);
  178. };
  179. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  180. // eslint-disable-next-line no-prototype-builtins
  181. var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  182. return _cof(it) == 'String' ? it.split('') : Object(it);
  183. };
  184. // 7.2.1 RequireObjectCoercible(argument)
  185. var _defined = function (it) {
  186. if (it == undefined) throw TypeError("Can't call method on " + it);
  187. return it;
  188. };
  189. // to indexed object, toObject with fallback for non-array-like ES3 strings
  190. var _toIobject = function (it) {
  191. return _iobject(_defined(it));
  192. };
  193. // 7.1.4 ToInteger
  194. var ceil = Math.ceil;
  195. var floor = Math.floor;
  196. var _toInteger = function (it) {
  197. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  198. };
  199. // 7.1.15 ToLength
  200. var min = Math.min;
  201. var _toLength = function (it) {
  202. return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  203. };
  204. var max = Math.max;
  205. var min$1 = Math.min;
  206. var _toAbsoluteIndex = function (index, length) {
  207. index = _toInteger(index);
  208. return index < 0 ? max(index + length, 0) : min$1(index, length);
  209. };
  210. // false -> Array#indexOf
  211. // true -> Array#includes
  212. var _arrayIncludes = function (IS_INCLUDES) {
  213. return function ($this, el, fromIndex) {
  214. var O = _toIobject($this);
  215. var length = _toLength(O.length);
  216. var index = _toAbsoluteIndex(fromIndex, length);
  217. var value;
  218. // Array#includes uses SameValueZero equality algorithm
  219. // eslint-disable-next-line no-self-compare
  220. if (IS_INCLUDES && el != el) while (length > index) {
  221. value = O[index++];
  222. // eslint-disable-next-line no-self-compare
  223. if (value != value) return true;
  224. // Array#indexOf ignores holes, Array#includes - not
  225. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  226. if (O[index] === el) return IS_INCLUDES || index || 0;
  227. } return !IS_INCLUDES && -1;
  228. };
  229. };
  230. var _library = true;
  231. var _shared = createCommonjsModule(function (module) {
  232. var SHARED = '__core-js_shared__';
  233. var store = _global[SHARED] || (_global[SHARED] = {});
  234. (module.exports = function (key, value) {
  235. return store[key] || (store[key] = value !== undefined ? value : {});
  236. })('versions', []).push({
  237. version: _core.version,
  238. mode: _library ? 'pure' : 'global',
  239. copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
  240. });
  241. });
  242. var id = 0;
  243. var px = Math.random();
  244. var _uid = function (key) {
  245. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  246. };
  247. var shared = _shared('keys');
  248. var _sharedKey = function (key) {
  249. return shared[key] || (shared[key] = _uid(key));
  250. };
  251. var arrayIndexOf = _arrayIncludes(false);
  252. var IE_PROTO = _sharedKey('IE_PROTO');
  253. var _objectKeysInternal = function (object, names) {
  254. var O = _toIobject(object);
  255. var i = 0;
  256. var result = [];
  257. var key;
  258. for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
  259. // Don't enum bug & hidden keys
  260. while (names.length > i) if (_has(O, key = names[i++])) {
  261. ~arrayIndexOf(result, key) || result.push(key);
  262. }
  263. return result;
  264. };
  265. // IE 8- don't enum bug keys
  266. var _enumBugKeys = (
  267. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  268. ).split(',');
  269. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  270. var _objectKeys = Object.keys || function keys(O) {
  271. return _objectKeysInternal(O, _enumBugKeys);
  272. };
  273. var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  274. _anObject(O);
  275. var keys = _objectKeys(Properties);
  276. var length = keys.length;
  277. var i = 0;
  278. var P;
  279. while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
  280. return O;
  281. };
  282. var document$1 = _global.document;
  283. var _html = document$1 && document$1.documentElement;
  284. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  285. var IE_PROTO$1 = _sharedKey('IE_PROTO');
  286. var Empty = function () { /* empty */ };
  287. var PROTOTYPE$1 = 'prototype';
  288. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  289. var createDict = function () {
  290. // Thrash, waste and sodomy: IE GC bug
  291. var iframe = _domCreate('iframe');
  292. var i = _enumBugKeys.length;
  293. var lt = '<';
  294. var gt = '>';
  295. var iframeDocument;
  296. iframe.style.display = 'none';
  297. _html.appendChild(iframe);
  298. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  299. // createDict = iframe.contentWindow.Object;
  300. // html.removeChild(iframe);
  301. iframeDocument = iframe.contentWindow.document;
  302. iframeDocument.open();
  303. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  304. iframeDocument.close();
  305. createDict = iframeDocument.F;
  306. while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
  307. return createDict();
  308. };
  309. var _objectCreate = Object.create || function create(O, Properties) {
  310. var result;
  311. if (O !== null) {
  312. Empty[PROTOTYPE$1] = _anObject(O);
  313. result = new Empty();
  314. Empty[PROTOTYPE$1] = null;
  315. // add "__proto__" for Object.getPrototypeOf polyfill
  316. result[IE_PROTO$1] = O;
  317. } else result = createDict();
  318. return Properties === undefined ? result : _objectDps(result, Properties);
  319. };
  320. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  321. _export(_export.S, 'Object', { create: _objectCreate });
  322. var $Object = _core.Object;
  323. var create = function create(P, D) {
  324. return $Object.create(P, D);
  325. };
  326. var create$1 = createCommonjsModule(function (module) {
  327. module.exports = { "default": create, __esModule: true };
  328. });
  329. var _Object$create = unwrapExports(create$1);
  330. // 7.1.13 ToObject(argument)
  331. var _toObject = function (it) {
  332. return Object(_defined(it));
  333. };
  334. // most Object methods by ES6 should accept primitives
  335. var _objectSap = function (KEY, exec) {
  336. var fn = (_core.Object || {})[KEY] || Object[KEY];
  337. var exp = {};
  338. exp[KEY] = exec(fn);
  339. _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
  340. };
  341. // 19.1.2.14 Object.keys(O)
  342. _objectSap('keys', function () {
  343. return function keys(it) {
  344. return _objectKeys(_toObject(it));
  345. };
  346. });
  347. var keys = _core.Object.keys;
  348. var keys$1 = createCommonjsModule(function (module) {
  349. module.exports = { "default": keys, __esModule: true };
  350. });
  351. var _Object$keys = unwrapExports(keys$1);
  352. // true -> String#at
  353. // false -> String#codePointAt
  354. var _stringAt = function (TO_STRING) {
  355. return function (that, pos) {
  356. var s = String(_defined(that));
  357. var i = _toInteger(pos);
  358. var l = s.length;
  359. var a, b;
  360. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  361. a = s.charCodeAt(i);
  362. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  363. ? TO_STRING ? s.charAt(i) : a
  364. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  365. };
  366. };
  367. var _redefine = _hide;
  368. var _iterators = {};
  369. var _wks = createCommonjsModule(function (module) {
  370. var store = _shared('wks');
  371. var Symbol = _global.Symbol;
  372. var USE_SYMBOL = typeof Symbol == 'function';
  373. var $exports = module.exports = function (name) {
  374. return store[name] || (store[name] =
  375. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
  376. };
  377. $exports.store = store;
  378. });
  379. var def = _objectDp.f;
  380. var TAG = _wks('toStringTag');
  381. var _setToStringTag = function (it, tag, stat) {
  382. if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  383. };
  384. var IteratorPrototype = {};
  385. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  386. _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
  387. var _iterCreate = function (Constructor, NAME, next) {
  388. Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
  389. _setToStringTag(Constructor, NAME + ' Iterator');
  390. };
  391. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  392. var IE_PROTO$2 = _sharedKey('IE_PROTO');
  393. var ObjectProto = Object.prototype;
  394. var _objectGpo = Object.getPrototypeOf || function (O) {
  395. O = _toObject(O);
  396. if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
  397. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  398. return O.constructor.prototype;
  399. } return O instanceof Object ? ObjectProto : null;
  400. };
  401. var ITERATOR = _wks('iterator');
  402. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  403. var FF_ITERATOR = '@@iterator';
  404. var KEYS = 'keys';
  405. var VALUES = 'values';
  406. var returnThis = function () { return this; };
  407. var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  408. _iterCreate(Constructor, NAME, next);
  409. var getMethod = function (kind) {
  410. if (!BUGGY && kind in proto) return proto[kind];
  411. switch (kind) {
  412. case KEYS: return function keys() { return new Constructor(this, kind); };
  413. case VALUES: return function values() { return new Constructor(this, kind); };
  414. } return function entries() { return new Constructor(this, kind); };
  415. };
  416. var TAG = NAME + ' Iterator';
  417. var DEF_VALUES = DEFAULT == VALUES;
  418. var VALUES_BUG = false;
  419. var proto = Base.prototype;
  420. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  421. var $default = $native || getMethod(DEFAULT);
  422. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  423. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  424. var methods, key, IteratorPrototype;
  425. // Fix native
  426. if ($anyNative) {
  427. IteratorPrototype = _objectGpo($anyNative.call(new Base()));
  428. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  429. // Set @@toStringTag to native iterators
  430. _setToStringTag(IteratorPrototype, TAG, true);
  431. // fix for some old engines
  432. if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis);
  433. }
  434. }
  435. // fix Array#{values, @@iterator}.name in V8 / FF
  436. if (DEF_VALUES && $native && $native.name !== VALUES) {
  437. VALUES_BUG = true;
  438. $default = function values() { return $native.call(this); };
  439. }
  440. // Define iterator
  441. if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  442. _hide(proto, ITERATOR, $default);
  443. }
  444. // Plug for library
  445. _iterators[NAME] = $default;
  446. _iterators[TAG] = returnThis;
  447. if (DEFAULT) {
  448. methods = {
  449. values: DEF_VALUES ? $default : getMethod(VALUES),
  450. keys: IS_SET ? $default : getMethod(KEYS),
  451. entries: $entries
  452. };
  453. if (FORCED) for (key in methods) {
  454. if (!(key in proto)) _redefine(proto, key, methods[key]);
  455. } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
  456. }
  457. return methods;
  458. };
  459. var $at = _stringAt(true);
  460. // 21.1.3.27 String.prototype[@@iterator]()
  461. _iterDefine(String, 'String', function (iterated) {
  462. this._t = String(iterated); // target
  463. this._i = 0; // next index
  464. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  465. }, function () {
  466. var O = this._t;
  467. var index = this._i;
  468. var point;
  469. if (index >= O.length) return { value: undefined, done: true };
  470. point = $at(O, index);
  471. this._i += point.length;
  472. return { value: point, done: false };
  473. });
  474. var _iterStep = function (done, value) {
  475. return { value: value, done: !!done };
  476. };
  477. // 22.1.3.4 Array.prototype.entries()
  478. // 22.1.3.13 Array.prototype.keys()
  479. // 22.1.3.29 Array.prototype.values()
  480. // 22.1.3.30 Array.prototype[@@iterator]()
  481. var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
  482. this._t = _toIobject(iterated); // target
  483. this._i = 0; // next index
  484. this._k = kind; // kind
  485. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  486. }, function () {
  487. var O = this._t;
  488. var kind = this._k;
  489. var index = this._i++;
  490. if (!O || index >= O.length) {
  491. this._t = undefined;
  492. return _iterStep(1);
  493. }
  494. if (kind == 'keys') return _iterStep(0, index);
  495. if (kind == 'values') return _iterStep(0, O[index]);
  496. return _iterStep(0, [index, O[index]]);
  497. }, 'values');
  498. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  499. _iterators.Arguments = _iterators.Array;
  500. var TO_STRING_TAG = _wks('toStringTag');
  501. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  502. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  503. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  504. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  505. 'TextTrackList,TouchList').split(',');
  506. for (var i = 0; i < DOMIterables.length; i++) {
  507. var NAME = DOMIterables[i];
  508. var Collection = _global[NAME];
  509. var proto = Collection && Collection.prototype;
  510. if (proto && !proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
  511. _iterators[NAME] = _iterators.Array;
  512. }
  513. var f$1 = _wks;
  514. var _wksExt = {
  515. f: f$1
  516. };
  517. var iterator = _wksExt.f('iterator');
  518. var iterator$1 = createCommonjsModule(function (module) {
  519. module.exports = { "default": iterator, __esModule: true };
  520. });
  521. unwrapExports(iterator$1);
  522. var _meta = createCommonjsModule(function (module) {
  523. var META = _uid('meta');
  524. var setDesc = _objectDp.f;
  525. var id = 0;
  526. var isExtensible = Object.isExtensible || function () {
  527. return true;
  528. };
  529. var FREEZE = !_fails(function () {
  530. return isExtensible(Object.preventExtensions({}));
  531. });
  532. var setMeta = function (it) {
  533. setDesc(it, META, { value: {
  534. i: 'O' + ++id, // object ID
  535. w: {} // weak collections IDs
  536. } });
  537. };
  538. var fastKey = function (it, create) {
  539. // return primitive with prefix
  540. if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  541. if (!_has(it, META)) {
  542. // can't set metadata to uncaught frozen object
  543. if (!isExtensible(it)) return 'F';
  544. // not necessary to add metadata
  545. if (!create) return 'E';
  546. // add missing metadata
  547. setMeta(it);
  548. // return object ID
  549. } return it[META].i;
  550. };
  551. var getWeak = function (it, create) {
  552. if (!_has(it, META)) {
  553. // can't set metadata to uncaught frozen object
  554. if (!isExtensible(it)) return true;
  555. // not necessary to add metadata
  556. if (!create) return false;
  557. // add missing metadata
  558. setMeta(it);
  559. // return hash weak collections IDs
  560. } return it[META].w;
  561. };
  562. // add metadata on freeze-family methods calling
  563. var onFreeze = function (it) {
  564. if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it);
  565. return it;
  566. };
  567. var meta = module.exports = {
  568. KEY: META,
  569. NEED: false,
  570. fastKey: fastKey,
  571. getWeak: getWeak,
  572. onFreeze: onFreeze
  573. };
  574. });
  575. var _meta_1 = _meta.KEY;
  576. var _meta_2 = _meta.NEED;
  577. var _meta_3 = _meta.fastKey;
  578. var _meta_4 = _meta.getWeak;
  579. var _meta_5 = _meta.onFreeze;
  580. var defineProperty = _objectDp.f;
  581. var _wksDefine = function (name) {
  582. var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {});
  583. if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) });
  584. };
  585. var f$2 = Object.getOwnPropertySymbols;
  586. var _objectGops = {
  587. f: f$2
  588. };
  589. var f$3 = {}.propertyIsEnumerable;
  590. var _objectPie = {
  591. f: f$3
  592. };
  593. // all enumerable object keys, includes symbols
  594. var _enumKeys = function (it) {
  595. var result = _objectKeys(it);
  596. var getSymbols = _objectGops.f;
  597. if (getSymbols) {
  598. var symbols = getSymbols(it);
  599. var isEnum = _objectPie.f;
  600. var i = 0;
  601. var key;
  602. while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  603. } return result;
  604. };
  605. // 7.2.2 IsArray(argument)
  606. var _isArray = Array.isArray || function isArray(arg) {
  607. return _cof(arg) == 'Array';
  608. };
  609. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  610. var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
  611. var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  612. return _objectKeysInternal(O, hiddenKeys);
  613. };
  614. var _objectGopn = {
  615. f: f$4
  616. };
  617. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  618. var gOPN = _objectGopn.f;
  619. var toString$2 = {}.toString;
  620. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  621. ? Object.getOwnPropertyNames(window) : [];
  622. var getWindowNames = function (it) {
  623. try {
  624. return gOPN(it);
  625. } catch (e) {
  626. return windowNames.slice();
  627. }
  628. };
  629. var f$5 = function getOwnPropertyNames(it) {
  630. return windowNames && toString$2.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it));
  631. };
  632. var _objectGopnExt = {
  633. f: f$5
  634. };
  635. var gOPD = Object.getOwnPropertyDescriptor;
  636. var f$6 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) {
  637. O = _toIobject(O);
  638. P = _toPrimitive(P, true);
  639. if (_ie8DomDefine) try {
  640. return gOPD(O, P);
  641. } catch (e) { /* empty */ }
  642. if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
  643. };
  644. var _objectGopd = {
  645. f: f$6
  646. };
  647. // ECMAScript 6 symbols shim
  648. var META = _meta.KEY;
  649. var gOPD$1 = _objectGopd.f;
  650. var dP$1 = _objectDp.f;
  651. var gOPN$1 = _objectGopnExt.f;
  652. var $Symbol = _global.Symbol;
  653. var $JSON = _global.JSON;
  654. var _stringify = $JSON && $JSON.stringify;
  655. var PROTOTYPE$2 = 'prototype';
  656. var HIDDEN = _wks('_hidden');
  657. var TO_PRIMITIVE = _wks('toPrimitive');
  658. var isEnum = {}.propertyIsEnumerable;
  659. var SymbolRegistry = _shared('symbol-registry');
  660. var AllSymbols = _shared('symbols');
  661. var OPSymbols = _shared('op-symbols');
  662. var ObjectProto$1 = Object[PROTOTYPE$2];
  663. var USE_NATIVE = typeof $Symbol == 'function';
  664. var QObject = _global.QObject;
  665. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  666. var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild;
  667. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  668. var setSymbolDesc = _descriptors && _fails(function () {
  669. return _objectCreate(dP$1({}, 'a', {
  670. get: function () { return dP$1(this, 'a', { value: 7 }).a; }
  671. })).a != 7;
  672. }) ? function (it, key, D) {
  673. var protoDesc = gOPD$1(ObjectProto$1, key);
  674. if (protoDesc) delete ObjectProto$1[key];
  675. dP$1(it, key, D);
  676. if (protoDesc && it !== ObjectProto$1) dP$1(ObjectProto$1, key, protoDesc);
  677. } : dP$1;
  678. var wrap = function (tag) {
  679. var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]);
  680. sym._k = tag;
  681. return sym;
  682. };
  683. var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  684. return typeof it == 'symbol';
  685. } : function (it) {
  686. return it instanceof $Symbol;
  687. };
  688. var $defineProperty = function defineProperty(it, key, D) {
  689. if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D);
  690. _anObject(it);
  691. key = _toPrimitive(key, true);
  692. _anObject(D);
  693. if (_has(AllSymbols, key)) {
  694. if (!D.enumerable) {
  695. if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {}));
  696. it[HIDDEN][key] = true;
  697. } else {
  698. if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
  699. D = _objectCreate(D, { enumerable: _propertyDesc(0, false) });
  700. } return setSymbolDesc(it, key, D);
  701. } return dP$1(it, key, D);
  702. };
  703. var $defineProperties = function defineProperties(it, P) {
  704. _anObject(it);
  705. var keys = _enumKeys(P = _toIobject(P));
  706. var i = 0;
  707. var l = keys.length;
  708. var key;
  709. while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  710. return it;
  711. };
  712. var $create = function create(it, P) {
  713. return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P);
  714. };
  715. var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  716. var E = isEnum.call(this, key = _toPrimitive(key, true));
  717. if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false;
  718. return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  719. };
  720. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  721. it = _toIobject(it);
  722. key = _toPrimitive(key, true);
  723. if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return;
  724. var D = gOPD$1(it, key);
  725. if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  726. return D;
  727. };
  728. var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  729. var names = gOPN$1(_toIobject(it));
  730. var result = [];
  731. var i = 0;
  732. var key;
  733. while (names.length > i) {
  734. if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  735. } return result;
  736. };
  737. var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  738. var IS_OP = it === ObjectProto$1;
  739. var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it));
  740. var result = [];
  741. var i = 0;
  742. var key;
  743. while (names.length > i) {
  744. if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]);
  745. } return result;
  746. };
  747. // 19.4.1.1 Symbol([description])
  748. if (!USE_NATIVE) {
  749. $Symbol = function Symbol() {
  750. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
  751. var tag = _uid(arguments.length > 0 ? arguments[0] : undefined);
  752. var $set = function (value) {
  753. if (this === ObjectProto$1) $set.call(OPSymbols, value);
  754. if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  755. setSymbolDesc(this, tag, _propertyDesc(1, value));
  756. };
  757. if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set });
  758. return wrap(tag);
  759. };
  760. _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() {
  761. return this._k;
  762. });
  763. _objectGopd.f = $getOwnPropertyDescriptor;
  764. _objectDp.f = $defineProperty;
  765. _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames;
  766. _objectPie.f = $propertyIsEnumerable;
  767. _objectGops.f = $getOwnPropertySymbols;
  768. if (_descriptors && !_library) {
  769. _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  770. }
  771. _wksExt.f = function (name) {
  772. return wrap(_wks(name));
  773. };
  774. }
  775. _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Symbol: $Symbol });
  776. for (var es6Symbols = (
  777. // 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
  778. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
  779. ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]);
  780. for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]);
  781. _export(_export.S + _export.F * !USE_NATIVE, 'Symbol', {
  782. // 19.4.2.1 Symbol.for(key)
  783. 'for': function (key) {
  784. return _has(SymbolRegistry, key += '')
  785. ? SymbolRegistry[key]
  786. : SymbolRegistry[key] = $Symbol(key);
  787. },
  788. // 19.4.2.5 Symbol.keyFor(sym)
  789. keyFor: function keyFor(sym) {
  790. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
  791. for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  792. },
  793. useSetter: function () { setter = true; },
  794. useSimple: function () { setter = false; }
  795. });
  796. _export(_export.S + _export.F * !USE_NATIVE, 'Object', {
  797. // 19.1.2.2 Object.create(O [, Properties])
  798. create: $create,
  799. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  800. defineProperty: $defineProperty,
  801. // 19.1.2.3 Object.defineProperties(O, Properties)
  802. defineProperties: $defineProperties,
  803. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  804. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  805. // 19.1.2.7 Object.getOwnPropertyNames(O)
  806. getOwnPropertyNames: $getOwnPropertyNames,
  807. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  808. getOwnPropertySymbols: $getOwnPropertySymbols
  809. });
  810. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  811. $JSON && _export(_export.S + _export.F * (!USE_NATIVE || _fails(function () {
  812. var S = $Symbol();
  813. // MS Edge converts symbol values to JSON as {}
  814. // WebKit converts symbol values to JSON as null
  815. // V8 throws on boxed symbols
  816. return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
  817. })), 'JSON', {
  818. stringify: function stringify(it) {
  819. var args = [it];
  820. var i = 1;
  821. var replacer, $replacer;
  822. while (arguments.length > i) args.push(arguments[i++]);
  823. $replacer = replacer = args[1];
  824. if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  825. if (!_isArray(replacer)) replacer = function (key, value) {
  826. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  827. if (!isSymbol(value)) return value;
  828. };
  829. args[1] = replacer;
  830. return _stringify.apply($JSON, args);
  831. }
  832. });
  833. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  834. $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf);
  835. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  836. _setToStringTag($Symbol, 'Symbol');
  837. // 20.2.1.9 Math[@@toStringTag]
  838. _setToStringTag(Math, 'Math', true);
  839. // 24.3.3 JSON[@@toStringTag]
  840. _setToStringTag(_global.JSON, 'JSON', true);
  841. _wksDefine('asyncIterator');
  842. _wksDefine('observable');
  843. var symbol = _core.Symbol;
  844. var symbol$1 = createCommonjsModule(function (module) {
  845. module.exports = { "default": symbol, __esModule: true };
  846. });
  847. var _Symbol = unwrapExports(symbol$1);
  848. var _typeof_1 = createCommonjsModule(function (module, exports) {
  849. exports.__esModule = true;
  850. var _iterator2 = _interopRequireDefault(iterator$1);
  851. var _symbol2 = _interopRequireDefault(symbol$1);
  852. 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; };
  853. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  854. exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
  855. return typeof obj === "undefined" ? "undefined" : _typeof(obj);
  856. } : function (obj) {
  857. return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  858. };
  859. });
  860. var _typeof = unwrapExports(_typeof_1);
  861. // 7.2.9 SameValue(x, y)
  862. var _sameValue = Object.is || function is(x, y) {
  863. // eslint-disable-next-line no-self-compare
  864. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  865. };
  866. // 19.1.3.10 Object.is(value1, value2)
  867. _export(_export.S, 'Object', { is: _sameValue });
  868. var is$1 = _core.Object.is;
  869. var is$2 = createCommonjsModule(function (module) {
  870. module.exports = { "default": is$1, __esModule: true };
  871. });
  872. var _Object$is = unwrapExports(is$2);
  873. // 19.1.2.9 Object.getPrototypeOf(O)
  874. _objectSap('getPrototypeOf', function () {
  875. return function getPrototypeOf(it) {
  876. return _objectGpo(_toObject(it));
  877. };
  878. });
  879. var getPrototypeOf = _core.Object.getPrototypeOf;
  880. var getPrototypeOf$1 = createCommonjsModule(function (module) {
  881. module.exports = { "default": getPrototypeOf, __esModule: true };
  882. });
  883. var _Object$getPrototypeOf = unwrapExports(getPrototypeOf$1);
  884. var classCallCheck = createCommonjsModule(function (module, exports) {
  885. exports.__esModule = true;
  886. exports.default = function (instance, Constructor) {
  887. if (!(instance instanceof Constructor)) {
  888. throw new TypeError("Cannot call a class as a function");
  889. }
  890. };
  891. });
  892. var _classCallCheck = unwrapExports(classCallCheck);
  893. var possibleConstructorReturn = createCommonjsModule(function (module, exports) {
  894. exports.__esModule = true;
  895. var _typeof3 = _interopRequireDefault(_typeof_1);
  896. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  897. exports.default = function (self, call) {
  898. if (!self) {
  899. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  900. }
  901. return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
  902. };
  903. });
  904. var _possibleConstructorReturn = unwrapExports(possibleConstructorReturn);
  905. // Works with __proto__ only. Old v8 can't work with null proto objects.
  906. /* eslint-disable no-proto */
  907. var check = function (O, proto) {
  908. _anObject(O);
  909. if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
  910. };
  911. var _setProto = {
  912. set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
  913. function (test, buggy, set) {
  914. try {
  915. set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2);
  916. set(test, []);
  917. buggy = !(test instanceof Array);
  918. } catch (e) { buggy = true; }
  919. return function setPrototypeOf(O, proto) {
  920. check(O, proto);
  921. if (buggy) O.__proto__ = proto;
  922. else set(O, proto);
  923. return O;
  924. };
  925. }({}, false) : undefined),
  926. check: check
  927. };
  928. // 19.1.3.19 Object.setPrototypeOf(O, proto)
  929. _export(_export.S, 'Object', { setPrototypeOf: _setProto.set });
  930. var setPrototypeOf = _core.Object.setPrototypeOf;
  931. var setPrototypeOf$1 = createCommonjsModule(function (module) {
  932. module.exports = { "default": setPrototypeOf, __esModule: true };
  933. });
  934. unwrapExports(setPrototypeOf$1);
  935. var inherits = createCommonjsModule(function (module, exports) {
  936. exports.__esModule = true;
  937. var _setPrototypeOf2 = _interopRequireDefault(setPrototypeOf$1);
  938. var _create2 = _interopRequireDefault(create$1);
  939. var _typeof3 = _interopRequireDefault(_typeof_1);
  940. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  941. exports.default = function (subClass, superClass) {
  942. if (typeof superClass !== "function" && superClass !== null) {
  943. throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
  944. }
  945. subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
  946. constructor: {
  947. value: subClass,
  948. enumerable: false,
  949. writable: true,
  950. configurable: true
  951. }
  952. });
  953. if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
  954. };
  955. });
  956. var _inherits = unwrapExports(inherits);
  957. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  958. _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f });
  959. var $Object$1 = _core.Object;
  960. var defineProperty$1 = function defineProperty(it, key, desc) {
  961. return $Object$1.defineProperty(it, key, desc);
  962. };
  963. var defineProperty$2 = createCommonjsModule(function (module) {
  964. module.exports = { "default": defineProperty$1, __esModule: true };
  965. });
  966. var _Object$defineProperty = unwrapExports(defineProperty$2);
  967. // getting tag from 19.1.3.6 Object.prototype.toString()
  968. var TAG$1 = _wks('toStringTag');
  969. // ES3 wrong here
  970. var ARG = _cof(function () { return arguments; }()) == 'Arguments';
  971. // fallback for IE11 Script Access Denied error
  972. var tryGet = function (it, key) {
  973. try {
  974. return it[key];
  975. } catch (e) { /* empty */ }
  976. };
  977. var _classof = function (it) {
  978. var O, T, B;
  979. return it === undefined ? 'Undefined' : it === null ? 'Null'
  980. // @@toStringTag case
  981. : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
  982. // builtinTag case
  983. : ARG ? _cof(O)
  984. // ES3 arguments fallback
  985. : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  986. };
  987. var ITERATOR$1 = _wks('iterator');
  988. var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
  989. if (it != undefined) return it[ITERATOR$1]
  990. || it['@@iterator']
  991. || _iterators[_classof(it)];
  992. };
  993. var core_getIterator = _core.getIterator = function (it) {
  994. var iterFn = core_getIteratorMethod(it);
  995. if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
  996. return _anObject(iterFn.call(it));
  997. };
  998. var getIterator = core_getIterator;
  999. var getIterator$1 = createCommonjsModule(function (module) {
  1000. module.exports = { "default": getIterator, __esModule: true };
  1001. });
  1002. var _getIterator = unwrapExports(getIterator$1);
  1003. var _redefineAll = function (target, src, safe) {
  1004. for (var key in src) {
  1005. if (safe && target[key]) target[key] = src[key];
  1006. else _hide(target, key, src[key]);
  1007. } return target;
  1008. };
  1009. var _anInstance = function (it, Constructor, name, forbiddenField) {
  1010. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  1011. throw TypeError(name + ': incorrect invocation!');
  1012. } return it;
  1013. };
  1014. // call something on iterator step with safe closing on error
  1015. var _iterCall = function (iterator, fn, value, entries) {
  1016. try {
  1017. return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
  1018. // 7.4.6 IteratorClose(iterator, completion)
  1019. } catch (e) {
  1020. var ret = iterator['return'];
  1021. if (ret !== undefined) _anObject(ret.call(iterator));
  1022. throw e;
  1023. }
  1024. };
  1025. // check on default Array iterator
  1026. var ITERATOR$2 = _wks('iterator');
  1027. var ArrayProto = Array.prototype;
  1028. var _isArrayIter = function (it) {
  1029. return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$2] === it);
  1030. };
  1031. var _forOf = createCommonjsModule(function (module) {
  1032. var BREAK = {};
  1033. var RETURN = {};
  1034. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  1035. var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
  1036. var f = _ctx(fn, that, entries ? 2 : 1);
  1037. var index = 0;
  1038. var length, step, iterator, result;
  1039. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  1040. // fast case for arrays with default iterator
  1041. if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
  1042. result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  1043. if (result === BREAK || result === RETURN) return result;
  1044. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  1045. result = _iterCall(iterator, f, step.value, entries);
  1046. if (result === BREAK || result === RETURN) return result;
  1047. }
  1048. };
  1049. exports.BREAK = BREAK;
  1050. exports.RETURN = RETURN;
  1051. });
  1052. var SPECIES = _wks('species');
  1053. var _setSpecies = function (KEY) {
  1054. var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
  1055. if (_descriptors && C && !C[SPECIES]) _objectDp.f(C, SPECIES, {
  1056. configurable: true,
  1057. get: function () { return this; }
  1058. });
  1059. };
  1060. var _validateCollection = function (it, TYPE) {
  1061. if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  1062. return it;
  1063. };
  1064. var dP$2 = _objectDp.f;
  1065. var fastKey = _meta.fastKey;
  1066. var SIZE = _descriptors ? '_s' : 'size';
  1067. var getEntry = function (that, key) {
  1068. // fast case
  1069. var index = fastKey(key);
  1070. var entry;
  1071. if (index !== 'F') return that._i[index];
  1072. // frozen object case
  1073. for (entry = that._f; entry; entry = entry.n) {
  1074. if (entry.k == key) return entry;
  1075. }
  1076. };
  1077. var _collectionStrong = {
  1078. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  1079. var C = wrapper(function (that, iterable) {
  1080. _anInstance(that, C, NAME, '_i');
  1081. that._t = NAME; // collection type
  1082. that._i = _objectCreate(null); // index
  1083. that._f = undefined; // first entry
  1084. that._l = undefined; // last entry
  1085. that[SIZE] = 0; // size
  1086. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  1087. });
  1088. _redefineAll(C.prototype, {
  1089. // 23.1.3.1 Map.prototype.clear()
  1090. // 23.2.3.2 Set.prototype.clear()
  1091. clear: function clear() {
  1092. for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  1093. entry.r = true;
  1094. if (entry.p) entry.p = entry.p.n = undefined;
  1095. delete data[entry.i];
  1096. }
  1097. that._f = that._l = undefined;
  1098. that[SIZE] = 0;
  1099. },
  1100. // 23.1.3.3 Map.prototype.delete(key)
  1101. // 23.2.3.4 Set.prototype.delete(value)
  1102. 'delete': function (key) {
  1103. var that = _validateCollection(this, NAME);
  1104. var entry = getEntry(that, key);
  1105. if (entry) {
  1106. var next = entry.n;
  1107. var prev = entry.p;
  1108. delete that._i[entry.i];
  1109. entry.r = true;
  1110. if (prev) prev.n = next;
  1111. if (next) next.p = prev;
  1112. if (that._f == entry) that._f = next;
  1113. if (that._l == entry) that._l = prev;
  1114. that[SIZE]--;
  1115. } return !!entry;
  1116. },
  1117. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  1118. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  1119. forEach: function forEach(callbackfn /* , that = undefined */) {
  1120. _validateCollection(this, NAME);
  1121. var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  1122. var entry;
  1123. while (entry = entry ? entry.n : this._f) {
  1124. f(entry.v, entry.k, this);
  1125. // revert to the last existing entry
  1126. while (entry && entry.r) entry = entry.p;
  1127. }
  1128. },
  1129. // 23.1.3.7 Map.prototype.has(key)
  1130. // 23.2.3.7 Set.prototype.has(value)
  1131. has: function has(key) {
  1132. return !!getEntry(_validateCollection(this, NAME), key);
  1133. }
  1134. });
  1135. if (_descriptors) dP$2(C.prototype, 'size', {
  1136. get: function () {
  1137. return _validateCollection(this, NAME)[SIZE];
  1138. }
  1139. });
  1140. return C;
  1141. },
  1142. def: function (that, key, value) {
  1143. var entry = getEntry(that, key);
  1144. var prev, index;
  1145. // change existing entry
  1146. if (entry) {
  1147. entry.v = value;
  1148. // create new entry
  1149. } else {
  1150. that._l = entry = {
  1151. i: index = fastKey(key, true), // <- index
  1152. k: key, // <- key
  1153. v: value, // <- value
  1154. p: prev = that._l, // <- previous entry
  1155. n: undefined, // <- next entry
  1156. r: false // <- removed
  1157. };
  1158. if (!that._f) that._f = entry;
  1159. if (prev) prev.n = entry;
  1160. that[SIZE]++;
  1161. // add to index
  1162. if (index !== 'F') that._i[index] = entry;
  1163. } return that;
  1164. },
  1165. getEntry: getEntry,
  1166. setStrong: function (C, NAME, IS_MAP) {
  1167. // add .keys, .values, .entries, [@@iterator]
  1168. // 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
  1169. _iterDefine(C, NAME, function (iterated, kind) {
  1170. this._t = _validateCollection(iterated, NAME); // target
  1171. this._k = kind; // kind
  1172. this._l = undefined; // previous
  1173. }, function () {
  1174. var that = this;
  1175. var kind = that._k;
  1176. var entry = that._l;
  1177. // revert to the last existing entry
  1178. while (entry && entry.r) entry = entry.p;
  1179. // get next entry
  1180. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  1181. // or finish the iteration
  1182. that._t = undefined;
  1183. return _iterStep(1);
  1184. }
  1185. // return step by kind
  1186. if (kind == 'keys') return _iterStep(0, entry.k);
  1187. if (kind == 'values') return _iterStep(0, entry.v);
  1188. return _iterStep(0, [entry.k, entry.v]);
  1189. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  1190. // add [@@species], 23.1.2.2, 23.2.2.2
  1191. _setSpecies(NAME);
  1192. }
  1193. };
  1194. var SPECIES$1 = _wks('species');
  1195. var _arraySpeciesConstructor = function (original) {
  1196. var C;
  1197. if (_isArray(original)) {
  1198. C = original.constructor;
  1199. // cross-realm fallback
  1200. if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
  1201. if (_isObject(C)) {
  1202. C = C[SPECIES$1];
  1203. if (C === null) C = undefined;
  1204. }
  1205. } return C === undefined ? Array : C;
  1206. };
  1207. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  1208. var _arraySpeciesCreate = function (original, length) {
  1209. return new (_arraySpeciesConstructor(original))(length);
  1210. };
  1211. // 0 -> Array#forEach
  1212. // 1 -> Array#map
  1213. // 2 -> Array#filter
  1214. // 3 -> Array#some
  1215. // 4 -> Array#every
  1216. // 5 -> Array#find
  1217. // 6 -> Array#findIndex
  1218. var _arrayMethods = function (TYPE, $create) {
  1219. var IS_MAP = TYPE == 1;
  1220. var IS_FILTER = TYPE == 2;
  1221. var IS_SOME = TYPE == 3;
  1222. var IS_EVERY = TYPE == 4;
  1223. var IS_FIND_INDEX = TYPE == 6;
  1224. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1225. var create = $create || _arraySpeciesCreate;
  1226. return function ($this, callbackfn, that) {
  1227. var O = _toObject($this);
  1228. var self = _iobject(O);
  1229. var f = _ctx(callbackfn, that, 3);
  1230. var length = _toLength(self.length);
  1231. var index = 0;
  1232. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  1233. var val, res;
  1234. for (;length > index; index++) if (NO_HOLES || index in self) {
  1235. val = self[index];
  1236. res = f(val, index, O);
  1237. if (TYPE) {
  1238. if (IS_MAP) result[index] = res; // map
  1239. else if (res) switch (TYPE) {
  1240. case 3: return true; // some
  1241. case 5: return val; // find
  1242. case 6: return index; // findIndex
  1243. case 2: result.push(val); // filter
  1244. } else if (IS_EVERY) return false; // every
  1245. }
  1246. }
  1247. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  1248. };
  1249. };
  1250. var dP$3 = _objectDp.f;
  1251. var each = _arrayMethods(0);
  1252. var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  1253. var Base = _global[NAME];
  1254. var C = Base;
  1255. var ADDER = IS_MAP ? 'set' : 'add';
  1256. var proto = C && C.prototype;
  1257. var O = {};
  1258. if (!_descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () {
  1259. new C().entries().next();
  1260. }))) {
  1261. // create collection constructor
  1262. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  1263. _redefineAll(C.prototype, methods);
  1264. _meta.NEED = true;
  1265. } else {
  1266. C = wrapper(function (target, iterable) {
  1267. _anInstance(target, C, NAME, '_c');
  1268. target._c = new Base();
  1269. if (iterable != undefined) _forOf(iterable, IS_MAP, target[ADDER], target);
  1270. });
  1271. each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
  1272. var IS_ADDER = KEY == 'add' || KEY == 'set';
  1273. if (KEY in proto && !(IS_WEAK && KEY == 'clear')) _hide(C.prototype, KEY, function (a, b) {
  1274. _anInstance(this, C, KEY);
  1275. if (!IS_ADDER && IS_WEAK && !_isObject(a)) return KEY == 'get' ? undefined : false;
  1276. var result = this._c[KEY](a === 0 ? 0 : a, b);
  1277. return IS_ADDER ? this : result;
  1278. });
  1279. });
  1280. IS_WEAK || dP$3(C.prototype, 'size', {
  1281. get: function () {
  1282. return this._c.size;
  1283. }
  1284. });
  1285. }
  1286. _setToStringTag(C, NAME);
  1287. O[NAME] = C;
  1288. _export(_export.G + _export.W + _export.F, O);
  1289. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  1290. return C;
  1291. };
  1292. var MAP = 'Map';
  1293. // 23.1 Map Objects
  1294. var es6_map = _collection(MAP, function (get) {
  1295. return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1296. }, {
  1297. // 23.1.3.6 Map.prototype.get(key)
  1298. get: function get(key) {
  1299. var entry = _collectionStrong.getEntry(_validateCollection(this, MAP), key);
  1300. return entry && entry.v;
  1301. },
  1302. // 23.1.3.9 Map.prototype.set(key, value)
  1303. set: function set(key, value) {
  1304. return _collectionStrong.def(_validateCollection(this, MAP), key === 0 ? 0 : key, value);
  1305. }
  1306. }, _collectionStrong, true);
  1307. var _arrayFromIterable = function (iter, ITERATOR) {
  1308. var result = [];
  1309. _forOf(iter, false, result.push, result, ITERATOR);
  1310. return result;
  1311. };
  1312. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1313. var _collectionToJson = function (NAME) {
  1314. return function toJSON() {
  1315. if (_classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  1316. return _arrayFromIterable(this);
  1317. };
  1318. };
  1319. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1320. _export(_export.P + _export.R, 'Map', { toJSON: _collectionToJson('Map') });
  1321. // https://tc39.github.io/proposal-setmap-offrom/
  1322. var _setCollectionOf = function (COLLECTION) {
  1323. _export(_export.S, COLLECTION, { of: function of() {
  1324. var length = arguments.length;
  1325. var A = new Array(length);
  1326. while (length--) A[length] = arguments[length];
  1327. return new this(A);
  1328. } });
  1329. };
  1330. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  1331. _setCollectionOf('Map');
  1332. // https://tc39.github.io/proposal-setmap-offrom/
  1333. var _setCollectionFrom = function (COLLECTION) {
  1334. _export(_export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
  1335. var mapFn = arguments[1];
  1336. var mapping, A, n, cb;
  1337. _aFunction(this);
  1338. mapping = mapFn !== undefined;
  1339. if (mapping) _aFunction(mapFn);
  1340. if (source == undefined) return new this();
  1341. A = [];
  1342. if (mapping) {
  1343. n = 0;
  1344. cb = _ctx(mapFn, arguments[2], 2);
  1345. _forOf(source, false, function (nextItem) {
  1346. A.push(cb(nextItem, n++));
  1347. });
  1348. } else {
  1349. _forOf(source, false, A.push, A);
  1350. }
  1351. return new this(A);
  1352. } });
  1353. };
  1354. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  1355. _setCollectionFrom('Map');
  1356. var map = _core.Map;
  1357. var map$1 = createCommonjsModule(function (module) {
  1358. module.exports = { "default": map, __esModule: true };
  1359. });
  1360. var _Map = unwrapExports(map$1);
  1361. var colorName = {
  1362. "aliceblue": [240, 248, 255],
  1363. "antiquewhite": [250, 235, 215],
  1364. "aqua": [0, 255, 255],
  1365. "aquamarine": [127, 255, 212],
  1366. "azure": [240, 255, 255],
  1367. "beige": [245, 245, 220],
  1368. "bisque": [255, 228, 196],
  1369. "black": [0, 0, 0],
  1370. "blanchedalmond": [255, 235, 205],
  1371. "blue": [0, 0, 255],
  1372. "blueviolet": [138, 43, 226],
  1373. "brown": [165, 42, 42],
  1374. "burlywood": [222, 184, 135],
  1375. "cadetblue": [95, 158, 160],
  1376. "chartreuse": [127, 255, 0],
  1377. "chocolate": [210, 105, 30],
  1378. "coral": [255, 127, 80],
  1379. "cornflowerblue": [100, 149, 237],
  1380. "cornsilk": [255, 248, 220],
  1381. "crimson": [220, 20, 60],
  1382. "cyan": [0, 255, 255],
  1383. "darkblue": [0, 0, 139],
  1384. "darkcyan": [0, 139, 139],
  1385. "darkgoldenrod": [184, 134, 11],
  1386. "darkgray": [169, 169, 169],
  1387. "darkgreen": [0, 100, 0],
  1388. "darkgrey": [169, 169, 169],
  1389. "darkkhaki": [189, 183, 107],
  1390. "darkmagenta": [139, 0, 139],
  1391. "darkolivegreen": [85, 107, 47],
  1392. "darkorange": [255, 140, 0],
  1393. "darkorchid": [153, 50, 204],
  1394. "darkred": [139, 0, 0],
  1395. "darksalmon": [233, 150, 122],
  1396. "darkseagreen": [143, 188, 143],
  1397. "darkslateblue": [72, 61, 139],
  1398. "darkslategray": [47, 79, 79],
  1399. "darkslategrey": [47, 79, 79],
  1400. "darkturquoise": [0, 206, 209],
  1401. "darkviolet": [148, 0, 211],
  1402. "deeppink": [255, 20, 147],
  1403. "deepskyblue": [0, 191, 255],
  1404. "dimgray": [105, 105, 105],
  1405. "dimgrey": [105, 105, 105],
  1406. "dodgerblue": [30, 144, 255],
  1407. "firebrick": [178, 34, 34],
  1408. "floralwhite": [255, 250, 240],
  1409. "forestgreen": [34, 139, 34],
  1410. "fuchsia": [255, 0, 255],
  1411. "gainsboro": [220, 220, 220],
  1412. "ghostwhite": [248, 248, 255],
  1413. "gold": [255, 215, 0],
  1414. "goldenrod": [218, 165, 32],
  1415. "gray": [128, 128, 128],
  1416. "green": [0, 128, 0],
  1417. "greenyellow": [173, 255, 47],
  1418. "grey": [128, 128, 128],
  1419. "honeydew": [240, 255, 240],
  1420. "hotpink": [255, 105, 180],
  1421. "indianred": [205, 92, 92],
  1422. "indigo": [75, 0, 130],
  1423. "ivory": [255, 255, 240],
  1424. "khaki": [240, 230, 140],
  1425. "lavender": [230, 230, 250],
  1426. "lavenderblush": [255, 240, 245],
  1427. "lawngreen": [124, 252, 0],
  1428. "lemonchiffon": [255, 250, 205],
  1429. "lightblue": [173, 216, 230],
  1430. "lightcoral": [240, 128, 128],
  1431. "lightcyan": [224, 255, 255],
  1432. "lightgoldenrodyellow": [250, 250, 210],
  1433. "lightgray": [211, 211, 211],
  1434. "lightgreen": [144, 238, 144],
  1435. "lightgrey": [211, 211, 211],
  1436. "lightpink": [255, 182, 193],
  1437. "lightsalmon": [255, 160, 122],
  1438. "lightseagreen": [32, 178, 170],
  1439. "lightskyblue": [135, 206, 250],
  1440. "lightslategray": [119, 136, 153],
  1441. "lightslategrey": [119, 136, 153],
  1442. "lightsteelblue": [176, 196, 222],
  1443. "lightyellow": [255, 255, 224],
  1444. "lime": [0, 255, 0],
  1445. "limegreen": [50, 205, 50],
  1446. "linen": [250, 240, 230],
  1447. "magenta": [255, 0, 255],
  1448. "maroon": [128, 0, 0],
  1449. "mediumaquamarine": [102, 205, 170],
  1450. "mediumblue": [0, 0, 205],
  1451. "mediumorchid": [186, 85, 211],
  1452. "mediumpurple": [147, 112, 219],
  1453. "mediumseagreen": [60, 179, 113],
  1454. "mediumslateblue": [123, 104, 238],
  1455. "mediumspringgreen": [0, 250, 154],
  1456. "mediumturquoise": [72, 209, 204],
  1457. "mediumvioletred": [199, 21, 133],
  1458. "midnightblue": [25, 25, 112],
  1459. "mintcream": [245, 255, 250],
  1460. "mistyrose": [255, 228, 225],
  1461. "moccasin": [255, 228, 181],
  1462. "navajowhite": [255, 222, 173],
  1463. "navy": [0, 0, 128],
  1464. "oldlace": [253, 245, 230],
  1465. "olive": [128, 128, 0],
  1466. "olivedrab": [107, 142, 35],
  1467. "orange": [255, 165, 0],
  1468. "orangered": [255, 69, 0],
  1469. "orchid": [218, 112, 214],
  1470. "palegoldenrod": [238, 232, 170],
  1471. "palegreen": [152, 251, 152],
  1472. "paleturquoise": [175, 238, 238],
  1473. "palevioletred": [219, 112, 147],
  1474. "papayawhip": [255, 239, 213],
  1475. "peachpuff": [255, 218, 185],
  1476. "peru": [205, 133, 63],
  1477. "pink": [255, 192, 203],
  1478. "plum": [221, 160, 221],
  1479. "powderblue": [176, 224, 230],
  1480. "purple": [128, 0, 128],
  1481. "rebeccapurple": [102, 51, 153],
  1482. "red": [255, 0, 0],
  1483. "rosybrown": [188, 143, 143],
  1484. "royalblue": [65, 105, 225],
  1485. "saddlebrown": [139, 69, 19],
  1486. "salmon": [250, 128, 114],
  1487. "sandybrown": [244, 164, 96],
  1488. "seagreen": [46, 139, 87],
  1489. "seashell": [255, 245, 238],
  1490. "sienna": [160, 82, 45],
  1491. "silver": [192, 192, 192],
  1492. "skyblue": [135, 206, 235],
  1493. "slateblue": [106, 90, 205],
  1494. "slategray": [112, 128, 144],
  1495. "slategrey": [112, 128, 144],
  1496. "snow": [255, 250, 250],
  1497. "springgreen": [0, 255, 127],
  1498. "steelblue": [70, 130, 180],
  1499. "tan": [210, 180, 140],
  1500. "teal": [0, 128, 128],
  1501. "thistle": [216, 191, 216],
  1502. "tomato": [255, 99, 71],
  1503. "turquoise": [64, 224, 208],
  1504. "violet": [238, 130, 238],
  1505. "wheat": [245, 222, 179],
  1506. "white": [255, 255, 255],
  1507. "whitesmoke": [245, 245, 245],
  1508. "yellow": [255, 255, 0],
  1509. "yellowgreen": [154, 205, 50]
  1510. };
  1511. var conversions = createCommonjsModule(function (module) {
  1512. /* MIT license */
  1513. // NOTE: conversions should only return primitive values (i.e. arrays, or
  1514. // values that give correct `typeof` results).
  1515. // do not use box values types (i.e. Number(), String(), etc.)
  1516. var reverseKeywords = {};
  1517. for (var key in colorName) {
  1518. if (colorName.hasOwnProperty(key)) {
  1519. reverseKeywords[colorName[key]] = key;
  1520. }
  1521. }
  1522. var convert = module.exports = {
  1523. rgb: {channels: 3, labels: 'rgb'},
  1524. hsl: {channels: 3, labels: 'hsl'},
  1525. hsv: {channels: 3, labels: 'hsv'},
  1526. hwb: {channels: 3, labels: 'hwb'},
  1527. cmyk: {channels: 4, labels: 'cmyk'},
  1528. xyz: {channels: 3, labels: 'xyz'},
  1529. lab: {channels: 3, labels: 'lab'},
  1530. lch: {channels: 3, labels: 'lch'},
  1531. hex: {channels: 1, labels: ['hex']},
  1532. keyword: {channels: 1, labels: ['keyword']},
  1533. ansi16: {channels: 1, labels: ['ansi16']},
  1534. ansi256: {channels: 1, labels: ['ansi256']},
  1535. hcg: {channels: 3, labels: ['h', 'c', 'g']},
  1536. apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
  1537. gray: {channels: 1, labels: ['gray']}
  1538. };
  1539. // hide .channels and .labels properties
  1540. for (var model in convert) {
  1541. if (convert.hasOwnProperty(model)) {
  1542. if (!('channels' in convert[model])) {
  1543. throw new Error('missing channels property: ' + model);
  1544. }
  1545. if (!('labels' in convert[model])) {
  1546. throw new Error('missing channel labels property: ' + model);
  1547. }
  1548. if (convert[model].labels.length !== convert[model].channels) {
  1549. throw new Error('channel and label counts mismatch: ' + model);
  1550. }
  1551. var channels = convert[model].channels;
  1552. var labels = convert[model].labels;
  1553. delete convert[model].channels;
  1554. delete convert[model].labels;
  1555. Object.defineProperty(convert[model], 'channels', {value: channels});
  1556. Object.defineProperty(convert[model], 'labels', {value: labels});
  1557. }
  1558. }
  1559. convert.rgb.hsl = function (rgb) {
  1560. var r = rgb[0] / 255;
  1561. var g = rgb[1] / 255;
  1562. var b = rgb[2] / 255;
  1563. var min = Math.min(r, g, b);
  1564. var max = Math.max(r, g, b);
  1565. var delta = max - min;
  1566. var h;
  1567. var s;
  1568. var l;
  1569. if (max === min) {
  1570. h = 0;
  1571. } else if (r === max) {
  1572. h = (g - b) / delta;
  1573. } else if (g === max) {
  1574. h = 2 + (b - r) / delta;
  1575. } else if (b === max) {
  1576. h = 4 + (r - g) / delta;
  1577. }
  1578. h = Math.min(h * 60, 360);
  1579. if (h < 0) {
  1580. h += 360;
  1581. }
  1582. l = (min + max) / 2;
  1583. if (max === min) {
  1584. s = 0;
  1585. } else if (l <= 0.5) {
  1586. s = delta / (max + min);
  1587. } else {
  1588. s = delta / (2 - max - min);
  1589. }
  1590. return [h, s * 100, l * 100];
  1591. };
  1592. convert.rgb.hsv = function (rgb) {
  1593. var rdif;
  1594. var gdif;
  1595. var bdif;
  1596. var h;
  1597. var s;
  1598. var r = rgb[0] / 255;
  1599. var g = rgb[1] / 255;
  1600. var b = rgb[2] / 255;
  1601. var v = Math.max(r, g, b);
  1602. var diff = v - Math.min(r, g, b);
  1603. var diffc = function (c) {
  1604. return (v - c) / 6 / diff + 1 / 2;
  1605. };
  1606. if (diff === 0) {
  1607. h = s = 0;
  1608. } else {
  1609. s = diff / v;
  1610. rdif = diffc(r);
  1611. gdif = diffc(g);
  1612. bdif = diffc(b);
  1613. if (r === v) {
  1614. h = bdif - gdif;
  1615. } else if (g === v) {
  1616. h = (1 / 3) + rdif - bdif;
  1617. } else if (b === v) {
  1618. h = (2 / 3) + gdif - rdif;
  1619. }
  1620. if (h < 0) {
  1621. h += 1;
  1622. } else if (h > 1) {
  1623. h -= 1;
  1624. }
  1625. }
  1626. return [
  1627. h * 360,
  1628. s * 100,
  1629. v * 100
  1630. ];
  1631. };
  1632. convert.rgb.hwb = function (rgb) {
  1633. var r = rgb[0];
  1634. var g = rgb[1];
  1635. var b = rgb[2];
  1636. var h = convert.rgb.hsl(rgb)[0];
  1637. var w = 1 / 255 * Math.min(r, Math.min(g, b));
  1638. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  1639. return [h, w * 100, b * 100];
  1640. };
  1641. convert.rgb.cmyk = function (rgb) {
  1642. var r = rgb[0] / 255;
  1643. var g = rgb[1] / 255;
  1644. var b = rgb[2] / 255;
  1645. var c;
  1646. var m;
  1647. var y;
  1648. var k;
  1649. k = Math.min(1 - r, 1 - g, 1 - b);
  1650. c = (1 - r - k) / (1 - k) || 0;
  1651. m = (1 - g - k) / (1 - k) || 0;
  1652. y = (1 - b - k) / (1 - k) || 0;
  1653. return [c * 100, m * 100, y * 100, k * 100];
  1654. };
  1655. /**
  1656. * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
  1657. * */
  1658. function comparativeDistance(x, y) {
  1659. return (
  1660. Math.pow(x[0] - y[0], 2) +
  1661. Math.pow(x[1] - y[1], 2) +
  1662. Math.pow(x[2] - y[2], 2)
  1663. );
  1664. }
  1665. convert.rgb.keyword = function (rgb) {
  1666. var reversed = reverseKeywords[rgb];
  1667. if (reversed) {
  1668. return reversed;
  1669. }
  1670. var currentClosestDistance = Infinity;
  1671. var currentClosestKeyword;
  1672. for (var keyword in colorName) {
  1673. if (colorName.hasOwnProperty(keyword)) {
  1674. var value = colorName[keyword];
  1675. // Compute comparative distance
  1676. var distance = comparativeDistance(rgb, value);
  1677. // Check if its less, if so set as closest
  1678. if (distance < currentClosestDistance) {
  1679. currentClosestDistance = distance;
  1680. currentClosestKeyword = keyword;
  1681. }
  1682. }
  1683. }
  1684. return currentClosestKeyword;
  1685. };
  1686. convert.keyword.rgb = function (keyword) {
  1687. return colorName[keyword];
  1688. };
  1689. convert.rgb.xyz = function (rgb) {
  1690. var r = rgb[0] / 255;
  1691. var g = rgb[1] / 255;
  1692. var b = rgb[2] / 255;
  1693. // assume sRGB
  1694. r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
  1695. g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
  1696. b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
  1697. var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
  1698. var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
  1699. var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
  1700. return [x * 100, y * 100, z * 100];
  1701. };
  1702. convert.rgb.lab = function (rgb) {
  1703. var xyz = convert.rgb.xyz(rgb);
  1704. var x = xyz[0];
  1705. var y = xyz[1];
  1706. var z = xyz[2];
  1707. var l;
  1708. var a;
  1709. var b;
  1710. x /= 95.047;
  1711. y /= 100;
  1712. z /= 108.883;
  1713. x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
  1714. y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
  1715. z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
  1716. l = (116 * y) - 16;
  1717. a = 500 * (x - y);
  1718. b = 200 * (y - z);
  1719. return [l, a, b];
  1720. };
  1721. convert.hsl.rgb = function (hsl) {
  1722. var h = hsl[0] / 360;
  1723. var s = hsl[1] / 100;
  1724. var l = hsl[2] / 100;
  1725. var t1;
  1726. var t2;
  1727. var t3;
  1728. var rgb;
  1729. var val;
  1730. if (s === 0) {
  1731. val = l * 255;
  1732. return [val, val, val];
  1733. }
  1734. if (l < 0.5) {
  1735. t2 = l * (1 + s);
  1736. } else {
  1737. t2 = l + s - l * s;
  1738. }
  1739. t1 = 2 * l - t2;
  1740. rgb = [0, 0, 0];
  1741. for (var i = 0; i < 3; i++) {
  1742. t3 = h + 1 / 3 * -(i - 1);
  1743. if (t3 < 0) {
  1744. t3++;
  1745. }
  1746. if (t3 > 1) {
  1747. t3--;
  1748. }
  1749. if (6 * t3 < 1) {
  1750. val = t1 + (t2 - t1) * 6 * t3;
  1751. } else if (2 * t3 < 1) {
  1752. val = t2;
  1753. } else if (3 * t3 < 2) {
  1754. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  1755. } else {
  1756. val = t1;
  1757. }
  1758. rgb[i] = val * 255;
  1759. }
  1760. return rgb;
  1761. };
  1762. convert.hsl.hsv = function (hsl) {
  1763. var h = hsl[0];
  1764. var s = hsl[1] / 100;
  1765. var l = hsl[2] / 100;
  1766. var smin = s;
  1767. var lmin = Math.max(l, 0.01);
  1768. var sv;
  1769. var v;
  1770. l *= 2;
  1771. s *= (l <= 1) ? l : 2 - l;
  1772. smin *= lmin <= 1 ? lmin : 2 - lmin;
  1773. v = (l + s) / 2;
  1774. sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
  1775. return [h, sv * 100, v * 100];
  1776. };
  1777. convert.hsv.rgb = function (hsv) {
  1778. var h = hsv[0] / 60;
  1779. var s = hsv[1] / 100;
  1780. var v = hsv[2] / 100;
  1781. var hi = Math.floor(h) % 6;
  1782. var f = h - Math.floor(h);
  1783. var p = 255 * v * (1 - s);
  1784. var q = 255 * v * (1 - (s * f));
  1785. var t = 255 * v * (1 - (s * (1 - f)));
  1786. v *= 255;
  1787. switch (hi) {
  1788. case 0:
  1789. return [v, t, p];
  1790. case 1:
  1791. return [q, v, p];
  1792. case 2:
  1793. return [p, v, t];
  1794. case 3:
  1795. return [p, q, v];
  1796. case 4:
  1797. return [t, p, v];
  1798. case 5:
  1799. return [v, p, q];
  1800. }
  1801. };
  1802. convert.hsv.hsl = function (hsv) {
  1803. var h = hsv[0];
  1804. var s = hsv[1] / 100;
  1805. var v = hsv[2] / 100;
  1806. var vmin = Math.max(v, 0.01);
  1807. var lmin;
  1808. var sl;
  1809. var l;
  1810. l = (2 - s) * v;
  1811. lmin = (2 - s) * vmin;
  1812. sl = s * vmin;
  1813. sl /= (lmin <= 1) ? lmin : 2 - lmin;
  1814. sl = sl || 0;
  1815. l /= 2;
  1816. return [h, sl * 100, l * 100];
  1817. };
  1818. // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  1819. convert.hwb.rgb = function (hwb) {
  1820. var h = hwb[0] / 360;
  1821. var wh = hwb[1] / 100;
  1822. var bl = hwb[2] / 100;
  1823. var ratio = wh + bl;
  1824. var i;
  1825. var v;
  1826. var f;
  1827. var n;
  1828. // wh + bl cant be > 1
  1829. if (ratio > 1) {
  1830. wh /= ratio;
  1831. bl /= ratio;
  1832. }
  1833. i = Math.floor(6 * h);
  1834. v = 1 - bl;
  1835. f = 6 * h - i;
  1836. if ((i & 0x01) !== 0) {
  1837. f = 1 - f;
  1838. }
  1839. n = wh + f * (v - wh); // linear interpolation
  1840. var r;
  1841. var g;
  1842. var b;
  1843. switch (i) {
  1844. default:
  1845. case 6:
  1846. case 0: r = v; g = n; b = wh; break;
  1847. case 1: r = n; g = v; b = wh; break;
  1848. case 2: r = wh; g = v; b = n; break;
  1849. case 3: r = wh; g = n; b = v; break;
  1850. case 4: r = n; g = wh; b = v; break;
  1851. case 5: r = v; g = wh; b = n; break;
  1852. }
  1853. return [r * 255, g * 255, b * 255];
  1854. };
  1855. convert.cmyk.rgb = function (cmyk) {
  1856. var c = cmyk[0] / 100;
  1857. var m = cmyk[1] / 100;
  1858. var y = cmyk[2] / 100;
  1859. var k = cmyk[3] / 100;
  1860. var r;
  1861. var g;
  1862. var b;
  1863. r = 1 - Math.min(1, c * (1 - k) + k);
  1864. g = 1 - Math.min(1, m * (1 - k) + k);
  1865. b = 1 - Math.min(1, y * (1 - k) + k);
  1866. return [r * 255, g * 255, b * 255];
  1867. };
  1868. convert.xyz.rgb = function (xyz) {
  1869. var x = xyz[0] / 100;
  1870. var y = xyz[1] / 100;
  1871. var z = xyz[2] / 100;
  1872. var r;
  1873. var g;
  1874. var b;
  1875. r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
  1876. g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
  1877. b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
  1878. // assume sRGB
  1879. r = r > 0.0031308
  1880. ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
  1881. : r * 12.92;
  1882. g = g > 0.0031308
  1883. ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
  1884. : g * 12.92;
  1885. b = b > 0.0031308
  1886. ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
  1887. : b * 12.92;
  1888. r = Math.min(Math.max(0, r), 1);
  1889. g = Math.min(Math.max(0, g), 1);
  1890. b = Math.min(Math.max(0, b), 1);
  1891. return [r * 255, g * 255, b * 255];
  1892. };
  1893. convert.xyz.lab = function (xyz) {
  1894. var x = xyz[0];
  1895. var y = xyz[1];
  1896. var z = xyz[2];
  1897. var l;
  1898. var a;
  1899. var b;
  1900. x /= 95.047;
  1901. y /= 100;
  1902. z /= 108.883;
  1903. x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
  1904. y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
  1905. z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
  1906. l = (116 * y) - 16;
  1907. a = 500 * (x - y);
  1908. b = 200 * (y - z);
  1909. return [l, a, b];
  1910. };
  1911. convert.lab.xyz = function (lab) {
  1912. var l = lab[0];
  1913. var a = lab[1];
  1914. var b = lab[2];
  1915. var x;
  1916. var y;
  1917. var z;
  1918. y = (l + 16) / 116;
  1919. x = a / 500 + y;
  1920. z = y - b / 200;
  1921. var y2 = Math.pow(y, 3);
  1922. var x2 = Math.pow(x, 3);
  1923. var z2 = Math.pow(z, 3);
  1924. y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
  1925. x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
  1926. z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
  1927. x *= 95.047;
  1928. y *= 100;
  1929. z *= 108.883;
  1930. return [x, y, z];
  1931. };
  1932. convert.lab.lch = function (lab) {
  1933. var l = lab[0];
  1934. var a = lab[1];
  1935. var b = lab[2];
  1936. var hr;
  1937. var h;
  1938. var c;
  1939. hr = Math.atan2(b, a);
  1940. h = hr * 360 / 2 / Math.PI;
  1941. if (h < 0) {
  1942. h += 360;
  1943. }
  1944. c = Math.sqrt(a * a + b * b);
  1945. return [l, c, h];
  1946. };
  1947. convert.lch.lab = function (lch) {
  1948. var l = lch[0];
  1949. var c = lch[1];
  1950. var h = lch[2];
  1951. var a;
  1952. var b;
  1953. var hr;
  1954. hr = h / 360 * 2 * Math.PI;
  1955. a = c * Math.cos(hr);
  1956. b = c * Math.sin(hr);
  1957. return [l, a, b];
  1958. };
  1959. convert.rgb.ansi16 = function (args) {
  1960. var r = args[0];
  1961. var g = args[1];
  1962. var b = args[2];
  1963. var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
  1964. value = Math.round(value / 50);
  1965. if (value === 0) {
  1966. return 30;
  1967. }
  1968. var ansi = 30
  1969. + ((Math.round(b / 255) << 2)
  1970. | (Math.round(g / 255) << 1)
  1971. | Math.round(r / 255));
  1972. if (value === 2) {
  1973. ansi += 60;
  1974. }
  1975. return ansi;
  1976. };
  1977. convert.hsv.ansi16 = function (args) {
  1978. // optimization here; we already know the value and don't need to get
  1979. // it converted for us.
  1980. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  1981. };
  1982. convert.rgb.ansi256 = function (args) {
  1983. var r = args[0];
  1984. var g = args[1];
  1985. var b = args[2];
  1986. // we use the extended greyscale palette here, with the exception of
  1987. // black and white. normal palette only has 4 greyscale shades.
  1988. if (r === g && g === b) {
  1989. if (r < 8) {
  1990. return 16;
  1991. }
  1992. if (r > 248) {
  1993. return 231;
  1994. }
  1995. return Math.round(((r - 8) / 247) * 24) + 232;
  1996. }
  1997. var ansi = 16
  1998. + (36 * Math.round(r / 255 * 5))
  1999. + (6 * Math.round(g / 255 * 5))
  2000. + Math.round(b / 255 * 5);
  2001. return ansi;
  2002. };
  2003. convert.ansi16.rgb = function (args) {
  2004. var color = args % 10;
  2005. // handle greyscale
  2006. if (color === 0 || color === 7) {
  2007. if (args > 50) {
  2008. color += 3.5;
  2009. }
  2010. color = color / 10.5 * 255;
  2011. return [color, color, color];
  2012. }
  2013. var mult = (~~(args > 50) + 1) * 0.5;
  2014. var r = ((color & 1) * mult) * 255;
  2015. var g = (((color >> 1) & 1) * mult) * 255;
  2016. var b = (((color >> 2) & 1) * mult) * 255;
  2017. return [r, g, b];
  2018. };
  2019. convert.ansi256.rgb = function (args) {
  2020. // handle greyscale
  2021. if (args >= 232) {
  2022. var c = (args - 232) * 10 + 8;
  2023. return [c, c, c];
  2024. }
  2025. args -= 16;
  2026. var rem;
  2027. var r = Math.floor(args / 36) / 5 * 255;
  2028. var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  2029. var b = (rem % 6) / 5 * 255;
  2030. return [r, g, b];
  2031. };
  2032. convert.rgb.hex = function (args) {
  2033. var integer = ((Math.round(args[0]) & 0xFF) << 16)
  2034. + ((Math.round(args[1]) & 0xFF) << 8)
  2035. + (Math.round(args[2]) & 0xFF);
  2036. var string = integer.toString(16).toUpperCase();
  2037. return '000000'.substring(string.length) + string;
  2038. };
  2039. convert.hex.rgb = function (args) {
  2040. var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  2041. if (!match) {
  2042. return [0, 0, 0];
  2043. }
  2044. var colorString = match[0];
  2045. if (match[0].length === 3) {
  2046. colorString = colorString.split('').map(function (char) {
  2047. return char + char;
  2048. }).join('');
  2049. }
  2050. var integer = parseInt(colorString, 16);
  2051. var r = (integer >> 16) & 0xFF;
  2052. var g = (integer >> 8) & 0xFF;
  2053. var b = integer & 0xFF;
  2054. return [r, g, b];
  2055. };
  2056. convert.rgb.hcg = function (rgb) {
  2057. var r = rgb[0] / 255;
  2058. var g = rgb[1] / 255;
  2059. var b = rgb[2] / 255;
  2060. var max = Math.max(Math.max(r, g), b);
  2061. var min = Math.min(Math.min(r, g), b);
  2062. var chroma = (max - min);
  2063. var grayscale;
  2064. var hue;
  2065. if (chroma < 1) {
  2066. grayscale = min / (1 - chroma);
  2067. } else {
  2068. grayscale = 0;
  2069. }
  2070. if (chroma <= 0) {
  2071. hue = 0;
  2072. } else
  2073. if (max === r) {
  2074. hue = ((g - b) / chroma) % 6;
  2075. } else
  2076. if (max === g) {
  2077. hue = 2 + (b - r) / chroma;
  2078. } else {
  2079. hue = 4 + (r - g) / chroma + 4;
  2080. }
  2081. hue /= 6;
  2082. hue %= 1;
  2083. return [hue * 360, chroma * 100, grayscale * 100];
  2084. };
  2085. convert.hsl.hcg = function (hsl) {
  2086. var s = hsl[1] / 100;
  2087. var l = hsl[2] / 100;
  2088. var c = 1;
  2089. var f = 0;
  2090. if (l < 0.5) {
  2091. c = 2.0 * s * l;
  2092. } else {
  2093. c = 2.0 * s * (1.0 - l);
  2094. }
  2095. if (c < 1.0) {
  2096. f = (l - 0.5 * c) / (1.0 - c);
  2097. }
  2098. return [hsl[0], c * 100, f * 100];
  2099. };
  2100. convert.hsv.hcg = function (hsv) {
  2101. var s = hsv[1] / 100;
  2102. var v = hsv[2] / 100;
  2103. var c = s * v;
  2104. var f = 0;
  2105. if (c < 1.0) {
  2106. f = (v - c) / (1 - c);
  2107. }
  2108. return [hsv[0], c * 100, f * 100];
  2109. };
  2110. convert.hcg.rgb = function (hcg) {
  2111. var h = hcg[0] / 360;
  2112. var c = hcg[1] / 100;
  2113. var g = hcg[2] / 100;
  2114. if (c === 0.0) {
  2115. return [g * 255, g * 255, g * 255];
  2116. }
  2117. var pure = [0, 0, 0];
  2118. var hi = (h % 1) * 6;
  2119. var v = hi % 1;
  2120. var w = 1 - v;
  2121. var mg = 0;
  2122. switch (Math.floor(hi)) {
  2123. case 0:
  2124. pure[0] = 1; pure[1] = v; pure[2] = 0; break;
  2125. case 1:
  2126. pure[0] = w; pure[1] = 1; pure[2] = 0; break;
  2127. case 2:
  2128. pure[0] = 0; pure[1] = 1; pure[2] = v; break;
  2129. case 3:
  2130. pure[0] = 0; pure[1] = w; pure[2] = 1; break;
  2131. case 4:
  2132. pure[0] = v; pure[1] = 0; pure[2] = 1; break;
  2133. default:
  2134. pure[0] = 1; pure[1] = 0; pure[2] = w;
  2135. }
  2136. mg = (1.0 - c) * g;
  2137. return [
  2138. (c * pure[0] + mg) * 255,
  2139. (c * pure[1] + mg) * 255,
  2140. (c * pure[2] + mg) * 255
  2141. ];
  2142. };
  2143. convert.hcg.hsv = function (hcg) {
  2144. var c = hcg[1] / 100;
  2145. var g = hcg[2] / 100;
  2146. var v = c + g * (1.0 - c);
  2147. var f = 0;
  2148. if (v > 0.0) {
  2149. f = c / v;
  2150. }
  2151. return [hcg[0], f * 100, v * 100];
  2152. };
  2153. convert.hcg.hsl = function (hcg) {
  2154. var c = hcg[1] / 100;
  2155. var g = hcg[2] / 100;
  2156. var l = g * (1.0 - c) + 0.5 * c;
  2157. var s = 0;
  2158. if (l > 0.0 && l < 0.5) {
  2159. s = c / (2 * l);
  2160. } else
  2161. if (l >= 0.5 && l < 1.0) {
  2162. s = c / (2 * (1 - l));
  2163. }
  2164. return [hcg[0], s * 100, l * 100];
  2165. };
  2166. convert.hcg.hwb = function (hcg) {
  2167. var c = hcg[1] / 100;
  2168. var g = hcg[2] / 100;
  2169. var v = c + g * (1.0 - c);
  2170. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  2171. };
  2172. convert.hwb.hcg = function (hwb) {
  2173. var w = hwb[1] / 100;
  2174. var b = hwb[2] / 100;
  2175. var v = 1 - b;
  2176. var c = v - w;
  2177. var g = 0;
  2178. if (c < 1) {
  2179. g = (v - c) / (1 - c);
  2180. }
  2181. return [hwb[0], c * 100, g * 100];
  2182. };
  2183. convert.apple.rgb = function (apple) {
  2184. return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
  2185. };
  2186. convert.rgb.apple = function (rgb) {
  2187. return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
  2188. };
  2189. convert.gray.rgb = function (args) {
  2190. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  2191. };
  2192. convert.gray.hsl = convert.gray.hsv = function (args) {
  2193. return [0, 0, args[0]];
  2194. };
  2195. convert.gray.hwb = function (gray) {
  2196. return [0, 100, gray[0]];
  2197. };
  2198. convert.gray.cmyk = function (gray) {
  2199. return [0, 0, 0, gray[0]];
  2200. };
  2201. convert.gray.lab = function (gray) {
  2202. return [gray[0], 0, 0];
  2203. };
  2204. convert.gray.hex = function (gray) {
  2205. var val = Math.round(gray[0] / 100 * 255) & 0xFF;
  2206. var integer = (val << 16) + (val << 8) + val;
  2207. var string = integer.toString(16).toUpperCase();
  2208. return '000000'.substring(string.length) + string;
  2209. };
  2210. convert.rgb.gray = function (rgb) {
  2211. var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  2212. return [val / 255 * 100];
  2213. };
  2214. });
  2215. var conversions_1 = conversions.rgb;
  2216. var conversions_2 = conversions.hsl;
  2217. var conversions_3 = conversions.hsv;
  2218. var conversions_4 = conversions.hwb;
  2219. var conversions_5 = conversions.cmyk;
  2220. var conversions_6 = conversions.xyz;
  2221. var conversions_7 = conversions.lab;
  2222. var conversions_8 = conversions.lch;
  2223. var conversions_9 = conversions.hex;
  2224. var conversions_10 = conversions.keyword;
  2225. var conversions_11 = conversions.ansi16;
  2226. var conversions_12 = conversions.ansi256;
  2227. var conversions_13 = conversions.hcg;
  2228. var conversions_14 = conversions.apple;
  2229. var conversions_15 = conversions.gray;
  2230. /*
  2231. this function routes a model to all other models.
  2232. all functions that are routed have a property `.conversion` attached
  2233. to the returned synthetic function. This property is an array
  2234. of strings, each with the steps in between the 'from' and 'to'
  2235. color models (inclusive).
  2236. conversions that are not possible simply are not included.
  2237. */
  2238. function buildGraph() {
  2239. var graph = {};
  2240. // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  2241. var models = Object.keys(conversions);
  2242. for (var len = models.length, i = 0; i < len; i++) {
  2243. graph[models[i]] = {
  2244. // http://jsperf.com/1-vs-infinity
  2245. // micro-opt, but this is simple.
  2246. distance: -1,
  2247. parent: null
  2248. };
  2249. }
  2250. return graph;
  2251. }
  2252. // https://en.wikipedia.org/wiki/Breadth-first_search
  2253. function deriveBFS(fromModel) {
  2254. var graph = buildGraph();
  2255. var queue = [fromModel]; // unshift -> queue -> pop
  2256. graph[fromModel].distance = 0;
  2257. while (queue.length) {
  2258. var current = queue.pop();
  2259. var adjacents = Object.keys(conversions[current]);
  2260. for (var len = adjacents.length, i = 0; i < len; i++) {
  2261. var adjacent = adjacents[i];
  2262. var node = graph[adjacent];
  2263. if (node.distance === -1) {
  2264. node.distance = graph[current].distance + 1;
  2265. node.parent = current;
  2266. queue.unshift(adjacent);
  2267. }
  2268. }
  2269. }
  2270. return graph;
  2271. }
  2272. function link(from, to) {
  2273. return function (args) {
  2274. return to(from(args));
  2275. };
  2276. }
  2277. function wrapConversion(toModel, graph) {
  2278. var path = [graph[toModel].parent, toModel];
  2279. var fn = conversions[graph[toModel].parent][toModel];
  2280. var cur = graph[toModel].parent;
  2281. while (graph[cur].parent) {
  2282. path.unshift(graph[cur].parent);
  2283. fn = link(conversions[graph[cur].parent][cur], fn);
  2284. cur = graph[cur].parent;
  2285. }
  2286. fn.conversion = path;
  2287. return fn;
  2288. }
  2289. var route = function (fromModel) {
  2290. var graph = deriveBFS(fromModel);
  2291. var conversion = {};
  2292. var models = Object.keys(graph);
  2293. for (var len = models.length, i = 0; i < len; i++) {
  2294. var toModel = models[i];
  2295. var node = graph[toModel];
  2296. if (node.parent === null) {
  2297. // no possible conversion, or this node is the source model.
  2298. continue;
  2299. }
  2300. conversion[toModel] = wrapConversion(toModel, graph);
  2301. }
  2302. return conversion;
  2303. };
  2304. var convert = {};
  2305. var models = Object.keys(conversions);
  2306. function wrapRaw(fn) {
  2307. var wrappedFn = function (args) {
  2308. if (args === undefined || args === null) {
  2309. return args;
  2310. }
  2311. if (arguments.length > 1) {
  2312. args = Array.prototype.slice.call(arguments);
  2313. }
  2314. return fn(args);
  2315. };
  2316. // preserve .conversion property if there is one
  2317. if ('conversion' in fn) {
  2318. wrappedFn.conversion = fn.conversion;
  2319. }
  2320. return wrappedFn;
  2321. }
  2322. function wrapRounded(fn) {
  2323. var wrappedFn = function (args) {
  2324. if (args === undefined || args === null) {
  2325. return args;
  2326. }
  2327. if (arguments.length > 1) {
  2328. args = Array.prototype.slice.call(arguments);
  2329. }
  2330. var result = fn(args);
  2331. // we're assuming the result is an array here.
  2332. // see notice in conversions.js; don't use box types
  2333. // in conversion functions.
  2334. if (typeof result === 'object') {
  2335. for (var len = result.length, i = 0; i < len; i++) {
  2336. result[i] = Math.round(result[i]);
  2337. }
  2338. }
  2339. return result;
  2340. };
  2341. // preserve .conversion property if there is one
  2342. if ('conversion' in fn) {
  2343. wrappedFn.conversion = fn.conversion;
  2344. }
  2345. return wrappedFn;
  2346. }
  2347. models.forEach(function (fromModel) {
  2348. convert[fromModel] = {};
  2349. Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
  2350. Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
  2351. var routes = route(fromModel);
  2352. var routeModels = Object.keys(routes);
  2353. routeModels.forEach(function (toModel) {
  2354. var fn = routes[toModel];
  2355. convert[fromModel][toModel] = wrapRounded(fn);
  2356. convert[fromModel][toModel].raw = wrapRaw(fn);
  2357. });
  2358. });
  2359. var colorConvert = convert;
  2360. var ansiStyles = createCommonjsModule(function (module) {
  2361. var wrapAnsi16 = function wrapAnsi16(fn, offset) {
  2362. return function () {
  2363. var code = fn.apply(colorConvert, arguments);
  2364. return '\x1B[' + (code + offset) + 'm';
  2365. };
  2366. };
  2367. var wrapAnsi256 = function wrapAnsi256(fn, offset) {
  2368. return function () {
  2369. var code = fn.apply(colorConvert, arguments);
  2370. return '\x1B[' + (38 + offset) + ';5;' + code + 'm';
  2371. };
  2372. };
  2373. var wrapAnsi16m = function wrapAnsi16m(fn, offset) {
  2374. return function () {
  2375. var rgb = fn.apply(colorConvert, arguments);
  2376. return '\x1B[' + (38 + offset) + ';2;' + rgb[0] + ';' + rgb[1] + ';' + rgb[2] + 'm';
  2377. };
  2378. };
  2379. function assembleStyles() {
  2380. var codes = new _Map();
  2381. var styles = {
  2382. modifier: {
  2383. reset: [0, 0],
  2384. // 21 isn't widely supported and 22 does the same thing
  2385. bold: [1, 22],
  2386. dim: [2, 22],
  2387. italic: [3, 23],
  2388. underline: [4, 24],
  2389. inverse: [7, 27],
  2390. hidden: [8, 28],
  2391. strikethrough: [9, 29]
  2392. },
  2393. color: {
  2394. black: [30, 39],
  2395. red: [31, 39],
  2396. green: [32, 39],
  2397. yellow: [33, 39],
  2398. blue: [34, 39],
  2399. magenta: [35, 39],
  2400. cyan: [36, 39],
  2401. white: [37, 39],
  2402. gray: [90, 39],
  2403. // Bright color
  2404. redBright: [91, 39],
  2405. greenBright: [92, 39],
  2406. yellowBright: [93, 39],
  2407. blueBright: [94, 39],
  2408. magentaBright: [95, 39],
  2409. cyanBright: [96, 39],
  2410. whiteBright: [97, 39]
  2411. },
  2412. bgColor: {
  2413. bgBlack: [40, 49],
  2414. bgRed: [41, 49],
  2415. bgGreen: [42, 49],
  2416. bgYellow: [43, 49],
  2417. bgBlue: [44, 49],
  2418. bgMagenta: [45, 49],
  2419. bgCyan: [46, 49],
  2420. bgWhite: [47, 49],
  2421. // Bright color
  2422. bgBlackBright: [100, 49],
  2423. bgRedBright: [101, 49],
  2424. bgGreenBright: [102, 49],
  2425. bgYellowBright: [103, 49],
  2426. bgBlueBright: [104, 49],
  2427. bgMagentaBright: [105, 49],
  2428. bgCyanBright: [106, 49],
  2429. bgWhiteBright: [107, 49]
  2430. }
  2431. };
  2432. // Fix humans
  2433. styles.color.grey = styles.color.gray;
  2434. var _iteratorNormalCompletion = true;
  2435. var _didIteratorError = false;
  2436. var _iteratorError = undefined;
  2437. try {
  2438. for (var _iterator = _getIterator(_Object$keys(styles)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2439. var groupName = _step.value;
  2440. var group = styles[groupName];
  2441. var _iteratorNormalCompletion3 = true;
  2442. var _didIteratorError3 = false;
  2443. var _iteratorError3 = undefined;
  2444. try {
  2445. for (var _iterator3 = _getIterator(_Object$keys(group)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
  2446. var styleName = _step3.value;
  2447. var style = group[styleName];
  2448. styles[styleName] = {
  2449. open: '\x1B[' + style[0] + 'm',
  2450. close: '\x1B[' + style[1] + 'm'
  2451. };
  2452. group[styleName] = styles[styleName];
  2453. codes.set(style[0], style[1]);
  2454. }
  2455. } catch (err) {
  2456. _didIteratorError3 = true;
  2457. _iteratorError3 = err;
  2458. } finally {
  2459. try {
  2460. if (!_iteratorNormalCompletion3 && _iterator3.return) {
  2461. _iterator3.return();
  2462. }
  2463. } finally {
  2464. if (_didIteratorError3) {
  2465. throw _iteratorError3;
  2466. }
  2467. }
  2468. }
  2469. _Object$defineProperty(styles, groupName, {
  2470. value: group,
  2471. enumerable: false
  2472. });
  2473. Object.defineProperty(styles, 'codes', {
  2474. value: codes,
  2475. enumerable: false
  2476. });
  2477. }
  2478. } catch (err) {
  2479. _didIteratorError = true;
  2480. _iteratorError = err;
  2481. } finally {
  2482. try {
  2483. if (!_iteratorNormalCompletion && _iterator.return) {
  2484. _iterator.return();
  2485. }
  2486. } finally {
  2487. if (_didIteratorError) {
  2488. throw _iteratorError;
  2489. }
  2490. }
  2491. }
  2492. var ansi2ansi = function ansi2ansi(n) {
  2493. return n;
  2494. };
  2495. var rgb2rgb = function rgb2rgb(r, g, b) {
  2496. return [r, g, b];
  2497. };
  2498. styles.color.close = '\x1B[39m';
  2499. styles.bgColor.close = '\x1B[49m';
  2500. styles.color.ansi = {
  2501. ansi: wrapAnsi16(ansi2ansi, 0)
  2502. };
  2503. styles.color.ansi256 = {
  2504. ansi256: wrapAnsi256(ansi2ansi, 0)
  2505. };
  2506. styles.color.ansi16m = {
  2507. rgb: wrapAnsi16m(rgb2rgb, 0)
  2508. };
  2509. styles.bgColor.ansi = {
  2510. ansi: wrapAnsi16(ansi2ansi, 10)
  2511. };
  2512. styles.bgColor.ansi256 = {
  2513. ansi256: wrapAnsi256(ansi2ansi, 10)
  2514. };
  2515. styles.bgColor.ansi16m = {
  2516. rgb: wrapAnsi16m(rgb2rgb, 10)
  2517. };
  2518. var _iteratorNormalCompletion2 = true;
  2519. var _didIteratorError2 = false;
  2520. var _iteratorError2 = undefined;
  2521. try {
  2522. for (var _iterator2 = _getIterator(_Object$keys(colorConvert)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  2523. var key = _step2.value;
  2524. if (_typeof(colorConvert[key]) !== 'object') {
  2525. continue;
  2526. }
  2527. var suite = colorConvert[key];
  2528. if (key === 'ansi16') {
  2529. key = 'ansi';
  2530. }
  2531. if ('ansi16' in suite) {
  2532. styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
  2533. styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
  2534. }
  2535. if ('ansi256' in suite) {
  2536. styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
  2537. styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
  2538. }
  2539. if ('rgb' in suite) {
  2540. styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
  2541. styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
  2542. }
  2543. }
  2544. } catch (err) {
  2545. _didIteratorError2 = true;
  2546. _iteratorError2 = err;
  2547. } finally {
  2548. try {
  2549. if (!_iteratorNormalCompletion2 && _iterator2.return) {
  2550. _iterator2.return();
  2551. }
  2552. } finally {
  2553. if (_didIteratorError2) {
  2554. throw _iteratorError2;
  2555. }
  2556. }
  2557. }
  2558. return styles;
  2559. }
  2560. // Make the export immutable
  2561. Object.defineProperty(module, 'exports', {
  2562. enumerable: true,
  2563. get: assembleStyles
  2564. });
  2565. });
  2566. var getOwnPropertySymbols = _core.Object.getOwnPropertySymbols;
  2567. var getOwnPropertySymbols$1 = createCommonjsModule(function (module) {
  2568. module.exports = { "default": getOwnPropertySymbols, __esModule: true };
  2569. });
  2570. var _Object$getOwnPropertySymbols = unwrapExports(getOwnPropertySymbols$1);
  2571. /**
  2572. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2573. *
  2574. * This source code is licensed under the MIT license found in the
  2575. * LICENSE file in the root directory of this source tree.
  2576. *
  2577. *
  2578. */
  2579. var getSymbols = _Object$getOwnPropertySymbols || function (obj) {
  2580. return [];
  2581. };
  2582. var isSymbol$1 = function isSymbol(key) {
  2583. return (
  2584. // $FlowFixMe string literal `symbol`. This value is not a valid `typeof` return value
  2585. (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'symbol' || toString.call(key) === '[object Symbol]'
  2586. );
  2587. };
  2588. // Return entries (for example, of a map)
  2589. // with spacing, indentation, and comma
  2590. // without surrounding punctuation (for example, braces)
  2591. function printIteratorEntries(
  2592. // Flow 0.51.0: property `@@iterator` of $Iterator not found in Object
  2593. // To allow simplistic getRecordIterator in immutable.js
  2594. iterator, config, indentation, depth, refs, printer) {
  2595. var separator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ': ';
  2596. var result = '';
  2597. var current = iterator.next();
  2598. if (!current.done) {
  2599. result += config.spacingOuter;
  2600. var indentationNext = indentation + config.indent;
  2601. while (!current.done) {
  2602. var name = printer(current.value[0], config, indentationNext, depth, refs);
  2603. var value = printer(current.value[1], config, indentationNext, depth, refs);
  2604. result += indentationNext + name + separator + value;
  2605. current = iterator.next();
  2606. if (!current.done) {
  2607. result += ',' + config.spacingInner;
  2608. } else if (!config.min) {
  2609. result += ',';
  2610. }
  2611. }
  2612. result += config.spacingOuter + indentation;
  2613. }
  2614. return result;
  2615. }
  2616. // Return values (for example, of a set)
  2617. // with spacing, indentation, and comma
  2618. // without surrounding punctuation (braces or brackets)
  2619. function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
  2620. var result = '';
  2621. var current = iterator.next();
  2622. if (!current.done) {
  2623. result += config.spacingOuter;
  2624. var indentationNext = indentation + config.indent;
  2625. while (!current.done) {
  2626. result += indentationNext + printer(current.value, config, indentationNext, depth, refs);
  2627. current = iterator.next();
  2628. if (!current.done) {
  2629. result += ',' + config.spacingInner;
  2630. } else if (!config.min) {
  2631. result += ',';
  2632. }
  2633. }
  2634. result += config.spacingOuter + indentation;
  2635. }
  2636. return result;
  2637. }
  2638. // Return items (for example, of an array)
  2639. // with spacing, indentation, and comma
  2640. // without surrounding punctuation (for example, brackets)
  2641. function printListItems(list, config, indentation, depth, refs, printer) {
  2642. var result = '';
  2643. if (list.length) {
  2644. result += config.spacingOuter;
  2645. var indentationNext = indentation + config.indent;
  2646. for (var i = 0; i < list.length; i++) {
  2647. result += indentationNext + printer(list[i], config, indentationNext, depth, refs);
  2648. if (i < list.length - 1) {
  2649. result += ',' + config.spacingInner;
  2650. } else if (!config.min) {
  2651. result += ',';
  2652. }
  2653. }
  2654. result += config.spacingOuter + indentation;
  2655. }
  2656. return result;
  2657. }
  2658. // Return properties of an object
  2659. // with spacing, indentation, and comma
  2660. // without surrounding punctuation (for example, braces)
  2661. function printObjectProperties(val, config, indentation, depth, refs, printer) {
  2662. var result = '';
  2663. var keys = _Object$keys(val).sort();
  2664. var symbols = getSymbols(val);
  2665. if (symbols.length) {
  2666. keys = keys.filter(function (key) {
  2667. return !isSymbol$1(key);
  2668. }).concat(symbols);
  2669. }
  2670. if (keys.length) {
  2671. result += config.spacingOuter;
  2672. var indentationNext = indentation + config.indent;
  2673. for (var i = 0; i < keys.length; i++) {
  2674. var key = keys[i];
  2675. var name = printer(key, config, indentationNext, depth, refs);
  2676. var value = printer(val[key], config, indentationNext, depth, refs);
  2677. result += indentationNext + name + ': ' + value;
  2678. if (i < keys.length - 1) {
  2679. result += ',' + config.spacingInner;
  2680. } else if (!config.min) {
  2681. result += ',';
  2682. }
  2683. }
  2684. result += config.spacingOuter + indentation;
  2685. }
  2686. return result;
  2687. }
  2688. var _for = _core.Symbol['for'];
  2689. var _for$1 = createCommonjsModule(function (module) {
  2690. module.exports = { "default": _for, __esModule: true };
  2691. });
  2692. var _Symbol$for = unwrapExports(_for$1);
  2693. var asymmetricMatcher = _Symbol$for('jest.asymmetricMatcher');
  2694. var SPACE = ' ';
  2695. var serialize = function serialize(val, config, indentation, depth, refs, printer) {
  2696. var stringedValue = val.toString();
  2697. if (stringedValue === 'ArrayContaining' || stringedValue === 'ArrayNotContaining') {
  2698. if (++depth > config.maxDepth) {
  2699. return '[' + stringedValue + ']';
  2700. }
  2701. return stringedValue + SPACE + '[' + printListItems(val.sample, config, indentation, depth, refs, printer) + ']';
  2702. }
  2703. if (stringedValue === 'ObjectContaining' || stringedValue === 'ObjectNotContaining') {
  2704. if (++depth > config.maxDepth) {
  2705. return '[' + stringedValue + ']';
  2706. }
  2707. return stringedValue + SPACE + '{' + printObjectProperties(val.sample, config, indentation, depth, refs, printer) + '}';
  2708. }
  2709. if (stringedValue === 'StringMatching' || stringedValue === 'StringNotMatching') {
  2710. return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
  2711. }
  2712. if (stringedValue === 'StringContaining' || stringedValue === 'StringNotContaining') {
  2713. return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
  2714. }
  2715. return val.toAsymmetricMatcher();
  2716. };
  2717. var test = function test(val) {
  2718. return val && val.$$typeof === asymmetricMatcher;
  2719. };
  2720. var AsymmetricMatcher = { serialize: serialize, test: test };
  2721. var ansiRegex = createCommonjsModule(function (module) {
  2722. module.exports = function () {
  2723. var pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'].join('|');
  2724. return new RegExp(pattern, 'g');
  2725. };
  2726. });
  2727. var toHumanReadableAnsi = function toHumanReadableAnsi(text) {
  2728. return text.replace(ansiRegex(), function (match, offset, string) {
  2729. switch (match) {
  2730. case ansiStyles.red.close:
  2731. case ansiStyles.green.close:
  2732. case ansiStyles.cyan.close:
  2733. case ansiStyles.gray.close:
  2734. case ansiStyles.white.close:
  2735. case ansiStyles.yellow.close:
  2736. case ansiStyles.bgRed.close:
  2737. case ansiStyles.bgGreen.close:
  2738. case ansiStyles.bgYellow.close:
  2739. case ansiStyles.inverse.close:
  2740. case ansiStyles.dim.close:
  2741. case ansiStyles.bold.close:
  2742. case ansiStyles.reset.open:
  2743. case ansiStyles.reset.close:
  2744. return '</>';
  2745. case ansiStyles.red.open:
  2746. return '<red>';
  2747. case ansiStyles.green.open:
  2748. return '<green>';
  2749. case ansiStyles.cyan.open:
  2750. return '<cyan>';
  2751. case ansiStyles.gray.open:
  2752. return '<gray>';
  2753. case ansiStyles.white.open:
  2754. return '<white>';
  2755. case ansiStyles.yellow.open:
  2756. return '<yellow>';
  2757. case ansiStyles.bgRed.open:
  2758. return '<bgRed>';
  2759. case ansiStyles.bgGreen.open:
  2760. return '<bgGreen>';
  2761. case ansiStyles.bgYellow.open:
  2762. return '<bgYellow>';
  2763. case ansiStyles.inverse.open:
  2764. return '<inverse>';
  2765. case ansiStyles.dim.open:
  2766. return '<dim>';
  2767. case ansiStyles.bold.open:
  2768. return '<bold>';
  2769. default:
  2770. return '';
  2771. }
  2772. });
  2773. };
  2774. var test$1 = function test(val) {
  2775. return typeof val === 'string' && val.match(ansiRegex());
  2776. };
  2777. var serialize$1 = function serialize(val, config, indentation, depth, refs, printer) {
  2778. return printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
  2779. };
  2780. var ConvertAnsi = { serialize: serialize$1, test: test$1 };
  2781. // 19.1.2.1 Object.assign(target, source, ...)
  2782. var $assign = Object.assign;
  2783. // should work with symbols and should have deterministic property order (V8 bug)
  2784. var _objectAssign = !$assign || _fails(function () {
  2785. var A = {};
  2786. var B = {};
  2787. // eslint-disable-next-line no-undef
  2788. var S = Symbol();
  2789. var K = 'abcdefghijklmnopqrst';
  2790. A[S] = 7;
  2791. K.split('').forEach(function (k) { B[k] = k; });
  2792. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  2793. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  2794. var T = _toObject(target);
  2795. var aLen = arguments.length;
  2796. var index = 1;
  2797. var getSymbols = _objectGops.f;
  2798. var isEnum = _objectPie.f;
  2799. while (aLen > index) {
  2800. var S = _iobject(arguments[index++]);
  2801. var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
  2802. var length = keys.length;
  2803. var j = 0;
  2804. var key;
  2805. while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  2806. } return T;
  2807. } : $assign;
  2808. // 19.1.3.1 Object.assign(target, source)
  2809. _export(_export.S + _export.F, 'Object', { assign: _objectAssign });
  2810. var assign = _core.Object.assign;
  2811. var assign$1 = createCommonjsModule(function (module) {
  2812. module.exports = { "default": assign, __esModule: true };
  2813. });
  2814. var _Object$assign = unwrapExports(assign$1);
  2815. var SPACE$1 = ' ';
  2816. var COLLECTION_NAMES = ['DOMStringMap', 'NamedNodeMap'];
  2817. var test$2 = function test(val) {
  2818. return val && val.constructor && COLLECTION_NAMES.indexOf(val.constructor.name) !== -1;
  2819. };
  2820. var convertCollectionToObject = function convertCollectionToObject(collection) {
  2821. var result = {};
  2822. if (collection.constructor.name === 'NamedNodeMap') {
  2823. for (var i = 0; i < collection.length; i++) {
  2824. result[collection[i].name] = collection[i].value;
  2825. }
  2826. } else {
  2827. result = _Object$assign({}, collection);
  2828. }
  2829. return result;
  2830. };
  2831. var serialize$2 = function serialize(collection, config, indentation, depth, refs, printer) {
  2832. if (++depth > config.maxDepth) {
  2833. return '[' + collection.constructor.name + ']';
  2834. }
  2835. return collection.constructor.name + SPACE$1 + '{' + printObjectProperties(convertCollectionToObject(collection), config, indentation, depth, refs, printer) + '}';
  2836. };
  2837. var DOMCollection = { serialize: serialize$2, test: test$2 };
  2838. /**
  2839. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2840. *
  2841. * This source code is licensed under the MIT license found in the
  2842. * LICENSE file in the root directory of this source tree.
  2843. *
  2844. *
  2845. */
  2846. function escapeHTML(str) {
  2847. return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
  2848. }
  2849. // Return empty string if keys is empty.
  2850. var printProps = function printProps(keys, props, config, indentation, depth, refs, printer) {
  2851. var indentationNext = indentation + config.indent;
  2852. var colors = config.colors;
  2853. return keys.map(function (key) {
  2854. var value = props[key];
  2855. var printed = printer(value, config, indentationNext, depth, refs);
  2856. if (typeof value !== 'string') {
  2857. if (printed.indexOf('\n') !== -1) {
  2858. printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
  2859. }
  2860. printed = '{' + printed + '}';
  2861. }
  2862. return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;
  2863. }).join('');
  2864. };
  2865. // Return empty string if children is empty.
  2866. var printChildren = function printChildren(children, config, indentation, depth, refs, printer) {
  2867. return children.map(function (child) {
  2868. return config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs));
  2869. }).join('');
  2870. };
  2871. var printText = function printText(text, config) {
  2872. var contentColor = config.colors.content;
  2873. return contentColor.open + escapeHTML(text) + contentColor.close;
  2874. };
  2875. var printComment = function printComment(comment, config) {
  2876. var commentColor = config.colors.comment;
  2877. return commentColor.open + '<!--' + escapeHTML(comment) + '-->' + commentColor.close;
  2878. };
  2879. // Separate the functions to format props, children, and element,
  2880. // so a plugin could override a particular function, if needed.
  2881. // Too bad, so sad: the traditional (but unnecessary) space
  2882. // in a self-closing tagColor requires a second test of printedProps.
  2883. var printElement = function printElement(type, printedProps, printedChildren, config, indentation) {
  2884. var tagColor = config.colors.tag;
  2885. return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;
  2886. };
  2887. var printElementAsLeaf = function printElementAsLeaf(type, config) {
  2888. var tagColor = config.colors.tag;
  2889. return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;
  2890. };
  2891. var ELEMENT_NODE = 1;
  2892. var TEXT_NODE = 3;
  2893. var COMMENT_NODE = 8;
  2894. var FRAGMENT_NODE = 11;
  2895. var ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
  2896. var testNode = function testNode(nodeType, name) {
  2897. return nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name) || nodeType === TEXT_NODE && name === 'Text' || nodeType === COMMENT_NODE && name === 'Comment' || nodeType === FRAGMENT_NODE && name === 'DocumentFragment';
  2898. };
  2899. var test$3 = function test(val) {
  2900. return val && val.constructor && val.constructor.name && testNode(val.nodeType, val.constructor.name);
  2901. };
  2902. // Convert array of attribute objects to keys array and props object.
  2903. var keysMapper = function keysMapper(attribute) {
  2904. return attribute.name;
  2905. };
  2906. var propsReducer = function propsReducer(props, attribute) {
  2907. props[attribute.name] = attribute.value;
  2908. return props;
  2909. };
  2910. var serialize$3 = function serialize(node, config, indentation, depth, refs, printer) {
  2911. if (node.nodeType === TEXT_NODE) {
  2912. return printText(node.data, config);
  2913. }
  2914. if (node.nodeType === COMMENT_NODE) {
  2915. return printComment(node.data, config);
  2916. }
  2917. var type = node.nodeType === FRAGMENT_NODE ? 'DocumentFragment' : node.tagName.toLowerCase();
  2918. if (++depth > config.maxDepth) {
  2919. return printElementAsLeaf(type, config);
  2920. }
  2921. return printElement(type, printProps(Array.prototype.map.call(node.attributes || [], keysMapper).sort(), Array.prototype.reduce.call(node.attributes || [], propsReducer, {}), config, indentation + config.indent, depth, refs, printer), printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
  2922. };
  2923. var DOMElement = { serialize: serialize$3, test: test$3 };
  2924. // SENTINEL constants are from https://github.com/facebook/immutable-js
  2925. var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
  2926. var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
  2927. var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
  2928. var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
  2929. var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
  2930. var IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
  2931. var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
  2932. var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
  2933. var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
  2934. var getImmutableName = function getImmutableName(name) {
  2935. return 'Immutable.' + name;
  2936. };
  2937. var printAsLeaf = function printAsLeaf(name) {
  2938. return '[' + name + ']';
  2939. };
  2940. var SPACE$2 = ' ';
  2941. var LAZY = '…'; // Seq is lazy if it calls a method like filter
  2942. var printImmutableEntries = function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
  2943. return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE$2 + '{' + printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) + '}';
  2944. };
  2945. // Record has an entries method because it is a collection in immutable v3.
  2946. // Return an iterator for Immutable Record from version v3 or v4.
  2947. var getRecordEntries = function getRecordEntries(val) {
  2948. var i = 0;
  2949. return {
  2950. next: function next() {
  2951. if (i < val._keys.length) {
  2952. var key = val._keys[i++];
  2953. return { done: false, value: [key, val.get(key)] };
  2954. }
  2955. return { done: true };
  2956. }
  2957. };
  2958. };
  2959. var printImmutableRecord = function printImmutableRecord(val, config, indentation, depth, refs, printer) {
  2960. // _name property is defined only for an Immutable Record instance
  2961. // which was constructed with a second optional descriptive name arg
  2962. var name = getImmutableName(val._name || 'Record');
  2963. return ++depth > config.maxDepth ? printAsLeaf(name) : name + SPACE$2 + '{' + printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer) + '}';
  2964. };
  2965. var printImmutableSeq = function printImmutableSeq(val, config, indentation, depth, refs, printer) {
  2966. var name = getImmutableName('Seq');
  2967. if (++depth > config.maxDepth) {
  2968. return printAsLeaf(name);
  2969. }
  2970. if (val[IS_KEYED_SENTINEL]) {
  2971. return name + SPACE$2 + '{' + (
  2972. // from Immutable collection of entries or from ECMAScript object
  2973. val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) : LAZY) + '}';
  2974. }
  2975. return name + SPACE$2 + '[' + (val._iter || // from Immutable collection of values
  2976. val._array || // from ECMAScript array
  2977. val._collection || // from ECMAScript collection in immutable v4
  2978. val._iterable // from ECMAScript collection in immutable v3
  2979. ? printIteratorValues(val.values(), config, indentation, depth, refs, printer) : LAZY) + ']';
  2980. };
  2981. var printImmutableValues = function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
  2982. return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE$2 + '[' + printIteratorValues(val.values(), config, indentation, depth, refs, printer) + ']';
  2983. };
  2984. var serialize$4 = function serialize(val, config, indentation, depth, refs, printer) {
  2985. if (val[IS_MAP_SENTINEL]) {
  2986. return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map');
  2987. }
  2988. if (val[IS_LIST_SENTINEL]) {
  2989. return printImmutableValues(val, config, indentation, depth, refs, printer, 'List');
  2990. }
  2991. if (val[IS_SET_SENTINEL]) {
  2992. return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set');
  2993. }
  2994. if (val[IS_STACK_SENTINEL]) {
  2995. return printImmutableValues(val, config, indentation, depth, refs, printer, 'Stack');
  2996. }
  2997. if (val[IS_SEQ_SENTINEL]) {
  2998. return printImmutableSeq(val, config, indentation, depth, refs, printer);
  2999. }
  3000. // For compatibility with immutable v3 and v4, let record be the default.
  3001. return printImmutableRecord(val, config, indentation, depth, refs, printer);
  3002. };
  3003. // Explicitly comparing sentinel properties to true avoids false positive
  3004. // when mock identity-obj-proxy returns the key as the value for any key.
  3005. var test$4 = function test(val) {
  3006. return val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
  3007. };
  3008. var Immutable = { serialize: serialize$4, test: test$4 };
  3009. var elementSymbol = _Symbol$for('react.element');
  3010. var fragmentSymbol = _Symbol$for('react.fragment');
  3011. var forwardRefSymbol = _Symbol$for('react.forward_ref');
  3012. var providerSymbol = _Symbol$for('react.provider');
  3013. var contextSymbol = _Symbol$for('react.context');
  3014. // Given element.props.children, or subtree during recursive traversal,
  3015. // return flattened array of children.
  3016. var getChildren = function getChildren(arg) {
  3017. var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  3018. if (Array.isArray(arg)) {
  3019. arg.forEach(function (item) {
  3020. getChildren(item, children);
  3021. });
  3022. } else if (arg != null && arg !== false) {
  3023. children.push(arg);
  3024. }
  3025. return children;
  3026. };
  3027. var getType = function getType(element) {
  3028. var type = element.type;
  3029. if (typeof type === 'string') {
  3030. return type;
  3031. }
  3032. if (typeof type === 'function') {
  3033. return type.displayName || type.name || 'Unknown';
  3034. }
  3035. if (type === fragmentSymbol) {
  3036. return 'React.Fragment';
  3037. }
  3038. if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object' && type !== null) {
  3039. if (type.$$typeof === providerSymbol) {
  3040. return 'Context.Provider';
  3041. }
  3042. if (type.$$typeof === contextSymbol) {
  3043. return 'Context.Consumer';
  3044. }
  3045. if (type.$$typeof === forwardRefSymbol) {
  3046. var functionName = type.render.displayName || type.render.name || '';
  3047. return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
  3048. }
  3049. }
  3050. return 'UNDEFINED';
  3051. };
  3052. var getPropKeys = function getPropKeys(element) {
  3053. var props = element.props;
  3054. return _Object$keys(props).filter(function (key) {
  3055. return key !== 'children' && props[key] !== undefined;
  3056. }).sort();
  3057. };
  3058. var serialize$5 = function serialize(element, config, indentation, depth, refs, printer) {
  3059. return ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
  3060. };
  3061. var test$5 = function test(val) {
  3062. return val && val.$$typeof === elementSymbol;
  3063. };
  3064. var ReactElement = { serialize: serialize$5, test: test$5 };
  3065. var testSymbol = _Symbol$for('react.test.json');
  3066. var getPropKeys$1 = function getPropKeys(object) {
  3067. var props = object.props;
  3068. return props ? _Object$keys(props).filter(function (key) {
  3069. return props[key] !== undefined;
  3070. }).sort() : [];
  3071. };
  3072. var serialize$6 = function serialize(object, config, indentation, depth, refs, printer) {
  3073. return ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys$1(object),
  3074. // Despite ternary expression, Flow 0.51.0 found incorrect error:
  3075. // undefined is incompatible with the expected param type of Object
  3076. // $FlowFixMe
  3077. object.props, config, indentation + config.indent, depth, refs, printer) : '', object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer) : '', config, indentation);
  3078. };
  3079. var test$6 = function test(val) {
  3080. return val && val.$$typeof === testSymbol;
  3081. };
  3082. var ReactTestComponent = { serialize: serialize$6, test: test$6 };
  3083. var toString$3 = Object.prototype.toString;
  3084. var toISOString = Date.prototype.toISOString;
  3085. var errorToString = Error.prototype.toString;
  3086. var regExpToString = RegExp.prototype.toString;
  3087. var symbolToString = _Symbol.prototype.toString;
  3088. // Explicitly comparing typeof constructor to function avoids undefined as name
  3089. // when mock identity-obj-proxy returns the key as the value for any key.
  3090. var getConstructorName = function getConstructorName(val) {
  3091. return typeof val.constructor === 'function' && val.constructor.name || 'Object';
  3092. };
  3093. // Is val is equal to global window object? Works even if it does not exist :)
  3094. /* global window */
  3095. var isWindow = function isWindow(val) {
  3096. return typeof window !== 'undefined' && val === window;
  3097. };
  3098. var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
  3099. var NEWLINE_REGEXP = /\n/gi;
  3100. var PrettyFormatPluginError = function (_Error) {
  3101. _inherits(PrettyFormatPluginError, _Error);
  3102. function PrettyFormatPluginError(message, stack) {
  3103. _classCallCheck(this, PrettyFormatPluginError);
  3104. var _this = _possibleConstructorReturn(this, (PrettyFormatPluginError.__proto__ || _Object$getPrototypeOf(PrettyFormatPluginError)).call(this, message));
  3105. _this.stack = stack;
  3106. _this.name = _this.constructor.name;
  3107. return _this;
  3108. }
  3109. return PrettyFormatPluginError;
  3110. }(Error);
  3111. function isToStringedArrayType(toStringed) {
  3112. return toStringed === '[object Array]' || toStringed === '[object ArrayBuffer]' || toStringed === '[object DataView]' || toStringed === '[object Float32Array]' || toStringed === '[object Float64Array]' || toStringed === '[object Int8Array]' || toStringed === '[object Int16Array]' || toStringed === '[object Int32Array]' || toStringed === '[object Uint8Array]' || toStringed === '[object Uint8ClampedArray]' || toStringed === '[object Uint16Array]' || toStringed === '[object Uint32Array]';
  3113. }
  3114. function printNumber(val) {
  3115. return _Object$is(val, -0) ? '-0' : String(val);
  3116. }
  3117. function printFunction(val, printFunctionName) {
  3118. if (!printFunctionName) {
  3119. return '[Function]';
  3120. }
  3121. return '[Function ' + (val.name || 'anonymous') + ']';
  3122. }
  3123. function printSymbol(val) {
  3124. return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
  3125. }
  3126. function printError(val) {
  3127. return '[' + errorToString.call(val) + ']';
  3128. }
  3129. function printBasicValue(val, printFunctionName, escapeRegex) {
  3130. if (val === true || val === false) {
  3131. return '' + val;
  3132. }
  3133. if (val === undefined) {
  3134. return 'undefined';
  3135. }
  3136. if (val === null) {
  3137. return 'null';
  3138. }
  3139. var typeOf = typeof val === 'undefined' ? 'undefined' : _typeof(val);
  3140. if (typeOf === 'number') {
  3141. return printNumber(val);
  3142. }
  3143. if (typeOf === 'string') {
  3144. return '"' + val.replace(/"|\\/g, '\\$&') + '"';
  3145. }
  3146. if (typeOf === 'function') {
  3147. return printFunction(val, printFunctionName);
  3148. }
  3149. if (typeOf === 'symbol') {
  3150. return printSymbol(val);
  3151. }
  3152. var toStringed = toString$3.call(val);
  3153. if (toStringed === '[object WeakMap]') {
  3154. return 'WeakMap {}';
  3155. }
  3156. if (toStringed === '[object WeakSet]') {
  3157. return 'WeakSet {}';
  3158. }
  3159. if (toStringed === '[object Function]' || toStringed === '[object GeneratorFunction]') {
  3160. return printFunction(val, printFunctionName);
  3161. }
  3162. if (toStringed === '[object Symbol]') {
  3163. return printSymbol(val);
  3164. }
  3165. if (toStringed === '[object Date]') {
  3166. return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
  3167. }
  3168. if (toStringed === '[object Error]') {
  3169. return printError(val);
  3170. }
  3171. if (toStringed === '[object RegExp]') {
  3172. if (escapeRegex) {
  3173. // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
  3174. return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
  3175. }
  3176. return regExpToString.call(val);
  3177. }
  3178. if (val instanceof Error) {
  3179. return printError(val);
  3180. }
  3181. return null;
  3182. }
  3183. function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
  3184. if (refs.indexOf(val) !== -1) {
  3185. return '[Circular]';
  3186. }
  3187. refs = refs.slice();
  3188. refs.push(val);
  3189. var hitMaxDepth = ++depth > config.maxDepth;
  3190. var min = config.min;
  3191. if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === 'function' && !hasCalledToJSON) {
  3192. return printer(val.toJSON(), config, indentation, depth, refs, true);
  3193. }
  3194. var toStringed = toString$3.call(val);
  3195. if (toStringed === '[object Arguments]') {
  3196. return hitMaxDepth ? '[Arguments]' : (min ? '' : 'Arguments ') + '[' + printListItems(val, config, indentation, depth, refs, printer) + ']';
  3197. }
  3198. if (isToStringedArrayType(toStringed)) {
  3199. return hitMaxDepth ? '[' + val.constructor.name + ']' : (min ? '' : val.constructor.name + ' ') + '[' + printListItems(val, config, indentation, depth, refs, printer) + ']';
  3200. }
  3201. if (toStringed === '[object Map]') {
  3202. return hitMaxDepth ? '[Map]' : 'Map {' + printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, ' => ') + '}';
  3203. }
  3204. if (toStringed === '[object Set]') {
  3205. return hitMaxDepth ? '[Set]' : 'Set {' + printIteratorValues(val.values(), config, indentation, depth, refs, printer) + '}';
  3206. }
  3207. // Avoid failure to serialize global window object in jsdom test environment.
  3208. // For example, not even relevant if window is prop of React element.
  3209. return hitMaxDepth || isWindow(val) ? '[' + getConstructorName(val) + ']' : (min ? '' : getConstructorName(val) + ' ') + '{' + printObjectProperties(val, config, indentation, depth, refs, printer) + '}';
  3210. }
  3211. function printPlugin(plugin, val, config, indentation, depth, refs) {
  3212. var printed = void 0;
  3213. try {
  3214. printed = plugin.serialize ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, function (valChild) {
  3215. return printer(valChild, config, indentation, depth, refs);
  3216. }, function (str) {
  3217. var indentationNext = indentation + config.indent;
  3218. return indentationNext + str.replace(NEWLINE_REGEXP, '\n' + indentationNext);
  3219. }, {
  3220. edgeSpacing: config.spacingOuter,
  3221. min: config.min,
  3222. spacing: config.spacingInner
  3223. }, config.colors);
  3224. } catch (error) {
  3225. throw new PrettyFormatPluginError(error.message, error.stack);
  3226. }
  3227. if (typeof printed !== 'string') {
  3228. throw new Error('pretty-format: Plugin must return type "string" but instead returned "' + (typeof printed === 'undefined' ? 'undefined' : _typeof(printed)) + '".');
  3229. }
  3230. return printed;
  3231. }
  3232. function findPlugin(plugins, val) {
  3233. for (var p = 0; p < plugins.length; p++) {
  3234. try {
  3235. if (plugins[p].test(val)) {
  3236. return plugins[p];
  3237. }
  3238. } catch (error) {
  3239. throw new PrettyFormatPluginError(error.message, error.stack);
  3240. }
  3241. }
  3242. return null;
  3243. }
  3244. function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
  3245. var plugin = findPlugin(config.plugins, val);
  3246. if (plugin !== null) {
  3247. return printPlugin(plugin, val, config, indentation, depth, refs);
  3248. }
  3249. var basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex);
  3250. if (basicResult !== null) {
  3251. return basicResult;
  3252. }
  3253. return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
  3254. }
  3255. var DEFAULT_THEME = {
  3256. comment: 'gray',
  3257. content: 'reset',
  3258. prop: 'yellow',
  3259. tag: 'cyan',
  3260. value: 'green'
  3261. };
  3262. var DEFAULT_THEME_KEYS = _Object$keys(DEFAULT_THEME);
  3263. var DEFAULT_OPTIONS = {
  3264. callToJSON: true,
  3265. escapeRegex: false,
  3266. highlight: false,
  3267. indent: 2,
  3268. maxDepth: Infinity,
  3269. min: false,
  3270. plugins: [],
  3271. printFunctionName: true,
  3272. theme: DEFAULT_THEME
  3273. };
  3274. function validateOptions(options) {
  3275. _Object$keys(options).forEach(function (key) {
  3276. if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
  3277. throw new Error('pretty-format: Unknown option "' + key + '".');
  3278. }
  3279. });
  3280. if (options.min && options.indent !== undefined && options.indent !== 0) {
  3281. throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
  3282. }
  3283. if (options.theme !== undefined) {
  3284. if (options.theme === null) {
  3285. throw new Error('pretty-format: Option "theme" must not be null.');
  3286. }
  3287. if (_typeof(options.theme) !== 'object') {
  3288. throw new Error('pretty-format: Option "theme" must be of type "object" but instead received "' + _typeof(options.theme) + '".');
  3289. }
  3290. }
  3291. }
  3292. var getColorsHighlight = function getColorsHighlight(options) {
  3293. return (
  3294. // $FlowFixMe: Flow thinks keys from `Colors` are missing from `DEFAULT_THEME_KEYS`
  3295. DEFAULT_THEME_KEYS.reduce(function (colors, key) {
  3296. var value = options.theme && options.theme[key] !== undefined ? options.theme[key] : DEFAULT_THEME[key];
  3297. var color = ansiStyles[value];
  3298. if (color && typeof color.close === 'string' && typeof color.open === 'string') {
  3299. colors[key] = color;
  3300. } else {
  3301. throw new Error('pretty-format: Option "theme" has a key "' + key + '" whose value "' + value + '" is undefined in ansi-styles.');
  3302. }
  3303. return colors;
  3304. }, _Object$create(null))
  3305. );
  3306. };
  3307. var getColorsEmpty = function getColorsEmpty() {
  3308. return (
  3309. // $FlowFixMe: Flow thinks keys from `Colors` are missing from `DEFAULT_THEME_KEYS`
  3310. DEFAULT_THEME_KEYS.reduce(function (colors, key) {
  3311. colors[key] = { close: '', open: '' };
  3312. return colors;
  3313. }, _Object$create(null))
  3314. );
  3315. };
  3316. var getPrintFunctionName = function getPrintFunctionName(options) {
  3317. return options && options.printFunctionName !== undefined ? options.printFunctionName : DEFAULT_OPTIONS.printFunctionName;
  3318. };
  3319. var getEscapeRegex = function getEscapeRegex(options) {
  3320. return options && options.escapeRegex !== undefined ? options.escapeRegex : DEFAULT_OPTIONS.escapeRegex;
  3321. };
  3322. var getConfig = function getConfig(options) {
  3323. return {
  3324. callToJSON: options && options.callToJSON !== undefined ? options.callToJSON : DEFAULT_OPTIONS.callToJSON,
  3325. colors: options && options.highlight ? getColorsHighlight(options) : getColorsEmpty(),
  3326. escapeRegex: getEscapeRegex(options),
  3327. indent: options && options.min ? '' : createIndent(options && options.indent !== undefined ? options.indent : DEFAULT_OPTIONS.indent),
  3328. maxDepth: options && options.maxDepth !== undefined ? options.maxDepth : DEFAULT_OPTIONS.maxDepth,
  3329. min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
  3330. plugins: options && options.plugins !== undefined ? options.plugins : DEFAULT_OPTIONS.plugins,
  3331. printFunctionName: getPrintFunctionName(options),
  3332. spacingInner: options && options.min ? ' ' : '\n',
  3333. spacingOuter: options && options.min ? '' : '\n'
  3334. };
  3335. };
  3336. function createIndent(indent) {
  3337. return new Array(indent + 1).join(' ');
  3338. }
  3339. function prettyFormat(val, options) {
  3340. if (options) {
  3341. validateOptions(options);
  3342. if (options.plugins) {
  3343. var plugin = findPlugin(options.plugins, val);
  3344. if (plugin !== null) {
  3345. return printPlugin(plugin, val, getConfig(options), '', 0, []);
  3346. }
  3347. }
  3348. }
  3349. var basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options));
  3350. if (basicResult !== null) {
  3351. return basicResult;
  3352. }
  3353. return printComplexValue(val, getConfig(options), '', 0, []);
  3354. }
  3355. prettyFormat.plugins = {
  3356. AsymmetricMatcher: AsymmetricMatcher,
  3357. ConvertAnsi: ConvertAnsi,
  3358. DOMCollection: DOMCollection,
  3359. DOMElement: DOMElement,
  3360. Immutable: Immutable,
  3361. ReactElement: ReactElement,
  3362. ReactTestComponent: ReactTestComponent
  3363. };
  3364. module.exports = prettyFormat;
  3365. })));