react-dom-server.browser.development.js 137 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147
  1. /** @license React v16.13.1
  2. * react-dom-server.browser.development.js
  3. *
  4. * Copyright (c) Facebook, Inc. and its affiliates.
  5. *
  6. * This source code is licensed under the MIT license found in the
  7. * LICENSE file in the root directory of this source tree.
  8. */
  9. 'use strict';
  10. (function (global, factory) {
  11. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
  12. typeof define === 'function' && define.amd ? define(['react'], factory) :
  13. (global = global || self, global.ReactDOMServer = factory(global.React));
  14. }(this, (function (React) { 'use strict';
  15. // Do not require this module directly! Use normal `invariant` calls with
  16. // template literal strings. The messages will be replaced with error codes
  17. // during build.
  18. function formatProdErrorMessage(code) {
  19. var url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code;
  20. for (var i = 1; i < arguments.length; i++) {
  21. url += '&args[]=' + encodeURIComponent(arguments[i]);
  22. }
  23. return "Minified React error #" + code + "; visit " + url + " for the full message or " + 'use the non-minified dev environment for full errors and additional ' + 'helpful warnings.';
  24. }
  25. var ReactVersion = '16.13.1';
  26. var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
  27. // Current owner and dispatcher used to share the same ref,
  28. // but PR #14548 split them out to better support the react-debug-tools package.
  29. if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
  30. ReactSharedInternals.ReactCurrentDispatcher = {
  31. current: null
  32. };
  33. }
  34. if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
  35. ReactSharedInternals.ReactCurrentBatchConfig = {
  36. suspense: null
  37. };
  38. }
  39. // by calls to these methods by a Babel plugin.
  40. //
  41. // In PROD (or in packages without access to React internals),
  42. // they are left as they are instead.
  43. function warn(format) {
  44. {
  45. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  46. args[_key - 1] = arguments[_key];
  47. }
  48. printWarning('warn', format, args);
  49. }
  50. }
  51. function error(format) {
  52. {
  53. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  54. args[_key2 - 1] = arguments[_key2];
  55. }
  56. printWarning('error', format, args);
  57. }
  58. }
  59. function printWarning(level, format, args) {
  60. // When changing this logic, you might want to also
  61. // update consoleWithStackDev.www.js as well.
  62. {
  63. var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
  64. if (!hasExistingStack) {
  65. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  66. var stack = ReactDebugCurrentFrame.getStackAddendum();
  67. if (stack !== '') {
  68. format += '%s';
  69. args = args.concat([stack]);
  70. }
  71. }
  72. var argsWithFormat = args.map(function (item) {
  73. return '' + item;
  74. }); // Careful: RN currently depends on this prefix
  75. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  76. // breaks IE9: https://github.com/facebook/react/issues/13610
  77. // eslint-disable-next-line react-internal/no-production-logging
  78. Function.prototype.apply.call(console[level], console, argsWithFormat);
  79. try {
  80. // --- Welcome to debugging React ---
  81. // This error was thrown as a convenience so that you can use this stack
  82. // to find the callsite that caused this warning to fire.
  83. var argIndex = 0;
  84. var message = 'Warning: ' + format.replace(/%s/g, function () {
  85. return args[argIndex++];
  86. });
  87. throw new Error(message);
  88. } catch (x) {}
  89. }
  90. }
  91. var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
  92. var _assign = ReactInternals.assign;
  93. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  94. // nor polyfill, then a plain number is used for performance.
  95. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  96. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  97. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  98. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  99. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  100. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  101. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  102. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  103. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  104. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  105. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  106. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  107. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  108. var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  109. var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
  110. var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
  111. var Uninitialized = -1;
  112. var Pending = 0;
  113. var Resolved = 1;
  114. var Rejected = 2;
  115. function refineResolvedLazyComponent(lazyComponent) {
  116. return lazyComponent._status === Resolved ? lazyComponent._result : null;
  117. }
  118. function initializeLazyComponentType(lazyComponent) {
  119. if (lazyComponent._status === Uninitialized) {
  120. lazyComponent._status = Pending;
  121. var ctor = lazyComponent._ctor;
  122. var thenable = ctor();
  123. lazyComponent._result = thenable;
  124. thenable.then(function (moduleObject) {
  125. if (lazyComponent._status === Pending) {
  126. var defaultExport = moduleObject.default;
  127. {
  128. if (defaultExport === undefined) {
  129. error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
  130. }
  131. }
  132. lazyComponent._status = Resolved;
  133. lazyComponent._result = defaultExport;
  134. }
  135. }, function (error) {
  136. if (lazyComponent._status === Pending) {
  137. lazyComponent._status = Rejected;
  138. lazyComponent._result = error;
  139. }
  140. });
  141. }
  142. }
  143. function getWrappedName(outerType, innerType, wrapperName) {
  144. var functionName = innerType.displayName || innerType.name || '';
  145. return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
  146. }
  147. function getComponentName(type) {
  148. if (type == null) {
  149. // Host root, text node or just invalid type.
  150. return null;
  151. }
  152. {
  153. if (typeof type.tag === 'number') {
  154. error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
  155. }
  156. }
  157. if (typeof type === 'function') {
  158. return type.displayName || type.name || null;
  159. }
  160. if (typeof type === 'string') {
  161. return type;
  162. }
  163. switch (type) {
  164. case REACT_FRAGMENT_TYPE:
  165. return 'Fragment';
  166. case REACT_PORTAL_TYPE:
  167. return 'Portal';
  168. case REACT_PROFILER_TYPE:
  169. return "Profiler";
  170. case REACT_STRICT_MODE_TYPE:
  171. return 'StrictMode';
  172. case REACT_SUSPENSE_TYPE:
  173. return 'Suspense';
  174. case REACT_SUSPENSE_LIST_TYPE:
  175. return 'SuspenseList';
  176. }
  177. if (typeof type === 'object') {
  178. switch (type.$$typeof) {
  179. case REACT_CONTEXT_TYPE:
  180. return 'Context.Consumer';
  181. case REACT_PROVIDER_TYPE:
  182. return 'Context.Provider';
  183. case REACT_FORWARD_REF_TYPE:
  184. return getWrappedName(type, type.render, 'ForwardRef');
  185. case REACT_MEMO_TYPE:
  186. return getComponentName(type.type);
  187. case REACT_BLOCK_TYPE:
  188. return getComponentName(type.render);
  189. case REACT_LAZY_TYPE:
  190. {
  191. var thenable = type;
  192. var resolvedThenable = refineResolvedLazyComponent(thenable);
  193. if (resolvedThenable) {
  194. return getComponentName(resolvedThenable);
  195. }
  196. break;
  197. }
  198. }
  199. }
  200. return null;
  201. }
  202. var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  203. function describeComponentFrame (name, source, ownerName) {
  204. var sourceInfo = '';
  205. if (source) {
  206. var path = source.fileName;
  207. var fileName = path.replace(BEFORE_SLASH_RE, '');
  208. {
  209. // In DEV, include code for a common special case:
  210. // prefer "folder/index.js" instead of just "index.js".
  211. if (/^index\./.test(fileName)) {
  212. var match = path.match(BEFORE_SLASH_RE);
  213. if (match) {
  214. var pathBeforeSlash = match[1];
  215. if (pathBeforeSlash) {
  216. var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
  217. fileName = folderName + '/' + fileName;
  218. }
  219. }
  220. }
  221. }
  222. sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
  223. } else if (ownerName) {
  224. sourceInfo = ' (created by ' + ownerName + ')';
  225. }
  226. return '\n in ' + (name || 'Unknown') + sourceInfo;
  227. }
  228. var enableSuspenseServerRenderer = false;
  229. var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
  230. /**
  231. * Copyright (c) 2013-present, Facebook, Inc.
  232. *
  233. * This source code is licensed under the MIT license found in the
  234. * LICENSE file in the root directory of this source tree.
  235. */
  236. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  237. var ReactPropTypesSecret_1 = ReactPropTypesSecret;
  238. var printWarning$1 = function() {};
  239. {
  240. var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
  241. var loggedTypeFailures = {};
  242. var has = Function.call.bind(Object.prototype.hasOwnProperty);
  243. printWarning$1 = function(text) {
  244. var message = 'Warning: ' + text;
  245. if (typeof console !== 'undefined') {
  246. console.error(message);
  247. }
  248. try {
  249. // --- Welcome to debugging React ---
  250. // This error was thrown as a convenience so that you can use this stack
  251. // to find the callsite that caused this warning to fire.
  252. throw new Error(message);
  253. } catch (x) {}
  254. };
  255. }
  256. /**
  257. * Assert that the values match with the type specs.
  258. * Error messages are memorized and will only be shown once.
  259. *
  260. * @param {object} typeSpecs Map of name to a ReactPropType
  261. * @param {object} values Runtime values that need to be type-checked
  262. * @param {string} location e.g. "prop", "context", "child context"
  263. * @param {string} componentName Name of the component for error messages.
  264. * @param {?Function} getStack Returns the component stack.
  265. * @private
  266. */
  267. function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  268. {
  269. for (var typeSpecName in typeSpecs) {
  270. if (has(typeSpecs, typeSpecName)) {
  271. var error;
  272. // Prop type validation may throw. In case they do, we don't want to
  273. // fail the render phase where it didn't fail before. So we log it.
  274. // After these have been cleaned up, we'll let them throw.
  275. try {
  276. // This is intentionally an invariant that gets caught. It's the same
  277. // behavior as without this statement except with a better message.
  278. if (typeof typeSpecs[typeSpecName] !== 'function') {
  279. var err = Error(
  280. (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
  281. 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
  282. );
  283. err.name = 'Invariant Violation';
  284. throw err;
  285. }
  286. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
  287. } catch (ex) {
  288. error = ex;
  289. }
  290. if (error && !(error instanceof Error)) {
  291. printWarning$1(
  292. (componentName || 'React class') + ': type specification of ' +
  293. location + ' `' + typeSpecName + '` is invalid; the type checker ' +
  294. 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
  295. 'You may have forgotten to pass an argument to the type checker ' +
  296. 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
  297. 'shape all require an argument).'
  298. );
  299. }
  300. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  301. // Only monitor this failure once because there tends to be a lot of the
  302. // same error.
  303. loggedTypeFailures[error.message] = true;
  304. var stack = getStack ? getStack() : '';
  305. printWarning$1(
  306. 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
  307. );
  308. }
  309. }
  310. }
  311. }
  312. }
  313. /**
  314. * Resets warning cache when testing.
  315. *
  316. * @private
  317. */
  318. checkPropTypes.resetWarningCache = function() {
  319. {
  320. loggedTypeFailures = {};
  321. }
  322. };
  323. var checkPropTypes_1 = checkPropTypes;
  324. var ReactDebugCurrentFrame;
  325. var didWarnAboutInvalidateContextType;
  326. {
  327. ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  328. didWarnAboutInvalidateContextType = new Set();
  329. }
  330. var emptyObject = {};
  331. {
  332. Object.freeze(emptyObject);
  333. }
  334. function maskContext(type, context) {
  335. var contextTypes = type.contextTypes;
  336. if (!contextTypes) {
  337. return emptyObject;
  338. }
  339. var maskedContext = {};
  340. for (var contextName in contextTypes) {
  341. maskedContext[contextName] = context[contextName];
  342. }
  343. return maskedContext;
  344. }
  345. function checkContextTypes(typeSpecs, values, location) {
  346. {
  347. checkPropTypes_1(typeSpecs, values, location, 'Component', ReactDebugCurrentFrame.getCurrentStack);
  348. }
  349. }
  350. function validateContextBounds(context, threadID) {
  351. // If we don't have enough slots in this context to store this threadID,
  352. // fill it in without leaving any holes to ensure that the VM optimizes
  353. // this as non-holey index properties.
  354. // (Note: If `react` package is < 16.6, _threadCount is undefined.)
  355. for (var i = context._threadCount | 0; i <= threadID; i++) {
  356. // We assume that this is the same as the defaultValue which might not be
  357. // true if we're rendering inside a secondary renderer but they are
  358. // secondary because these use cases are very rare.
  359. context[i] = context._currentValue2;
  360. context._threadCount = i + 1;
  361. }
  362. }
  363. function processContext(type, context, threadID, isClass) {
  364. if (isClass) {
  365. var contextType = type.contextType;
  366. {
  367. if ('contextType' in type) {
  368. var isValid = // Allow null for conditional declaration
  369. contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
  370. if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
  371. didWarnAboutInvalidateContextType.add(type);
  372. var addendum = '';
  373. if (contextType === undefined) {
  374. addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
  375. } else if (typeof contextType !== 'object') {
  376. addendum = ' However, it is set to a ' + typeof contextType + '.';
  377. } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
  378. addendum = ' Did you accidentally pass the Context.Provider instead?';
  379. } else if (contextType._context !== undefined) {
  380. // <Context.Consumer>
  381. addendum = ' Did you accidentally pass the Context.Consumer instead?';
  382. } else {
  383. addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
  384. }
  385. error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
  386. }
  387. }
  388. }
  389. if (typeof contextType === 'object' && contextType !== null) {
  390. validateContextBounds(contextType, threadID);
  391. return contextType[threadID];
  392. }
  393. {
  394. var maskedContext = maskContext(type, context);
  395. {
  396. if (type.contextTypes) {
  397. checkContextTypes(type.contextTypes, maskedContext, 'context');
  398. }
  399. }
  400. return maskedContext;
  401. }
  402. } else {
  403. {
  404. var _maskedContext = maskContext(type, context);
  405. {
  406. if (type.contextTypes) {
  407. checkContextTypes(type.contextTypes, _maskedContext, 'context');
  408. }
  409. }
  410. return _maskedContext;
  411. }
  412. }
  413. }
  414. var nextAvailableThreadIDs = new Uint16Array(16);
  415. for (var i = 0; i < 15; i++) {
  416. nextAvailableThreadIDs[i] = i + 1;
  417. }
  418. nextAvailableThreadIDs[15] = 0;
  419. function growThreadCountAndReturnNextAvailable() {
  420. var oldArray = nextAvailableThreadIDs;
  421. var oldSize = oldArray.length;
  422. var newSize = oldSize * 2;
  423. if (!(newSize <= 0x10000)) {
  424. {
  425. throw Error( "Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic." );
  426. }
  427. }
  428. var newArray = new Uint16Array(newSize);
  429. newArray.set(oldArray);
  430. nextAvailableThreadIDs = newArray;
  431. nextAvailableThreadIDs[0] = oldSize + 1;
  432. for (var _i = oldSize; _i < newSize - 1; _i++) {
  433. nextAvailableThreadIDs[_i] = _i + 1;
  434. }
  435. nextAvailableThreadIDs[newSize - 1] = 0;
  436. return oldSize;
  437. }
  438. function allocThreadID() {
  439. var nextID = nextAvailableThreadIDs[0];
  440. if (nextID === 0) {
  441. return growThreadCountAndReturnNextAvailable();
  442. }
  443. nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
  444. return nextID;
  445. }
  446. function freeThreadID(id) {
  447. nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
  448. nextAvailableThreadIDs[0] = id;
  449. }
  450. // A reserved attribute.
  451. // It is handled by React separately and shouldn't be written to the DOM.
  452. var RESERVED = 0; // A simple string attribute.
  453. // Attributes that aren't in the whitelist are presumed to have this type.
  454. var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
  455. // "enumerated" attributes with "true" and "false" as possible values.
  456. // When true, it should be set to a "true" string.
  457. // When false, it should be set to a "false" string.
  458. var BOOLEANISH_STRING = 2; // A real boolean attribute.
  459. // When true, it should be present (set either to an empty string or its name).
  460. // When false, it should be omitted.
  461. var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
  462. // When true, it should be present (set either to an empty string or its name).
  463. // When false, it should be omitted.
  464. // For any other value, should be present with that value.
  465. var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
  466. // When falsy, it should be removed.
  467. var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
  468. // When falsy, it should be removed.
  469. var POSITIVE_NUMERIC = 6;
  470. /* eslint-disable max-len */
  471. var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
  472. /* eslint-enable max-len */
  473. var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
  474. var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
  475. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
  476. var hasOwnProperty = Object.prototype.hasOwnProperty;
  477. var illegalAttributeNameCache = {};
  478. var validatedAttributeNameCache = {};
  479. function isAttributeNameSafe(attributeName) {
  480. if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
  481. return true;
  482. }
  483. if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
  484. return false;
  485. }
  486. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  487. validatedAttributeNameCache[attributeName] = true;
  488. return true;
  489. }
  490. illegalAttributeNameCache[attributeName] = true;
  491. {
  492. error('Invalid attribute name: `%s`', attributeName);
  493. }
  494. return false;
  495. }
  496. function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
  497. if (propertyInfo !== null) {
  498. return propertyInfo.type === RESERVED;
  499. }
  500. if (isCustomComponentTag) {
  501. return false;
  502. }
  503. if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
  504. return true;
  505. }
  506. return false;
  507. }
  508. function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
  509. if (propertyInfo !== null && propertyInfo.type === RESERVED) {
  510. return false;
  511. }
  512. switch (typeof value) {
  513. case 'function': // $FlowIssue symbol is perfectly valid here
  514. case 'symbol':
  515. // eslint-disable-line
  516. return true;
  517. case 'boolean':
  518. {
  519. if (isCustomComponentTag) {
  520. return false;
  521. }
  522. if (propertyInfo !== null) {
  523. return !propertyInfo.acceptsBooleans;
  524. } else {
  525. var prefix = name.toLowerCase().slice(0, 5);
  526. return prefix !== 'data-' && prefix !== 'aria-';
  527. }
  528. }
  529. default:
  530. return false;
  531. }
  532. }
  533. function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
  534. if (value === null || typeof value === 'undefined') {
  535. return true;
  536. }
  537. if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
  538. return true;
  539. }
  540. if (isCustomComponentTag) {
  541. return false;
  542. }
  543. if (propertyInfo !== null) {
  544. switch (propertyInfo.type) {
  545. case BOOLEAN:
  546. return !value;
  547. case OVERLOADED_BOOLEAN:
  548. return value === false;
  549. case NUMERIC:
  550. return isNaN(value);
  551. case POSITIVE_NUMERIC:
  552. return isNaN(value) || value < 1;
  553. }
  554. }
  555. return false;
  556. }
  557. function getPropertyInfo(name) {
  558. return properties.hasOwnProperty(name) ? properties[name] : null;
  559. }
  560. function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
  561. this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
  562. this.attributeName = attributeName;
  563. this.attributeNamespace = attributeNamespace;
  564. this.mustUseProperty = mustUseProperty;
  565. this.propertyName = name;
  566. this.type = type;
  567. this.sanitizeURL = sanitizeURL;
  568. } // When adding attributes to this list, be sure to also add them to
  569. // the `possibleStandardNames` module to ensure casing and incorrect
  570. // name warnings.
  571. var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
  572. var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
  573. // elements (not just inputs). Now that ReactDOMInput assigns to the
  574. // defaultValue property -- do we need this?
  575. 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
  576. reservedProps.forEach(function (name) {
  577. properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
  578. name, // attributeName
  579. null, // attributeNamespace
  580. false);
  581. }); // A few React string attributes have a different name.
  582. // This is a mapping from React prop names to the attribute names.
  583. [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
  584. var name = _ref[0],
  585. attributeName = _ref[1];
  586. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  587. attributeName, // attributeName
  588. null, // attributeNamespace
  589. false);
  590. }); // These are "enumerated" HTML attributes that accept "true" and "false".
  591. // In React, we let users pass `true` and `false` even though technically
  592. // these aren't boolean attributes (they are coerced to strings).
  593. ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
  594. properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  595. name.toLowerCase(), // attributeName
  596. null, // attributeNamespace
  597. false);
  598. }); // These are "enumerated" SVG attributes that accept "true" and "false".
  599. // In React, we let users pass `true` and `false` even though technically
  600. // these aren't boolean attributes (they are coerced to strings).
  601. // Since these are SVG attributes, their attribute names are case-sensitive.
  602. ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
  603. properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  604. name, // attributeName
  605. null, // attributeNamespace
  606. false);
  607. }); // These are HTML boolean attributes.
  608. ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
  609. // on the client side because the browsers are inconsistent. Instead we call focus().
  610. 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
  611. 'itemScope'].forEach(function (name) {
  612. properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
  613. name.toLowerCase(), // attributeName
  614. null, // attributeNamespace
  615. false);
  616. }); // These are the few React props that we set as DOM properties
  617. // rather than attributes. These are all booleans.
  618. ['checked', // Note: `option.selected` is not updated if `select.multiple` is
  619. // disabled with `removeAttribute`. We have special logic for handling this.
  620. 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
  621. // you'll need to set attributeName to name.toLowerCase()
  622. // instead in the assignment below.
  623. ].forEach(function (name) {
  624. properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
  625. name, // attributeName
  626. null, // attributeNamespace
  627. false);
  628. }); // These are HTML attributes that are "overloaded booleans": they behave like
  629. // booleans, but can also accept a string value.
  630. ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
  631. // you'll need to set attributeName to name.toLowerCase()
  632. // instead in the assignment below.
  633. ].forEach(function (name) {
  634. properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
  635. name, // attributeName
  636. null, // attributeNamespace
  637. false);
  638. }); // These are HTML attributes that must be positive numbers.
  639. ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
  640. // you'll need to set attributeName to name.toLowerCase()
  641. // instead in the assignment below.
  642. ].forEach(function (name) {
  643. properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
  644. name, // attributeName
  645. null, // attributeNamespace
  646. false);
  647. }); // These are HTML attributes that must be numbers.
  648. ['rowSpan', 'start'].forEach(function (name) {
  649. properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
  650. name.toLowerCase(), // attributeName
  651. null, // attributeNamespace
  652. false);
  653. });
  654. var CAMELIZE = /[\-\:]([a-z])/g;
  655. var capitalize = function (token) {
  656. return token[1].toUpperCase();
  657. }; // This is a list of all SVG attributes that need special casing, namespacing,
  658. // or boolean value assignment. Regular attributes that just accept strings
  659. // and have the same names are omitted, just like in the HTML whitelist.
  660. // Some of these attributes can be hard to find. This list was created by
  661. // scraping the MDN documentation.
  662. ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
  663. // you'll need to set attributeName to name.toLowerCase()
  664. // instead in the assignment below.
  665. ].forEach(function (attributeName) {
  666. var name = attributeName.replace(CAMELIZE, capitalize);
  667. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  668. attributeName, null, // attributeNamespace
  669. false);
  670. }); // String SVG attributes with the xlink namespace.
  671. ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
  672. // you'll need to set attributeName to name.toLowerCase()
  673. // instead in the assignment below.
  674. ].forEach(function (attributeName) {
  675. var name = attributeName.replace(CAMELIZE, capitalize);
  676. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  677. attributeName, 'http://www.w3.org/1999/xlink', false);
  678. }); // String SVG attributes with the xml namespace.
  679. ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
  680. // you'll need to set attributeName to name.toLowerCase()
  681. // instead in the assignment below.
  682. ].forEach(function (attributeName) {
  683. var name = attributeName.replace(CAMELIZE, capitalize);
  684. properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  685. attributeName, 'http://www.w3.org/XML/1998/namespace', false);
  686. }); // These attribute exists both in HTML and SVG.
  687. // The attribute name is case-sensitive in SVG so we can't just use
  688. // the React name like we do for attributes that exist only in HTML.
  689. ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
  690. properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
  691. attributeName.toLowerCase(), // attributeName
  692. null, // attributeNamespace
  693. false);
  694. }); // These attributes accept URLs. These must not allow javascript: URLS.
  695. // These will also need to accept Trusted Types object in the future.
  696. var xlinkHref = 'xlinkHref';
  697. properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
  698. 'xlink:href', 'http://www.w3.org/1999/xlink', true);
  699. ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
  700. properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
  701. attributeName.toLowerCase(), // attributeName
  702. null, // attributeNamespace
  703. true);
  704. });
  705. var ReactDebugCurrentFrame$1 = null;
  706. {
  707. ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
  708. } // A javascript: URL can contain leading C0 control or \u0020 SPACE,
  709. // and any newline or tab are filtered out as if they're not part of the URL.
  710. // https://url.spec.whatwg.org/#url-parsing
  711. // Tab or newline are defined as \r\n\t:
  712. // https://infra.spec.whatwg.org/#ascii-tab-or-newline
  713. // A C0 control is a code point in the range \u0000 NULL to \u001F
  714. // INFORMATION SEPARATOR ONE, inclusive:
  715. // https://infra.spec.whatwg.org/#c0-control-or-space
  716. /* eslint-disable max-len */
  717. var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
  718. var didWarn = false;
  719. function sanitizeURL(url) {
  720. {
  721. if (!didWarn && isJavaScriptProtocol.test(url)) {
  722. didWarn = true;
  723. error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
  724. }
  725. }
  726. }
  727. // code copied and modified from escape-html
  728. /**
  729. * Module variables.
  730. * @private
  731. */
  732. var matchHtmlRegExp = /["'&<>]/;
  733. /**
  734. * Escapes special characters and HTML entities in a given html string.
  735. *
  736. * @param {string} string HTML string to escape for later insertion
  737. * @return {string}
  738. * @public
  739. */
  740. function escapeHtml(string) {
  741. var str = '' + string;
  742. var match = matchHtmlRegExp.exec(str);
  743. if (!match) {
  744. return str;
  745. }
  746. var escape;
  747. var html = '';
  748. var index;
  749. var lastIndex = 0;
  750. for (index = match.index; index < str.length; index++) {
  751. switch (str.charCodeAt(index)) {
  752. case 34:
  753. // "
  754. escape = '&quot;';
  755. break;
  756. case 38:
  757. // &
  758. escape = '&amp;';
  759. break;
  760. case 39:
  761. // '
  762. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  763. break;
  764. case 60:
  765. // <
  766. escape = '&lt;';
  767. break;
  768. case 62:
  769. // >
  770. escape = '&gt;';
  771. break;
  772. default:
  773. continue;
  774. }
  775. if (lastIndex !== index) {
  776. html += str.substring(lastIndex, index);
  777. }
  778. lastIndex = index + 1;
  779. html += escape;
  780. }
  781. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  782. } // end code copied and modified from escape-html
  783. /**
  784. * Escapes text to prevent scripting attacks.
  785. *
  786. * @param {*} text Text value to escape.
  787. * @return {string} An escaped string.
  788. */
  789. function escapeTextForBrowser(text) {
  790. if (typeof text === 'boolean' || typeof text === 'number') {
  791. // this shortcircuit helps perf for types that we know will never have
  792. // special characters, especially given that this function is used often
  793. // for numeric dom ids.
  794. return '' + text;
  795. }
  796. return escapeHtml(text);
  797. }
  798. /**
  799. * Escapes attribute value to prevent scripting attacks.
  800. *
  801. * @param {*} value Value to escape.
  802. * @return {string} An escaped string.
  803. */
  804. function quoteAttributeValueForBrowser(value) {
  805. return '"' + escapeTextForBrowser(value) + '"';
  806. }
  807. function createMarkupForRoot() {
  808. return ROOT_ATTRIBUTE_NAME + '=""';
  809. }
  810. /**
  811. * Creates markup for a property.
  812. *
  813. * @param {string} name
  814. * @param {*} value
  815. * @return {?string} Markup string, or null if the property was invalid.
  816. */
  817. function createMarkupForProperty(name, value) {
  818. var propertyInfo = getPropertyInfo(name);
  819. if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
  820. return '';
  821. }
  822. if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
  823. return '';
  824. }
  825. if (propertyInfo !== null) {
  826. var attributeName = propertyInfo.attributeName;
  827. var type = propertyInfo.type;
  828. if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
  829. return attributeName + '=""';
  830. } else {
  831. if (propertyInfo.sanitizeURL) {
  832. value = '' + value;
  833. sanitizeURL(value);
  834. }
  835. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  836. }
  837. } else if (isAttributeNameSafe(name)) {
  838. return name + '=' + quoteAttributeValueForBrowser(value);
  839. }
  840. return '';
  841. }
  842. /**
  843. * Creates markup for a custom property.
  844. *
  845. * @param {string} name
  846. * @param {*} value
  847. * @return {string} Markup string, or empty string if the property was invalid.
  848. */
  849. function createMarkupForCustomAttribute(name, value) {
  850. if (!isAttributeNameSafe(name) || value == null) {
  851. return '';
  852. }
  853. return name + '=' + quoteAttributeValueForBrowser(value);
  854. }
  855. /**
  856. * inlined Object.is polyfill to avoid requiring consumers ship their own
  857. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  858. */
  859. function is(x, y) {
  860. return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
  861. ;
  862. }
  863. var objectIs = typeof Object.is === 'function' ? Object.is : is;
  864. var currentlyRenderingComponent = null;
  865. var firstWorkInProgressHook = null;
  866. var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
  867. var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
  868. var didScheduleRenderPhaseUpdate = false; // Lazily created map of render-phase updates
  869. var renderPhaseUpdates = null; // Counter to prevent infinite loops.
  870. var numberOfReRenders = 0;
  871. var RE_RENDER_LIMIT = 25;
  872. var isInHookUserCodeInDev = false; // In DEV, this is the name of the currently executing primitive hook
  873. var currentHookNameInDev;
  874. function resolveCurrentlyRenderingComponent() {
  875. if (!(currentlyRenderingComponent !== null)) {
  876. {
  877. throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
  878. }
  879. }
  880. {
  881. if (isInHookUserCodeInDev) {
  882. error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
  883. }
  884. }
  885. return currentlyRenderingComponent;
  886. }
  887. function areHookInputsEqual(nextDeps, prevDeps) {
  888. if (prevDeps === null) {
  889. {
  890. error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
  891. }
  892. return false;
  893. }
  894. {
  895. // Don't bother comparing lengths in prod because these arrays should be
  896. // passed inline.
  897. if (nextDeps.length !== prevDeps.length) {
  898. error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
  899. }
  900. }
  901. for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
  902. if (objectIs(nextDeps[i], prevDeps[i])) {
  903. continue;
  904. }
  905. return false;
  906. }
  907. return true;
  908. }
  909. function createHook() {
  910. if (numberOfReRenders > 0) {
  911. {
  912. {
  913. throw Error( "Rendered more hooks than during the previous render" );
  914. }
  915. }
  916. }
  917. return {
  918. memoizedState: null,
  919. queue: null,
  920. next: null
  921. };
  922. }
  923. function createWorkInProgressHook() {
  924. if (workInProgressHook === null) {
  925. // This is the first hook in the list
  926. if (firstWorkInProgressHook === null) {
  927. isReRender = false;
  928. firstWorkInProgressHook = workInProgressHook = createHook();
  929. } else {
  930. // There's already a work-in-progress. Reuse it.
  931. isReRender = true;
  932. workInProgressHook = firstWorkInProgressHook;
  933. }
  934. } else {
  935. if (workInProgressHook.next === null) {
  936. isReRender = false; // Append to the end of the list
  937. workInProgressHook = workInProgressHook.next = createHook();
  938. } else {
  939. // There's already a work-in-progress. Reuse it.
  940. isReRender = true;
  941. workInProgressHook = workInProgressHook.next;
  942. }
  943. }
  944. return workInProgressHook;
  945. }
  946. function prepareToUseHooks(componentIdentity) {
  947. currentlyRenderingComponent = componentIdentity;
  948. {
  949. isInHookUserCodeInDev = false;
  950. } // The following should have already been reset
  951. // didScheduleRenderPhaseUpdate = false;
  952. // firstWorkInProgressHook = null;
  953. // numberOfReRenders = 0;
  954. // renderPhaseUpdates = null;
  955. // workInProgressHook = null;
  956. }
  957. function finishHooks(Component, props, children, refOrContext) {
  958. // This must be called after every function component to prevent hooks from
  959. // being used in classes.
  960. while (didScheduleRenderPhaseUpdate) {
  961. // Updates were scheduled during the render phase. They are stored in
  962. // the `renderPhaseUpdates` map. Call the component again, reusing the
  963. // work-in-progress hooks and applying the additional updates on top. Keep
  964. // restarting until no more updates are scheduled.
  965. didScheduleRenderPhaseUpdate = false;
  966. numberOfReRenders += 1; // Start over from the beginning of the list
  967. workInProgressHook = null;
  968. children = Component(props, refOrContext);
  969. }
  970. currentlyRenderingComponent = null;
  971. firstWorkInProgressHook = null;
  972. numberOfReRenders = 0;
  973. renderPhaseUpdates = null;
  974. workInProgressHook = null;
  975. {
  976. isInHookUserCodeInDev = false;
  977. } // These were reset above
  978. // currentlyRenderingComponent = null;
  979. // didScheduleRenderPhaseUpdate = false;
  980. // firstWorkInProgressHook = null;
  981. // numberOfReRenders = 0;
  982. // renderPhaseUpdates = null;
  983. // workInProgressHook = null;
  984. return children;
  985. }
  986. function readContext(context, observedBits) {
  987. var threadID = currentThreadID;
  988. validateContextBounds(context, threadID);
  989. {
  990. if (isInHookUserCodeInDev) {
  991. error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
  992. }
  993. }
  994. return context[threadID];
  995. }
  996. function useContext(context, observedBits) {
  997. {
  998. currentHookNameInDev = 'useContext';
  999. }
  1000. resolveCurrentlyRenderingComponent();
  1001. var threadID = currentThreadID;
  1002. validateContextBounds(context, threadID);
  1003. return context[threadID];
  1004. }
  1005. function basicStateReducer(state, action) {
  1006. // $FlowFixMe: Flow doesn't like mixed types
  1007. return typeof action === 'function' ? action(state) : action;
  1008. }
  1009. function useState(initialState) {
  1010. {
  1011. currentHookNameInDev = 'useState';
  1012. }
  1013. return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
  1014. initialState);
  1015. }
  1016. function useReducer(reducer, initialArg, init) {
  1017. {
  1018. if (reducer !== basicStateReducer) {
  1019. currentHookNameInDev = 'useReducer';
  1020. }
  1021. }
  1022. currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
  1023. workInProgressHook = createWorkInProgressHook();
  1024. if (isReRender) {
  1025. // This is a re-render. Apply the new render phase updates to the previous
  1026. // current hook.
  1027. var queue = workInProgressHook.queue;
  1028. var dispatch = queue.dispatch;
  1029. if (renderPhaseUpdates !== null) {
  1030. // Render phase updates are stored in a map of queue -> linked list
  1031. var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
  1032. if (firstRenderPhaseUpdate !== undefined) {
  1033. renderPhaseUpdates.delete(queue);
  1034. var newState = workInProgressHook.memoizedState;
  1035. var update = firstRenderPhaseUpdate;
  1036. do {
  1037. // Process this render phase update. We don't have to check the
  1038. // priority because it will always be the same as the current
  1039. // render's.
  1040. var action = update.action;
  1041. {
  1042. isInHookUserCodeInDev = true;
  1043. }
  1044. newState = reducer(newState, action);
  1045. {
  1046. isInHookUserCodeInDev = false;
  1047. }
  1048. update = update.next;
  1049. } while (update !== null);
  1050. workInProgressHook.memoizedState = newState;
  1051. return [newState, dispatch];
  1052. }
  1053. }
  1054. return [workInProgressHook.memoizedState, dispatch];
  1055. } else {
  1056. {
  1057. isInHookUserCodeInDev = true;
  1058. }
  1059. var initialState;
  1060. if (reducer === basicStateReducer) {
  1061. // Special case for `useState`.
  1062. initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
  1063. } else {
  1064. initialState = init !== undefined ? init(initialArg) : initialArg;
  1065. }
  1066. {
  1067. isInHookUserCodeInDev = false;
  1068. }
  1069. workInProgressHook.memoizedState = initialState;
  1070. var _queue = workInProgressHook.queue = {
  1071. last: null,
  1072. dispatch: null
  1073. };
  1074. var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
  1075. return [workInProgressHook.memoizedState, _dispatch];
  1076. }
  1077. }
  1078. function useMemo(nextCreate, deps) {
  1079. currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
  1080. workInProgressHook = createWorkInProgressHook();
  1081. var nextDeps = deps === undefined ? null : deps;
  1082. if (workInProgressHook !== null) {
  1083. var prevState = workInProgressHook.memoizedState;
  1084. if (prevState !== null) {
  1085. if (nextDeps !== null) {
  1086. var prevDeps = prevState[1];
  1087. if (areHookInputsEqual(nextDeps, prevDeps)) {
  1088. return prevState[0];
  1089. }
  1090. }
  1091. }
  1092. }
  1093. {
  1094. isInHookUserCodeInDev = true;
  1095. }
  1096. var nextValue = nextCreate();
  1097. {
  1098. isInHookUserCodeInDev = false;
  1099. }
  1100. workInProgressHook.memoizedState = [nextValue, nextDeps];
  1101. return nextValue;
  1102. }
  1103. function useRef(initialValue) {
  1104. currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
  1105. workInProgressHook = createWorkInProgressHook();
  1106. var previousRef = workInProgressHook.memoizedState;
  1107. if (previousRef === null) {
  1108. var ref = {
  1109. current: initialValue
  1110. };
  1111. {
  1112. Object.seal(ref);
  1113. }
  1114. workInProgressHook.memoizedState = ref;
  1115. return ref;
  1116. } else {
  1117. return previousRef;
  1118. }
  1119. }
  1120. function useLayoutEffect(create, inputs) {
  1121. {
  1122. currentHookNameInDev = 'useLayoutEffect';
  1123. error('useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://fb.me/react-uselayouteffect-ssr for common fixes.');
  1124. }
  1125. }
  1126. function dispatchAction(componentIdentity, queue, action) {
  1127. if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
  1128. {
  1129. throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
  1130. }
  1131. }
  1132. if (componentIdentity === currentlyRenderingComponent) {
  1133. // This is a render phase update. Stash it in a lazily-created map of
  1134. // queue -> linked list of updates. After this render pass, we'll restart
  1135. // and apply the stashed updates on top of the work-in-progress hook.
  1136. didScheduleRenderPhaseUpdate = true;
  1137. var update = {
  1138. action: action,
  1139. next: null
  1140. };
  1141. if (renderPhaseUpdates === null) {
  1142. renderPhaseUpdates = new Map();
  1143. }
  1144. var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
  1145. if (firstRenderPhaseUpdate === undefined) {
  1146. renderPhaseUpdates.set(queue, update);
  1147. } else {
  1148. // Append the update to the end of the list.
  1149. var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
  1150. while (lastRenderPhaseUpdate.next !== null) {
  1151. lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
  1152. }
  1153. lastRenderPhaseUpdate.next = update;
  1154. }
  1155. }
  1156. }
  1157. function useCallback(callback, deps) {
  1158. // Callbacks are passed as they are in the server environment.
  1159. return callback;
  1160. }
  1161. function useResponder(responder, props) {
  1162. return {
  1163. props: props,
  1164. responder: responder
  1165. };
  1166. }
  1167. function useDeferredValue(value, config) {
  1168. resolveCurrentlyRenderingComponent();
  1169. return value;
  1170. }
  1171. function useTransition(config) {
  1172. resolveCurrentlyRenderingComponent();
  1173. var startTransition = function (callback) {
  1174. callback();
  1175. };
  1176. return [startTransition, false];
  1177. }
  1178. function noop() {}
  1179. var currentThreadID = 0;
  1180. function setCurrentThreadID(threadID) {
  1181. currentThreadID = threadID;
  1182. }
  1183. var Dispatcher = {
  1184. readContext: readContext,
  1185. useContext: useContext,
  1186. useMemo: useMemo,
  1187. useReducer: useReducer,
  1188. useRef: useRef,
  1189. useState: useState,
  1190. useLayoutEffect: useLayoutEffect,
  1191. useCallback: useCallback,
  1192. // useImperativeHandle is not run in the server environment
  1193. useImperativeHandle: noop,
  1194. // Effects are not run in the server environment.
  1195. useEffect: noop,
  1196. // Debugging effect
  1197. useDebugValue: noop,
  1198. useResponder: useResponder,
  1199. useDeferredValue: useDeferredValue,
  1200. useTransition: useTransition
  1201. };
  1202. var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
  1203. var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
  1204. var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
  1205. var Namespaces = {
  1206. html: HTML_NAMESPACE,
  1207. mathml: MATH_NAMESPACE,
  1208. svg: SVG_NAMESPACE
  1209. }; // Assumes there is no parent namespace.
  1210. function getIntrinsicNamespace(type) {
  1211. switch (type) {
  1212. case 'svg':
  1213. return SVG_NAMESPACE;
  1214. case 'math':
  1215. return MATH_NAMESPACE;
  1216. default:
  1217. return HTML_NAMESPACE;
  1218. }
  1219. }
  1220. function getChildNamespace(parentNamespace, type) {
  1221. if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
  1222. // No (or default) parent namespace: potential entry point.
  1223. return getIntrinsicNamespace(type);
  1224. }
  1225. if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
  1226. // We're leaving SVG.
  1227. return HTML_NAMESPACE;
  1228. } // By default, pass namespace below.
  1229. return parentNamespace;
  1230. }
  1231. var ReactDebugCurrentFrame$2 = null;
  1232. var ReactControlledValuePropTypes = {
  1233. checkPropTypes: null
  1234. };
  1235. {
  1236. ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
  1237. var hasReadOnlyValue = {
  1238. button: true,
  1239. checkbox: true,
  1240. image: true,
  1241. hidden: true,
  1242. radio: true,
  1243. reset: true,
  1244. submit: true
  1245. };
  1246. var propTypes = {
  1247. value: function (props, propName, componentName) {
  1248. if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
  1249. return null;
  1250. }
  1251. return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  1252. },
  1253. checked: function (props, propName, componentName) {
  1254. if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
  1255. return null;
  1256. }
  1257. return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  1258. }
  1259. };
  1260. /**
  1261. * Provide a linked `value` attribute for controlled forms. You should not use
  1262. * this outside of the ReactDOM controlled form components.
  1263. */
  1264. ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
  1265. checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
  1266. };
  1267. }
  1268. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  1269. // those special-case tags.
  1270. var omittedCloseTags = {
  1271. area: true,
  1272. base: true,
  1273. br: true,
  1274. col: true,
  1275. embed: true,
  1276. hr: true,
  1277. img: true,
  1278. input: true,
  1279. keygen: true,
  1280. link: true,
  1281. meta: true,
  1282. param: true,
  1283. source: true,
  1284. track: true,
  1285. wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
  1286. };
  1287. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  1288. var voidElementTags = _assign({
  1289. menuitem: true
  1290. }, omittedCloseTags);
  1291. var HTML = '__html';
  1292. var ReactDebugCurrentFrame$3 = null;
  1293. {
  1294. ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
  1295. }
  1296. function assertValidProps(tag, props) {
  1297. if (!props) {
  1298. return;
  1299. } // Note the use of `==` which checks for null or undefined.
  1300. if (voidElementTags[tag]) {
  1301. if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
  1302. {
  1303. throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
  1304. }
  1305. }
  1306. }
  1307. if (props.dangerouslySetInnerHTML != null) {
  1308. if (!(props.children == null)) {
  1309. {
  1310. throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
  1311. }
  1312. }
  1313. if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
  1314. {
  1315. throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information." );
  1316. }
  1317. }
  1318. }
  1319. {
  1320. if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
  1321. error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
  1322. }
  1323. }
  1324. if (!(props.style == null || typeof props.style === 'object')) {
  1325. {
  1326. throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
  1327. }
  1328. }
  1329. }
  1330. /**
  1331. * CSS properties which accept numbers but are not in units of "px".
  1332. */
  1333. var isUnitlessNumber = {
  1334. animationIterationCount: true,
  1335. borderImageOutset: true,
  1336. borderImageSlice: true,
  1337. borderImageWidth: true,
  1338. boxFlex: true,
  1339. boxFlexGroup: true,
  1340. boxOrdinalGroup: true,
  1341. columnCount: true,
  1342. columns: true,
  1343. flex: true,
  1344. flexGrow: true,
  1345. flexPositive: true,
  1346. flexShrink: true,
  1347. flexNegative: true,
  1348. flexOrder: true,
  1349. gridArea: true,
  1350. gridRow: true,
  1351. gridRowEnd: true,
  1352. gridRowSpan: true,
  1353. gridRowStart: true,
  1354. gridColumn: true,
  1355. gridColumnEnd: true,
  1356. gridColumnSpan: true,
  1357. gridColumnStart: true,
  1358. fontWeight: true,
  1359. lineClamp: true,
  1360. lineHeight: true,
  1361. opacity: true,
  1362. order: true,
  1363. orphans: true,
  1364. tabSize: true,
  1365. widows: true,
  1366. zIndex: true,
  1367. zoom: true,
  1368. // SVG-related properties
  1369. fillOpacity: true,
  1370. floodOpacity: true,
  1371. stopOpacity: true,
  1372. strokeDasharray: true,
  1373. strokeDashoffset: true,
  1374. strokeMiterlimit: true,
  1375. strokeOpacity: true,
  1376. strokeWidth: true
  1377. };
  1378. /**
  1379. * @param {string} prefix vendor-specific prefix, eg: Webkit
  1380. * @param {string} key style name, eg: transitionDuration
  1381. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  1382. * WebkitTransitionDuration
  1383. */
  1384. function prefixKey(prefix, key) {
  1385. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  1386. }
  1387. /**
  1388. * Support style names that may come passed in prefixed by adding permutations
  1389. * of vendor prefixes.
  1390. */
  1391. var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  1392. // infinite loop, because it iterates over the newly added props too.
  1393. Object.keys(isUnitlessNumber).forEach(function (prop) {
  1394. prefixes.forEach(function (prefix) {
  1395. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  1396. });
  1397. });
  1398. /**
  1399. * Convert a value into the proper css writable value. The style name `name`
  1400. * should be logical (no hyphens), as specified
  1401. * in `CSSProperty.isUnitlessNumber`.
  1402. *
  1403. * @param {string} name CSS property name such as `topMargin`.
  1404. * @param {*} value CSS property value such as `10px`.
  1405. * @return {string} Normalized style value with dimensions applied.
  1406. */
  1407. function dangerousStyleValue(name, value, isCustomProperty) {
  1408. // Note that we've removed escapeTextForBrowser() calls here since the
  1409. // whole string will be escaped when the attribute is injected into
  1410. // the markup. If you provide unsafe user data here they can inject
  1411. // arbitrary CSS which may be problematic (I couldn't repro this):
  1412. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  1413. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  1414. // This is not an XSS hole but instead a potential CSS injection issue
  1415. // which has lead to a greater discussion about how we're going to
  1416. // trust URLs moving forward. See #2115901
  1417. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  1418. if (isEmpty) {
  1419. return '';
  1420. }
  1421. if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
  1422. return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
  1423. }
  1424. return ('' + value).trim();
  1425. }
  1426. var uppercasePattern = /([A-Z])/g;
  1427. var msPattern = /^ms-/;
  1428. /**
  1429. * Hyphenates a camelcased CSS property name, for example:
  1430. *
  1431. * > hyphenateStyleName('backgroundColor')
  1432. * < "background-color"
  1433. * > hyphenateStyleName('MozTransition')
  1434. * < "-moz-transition"
  1435. * > hyphenateStyleName('msTransition')
  1436. * < "-ms-transition"
  1437. *
  1438. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  1439. * is converted to `-ms-`.
  1440. */
  1441. function hyphenateStyleName(name) {
  1442. return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
  1443. }
  1444. function isCustomComponent(tagName, props) {
  1445. if (tagName.indexOf('-') === -1) {
  1446. return typeof props.is === 'string';
  1447. }
  1448. switch (tagName) {
  1449. // These are reserved SVG and MathML elements.
  1450. // We don't mind this whitelist too much because we expect it to never grow.
  1451. // The alternative is to track the namespace in a few places which is convoluted.
  1452. // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
  1453. case 'annotation-xml':
  1454. case 'color-profile':
  1455. case 'font-face':
  1456. case 'font-face-src':
  1457. case 'font-face-uri':
  1458. case 'font-face-format':
  1459. case 'font-face-name':
  1460. case 'missing-glyph':
  1461. return false;
  1462. default:
  1463. return true;
  1464. }
  1465. }
  1466. var warnValidStyle = function () {};
  1467. {
  1468. // 'msTransform' is correct, but the other prefixes should be capitalized
  1469. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  1470. var msPattern$1 = /^-ms-/;
  1471. var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
  1472. var badStyleValueWithSemicolonPattern = /;\s*$/;
  1473. var warnedStyleNames = {};
  1474. var warnedStyleValues = {};
  1475. var warnedForNaNValue = false;
  1476. var warnedForInfinityValue = false;
  1477. var camelize = function (string) {
  1478. return string.replace(hyphenPattern, function (_, character) {
  1479. return character.toUpperCase();
  1480. });
  1481. };
  1482. var warnHyphenatedStyleName = function (name) {
  1483. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  1484. return;
  1485. }
  1486. warnedStyleNames[name] = true;
  1487. error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
  1488. // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  1489. // is converted to lowercase `ms`.
  1490. camelize(name.replace(msPattern$1, 'ms-')));
  1491. };
  1492. var warnBadVendoredStyleName = function (name) {
  1493. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  1494. return;
  1495. }
  1496. warnedStyleNames[name] = true;
  1497. error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
  1498. };
  1499. var warnStyleValueWithSemicolon = function (name, value) {
  1500. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  1501. return;
  1502. }
  1503. warnedStyleValues[value] = true;
  1504. error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
  1505. };
  1506. var warnStyleValueIsNaN = function (name, value) {
  1507. if (warnedForNaNValue) {
  1508. return;
  1509. }
  1510. warnedForNaNValue = true;
  1511. error('`NaN` is an invalid value for the `%s` css style property.', name);
  1512. };
  1513. var warnStyleValueIsInfinity = function (name, value) {
  1514. if (warnedForInfinityValue) {
  1515. return;
  1516. }
  1517. warnedForInfinityValue = true;
  1518. error('`Infinity` is an invalid value for the `%s` css style property.', name);
  1519. };
  1520. warnValidStyle = function (name, value) {
  1521. if (name.indexOf('-') > -1) {
  1522. warnHyphenatedStyleName(name);
  1523. } else if (badVendoredStyleNamePattern.test(name)) {
  1524. warnBadVendoredStyleName(name);
  1525. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  1526. warnStyleValueWithSemicolon(name, value);
  1527. }
  1528. if (typeof value === 'number') {
  1529. if (isNaN(value)) {
  1530. warnStyleValueIsNaN(name, value);
  1531. } else if (!isFinite(value)) {
  1532. warnStyleValueIsInfinity(name, value);
  1533. }
  1534. }
  1535. };
  1536. }
  1537. var warnValidStyle$1 = warnValidStyle;
  1538. var ariaProperties = {
  1539. 'aria-current': 0,
  1540. // state
  1541. 'aria-details': 0,
  1542. 'aria-disabled': 0,
  1543. // state
  1544. 'aria-hidden': 0,
  1545. // state
  1546. 'aria-invalid': 0,
  1547. // state
  1548. 'aria-keyshortcuts': 0,
  1549. 'aria-label': 0,
  1550. 'aria-roledescription': 0,
  1551. // Widget Attributes
  1552. 'aria-autocomplete': 0,
  1553. 'aria-checked': 0,
  1554. 'aria-expanded': 0,
  1555. 'aria-haspopup': 0,
  1556. 'aria-level': 0,
  1557. 'aria-modal': 0,
  1558. 'aria-multiline': 0,
  1559. 'aria-multiselectable': 0,
  1560. 'aria-orientation': 0,
  1561. 'aria-placeholder': 0,
  1562. 'aria-pressed': 0,
  1563. 'aria-readonly': 0,
  1564. 'aria-required': 0,
  1565. 'aria-selected': 0,
  1566. 'aria-sort': 0,
  1567. 'aria-valuemax': 0,
  1568. 'aria-valuemin': 0,
  1569. 'aria-valuenow': 0,
  1570. 'aria-valuetext': 0,
  1571. // Live Region Attributes
  1572. 'aria-atomic': 0,
  1573. 'aria-busy': 0,
  1574. 'aria-live': 0,
  1575. 'aria-relevant': 0,
  1576. // Drag-and-Drop Attributes
  1577. 'aria-dropeffect': 0,
  1578. 'aria-grabbed': 0,
  1579. // Relationship Attributes
  1580. 'aria-activedescendant': 0,
  1581. 'aria-colcount': 0,
  1582. 'aria-colindex': 0,
  1583. 'aria-colspan': 0,
  1584. 'aria-controls': 0,
  1585. 'aria-describedby': 0,
  1586. 'aria-errormessage': 0,
  1587. 'aria-flowto': 0,
  1588. 'aria-labelledby': 0,
  1589. 'aria-owns': 0,
  1590. 'aria-posinset': 0,
  1591. 'aria-rowcount': 0,
  1592. 'aria-rowindex': 0,
  1593. 'aria-rowspan': 0,
  1594. 'aria-setsize': 0
  1595. };
  1596. var warnedProperties = {};
  1597. var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  1598. var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  1599. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  1600. function validateProperty(tagName, name) {
  1601. {
  1602. if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
  1603. return true;
  1604. }
  1605. if (rARIACamel.test(name)) {
  1606. var ariaName = 'aria-' + name.slice(4).toLowerCase();
  1607. var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
  1608. // DOM properties, then it is an invalid aria-* attribute.
  1609. if (correctName == null) {
  1610. error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
  1611. warnedProperties[name] = true;
  1612. return true;
  1613. } // aria-* attributes should be lowercase; suggest the lowercase version.
  1614. if (name !== correctName) {
  1615. error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
  1616. warnedProperties[name] = true;
  1617. return true;
  1618. }
  1619. }
  1620. if (rARIA.test(name)) {
  1621. var lowerCasedName = name.toLowerCase();
  1622. var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
  1623. // DOM properties, then it is an invalid aria-* attribute.
  1624. if (standardName == null) {
  1625. warnedProperties[name] = true;
  1626. return false;
  1627. } // aria-* attributes should be lowercase; suggest the lowercase version.
  1628. if (name !== standardName) {
  1629. error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
  1630. warnedProperties[name] = true;
  1631. return true;
  1632. }
  1633. }
  1634. }
  1635. return true;
  1636. }
  1637. function warnInvalidARIAProps(type, props) {
  1638. {
  1639. var invalidProps = [];
  1640. for (var key in props) {
  1641. var isValid = validateProperty(type, key);
  1642. if (!isValid) {
  1643. invalidProps.push(key);
  1644. }
  1645. }
  1646. var unknownPropString = invalidProps.map(function (prop) {
  1647. return '`' + prop + '`';
  1648. }).join(', ');
  1649. if (invalidProps.length === 1) {
  1650. error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  1651. } else if (invalidProps.length > 1) {
  1652. error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  1653. }
  1654. }
  1655. }
  1656. function validateProperties(type, props) {
  1657. if (isCustomComponent(type, props)) {
  1658. return;
  1659. }
  1660. warnInvalidARIAProps(type, props);
  1661. }
  1662. var didWarnValueNull = false;
  1663. function validateProperties$1(type, props) {
  1664. {
  1665. if (type !== 'input' && type !== 'textarea' && type !== 'select') {
  1666. return;
  1667. }
  1668. if (props != null && props.value === null && !didWarnValueNull) {
  1669. didWarnValueNull = true;
  1670. if (type === 'select' && props.multiple) {
  1671. error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
  1672. } else {
  1673. error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
  1674. }
  1675. }
  1676. }
  1677. }
  1678. /**
  1679. * Mapping from registration name to plugin module
  1680. */
  1681. var registrationNameModules = {};
  1682. /**
  1683. * Mapping from lowercase registration names to the properly cased version,
  1684. * used to warn in the case of missing event handlers. Available
  1685. * only in true.
  1686. * @type {Object}
  1687. */
  1688. var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true
  1689. // When adding attributes to the HTML or SVG whitelist, be sure to
  1690. // also add them to this module to ensure casing and incorrect name
  1691. // warnings.
  1692. var possibleStandardNames = {
  1693. // HTML
  1694. accept: 'accept',
  1695. acceptcharset: 'acceptCharset',
  1696. 'accept-charset': 'acceptCharset',
  1697. accesskey: 'accessKey',
  1698. action: 'action',
  1699. allowfullscreen: 'allowFullScreen',
  1700. alt: 'alt',
  1701. as: 'as',
  1702. async: 'async',
  1703. autocapitalize: 'autoCapitalize',
  1704. autocomplete: 'autoComplete',
  1705. autocorrect: 'autoCorrect',
  1706. autofocus: 'autoFocus',
  1707. autoplay: 'autoPlay',
  1708. autosave: 'autoSave',
  1709. capture: 'capture',
  1710. cellpadding: 'cellPadding',
  1711. cellspacing: 'cellSpacing',
  1712. challenge: 'challenge',
  1713. charset: 'charSet',
  1714. checked: 'checked',
  1715. children: 'children',
  1716. cite: 'cite',
  1717. class: 'className',
  1718. classid: 'classID',
  1719. classname: 'className',
  1720. cols: 'cols',
  1721. colspan: 'colSpan',
  1722. content: 'content',
  1723. contenteditable: 'contentEditable',
  1724. contextmenu: 'contextMenu',
  1725. controls: 'controls',
  1726. controlslist: 'controlsList',
  1727. coords: 'coords',
  1728. crossorigin: 'crossOrigin',
  1729. dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
  1730. data: 'data',
  1731. datetime: 'dateTime',
  1732. default: 'default',
  1733. defaultchecked: 'defaultChecked',
  1734. defaultvalue: 'defaultValue',
  1735. defer: 'defer',
  1736. dir: 'dir',
  1737. disabled: 'disabled',
  1738. disablepictureinpicture: 'disablePictureInPicture',
  1739. download: 'download',
  1740. draggable: 'draggable',
  1741. enctype: 'encType',
  1742. for: 'htmlFor',
  1743. form: 'form',
  1744. formmethod: 'formMethod',
  1745. formaction: 'formAction',
  1746. formenctype: 'formEncType',
  1747. formnovalidate: 'formNoValidate',
  1748. formtarget: 'formTarget',
  1749. frameborder: 'frameBorder',
  1750. headers: 'headers',
  1751. height: 'height',
  1752. hidden: 'hidden',
  1753. high: 'high',
  1754. href: 'href',
  1755. hreflang: 'hrefLang',
  1756. htmlfor: 'htmlFor',
  1757. httpequiv: 'httpEquiv',
  1758. 'http-equiv': 'httpEquiv',
  1759. icon: 'icon',
  1760. id: 'id',
  1761. innerhtml: 'innerHTML',
  1762. inputmode: 'inputMode',
  1763. integrity: 'integrity',
  1764. is: 'is',
  1765. itemid: 'itemID',
  1766. itemprop: 'itemProp',
  1767. itemref: 'itemRef',
  1768. itemscope: 'itemScope',
  1769. itemtype: 'itemType',
  1770. keyparams: 'keyParams',
  1771. keytype: 'keyType',
  1772. kind: 'kind',
  1773. label: 'label',
  1774. lang: 'lang',
  1775. list: 'list',
  1776. loop: 'loop',
  1777. low: 'low',
  1778. manifest: 'manifest',
  1779. marginwidth: 'marginWidth',
  1780. marginheight: 'marginHeight',
  1781. max: 'max',
  1782. maxlength: 'maxLength',
  1783. media: 'media',
  1784. mediagroup: 'mediaGroup',
  1785. method: 'method',
  1786. min: 'min',
  1787. minlength: 'minLength',
  1788. multiple: 'multiple',
  1789. muted: 'muted',
  1790. name: 'name',
  1791. nomodule: 'noModule',
  1792. nonce: 'nonce',
  1793. novalidate: 'noValidate',
  1794. open: 'open',
  1795. optimum: 'optimum',
  1796. pattern: 'pattern',
  1797. placeholder: 'placeholder',
  1798. playsinline: 'playsInline',
  1799. poster: 'poster',
  1800. preload: 'preload',
  1801. profile: 'profile',
  1802. radiogroup: 'radioGroup',
  1803. readonly: 'readOnly',
  1804. referrerpolicy: 'referrerPolicy',
  1805. rel: 'rel',
  1806. required: 'required',
  1807. reversed: 'reversed',
  1808. role: 'role',
  1809. rows: 'rows',
  1810. rowspan: 'rowSpan',
  1811. sandbox: 'sandbox',
  1812. scope: 'scope',
  1813. scoped: 'scoped',
  1814. scrolling: 'scrolling',
  1815. seamless: 'seamless',
  1816. selected: 'selected',
  1817. shape: 'shape',
  1818. size: 'size',
  1819. sizes: 'sizes',
  1820. span: 'span',
  1821. spellcheck: 'spellCheck',
  1822. src: 'src',
  1823. srcdoc: 'srcDoc',
  1824. srclang: 'srcLang',
  1825. srcset: 'srcSet',
  1826. start: 'start',
  1827. step: 'step',
  1828. style: 'style',
  1829. summary: 'summary',
  1830. tabindex: 'tabIndex',
  1831. target: 'target',
  1832. title: 'title',
  1833. type: 'type',
  1834. usemap: 'useMap',
  1835. value: 'value',
  1836. width: 'width',
  1837. wmode: 'wmode',
  1838. wrap: 'wrap',
  1839. // SVG
  1840. about: 'about',
  1841. accentheight: 'accentHeight',
  1842. 'accent-height': 'accentHeight',
  1843. accumulate: 'accumulate',
  1844. additive: 'additive',
  1845. alignmentbaseline: 'alignmentBaseline',
  1846. 'alignment-baseline': 'alignmentBaseline',
  1847. allowreorder: 'allowReorder',
  1848. alphabetic: 'alphabetic',
  1849. amplitude: 'amplitude',
  1850. arabicform: 'arabicForm',
  1851. 'arabic-form': 'arabicForm',
  1852. ascent: 'ascent',
  1853. attributename: 'attributeName',
  1854. attributetype: 'attributeType',
  1855. autoreverse: 'autoReverse',
  1856. azimuth: 'azimuth',
  1857. basefrequency: 'baseFrequency',
  1858. baselineshift: 'baselineShift',
  1859. 'baseline-shift': 'baselineShift',
  1860. baseprofile: 'baseProfile',
  1861. bbox: 'bbox',
  1862. begin: 'begin',
  1863. bias: 'bias',
  1864. by: 'by',
  1865. calcmode: 'calcMode',
  1866. capheight: 'capHeight',
  1867. 'cap-height': 'capHeight',
  1868. clip: 'clip',
  1869. clippath: 'clipPath',
  1870. 'clip-path': 'clipPath',
  1871. clippathunits: 'clipPathUnits',
  1872. cliprule: 'clipRule',
  1873. 'clip-rule': 'clipRule',
  1874. color: 'color',
  1875. colorinterpolation: 'colorInterpolation',
  1876. 'color-interpolation': 'colorInterpolation',
  1877. colorinterpolationfilters: 'colorInterpolationFilters',
  1878. 'color-interpolation-filters': 'colorInterpolationFilters',
  1879. colorprofile: 'colorProfile',
  1880. 'color-profile': 'colorProfile',
  1881. colorrendering: 'colorRendering',
  1882. 'color-rendering': 'colorRendering',
  1883. contentscripttype: 'contentScriptType',
  1884. contentstyletype: 'contentStyleType',
  1885. cursor: 'cursor',
  1886. cx: 'cx',
  1887. cy: 'cy',
  1888. d: 'd',
  1889. datatype: 'datatype',
  1890. decelerate: 'decelerate',
  1891. descent: 'descent',
  1892. diffuseconstant: 'diffuseConstant',
  1893. direction: 'direction',
  1894. display: 'display',
  1895. divisor: 'divisor',
  1896. dominantbaseline: 'dominantBaseline',
  1897. 'dominant-baseline': 'dominantBaseline',
  1898. dur: 'dur',
  1899. dx: 'dx',
  1900. dy: 'dy',
  1901. edgemode: 'edgeMode',
  1902. elevation: 'elevation',
  1903. enablebackground: 'enableBackground',
  1904. 'enable-background': 'enableBackground',
  1905. end: 'end',
  1906. exponent: 'exponent',
  1907. externalresourcesrequired: 'externalResourcesRequired',
  1908. fill: 'fill',
  1909. fillopacity: 'fillOpacity',
  1910. 'fill-opacity': 'fillOpacity',
  1911. fillrule: 'fillRule',
  1912. 'fill-rule': 'fillRule',
  1913. filter: 'filter',
  1914. filterres: 'filterRes',
  1915. filterunits: 'filterUnits',
  1916. floodopacity: 'floodOpacity',
  1917. 'flood-opacity': 'floodOpacity',
  1918. floodcolor: 'floodColor',
  1919. 'flood-color': 'floodColor',
  1920. focusable: 'focusable',
  1921. fontfamily: 'fontFamily',
  1922. 'font-family': 'fontFamily',
  1923. fontsize: 'fontSize',
  1924. 'font-size': 'fontSize',
  1925. fontsizeadjust: 'fontSizeAdjust',
  1926. 'font-size-adjust': 'fontSizeAdjust',
  1927. fontstretch: 'fontStretch',
  1928. 'font-stretch': 'fontStretch',
  1929. fontstyle: 'fontStyle',
  1930. 'font-style': 'fontStyle',
  1931. fontvariant: 'fontVariant',
  1932. 'font-variant': 'fontVariant',
  1933. fontweight: 'fontWeight',
  1934. 'font-weight': 'fontWeight',
  1935. format: 'format',
  1936. from: 'from',
  1937. fx: 'fx',
  1938. fy: 'fy',
  1939. g1: 'g1',
  1940. g2: 'g2',
  1941. glyphname: 'glyphName',
  1942. 'glyph-name': 'glyphName',
  1943. glyphorientationhorizontal: 'glyphOrientationHorizontal',
  1944. 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
  1945. glyphorientationvertical: 'glyphOrientationVertical',
  1946. 'glyph-orientation-vertical': 'glyphOrientationVertical',
  1947. glyphref: 'glyphRef',
  1948. gradienttransform: 'gradientTransform',
  1949. gradientunits: 'gradientUnits',
  1950. hanging: 'hanging',
  1951. horizadvx: 'horizAdvX',
  1952. 'horiz-adv-x': 'horizAdvX',
  1953. horizoriginx: 'horizOriginX',
  1954. 'horiz-origin-x': 'horizOriginX',
  1955. ideographic: 'ideographic',
  1956. imagerendering: 'imageRendering',
  1957. 'image-rendering': 'imageRendering',
  1958. in2: 'in2',
  1959. in: 'in',
  1960. inlist: 'inlist',
  1961. intercept: 'intercept',
  1962. k1: 'k1',
  1963. k2: 'k2',
  1964. k3: 'k3',
  1965. k4: 'k4',
  1966. k: 'k',
  1967. kernelmatrix: 'kernelMatrix',
  1968. kernelunitlength: 'kernelUnitLength',
  1969. kerning: 'kerning',
  1970. keypoints: 'keyPoints',
  1971. keysplines: 'keySplines',
  1972. keytimes: 'keyTimes',
  1973. lengthadjust: 'lengthAdjust',
  1974. letterspacing: 'letterSpacing',
  1975. 'letter-spacing': 'letterSpacing',
  1976. lightingcolor: 'lightingColor',
  1977. 'lighting-color': 'lightingColor',
  1978. limitingconeangle: 'limitingConeAngle',
  1979. local: 'local',
  1980. markerend: 'markerEnd',
  1981. 'marker-end': 'markerEnd',
  1982. markerheight: 'markerHeight',
  1983. markermid: 'markerMid',
  1984. 'marker-mid': 'markerMid',
  1985. markerstart: 'markerStart',
  1986. 'marker-start': 'markerStart',
  1987. markerunits: 'markerUnits',
  1988. markerwidth: 'markerWidth',
  1989. mask: 'mask',
  1990. maskcontentunits: 'maskContentUnits',
  1991. maskunits: 'maskUnits',
  1992. mathematical: 'mathematical',
  1993. mode: 'mode',
  1994. numoctaves: 'numOctaves',
  1995. offset: 'offset',
  1996. opacity: 'opacity',
  1997. operator: 'operator',
  1998. order: 'order',
  1999. orient: 'orient',
  2000. orientation: 'orientation',
  2001. origin: 'origin',
  2002. overflow: 'overflow',
  2003. overlineposition: 'overlinePosition',
  2004. 'overline-position': 'overlinePosition',
  2005. overlinethickness: 'overlineThickness',
  2006. 'overline-thickness': 'overlineThickness',
  2007. paintorder: 'paintOrder',
  2008. 'paint-order': 'paintOrder',
  2009. panose1: 'panose1',
  2010. 'panose-1': 'panose1',
  2011. pathlength: 'pathLength',
  2012. patterncontentunits: 'patternContentUnits',
  2013. patterntransform: 'patternTransform',
  2014. patternunits: 'patternUnits',
  2015. pointerevents: 'pointerEvents',
  2016. 'pointer-events': 'pointerEvents',
  2017. points: 'points',
  2018. pointsatx: 'pointsAtX',
  2019. pointsaty: 'pointsAtY',
  2020. pointsatz: 'pointsAtZ',
  2021. prefix: 'prefix',
  2022. preservealpha: 'preserveAlpha',
  2023. preserveaspectratio: 'preserveAspectRatio',
  2024. primitiveunits: 'primitiveUnits',
  2025. property: 'property',
  2026. r: 'r',
  2027. radius: 'radius',
  2028. refx: 'refX',
  2029. refy: 'refY',
  2030. renderingintent: 'renderingIntent',
  2031. 'rendering-intent': 'renderingIntent',
  2032. repeatcount: 'repeatCount',
  2033. repeatdur: 'repeatDur',
  2034. requiredextensions: 'requiredExtensions',
  2035. requiredfeatures: 'requiredFeatures',
  2036. resource: 'resource',
  2037. restart: 'restart',
  2038. result: 'result',
  2039. results: 'results',
  2040. rotate: 'rotate',
  2041. rx: 'rx',
  2042. ry: 'ry',
  2043. scale: 'scale',
  2044. security: 'security',
  2045. seed: 'seed',
  2046. shaperendering: 'shapeRendering',
  2047. 'shape-rendering': 'shapeRendering',
  2048. slope: 'slope',
  2049. spacing: 'spacing',
  2050. specularconstant: 'specularConstant',
  2051. specularexponent: 'specularExponent',
  2052. speed: 'speed',
  2053. spreadmethod: 'spreadMethod',
  2054. startoffset: 'startOffset',
  2055. stddeviation: 'stdDeviation',
  2056. stemh: 'stemh',
  2057. stemv: 'stemv',
  2058. stitchtiles: 'stitchTiles',
  2059. stopcolor: 'stopColor',
  2060. 'stop-color': 'stopColor',
  2061. stopopacity: 'stopOpacity',
  2062. 'stop-opacity': 'stopOpacity',
  2063. strikethroughposition: 'strikethroughPosition',
  2064. 'strikethrough-position': 'strikethroughPosition',
  2065. strikethroughthickness: 'strikethroughThickness',
  2066. 'strikethrough-thickness': 'strikethroughThickness',
  2067. string: 'string',
  2068. stroke: 'stroke',
  2069. strokedasharray: 'strokeDasharray',
  2070. 'stroke-dasharray': 'strokeDasharray',
  2071. strokedashoffset: 'strokeDashoffset',
  2072. 'stroke-dashoffset': 'strokeDashoffset',
  2073. strokelinecap: 'strokeLinecap',
  2074. 'stroke-linecap': 'strokeLinecap',
  2075. strokelinejoin: 'strokeLinejoin',
  2076. 'stroke-linejoin': 'strokeLinejoin',
  2077. strokemiterlimit: 'strokeMiterlimit',
  2078. 'stroke-miterlimit': 'strokeMiterlimit',
  2079. strokewidth: 'strokeWidth',
  2080. 'stroke-width': 'strokeWidth',
  2081. strokeopacity: 'strokeOpacity',
  2082. 'stroke-opacity': 'strokeOpacity',
  2083. suppresscontenteditablewarning: 'suppressContentEditableWarning',
  2084. suppresshydrationwarning: 'suppressHydrationWarning',
  2085. surfacescale: 'surfaceScale',
  2086. systemlanguage: 'systemLanguage',
  2087. tablevalues: 'tableValues',
  2088. targetx: 'targetX',
  2089. targety: 'targetY',
  2090. textanchor: 'textAnchor',
  2091. 'text-anchor': 'textAnchor',
  2092. textdecoration: 'textDecoration',
  2093. 'text-decoration': 'textDecoration',
  2094. textlength: 'textLength',
  2095. textrendering: 'textRendering',
  2096. 'text-rendering': 'textRendering',
  2097. to: 'to',
  2098. transform: 'transform',
  2099. typeof: 'typeof',
  2100. u1: 'u1',
  2101. u2: 'u2',
  2102. underlineposition: 'underlinePosition',
  2103. 'underline-position': 'underlinePosition',
  2104. underlinethickness: 'underlineThickness',
  2105. 'underline-thickness': 'underlineThickness',
  2106. unicode: 'unicode',
  2107. unicodebidi: 'unicodeBidi',
  2108. 'unicode-bidi': 'unicodeBidi',
  2109. unicoderange: 'unicodeRange',
  2110. 'unicode-range': 'unicodeRange',
  2111. unitsperem: 'unitsPerEm',
  2112. 'units-per-em': 'unitsPerEm',
  2113. unselectable: 'unselectable',
  2114. valphabetic: 'vAlphabetic',
  2115. 'v-alphabetic': 'vAlphabetic',
  2116. values: 'values',
  2117. vectoreffect: 'vectorEffect',
  2118. 'vector-effect': 'vectorEffect',
  2119. version: 'version',
  2120. vertadvy: 'vertAdvY',
  2121. 'vert-adv-y': 'vertAdvY',
  2122. vertoriginx: 'vertOriginX',
  2123. 'vert-origin-x': 'vertOriginX',
  2124. vertoriginy: 'vertOriginY',
  2125. 'vert-origin-y': 'vertOriginY',
  2126. vhanging: 'vHanging',
  2127. 'v-hanging': 'vHanging',
  2128. videographic: 'vIdeographic',
  2129. 'v-ideographic': 'vIdeographic',
  2130. viewbox: 'viewBox',
  2131. viewtarget: 'viewTarget',
  2132. visibility: 'visibility',
  2133. vmathematical: 'vMathematical',
  2134. 'v-mathematical': 'vMathematical',
  2135. vocab: 'vocab',
  2136. widths: 'widths',
  2137. wordspacing: 'wordSpacing',
  2138. 'word-spacing': 'wordSpacing',
  2139. writingmode: 'writingMode',
  2140. 'writing-mode': 'writingMode',
  2141. x1: 'x1',
  2142. x2: 'x2',
  2143. x: 'x',
  2144. xchannelselector: 'xChannelSelector',
  2145. xheight: 'xHeight',
  2146. 'x-height': 'xHeight',
  2147. xlinkactuate: 'xlinkActuate',
  2148. 'xlink:actuate': 'xlinkActuate',
  2149. xlinkarcrole: 'xlinkArcrole',
  2150. 'xlink:arcrole': 'xlinkArcrole',
  2151. xlinkhref: 'xlinkHref',
  2152. 'xlink:href': 'xlinkHref',
  2153. xlinkrole: 'xlinkRole',
  2154. 'xlink:role': 'xlinkRole',
  2155. xlinkshow: 'xlinkShow',
  2156. 'xlink:show': 'xlinkShow',
  2157. xlinktitle: 'xlinkTitle',
  2158. 'xlink:title': 'xlinkTitle',
  2159. xlinktype: 'xlinkType',
  2160. 'xlink:type': 'xlinkType',
  2161. xmlbase: 'xmlBase',
  2162. 'xml:base': 'xmlBase',
  2163. xmllang: 'xmlLang',
  2164. 'xml:lang': 'xmlLang',
  2165. xmlns: 'xmlns',
  2166. 'xml:space': 'xmlSpace',
  2167. xmlnsxlink: 'xmlnsXlink',
  2168. 'xmlns:xlink': 'xmlnsXlink',
  2169. xmlspace: 'xmlSpace',
  2170. y1: 'y1',
  2171. y2: 'y2',
  2172. y: 'y',
  2173. ychannelselector: 'yChannelSelector',
  2174. z: 'z',
  2175. zoomandpan: 'zoomAndPan'
  2176. };
  2177. var validateProperty$1 = function () {};
  2178. {
  2179. var warnedProperties$1 = {};
  2180. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  2181. var EVENT_NAME_REGEX = /^on./;
  2182. var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
  2183. var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  2184. var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  2185. validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
  2186. if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
  2187. return true;
  2188. }
  2189. var lowerCasedName = name.toLowerCase();
  2190. if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
  2191. error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
  2192. warnedProperties$1[name] = true;
  2193. return true;
  2194. } // We can't rely on the event system being injected on the server.
  2195. if (canUseEventSystem) {
  2196. if (registrationNameModules.hasOwnProperty(name)) {
  2197. return true;
  2198. }
  2199. var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
  2200. if (registrationName != null) {
  2201. error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
  2202. warnedProperties$1[name] = true;
  2203. return true;
  2204. }
  2205. if (EVENT_NAME_REGEX.test(name)) {
  2206. error('Unknown event handler property `%s`. It will be ignored.', name);
  2207. warnedProperties$1[name] = true;
  2208. return true;
  2209. }
  2210. } else if (EVENT_NAME_REGEX.test(name)) {
  2211. // If no event plugins have been injected, we are in a server environment.
  2212. // So we can't tell if the event name is correct for sure, but we can filter
  2213. // out known bad ones like `onclick`. We can't suggest a specific replacement though.
  2214. if (INVALID_EVENT_NAME_REGEX.test(name)) {
  2215. error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
  2216. }
  2217. warnedProperties$1[name] = true;
  2218. return true;
  2219. } // Let the ARIA attribute hook validate ARIA attributes
  2220. if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
  2221. return true;
  2222. }
  2223. if (lowerCasedName === 'innerhtml') {
  2224. error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
  2225. warnedProperties$1[name] = true;
  2226. return true;
  2227. }
  2228. if (lowerCasedName === 'aria') {
  2229. error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
  2230. warnedProperties$1[name] = true;
  2231. return true;
  2232. }
  2233. if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
  2234. error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
  2235. warnedProperties$1[name] = true;
  2236. return true;
  2237. }
  2238. if (typeof value === 'number' && isNaN(value)) {
  2239. error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
  2240. warnedProperties$1[name] = true;
  2241. return true;
  2242. }
  2243. var propertyInfo = getPropertyInfo(name);
  2244. var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
  2245. if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
  2246. var standardName = possibleStandardNames[lowerCasedName];
  2247. if (standardName !== name) {
  2248. error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
  2249. warnedProperties$1[name] = true;
  2250. return true;
  2251. }
  2252. } else if (!isReserved && name !== lowerCasedName) {
  2253. // Unknown attributes should have lowercase casing since that's how they
  2254. // will be cased anyway with server rendering.
  2255. error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
  2256. warnedProperties$1[name] = true;
  2257. return true;
  2258. }
  2259. if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
  2260. if (value) {
  2261. error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
  2262. } else {
  2263. error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
  2264. }
  2265. warnedProperties$1[name] = true;
  2266. return true;
  2267. } // Now that we've validated casing, do not validate
  2268. // data types for reserved props
  2269. if (isReserved) {
  2270. return true;
  2271. } // Warn when a known attribute is a bad type
  2272. if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
  2273. warnedProperties$1[name] = true;
  2274. return false;
  2275. } // Warn when passing the strings 'false' or 'true' into a boolean prop
  2276. if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
  2277. error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
  2278. warnedProperties$1[name] = true;
  2279. return true;
  2280. }
  2281. return true;
  2282. };
  2283. }
  2284. var warnUnknownProperties = function (type, props, canUseEventSystem) {
  2285. {
  2286. var unknownProps = [];
  2287. for (var key in props) {
  2288. var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
  2289. if (!isValid) {
  2290. unknownProps.push(key);
  2291. }
  2292. }
  2293. var unknownPropString = unknownProps.map(function (prop) {
  2294. return '`' + prop + '`';
  2295. }).join(', ');
  2296. if (unknownProps.length === 1) {
  2297. error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
  2298. } else if (unknownProps.length > 1) {
  2299. error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
  2300. }
  2301. }
  2302. };
  2303. function validateProperties$2(type, props, canUseEventSystem) {
  2304. if (isCustomComponent(type, props)) {
  2305. return;
  2306. }
  2307. warnUnknownProperties(type, props, canUseEventSystem);
  2308. }
  2309. var toArray = React.Children.toArray; // This is only used in DEV.
  2310. // Each entry is `this.stack` from a currently executing renderer instance.
  2311. // (There may be more than one because ReactDOMServer is reentrant).
  2312. // Each stack is an array of frames which may contain nested stacks of elements.
  2313. var currentDebugStacks = [];
  2314. var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
  2315. var ReactDebugCurrentFrame$4;
  2316. var prevGetCurrentStackImpl = null;
  2317. var getCurrentServerStackImpl = function () {
  2318. return '';
  2319. };
  2320. var describeStackFrame = function (element) {
  2321. return '';
  2322. };
  2323. var validatePropertiesInDevelopment = function (type, props) {};
  2324. var pushCurrentDebugStack = function (stack) {};
  2325. var pushElementToDebugStack = function (element) {};
  2326. var popCurrentDebugStack = function () {};
  2327. var hasWarnedAboutUsingContextAsConsumer = false;
  2328. {
  2329. ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame;
  2330. validatePropertiesInDevelopment = function (type, props) {
  2331. validateProperties(type, props);
  2332. validateProperties$1(type, props);
  2333. validateProperties$2(type, props,
  2334. /* canUseEventSystem */
  2335. false);
  2336. };
  2337. describeStackFrame = function (element) {
  2338. var source = element._source;
  2339. var type = element.type;
  2340. var name = getComponentName(type);
  2341. var ownerName = null;
  2342. return describeComponentFrame(name, source, ownerName);
  2343. };
  2344. pushCurrentDebugStack = function (stack) {
  2345. currentDebugStacks.push(stack);
  2346. if (currentDebugStacks.length === 1) {
  2347. // We are entering a server renderer.
  2348. // Remember the previous (e.g. client) global stack implementation.
  2349. prevGetCurrentStackImpl = ReactDebugCurrentFrame$4.getCurrentStack;
  2350. ReactDebugCurrentFrame$4.getCurrentStack = getCurrentServerStackImpl;
  2351. }
  2352. };
  2353. pushElementToDebugStack = function (element) {
  2354. // For the innermost executing ReactDOMServer call,
  2355. var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
  2356. var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
  2357. frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
  2358. // children and directly handle them in an inner loop instead of
  2359. // creating separate frames for them.
  2360. };
  2361. popCurrentDebugStack = function () {
  2362. currentDebugStacks.pop();
  2363. if (currentDebugStacks.length === 0) {
  2364. // We are exiting the server renderer.
  2365. // Restore the previous (e.g. client) global stack implementation.
  2366. ReactDebugCurrentFrame$4.getCurrentStack = prevGetCurrentStackImpl;
  2367. prevGetCurrentStackImpl = null;
  2368. }
  2369. };
  2370. getCurrentServerStackImpl = function () {
  2371. if (currentDebugStacks.length === 0) {
  2372. // Nothing is currently rendering.
  2373. return '';
  2374. } // ReactDOMServer is reentrant so there may be multiple calls at the same time.
  2375. // Take the frames from the innermost call which is the last in the array.
  2376. var frames = currentDebugStacks[currentDebugStacks.length - 1];
  2377. var stack = ''; // Go through every frame in the stack from the innermost one.
  2378. for (var i = frames.length - 1; i >= 0; i--) {
  2379. var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
  2380. // This is because single-child nesting doesn't create materialized frames.
  2381. // Instead it would push them through `pushElementToDebugStack()`.
  2382. var debugElementStack = frame.debugElementStack;
  2383. for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
  2384. stack += describeStackFrame(debugElementStack[ii]);
  2385. }
  2386. }
  2387. return stack;
  2388. };
  2389. }
  2390. var didWarnDefaultInputValue = false;
  2391. var didWarnDefaultChecked = false;
  2392. var didWarnDefaultSelectValue = false;
  2393. var didWarnDefaultTextareaValue = false;
  2394. var didWarnInvalidOptionChildren = false;
  2395. var didWarnAboutNoopUpdateForComponent = {};
  2396. var didWarnAboutBadClass = {};
  2397. var didWarnAboutModulePatternComponent = {};
  2398. var didWarnAboutDeprecatedWillMount = {};
  2399. var didWarnAboutUndefinedDerivedState = {};
  2400. var didWarnAboutUninitializedState = {};
  2401. var valuePropNames = ['value', 'defaultValue'];
  2402. var newlineEatingTags = {
  2403. listing: true,
  2404. pre: true,
  2405. textarea: true
  2406. }; // We accept any tag to be rendered but since this gets injected into arbitrary
  2407. // HTML, we want to make sure that it's a safe tag.
  2408. // http://www.w3.org/TR/REC-xml/#NT-Name
  2409. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  2410. var validatedTagCache = {};
  2411. function validateDangerousTag(tag) {
  2412. if (!validatedTagCache.hasOwnProperty(tag)) {
  2413. if (!VALID_TAG_REGEX.test(tag)) {
  2414. {
  2415. throw Error( "Invalid tag: " + tag );
  2416. }
  2417. }
  2418. validatedTagCache[tag] = true;
  2419. }
  2420. }
  2421. var styleNameCache = {};
  2422. var processStyleName = function (styleName) {
  2423. if (styleNameCache.hasOwnProperty(styleName)) {
  2424. return styleNameCache[styleName];
  2425. }
  2426. var result = hyphenateStyleName(styleName);
  2427. styleNameCache[styleName] = result;
  2428. return result;
  2429. };
  2430. function createMarkupForStyles(styles) {
  2431. var serialized = '';
  2432. var delimiter = '';
  2433. for (var styleName in styles) {
  2434. if (!styles.hasOwnProperty(styleName)) {
  2435. continue;
  2436. }
  2437. var isCustomProperty = styleName.indexOf('--') === 0;
  2438. var styleValue = styles[styleName];
  2439. {
  2440. if (!isCustomProperty) {
  2441. warnValidStyle$1(styleName, styleValue);
  2442. }
  2443. }
  2444. if (styleValue != null) {
  2445. serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
  2446. serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
  2447. delimiter = ';';
  2448. }
  2449. }
  2450. return serialized || null;
  2451. }
  2452. function warnNoop(publicInstance, callerName) {
  2453. {
  2454. var _constructor = publicInstance.constructor;
  2455. var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
  2456. var warningKey = componentName + '.' + callerName;
  2457. if (didWarnAboutNoopUpdateForComponent[warningKey]) {
  2458. return;
  2459. }
  2460. error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
  2461. didWarnAboutNoopUpdateForComponent[warningKey] = true;
  2462. }
  2463. }
  2464. function shouldConstruct(Component) {
  2465. return Component.prototype && Component.prototype.isReactComponent;
  2466. }
  2467. function getNonChildrenInnerMarkup(props) {
  2468. var innerHTML = props.dangerouslySetInnerHTML;
  2469. if (innerHTML != null) {
  2470. if (innerHTML.__html != null) {
  2471. return innerHTML.__html;
  2472. }
  2473. } else {
  2474. var content = props.children;
  2475. if (typeof content === 'string' || typeof content === 'number') {
  2476. return escapeTextForBrowser(content);
  2477. }
  2478. }
  2479. return null;
  2480. }
  2481. function flattenTopLevelChildren(children) {
  2482. if (!React.isValidElement(children)) {
  2483. return toArray(children);
  2484. }
  2485. var element = children;
  2486. if (element.type !== REACT_FRAGMENT_TYPE) {
  2487. return [element];
  2488. }
  2489. var fragmentChildren = element.props.children;
  2490. if (!React.isValidElement(fragmentChildren)) {
  2491. return toArray(fragmentChildren);
  2492. }
  2493. var fragmentChildElement = fragmentChildren;
  2494. return [fragmentChildElement];
  2495. }
  2496. function flattenOptionChildren(children) {
  2497. if (children === undefined || children === null) {
  2498. return children;
  2499. }
  2500. var content = ''; // Flatten children and warn if they aren't strings or numbers;
  2501. // invalid types are ignored.
  2502. React.Children.forEach(children, function (child) {
  2503. if (child == null) {
  2504. return;
  2505. }
  2506. content += child;
  2507. {
  2508. if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
  2509. didWarnInvalidOptionChildren = true;
  2510. error('Only strings and numbers are supported as <option> children.');
  2511. }
  2512. }
  2513. });
  2514. return content;
  2515. }
  2516. var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  2517. var STYLE = 'style';
  2518. var RESERVED_PROPS = {
  2519. children: null,
  2520. dangerouslySetInnerHTML: null,
  2521. suppressContentEditableWarning: null,
  2522. suppressHydrationWarning: null
  2523. };
  2524. function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
  2525. var ret = '<' + tagVerbatim;
  2526. for (var propKey in props) {
  2527. if (!hasOwnProperty$2.call(props, propKey)) {
  2528. continue;
  2529. }
  2530. var propValue = props[propKey];
  2531. if (propValue == null) {
  2532. continue;
  2533. }
  2534. if (propKey === STYLE) {
  2535. propValue = createMarkupForStyles(propValue);
  2536. }
  2537. var markup = null;
  2538. if (isCustomComponent(tagLowercase, props)) {
  2539. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  2540. markup = createMarkupForCustomAttribute(propKey, propValue);
  2541. }
  2542. } else {
  2543. markup = createMarkupForProperty(propKey, propValue);
  2544. }
  2545. if (markup) {
  2546. ret += ' ' + markup;
  2547. }
  2548. } // For static pages, no need to put React ID and checksum. Saves lots of
  2549. // bytes.
  2550. if (makeStaticMarkup) {
  2551. return ret;
  2552. }
  2553. if (isRootElement) {
  2554. ret += ' ' + createMarkupForRoot();
  2555. }
  2556. return ret;
  2557. }
  2558. function validateRenderResult(child, type) {
  2559. if (child === undefined) {
  2560. {
  2561. {
  2562. throw Error( (getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." );
  2563. }
  2564. }
  2565. }
  2566. }
  2567. function resolve(child, context, threadID) {
  2568. while (React.isValidElement(child)) {
  2569. // Safe because we just checked it's an element.
  2570. var element = child;
  2571. var Component = element.type;
  2572. {
  2573. pushElementToDebugStack(element);
  2574. }
  2575. if (typeof Component !== 'function') {
  2576. break;
  2577. }
  2578. processChild(element, Component);
  2579. } // Extra closure so queue and replace can be captured properly
  2580. function processChild(element, Component) {
  2581. var isClass = shouldConstruct(Component);
  2582. var publicContext = processContext(Component, context, threadID, isClass);
  2583. var queue = [];
  2584. var replace = false;
  2585. var updater = {
  2586. isMounted: function (publicInstance) {
  2587. return false;
  2588. },
  2589. enqueueForceUpdate: function (publicInstance) {
  2590. if (queue === null) {
  2591. warnNoop(publicInstance, 'forceUpdate');
  2592. return null;
  2593. }
  2594. },
  2595. enqueueReplaceState: function (publicInstance, completeState) {
  2596. replace = true;
  2597. queue = [completeState];
  2598. },
  2599. enqueueSetState: function (publicInstance, currentPartialState) {
  2600. if (queue === null) {
  2601. warnNoop(publicInstance, 'setState');
  2602. return null;
  2603. }
  2604. queue.push(currentPartialState);
  2605. }
  2606. };
  2607. var inst;
  2608. if (isClass) {
  2609. inst = new Component(element.props, publicContext, updater);
  2610. if (typeof Component.getDerivedStateFromProps === 'function') {
  2611. {
  2612. if (inst.state === null || inst.state === undefined) {
  2613. var componentName = getComponentName(Component) || 'Unknown';
  2614. if (!didWarnAboutUninitializedState[componentName]) {
  2615. error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
  2616. didWarnAboutUninitializedState[componentName] = true;
  2617. }
  2618. }
  2619. }
  2620. var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
  2621. {
  2622. if (partialState === undefined) {
  2623. var _componentName = getComponentName(Component) || 'Unknown';
  2624. if (!didWarnAboutUndefinedDerivedState[_componentName]) {
  2625. error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
  2626. didWarnAboutUndefinedDerivedState[_componentName] = true;
  2627. }
  2628. }
  2629. }
  2630. if (partialState != null) {
  2631. inst.state = _assign({}, inst.state, partialState);
  2632. }
  2633. }
  2634. } else {
  2635. {
  2636. if (Component.prototype && typeof Component.prototype.render === 'function') {
  2637. var _componentName2 = getComponentName(Component) || 'Unknown';
  2638. if (!didWarnAboutBadClass[_componentName2]) {
  2639. error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
  2640. didWarnAboutBadClass[_componentName2] = true;
  2641. }
  2642. }
  2643. }
  2644. var componentIdentity = {};
  2645. prepareToUseHooks(componentIdentity);
  2646. inst = Component(element.props, publicContext, updater);
  2647. inst = finishHooks(Component, element.props, inst, publicContext);
  2648. if (inst == null || inst.render == null) {
  2649. child = inst;
  2650. validateRenderResult(child, Component);
  2651. return;
  2652. }
  2653. {
  2654. var _componentName3 = getComponentName(Component) || 'Unknown';
  2655. if (!didWarnAboutModulePatternComponent[_componentName3]) {
  2656. error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
  2657. didWarnAboutModulePatternComponent[_componentName3] = true;
  2658. }
  2659. }
  2660. }
  2661. inst.props = element.props;
  2662. inst.context = publicContext;
  2663. inst.updater = updater;
  2664. var initialState = inst.state;
  2665. if (initialState === undefined) {
  2666. inst.state = initialState = null;
  2667. }
  2668. if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
  2669. if (typeof inst.componentWillMount === 'function') {
  2670. {
  2671. if ( inst.componentWillMount.__suppressDeprecationWarning !== true) {
  2672. var _componentName4 = getComponentName(Component) || 'Unknown';
  2673. if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
  2674. warn( // keep this warning in sync with ReactStrictModeWarning.js
  2675. 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
  2676. didWarnAboutDeprecatedWillMount[_componentName4] = true;
  2677. }
  2678. }
  2679. } // In order to support react-lifecycles-compat polyfilled components,
  2680. // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
  2681. if (typeof Component.getDerivedStateFromProps !== 'function') {
  2682. inst.componentWillMount();
  2683. }
  2684. }
  2685. if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
  2686. // In order to support react-lifecycles-compat polyfilled components,
  2687. // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
  2688. inst.UNSAFE_componentWillMount();
  2689. }
  2690. if (queue.length) {
  2691. var oldQueue = queue;
  2692. var oldReplace = replace;
  2693. queue = null;
  2694. replace = false;
  2695. if (oldReplace && oldQueue.length === 1) {
  2696. inst.state = oldQueue[0];
  2697. } else {
  2698. var nextState = oldReplace ? oldQueue[0] : inst.state;
  2699. var dontMutate = true;
  2700. for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
  2701. var partial = oldQueue[i];
  2702. var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
  2703. if (_partialState != null) {
  2704. if (dontMutate) {
  2705. dontMutate = false;
  2706. nextState = _assign({}, nextState, _partialState);
  2707. } else {
  2708. _assign(nextState, _partialState);
  2709. }
  2710. }
  2711. }
  2712. inst.state = nextState;
  2713. }
  2714. } else {
  2715. queue = null;
  2716. }
  2717. }
  2718. child = inst.render();
  2719. {
  2720. if (child === undefined && inst.render._isMockFunction) {
  2721. // This is probably bad practice. Consider warning here and
  2722. // deprecating this convenience.
  2723. child = null;
  2724. }
  2725. }
  2726. validateRenderResult(child, Component);
  2727. var childContext;
  2728. {
  2729. if (typeof inst.getChildContext === 'function') {
  2730. var _childContextTypes = Component.childContextTypes;
  2731. if (typeof _childContextTypes === 'object') {
  2732. childContext = inst.getChildContext();
  2733. for (var contextKey in childContext) {
  2734. if (!(contextKey in _childContextTypes)) {
  2735. {
  2736. throw Error( (getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." );
  2737. }
  2738. }
  2739. }
  2740. } else {
  2741. {
  2742. error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
  2743. }
  2744. }
  2745. }
  2746. if (childContext) {
  2747. context = _assign({}, context, childContext);
  2748. }
  2749. }
  2750. }
  2751. return {
  2752. child: child,
  2753. context: context
  2754. };
  2755. }
  2756. var ReactDOMServerRenderer =
  2757. /*#__PURE__*/
  2758. function () {
  2759. // TODO: type this more strictly:
  2760. // DEV-only
  2761. function ReactDOMServerRenderer(children, makeStaticMarkup) {
  2762. var flatChildren = flattenTopLevelChildren(children);
  2763. var topFrame = {
  2764. type: null,
  2765. // Assume all trees start in the HTML namespace (not totally true, but
  2766. // this is what we did historically)
  2767. domNamespace: Namespaces.html,
  2768. children: flatChildren,
  2769. childIndex: 0,
  2770. context: emptyObject,
  2771. footer: ''
  2772. };
  2773. {
  2774. topFrame.debugElementStack = [];
  2775. }
  2776. this.threadID = allocThreadID();
  2777. this.stack = [topFrame];
  2778. this.exhausted = false;
  2779. this.currentSelectValue = null;
  2780. this.previousWasTextNode = false;
  2781. this.makeStaticMarkup = makeStaticMarkup;
  2782. this.suspenseDepth = 0; // Context (new API)
  2783. this.contextIndex = -1;
  2784. this.contextStack = [];
  2785. this.contextValueStack = [];
  2786. {
  2787. this.contextProviderStack = [];
  2788. }
  2789. }
  2790. var _proto = ReactDOMServerRenderer.prototype;
  2791. _proto.destroy = function destroy() {
  2792. if (!this.exhausted) {
  2793. this.exhausted = true;
  2794. this.clearProviders();
  2795. freeThreadID(this.threadID);
  2796. }
  2797. }
  2798. /**
  2799. * Note: We use just two stacks regardless of how many context providers you have.
  2800. * Providers are always popped in the reverse order to how they were pushed
  2801. * so we always know on the way down which provider you'll encounter next on the way up.
  2802. * On the way down, we push the current provider, and its context value *before*
  2803. * we mutated it, onto the stacks. Therefore, on the way up, we always know which
  2804. * provider needs to be "restored" to which value.
  2805. * https://github.com/facebook/react/pull/12985#issuecomment-396301248
  2806. */
  2807. ;
  2808. _proto.pushProvider = function pushProvider(provider) {
  2809. var index = ++this.contextIndex;
  2810. var context = provider.type._context;
  2811. var threadID = this.threadID;
  2812. validateContextBounds(context, threadID);
  2813. var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
  2814. this.contextStack[index] = context;
  2815. this.contextValueStack[index] = previousValue;
  2816. {
  2817. // Only used for push/pop mismatch warnings.
  2818. this.contextProviderStack[index] = provider;
  2819. } // Mutate the current value.
  2820. context[threadID] = provider.props.value;
  2821. };
  2822. _proto.popProvider = function popProvider(provider) {
  2823. var index = this.contextIndex;
  2824. {
  2825. if (index < 0 || provider !== this.contextProviderStack[index]) {
  2826. error('Unexpected pop.');
  2827. }
  2828. }
  2829. var context = this.contextStack[index];
  2830. var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
  2831. // because conceptually they are deletions--as long as we
  2832. // promise to never access values beyond `this.contextIndex`.
  2833. this.contextStack[index] = null;
  2834. this.contextValueStack[index] = null;
  2835. {
  2836. this.contextProviderStack[index] = null;
  2837. }
  2838. this.contextIndex--; // Restore to the previous value we stored as we were walking down.
  2839. // We've already verified that this context has been expanded to accommodate
  2840. // this thread id, so we don't need to do it again.
  2841. context[this.threadID] = previousValue;
  2842. };
  2843. _proto.clearProviders = function clearProviders() {
  2844. // Restore any remaining providers on the stack to previous values
  2845. for (var index = this.contextIndex; index >= 0; index--) {
  2846. var context = this.contextStack[index];
  2847. var previousValue = this.contextValueStack[index];
  2848. context[this.threadID] = previousValue;
  2849. }
  2850. };
  2851. _proto.read = function read(bytes) {
  2852. if (this.exhausted) {
  2853. return null;
  2854. }
  2855. var prevThreadID = currentThreadID;
  2856. setCurrentThreadID(this.threadID);
  2857. var prevDispatcher = ReactCurrentDispatcher.current;
  2858. ReactCurrentDispatcher.current = Dispatcher;
  2859. try {
  2860. // Markup generated within <Suspense> ends up buffered until we know
  2861. // nothing in that boundary suspended
  2862. var out = [''];
  2863. var suspended = false;
  2864. while (out[0].length < bytes) {
  2865. if (this.stack.length === 0) {
  2866. this.exhausted = true;
  2867. freeThreadID(this.threadID);
  2868. break;
  2869. }
  2870. var frame = this.stack[this.stack.length - 1];
  2871. if (suspended || frame.childIndex >= frame.children.length) {
  2872. var footer = frame.footer;
  2873. if (footer !== '') {
  2874. this.previousWasTextNode = false;
  2875. }
  2876. this.stack.pop();
  2877. if (frame.type === 'select') {
  2878. this.currentSelectValue = null;
  2879. } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
  2880. var provider = frame.type;
  2881. this.popProvider(provider);
  2882. } else if (frame.type === REACT_SUSPENSE_TYPE) {
  2883. this.suspenseDepth--;
  2884. var buffered = out.pop();
  2885. if (suspended) {
  2886. suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
  2887. var fallbackFrame = frame.fallbackFrame;
  2888. if (!fallbackFrame) {
  2889. {
  2890. throw Error(true ? "ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue." : formatProdErrorMessage(303));
  2891. }
  2892. }
  2893. this.stack.push(fallbackFrame);
  2894. out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
  2895. continue;
  2896. } else {
  2897. out[this.suspenseDepth] += buffered;
  2898. }
  2899. } // Flush output
  2900. out[this.suspenseDepth] += footer;
  2901. continue;
  2902. }
  2903. var child = frame.children[frame.childIndex++];
  2904. var outBuffer = '';
  2905. if (true) {
  2906. pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
  2907. frame.debugElementStack.length = 0;
  2908. }
  2909. try {
  2910. outBuffer += this.render(child, frame.context, frame.domNamespace);
  2911. } catch (err) {
  2912. if (err != null && typeof err.then === 'function') {
  2913. if (enableSuspenseServerRenderer) {
  2914. if (!(this.suspenseDepth > 0)) {
  2915. {
  2916. throw Error(true ? "A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display." : formatProdErrorMessage(342));
  2917. }
  2918. }
  2919. suspended = true;
  2920. } else {
  2921. if (!false) {
  2922. {
  2923. throw Error(true ? "ReactDOMServer does not yet support Suspense." : formatProdErrorMessage(294));
  2924. }
  2925. }
  2926. }
  2927. } else {
  2928. throw err;
  2929. }
  2930. } finally {
  2931. if (true) {
  2932. popCurrentDebugStack();
  2933. }
  2934. }
  2935. if (out.length <= this.suspenseDepth) {
  2936. out.push('');
  2937. }
  2938. out[this.suspenseDepth] += outBuffer;
  2939. }
  2940. return out[0];
  2941. } finally {
  2942. ReactCurrentDispatcher.current = prevDispatcher;
  2943. setCurrentThreadID(prevThreadID);
  2944. }
  2945. };
  2946. _proto.render = function render(child, context, parentNamespace) {
  2947. if (typeof child === 'string' || typeof child === 'number') {
  2948. var text = '' + child;
  2949. if (text === '') {
  2950. return '';
  2951. }
  2952. if (this.makeStaticMarkup) {
  2953. return escapeTextForBrowser(text);
  2954. }
  2955. if (this.previousWasTextNode) {
  2956. return '<!-- -->' + escapeTextForBrowser(text);
  2957. }
  2958. this.previousWasTextNode = true;
  2959. return escapeTextForBrowser(text);
  2960. } else {
  2961. var nextChild;
  2962. var _resolve = resolve(child, context, this.threadID);
  2963. nextChild = _resolve.child;
  2964. context = _resolve.context;
  2965. if (nextChild === null || nextChild === false) {
  2966. return '';
  2967. } else if (!React.isValidElement(nextChild)) {
  2968. if (nextChild != null && nextChild.$$typeof != null) {
  2969. // Catch unexpected special types early.
  2970. var $$typeof = nextChild.$$typeof;
  2971. if (!($$typeof !== REACT_PORTAL_TYPE)) {
  2972. {
  2973. throw Error( "Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render." );
  2974. }
  2975. } // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
  2976. {
  2977. {
  2978. throw Error( "Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue." );
  2979. }
  2980. }
  2981. }
  2982. var nextChildren = toArray(nextChild);
  2983. var frame = {
  2984. type: null,
  2985. domNamespace: parentNamespace,
  2986. children: nextChildren,
  2987. childIndex: 0,
  2988. context: context,
  2989. footer: ''
  2990. };
  2991. {
  2992. frame.debugElementStack = [];
  2993. }
  2994. this.stack.push(frame);
  2995. return '';
  2996. } // Safe because we just checked it's an element.
  2997. var nextElement = nextChild;
  2998. var elementType = nextElement.type;
  2999. if (typeof elementType === 'string') {
  3000. return this.renderDOM(nextElement, context, parentNamespace);
  3001. }
  3002. switch (elementType) {
  3003. case REACT_STRICT_MODE_TYPE:
  3004. case REACT_CONCURRENT_MODE_TYPE:
  3005. case REACT_PROFILER_TYPE:
  3006. case REACT_SUSPENSE_LIST_TYPE:
  3007. case REACT_FRAGMENT_TYPE:
  3008. {
  3009. var _nextChildren = toArray(nextChild.props.children);
  3010. var _frame = {
  3011. type: null,
  3012. domNamespace: parentNamespace,
  3013. children: _nextChildren,
  3014. childIndex: 0,
  3015. context: context,
  3016. footer: ''
  3017. };
  3018. {
  3019. _frame.debugElementStack = [];
  3020. }
  3021. this.stack.push(_frame);
  3022. return '';
  3023. }
  3024. case REACT_SUSPENSE_TYPE:
  3025. {
  3026. {
  3027. {
  3028. {
  3029. throw Error( "ReactDOMServer does not yet support Suspense." );
  3030. }
  3031. }
  3032. }
  3033. }
  3034. }
  3035. if (typeof elementType === 'object' && elementType !== null) {
  3036. switch (elementType.$$typeof) {
  3037. case REACT_FORWARD_REF_TYPE:
  3038. {
  3039. var element = nextChild;
  3040. var _nextChildren4;
  3041. var componentIdentity = {};
  3042. prepareToUseHooks(componentIdentity);
  3043. _nextChildren4 = elementType.render(element.props, element.ref);
  3044. _nextChildren4 = finishHooks(elementType.render, element.props, _nextChildren4, element.ref);
  3045. _nextChildren4 = toArray(_nextChildren4);
  3046. var _frame4 = {
  3047. type: null,
  3048. domNamespace: parentNamespace,
  3049. children: _nextChildren4,
  3050. childIndex: 0,
  3051. context: context,
  3052. footer: ''
  3053. };
  3054. {
  3055. _frame4.debugElementStack = [];
  3056. }
  3057. this.stack.push(_frame4);
  3058. return '';
  3059. }
  3060. case REACT_MEMO_TYPE:
  3061. {
  3062. var _element = nextChild;
  3063. var _nextChildren5 = [React.createElement(elementType.type, _assign({
  3064. ref: _element.ref
  3065. }, _element.props))];
  3066. var _frame5 = {
  3067. type: null,
  3068. domNamespace: parentNamespace,
  3069. children: _nextChildren5,
  3070. childIndex: 0,
  3071. context: context,
  3072. footer: ''
  3073. };
  3074. {
  3075. _frame5.debugElementStack = [];
  3076. }
  3077. this.stack.push(_frame5);
  3078. return '';
  3079. }
  3080. case REACT_PROVIDER_TYPE:
  3081. {
  3082. var provider = nextChild;
  3083. var nextProps = provider.props;
  3084. var _nextChildren6 = toArray(nextProps.children);
  3085. var _frame6 = {
  3086. type: provider,
  3087. domNamespace: parentNamespace,
  3088. children: _nextChildren6,
  3089. childIndex: 0,
  3090. context: context,
  3091. footer: ''
  3092. };
  3093. {
  3094. _frame6.debugElementStack = [];
  3095. }
  3096. this.pushProvider(provider);
  3097. this.stack.push(_frame6);
  3098. return '';
  3099. }
  3100. case REACT_CONTEXT_TYPE:
  3101. {
  3102. var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
  3103. // DEV mode, we create a separate object for Context.Consumer that acts
  3104. // like a proxy to Context. This proxy object adds unnecessary code in PROD
  3105. // so we use the old behaviour (Context.Consumer references Context) to
  3106. // reduce size and overhead. The separate object references context via
  3107. // a property called "_context", which also gives us the ability to check
  3108. // in DEV mode if this property exists or not and warn if it does not.
  3109. {
  3110. if (reactContext._context === undefined) {
  3111. // This may be because it's a Context (rather than a Consumer).
  3112. // Or it may be because it's older React where they're the same thing.
  3113. // We only want to warn if we're sure it's a new React.
  3114. if (reactContext !== reactContext.Consumer) {
  3115. if (!hasWarnedAboutUsingContextAsConsumer) {
  3116. hasWarnedAboutUsingContextAsConsumer = true;
  3117. error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
  3118. }
  3119. }
  3120. } else {
  3121. reactContext = reactContext._context;
  3122. }
  3123. }
  3124. var _nextProps = nextChild.props;
  3125. var threadID = this.threadID;
  3126. validateContextBounds(reactContext, threadID);
  3127. var nextValue = reactContext[threadID];
  3128. var _nextChildren7 = toArray(_nextProps.children(nextValue));
  3129. var _frame7 = {
  3130. type: nextChild,
  3131. domNamespace: parentNamespace,
  3132. children: _nextChildren7,
  3133. childIndex: 0,
  3134. context: context,
  3135. footer: ''
  3136. };
  3137. {
  3138. _frame7.debugElementStack = [];
  3139. }
  3140. this.stack.push(_frame7);
  3141. return '';
  3142. }
  3143. // eslint-disable-next-line-no-fallthrough
  3144. case REACT_FUNDAMENTAL_TYPE:
  3145. {
  3146. {
  3147. {
  3148. throw Error( "ReactDOMServer does not yet support the fundamental API." );
  3149. }
  3150. }
  3151. }
  3152. // eslint-disable-next-line-no-fallthrough
  3153. case REACT_LAZY_TYPE:
  3154. {
  3155. var _element2 = nextChild;
  3156. var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
  3157. // suspense server-side renderer is enabled so synchronously
  3158. // resolved constructors are supported.
  3159. initializeLazyComponentType(lazyComponent);
  3160. switch (lazyComponent._status) {
  3161. case Resolved:
  3162. {
  3163. var _nextChildren9 = [React.createElement(lazyComponent._result, _assign({
  3164. ref: _element2.ref
  3165. }, _element2.props))];
  3166. var _frame9 = {
  3167. type: null,
  3168. domNamespace: parentNamespace,
  3169. children: _nextChildren9,
  3170. childIndex: 0,
  3171. context: context,
  3172. footer: ''
  3173. };
  3174. {
  3175. _frame9.debugElementStack = [];
  3176. }
  3177. this.stack.push(_frame9);
  3178. return '';
  3179. }
  3180. case Rejected:
  3181. throw lazyComponent._result;
  3182. case Pending:
  3183. default:
  3184. {
  3185. {
  3186. throw Error( "ReactDOMServer does not yet support lazy-loaded components." );
  3187. }
  3188. }
  3189. }
  3190. }
  3191. // eslint-disable-next-line-no-fallthrough
  3192. case REACT_SCOPE_TYPE:
  3193. {
  3194. {
  3195. {
  3196. throw Error( "ReactDOMServer does not yet support scope components." );
  3197. }
  3198. }
  3199. }
  3200. }
  3201. }
  3202. var info = '';
  3203. {
  3204. var owner = nextElement._owner;
  3205. if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
  3206. info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
  3207. }
  3208. var ownerName = owner ? getComponentName(owner) : null;
  3209. if (ownerName) {
  3210. info += '\n\nCheck the render method of `' + ownerName + '`.';
  3211. }
  3212. }
  3213. {
  3214. {
  3215. throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info );
  3216. }
  3217. }
  3218. }
  3219. };
  3220. _proto.renderDOM = function renderDOM(element, context, parentNamespace) {
  3221. var tag = element.type.toLowerCase();
  3222. var namespace = parentNamespace;
  3223. if (parentNamespace === Namespaces.html) {
  3224. namespace = getIntrinsicNamespace(tag);
  3225. }
  3226. {
  3227. if (namespace === Namespaces.html) {
  3228. // Should this check be gated by parent namespace? Not sure we want to
  3229. // allow <SVG> or <mATH>.
  3230. if (tag !== element.type) {
  3231. error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type);
  3232. }
  3233. }
  3234. }
  3235. validateDangerousTag(tag);
  3236. var props = element.props;
  3237. if (tag === 'input') {
  3238. {
  3239. ReactControlledValuePropTypes.checkPropTypes('input', props);
  3240. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
  3241. error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
  3242. didWarnDefaultChecked = true;
  3243. }
  3244. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
  3245. error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
  3246. didWarnDefaultInputValue = true;
  3247. }
  3248. }
  3249. props = _assign({
  3250. type: undefined
  3251. }, props, {
  3252. defaultChecked: undefined,
  3253. defaultValue: undefined,
  3254. value: props.value != null ? props.value : props.defaultValue,
  3255. checked: props.checked != null ? props.checked : props.defaultChecked
  3256. });
  3257. } else if (tag === 'textarea') {
  3258. {
  3259. ReactControlledValuePropTypes.checkPropTypes('textarea', props);
  3260. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
  3261. error('Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
  3262. didWarnDefaultTextareaValue = true;
  3263. }
  3264. }
  3265. var initialValue = props.value;
  3266. if (initialValue == null) {
  3267. var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
  3268. var textareaChildren = props.children;
  3269. if (textareaChildren != null) {
  3270. {
  3271. error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
  3272. }
  3273. if (!(defaultValue == null)) {
  3274. {
  3275. throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
  3276. }
  3277. }
  3278. if (Array.isArray(textareaChildren)) {
  3279. if (!(textareaChildren.length <= 1)) {
  3280. {
  3281. throw Error( "<textarea> can only have at most one child." );
  3282. }
  3283. }
  3284. textareaChildren = textareaChildren[0];
  3285. }
  3286. defaultValue = '' + textareaChildren;
  3287. }
  3288. if (defaultValue == null) {
  3289. defaultValue = '';
  3290. }
  3291. initialValue = defaultValue;
  3292. }
  3293. props = _assign({}, props, {
  3294. value: undefined,
  3295. children: '' + initialValue
  3296. });
  3297. } else if (tag === 'select') {
  3298. {
  3299. ReactControlledValuePropTypes.checkPropTypes('select', props);
  3300. for (var i = 0; i < valuePropNames.length; i++) {
  3301. var propName = valuePropNames[i];
  3302. if (props[propName] == null) {
  3303. continue;
  3304. }
  3305. var isArray = Array.isArray(props[propName]);
  3306. if (props.multiple && !isArray) {
  3307. error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
  3308. } else if (!props.multiple && isArray) {
  3309. error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
  3310. }
  3311. }
  3312. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
  3313. error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
  3314. didWarnDefaultSelectValue = true;
  3315. }
  3316. }
  3317. this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
  3318. props = _assign({}, props, {
  3319. value: undefined
  3320. });
  3321. } else if (tag === 'option') {
  3322. var selected = null;
  3323. var selectValue = this.currentSelectValue;
  3324. var optionChildren = flattenOptionChildren(props.children);
  3325. if (selectValue != null) {
  3326. var value;
  3327. if (props.value != null) {
  3328. value = props.value + '';
  3329. } else {
  3330. value = optionChildren;
  3331. }
  3332. selected = false;
  3333. if (Array.isArray(selectValue)) {
  3334. // multiple
  3335. for (var j = 0; j < selectValue.length; j++) {
  3336. if ('' + selectValue[j] === value) {
  3337. selected = true;
  3338. break;
  3339. }
  3340. }
  3341. } else {
  3342. selected = '' + selectValue === value;
  3343. }
  3344. props = _assign({
  3345. selected: undefined,
  3346. children: undefined
  3347. }, props, {
  3348. selected: selected,
  3349. children: optionChildren
  3350. });
  3351. }
  3352. }
  3353. {
  3354. validatePropertiesInDevelopment(tag, props);
  3355. }
  3356. assertValidProps(tag, props);
  3357. var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
  3358. var footer = '';
  3359. if (omittedCloseTags.hasOwnProperty(tag)) {
  3360. out += '/>';
  3361. } else {
  3362. out += '>';
  3363. footer = '</' + element.type + '>';
  3364. }
  3365. var children;
  3366. var innerMarkup = getNonChildrenInnerMarkup(props);
  3367. if (innerMarkup != null) {
  3368. children = [];
  3369. if (newlineEatingTags.hasOwnProperty(tag) && innerMarkup.charAt(0) === '\n') {
  3370. // text/html ignores the first character in these tags if it's a newline
  3371. // Prefer to break application/xml over text/html (for now) by adding
  3372. // a newline specifically to get eaten by the parser. (Alternately for
  3373. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  3374. // \r is normalized out by HTMLTextAreaElement#value.)
  3375. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  3376. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  3377. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  3378. // See: Parsing of "textarea" "listing" and "pre" elements
  3379. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  3380. out += '\n';
  3381. }
  3382. out += innerMarkup;
  3383. } else {
  3384. children = toArray(props.children);
  3385. }
  3386. var frame = {
  3387. domNamespace: getChildNamespace(parentNamespace, element.type),
  3388. type: tag,
  3389. children: children,
  3390. childIndex: 0,
  3391. context: context,
  3392. footer: footer
  3393. };
  3394. {
  3395. frame.debugElementStack = [];
  3396. }
  3397. this.stack.push(frame);
  3398. this.previousWasTextNode = false;
  3399. return out;
  3400. };
  3401. return ReactDOMServerRenderer;
  3402. }();
  3403. /**
  3404. * Render a ReactElement to its initial HTML. This should only be used on the
  3405. * server.
  3406. * See https://reactjs.org/docs/react-dom-server.html#rendertostring
  3407. */
  3408. function renderToString(element) {
  3409. var renderer = new ReactDOMServerRenderer(element, false);
  3410. try {
  3411. var markup = renderer.read(Infinity);
  3412. return markup;
  3413. } finally {
  3414. renderer.destroy();
  3415. }
  3416. }
  3417. /**
  3418. * Similar to renderToString, except this doesn't create extra DOM attributes
  3419. * such as data-react-id that React uses internally.
  3420. * See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
  3421. */
  3422. function renderToStaticMarkup(element) {
  3423. var renderer = new ReactDOMServerRenderer(element, true);
  3424. try {
  3425. var markup = renderer.read(Infinity);
  3426. return markup;
  3427. } finally {
  3428. renderer.destroy();
  3429. }
  3430. }
  3431. function renderToNodeStream() {
  3432. {
  3433. {
  3434. throw Error( "ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead." );
  3435. }
  3436. }
  3437. }
  3438. function renderToStaticNodeStream() {
  3439. {
  3440. {
  3441. throw Error( "ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead." );
  3442. }
  3443. }
  3444. } // Note: when changing this, also consider https://github.com/facebook/react/issues/11526
  3445. var ReactDOMServer = {
  3446. renderToString: renderToString,
  3447. renderToStaticMarkup: renderToStaticMarkup,
  3448. renderToNodeStream: renderToNodeStream,
  3449. renderToStaticNodeStream: renderToStaticNodeStream,
  3450. version: ReactVersion
  3451. };
  3452. // TODO: decide on the top-level export form.
  3453. // This is hacky but makes it work with both Rollup and Jest
  3454. var server_browser = ReactDOMServer.default || ReactDOMServer;
  3455. return server_browser;
  3456. })));