Dashboard sipadu mbip
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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

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