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

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