index.js 105 KB

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