12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["ReactDevToolsBackend"] = factory();
- else
- root["ReactDevToolsBackend"] = factory();
- })(window, function() {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 31);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export alphaSortKeys */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getAllEnumerableKeys; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return getWrappedDisplayName; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getDisplayName; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return getUID; });
- /* unused harmony export utfDecodeString */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return utfEncodeString; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return printOperationsArray; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getDefaultComponentFilters; });
- /* unused harmony export getSavedComponentFilters */
- /* unused harmony export setSavedComponentFilters */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return castBool; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return castBrowserTheme; });
- /* unused harmony export getAppendComponentStack */
- /* unused harmony export getBreakOnConsoleErrors */
- /* unused harmony export getHideConsoleLogsInStrictMode */
- /* unused harmony export getShowInlineWarningsAndErrors */
- /* unused harmony export getDefaultOpenInEditorURL */
- /* unused harmony export getOpenInEditorURL */
- /* unused harmony export separateDisplayNameAndHOCs */
- /* unused harmony export shallowDiffers */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getInObject; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deletePathInObject; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return renamePathInObject; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return setInObject; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getDataType; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getDisplayNameForReactElement; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return formatDataForPreview; });
- /* harmony import */ var lru_cache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19);
- /* harmony import */ var lru_cache__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lru_cache__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
- /* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_is__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var shared_ReactSymbols__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
- /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
- /* harmony import */ var _hydration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10);
- /* harmony import */ var _isArray__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6);
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // $FlowFixMe[method-unbinding]
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- var cachedDisplayNames = new WeakMap(); // On large trees, encoding takes significant time.
- // Try to reuse the already encoded strings.
- var encodedStringCache = new lru_cache__WEBPACK_IMPORTED_MODULE_0___default.a({
- max: 1000
- });
- function alphaSortKeys(a, b) {
- if (a.toString() > b.toString()) {
- return 1;
- } else if (b.toString() > a.toString()) {
- return -1;
- } else {
- return 0;
- }
- }
- function getAllEnumerableKeys(obj) {
- var keys = new Set();
- var current = obj;
- var _loop = function _loop() {
- var currentKeys = [].concat(_toConsumableArray(Object.keys(current)), _toConsumableArray(Object.getOwnPropertySymbols(current)));
- var descriptors = Object.getOwnPropertyDescriptors(current);
- currentKeys.forEach(function (key) {
- // $FlowFixMe: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
- if (descriptors[key].enumerable) {
- keys.add(key);
- }
- });
- current = Object.getPrototypeOf(current);
- };
- while (current != null) {
- _loop();
- }
- return keys;
- } // Mirror https://github.com/facebook/react/blob/7c21bf72ace77094fd1910cc350a548287ef8350/packages/shared/getComponentName.js#L27-L37
- function getWrappedDisplayName(outerType, innerType, wrapperName, fallbackName) {
- var displayName = outerType.displayName;
- return displayName || "".concat(wrapperName, "(").concat(getDisplayName(innerType, fallbackName), ")");
- }
- function getDisplayName(type) {
- var fallbackName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Anonymous';
- var nameFromCache = cachedDisplayNames.get(type);
- if (nameFromCache != null) {
- return nameFromCache;
- }
- var displayName = fallbackName; // The displayName property is not guaranteed to be a string.
- // It's only safe to use for our purposes if it's a string.
- // github.com/facebook/react-devtools/issues/803
- if (typeof type.displayName === 'string') {
- displayName = type.displayName;
- } else if (typeof type.name === 'string' && type.name !== '') {
- displayName = type.name;
- }
- cachedDisplayNames.set(type, displayName);
- return displayName;
- }
- var uidCounter = 0;
- function getUID() {
- return ++uidCounter;
- }
- function utfDecodeString(array) {
- // Avoid spreading the array (e.g. String.fromCodePoint(...array))
- // Functions arguments are first placed on the stack before the function is called
- // which throws a RangeError for large arrays.
- // See github.com/facebook/react/issues/22293
- var string = '';
- for (var i = 0; i < array.length; i++) {
- var char = array[i];
- string += String.fromCodePoint(char);
- }
- return string;
- }
- function surrogatePairToCodePoint(charCode1, charCode2) {
- return ((charCode1 & 0x3ff) << 10) + (charCode2 & 0x3ff) + 0x10000;
- } // Credit for this encoding approach goes to Tim Down:
- // https://stackoverflow.com/questions/4877326/how-can-i-tell-if-a-string-contains-multibyte-characters-in-javascript
- function utfEncodeString(string) {
- var cached = encodedStringCache.get(string);
- if (cached !== undefined) {
- return cached;
- }
- var encoded = [];
- var i = 0;
- var charCode;
- while (i < string.length) {
- charCode = string.charCodeAt(i); // Handle multibyte unicode characters (like emoji).
- if ((charCode & 0xf800) === 0xd800) {
- encoded.push(surrogatePairToCodePoint(charCode, string.charCodeAt(++i)));
- } else {
- encoded.push(charCode);
- }
- ++i;
- }
- encodedStringCache.set(string, encoded);
- return encoded;
- }
- function printOperationsArray(operations) {
- // The first two values are always rendererID and rootID
- var rendererID = operations[0];
- var rootID = operations[1];
- var logs = ["operations for renderer:".concat(rendererID, " and root:").concat(rootID)];
- var i = 2; // Reassemble the string table.
- var stringTable = [null // ID = 0 corresponds to the null string.
- ];
- var stringTableSize = operations[i++];
- var stringTableEnd = i + stringTableSize;
- while (i < stringTableEnd) {
- var nextLength = operations[i++];
- var nextString = utfDecodeString(operations.slice(i, i + nextLength));
- stringTable.push(nextString);
- i += nextLength;
- }
- while (i < operations.length) {
- var operation = operations[i];
- switch (operation) {
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_ADD */ "l"]:
- {
- var _id = operations[i + 1];
- var type = operations[i + 2];
- i += 3;
- if (type === _types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeRoot */ "m"]) {
- logs.push("Add new root node ".concat(_id));
- i++; // isStrictModeCompliant
- i++; // supportsProfiling
- i++; // supportsStrictMode
- i++; // hasOwnerMetadata
- } else {
- var parentID = operations[i];
- i++;
- i++; // ownerID
- var displayNameStringID = operations[i];
- var displayName = stringTable[displayNameStringID];
- i++;
- i++; // key
- logs.push("Add node ".concat(_id, " (").concat(displayName || 'null', ") as child of ").concat(parentID));
- }
- break;
- }
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_REMOVE */ "m"]:
- {
- var removeLength = operations[i + 1];
- i += 2;
- for (var removeIndex = 0; removeIndex < removeLength; removeIndex++) {
- var _id2 = operations[i];
- i += 1;
- logs.push("Remove node ".concat(_id2));
- }
- break;
- }
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_REMOVE_ROOT */ "n"]:
- {
- i += 1;
- logs.push("Remove root ".concat(rootID));
- break;
- }
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_SET_SUBTREE_MODE */ "p"]:
- {
- var _id3 = operations[i + 1];
- var mode = operations[i + 1];
- i += 3;
- logs.push("Mode ".concat(mode, " set for subtree with root ").concat(_id3));
- break;
- }
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_REORDER_CHILDREN */ "o"]:
- {
- var _id4 = operations[i + 1];
- var numChildren = operations[i + 2];
- i += 3;
- var children = operations.slice(i, i + numChildren);
- i += numChildren;
- logs.push("Re-order node ".concat(_id4, " children ").concat(children.join(',')));
- break;
- }
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_UPDATE_TREE_BASE_DURATION */ "r"]:
- // Base duration updates are only sent while profiling is in progress.
- // We can ignore them at this point.
- // The profiler UI uses them lazily in order to generate the tree.
- i += 3;
- break;
- case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS */ "q"]:
- var id = operations[i + 1];
- var numErrors = operations[i + 2];
- var numWarnings = operations[i + 3];
- i += 4;
- logs.push("Node ".concat(id, " has ").concat(numErrors, " errors and ").concat(numWarnings, " warnings"));
- break;
- default:
- throw Error("Unsupported Bridge operation \"".concat(operation, "\""));
- }
- }
- console.log(logs.join('\n '));
- }
- function getDefaultComponentFilters() {
- return [{
- type: _types__WEBPACK_IMPORTED_MODULE_4__[/* ComponentFilterElementType */ "b"],
- value: _types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeHostComponent */ "i"],
- isEnabled: true
- }];
- }
- function getSavedComponentFilters() {
- try {
- var raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY */ "a"]);
- if (raw != null) {
- return JSON.parse(raw);
- }
- } catch (error) {}
- return getDefaultComponentFilters();
- }
- function setSavedComponentFilters(componentFilters) {
- Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageSetItem */ "b"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY */ "a"], JSON.stringify(componentFilters));
- }
- function parseBool(s) {
- if (s === 'true') {
- return true;
- }
- if (s === 'false') {
- return false;
- }
- }
- function castBool(v) {
- if (v === true || v === false) {
- return v;
- }
- }
- function castBrowserTheme(v) {
- if (v === 'light' || v === 'dark' || v === 'auto') {
- return v;
- }
- }
- function getAppendComponentStack() {
- var _parseBool;
- var raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY */ "d"]);
- return (_parseBool = parseBool(raw)) !== null && _parseBool !== void 0 ? _parseBool : true;
- }
- function getBreakOnConsoleErrors() {
- var _parseBool2;
- var raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS */ "e"]);
- return (_parseBool2 = parseBool(raw)) !== null && _parseBool2 !== void 0 ? _parseBool2 : false;
- }
- function getHideConsoleLogsInStrictMode() {
- var _parseBool3;
- var raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE */ "b"]);
- return (_parseBool3 = parseBool(raw)) !== null && _parseBool3 !== void 0 ? _parseBool3 : false;
- }
- function getShowInlineWarningsAndErrors() {
- var _parseBool4;
- var raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY */ "f"]);
- return (_parseBool4 = parseBool(raw)) !== null && _parseBool4 !== void 0 ? _parseBool4 : true;
- }
- function getDefaultOpenInEditorURL() {
- return typeof process.env.EDITOR_URL === 'string' ? process.env.EDITOR_URL : '';
- }
- function getOpenInEditorURL() {
- try {
- var raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_OPEN_IN_EDITOR_URL */ "c"]);
- if (raw != null) {
- return JSON.parse(raw);
- }
- } catch (error) {}
- return getDefaultOpenInEditorURL();
- }
- function separateDisplayNameAndHOCs(displayName, type) {
- if (displayName === null) {
- return [null, null];
- }
- var hocDisplayNames = null;
- switch (type) {
- case _types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeClass */ "e"]:
- case _types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeForwardRef */ "g"]:
- case _types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeFunction */ "h"]:
- case _types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeMemo */ "j"]:
- if (displayName.indexOf('(') >= 0) {
- var matches = displayName.match(/[^()]+/g);
- if (matches != null) {
- displayName = matches.pop();
- hocDisplayNames = matches;
- }
- }
- break;
- default:
- break;
- }
- return [displayName, hocDisplayNames];
- } // Pulled from react-compat
- // https://github.com/developit/preact-compat/blob/7c5de00e7c85e2ffd011bf3af02899b63f699d3a/src/index.js#L349
- function shallowDiffers(prev, next) {
- for (var attribute in prev) {
- if (!(attribute in next)) {
- return true;
- }
- }
- for (var _attribute in next) {
- if (prev[_attribute] !== next[_attribute]) {
- return true;
- }
- }
- return false;
- }
- function getInObject(object, path) {
- return path.reduce(function (reduced, attr) {
- if (reduced) {
- if (hasOwnProperty.call(reduced, attr)) {
- return reduced[attr];
- }
- if (typeof reduced[Symbol.iterator] === 'function') {
- // Convert iterable to array and return array[index]
- //
- // TRICKY
- // Don't use [...spread] syntax for this purpose.
- // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
- // Other types (e.g. typed arrays, Sets) will not spread correctly.
- return Array.from(reduced)[attr];
- }
- }
- return null;
- }, object);
- }
- function deletePathInObject(object, path) {
- var length = path.length;
- var last = path[length - 1];
- if (object != null) {
- var parent = getInObject(object, path.slice(0, length - 1));
- if (parent) {
- if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(parent)) {
- parent.splice(last, 1);
- } else {
- delete parent[last];
- }
- }
- }
- }
- function renamePathInObject(object, oldPath, newPath) {
- var length = oldPath.length;
- if (object != null) {
- var parent = getInObject(object, oldPath.slice(0, length - 1));
- if (parent) {
- var lastOld = oldPath[length - 1];
- var lastNew = newPath[length - 1];
- parent[lastNew] = parent[lastOld];
- if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(parent)) {
- parent.splice(lastOld, 1);
- } else {
- delete parent[lastOld];
- }
- }
- }
- }
- function setInObject(object, path, value) {
- var length = path.length;
- var last = path[length - 1];
- if (object != null) {
- var parent = getInObject(object, path.slice(0, length - 1));
- if (parent) {
- parent[last] = value;
- }
- }
- }
- /**
- * Get a enhanced/artificial type string based on the object instance
- */
- function getDataType(data) {
- if (data === null) {
- return 'null';
- } else if (data === undefined) {
- return 'undefined';
- }
- if (Object(react_is__WEBPACK_IMPORTED_MODULE_1__["isElement"])(data)) {
- return 'react_element';
- }
- if (typeof HTMLElement !== 'undefined' && data instanceof HTMLElement) {
- return 'html_element';
- }
- var type = _typeof(data);
- switch (type) {
- case 'bigint':
- return 'bigint';
- case 'boolean':
- return 'boolean';
- case 'function':
- return 'function';
- case 'number':
- if (Number.isNaN(data)) {
- return 'nan';
- } else if (!Number.isFinite(data)) {
- return 'infinity';
- } else {
- return 'number';
- }
- case 'object':
- if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(data)) {
- return 'array';
- } else if (ArrayBuffer.isView(data)) {
- return hasOwnProperty.call(data.constructor, 'BYTES_PER_ELEMENT') ? 'typed_array' : 'data_view';
- } else if (data.constructor && data.constructor.name === 'ArrayBuffer') {
- // HACK This ArrayBuffer check is gross; is there a better way?
- // We could try to create a new DataView with the value.
- // If it doesn't error, we know it's an ArrayBuffer,
- // but this seems kind of awkward and expensive.
- return 'array_buffer';
- } else if (typeof data[Symbol.iterator] === 'function') {
- var iterator = data[Symbol.iterator]();
- if (!iterator) {// Proxies might break assumptoins about iterators.
- // See github.com/facebook/react/issues/21654
- } else {
- return iterator === data ? 'opaque_iterator' : 'iterator';
- }
- } else if (data.constructor && data.constructor.name === 'RegExp') {
- return 'regexp';
- } else {
- // $FlowFixMe[method-unbinding]
- var toStringValue = Object.prototype.toString.call(data);
- if (toStringValue === '[object Date]') {
- return 'date';
- } else if (toStringValue === '[object HTMLAllCollection]') {
- return 'html_all_collection';
- }
- }
- return 'object';
- case 'string':
- return 'string';
- case 'symbol':
- return 'symbol';
- case 'undefined':
- if ( // $FlowFixMe[method-unbinding]
- Object.prototype.toString.call(data) === '[object HTMLAllCollection]') {
- return 'html_all_collection';
- }
- return 'undefined';
- default:
- return 'unknown';
- }
- }
- function getDisplayNameForReactElement(element) {
- var elementType = Object(react_is__WEBPACK_IMPORTED_MODULE_1__["typeOf"])(element);
- switch (elementType) {
- case react_is__WEBPACK_IMPORTED_MODULE_1__["ContextConsumer"]:
- return 'ContextConsumer';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["ContextProvider"]:
- return 'ContextProvider';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["ForwardRef"]:
- return 'ForwardRef';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["Fragment"]:
- return 'Fragment';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["Lazy"]:
- return 'Lazy';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["Memo"]:
- return 'Memo';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["Portal"]:
- return 'Portal';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["Profiler"]:
- return 'Profiler';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["StrictMode"]:
- return 'StrictMode';
- case react_is__WEBPACK_IMPORTED_MODULE_1__["Suspense"]:
- return 'Suspense';
- case shared_ReactSymbols__WEBPACK_IMPORTED_MODULE_2__[/* REACT_SUSPENSE_LIST_TYPE */ "a"]:
- return 'SuspenseList';
- case shared_ReactSymbols__WEBPACK_IMPORTED_MODULE_2__[/* REACT_TRACING_MARKER_TYPE */ "b"]:
- return 'TracingMarker';
- default:
- var type = element.type;
- if (typeof type === 'string') {
- return type;
- } else if (typeof type === 'function') {
- return getDisplayName(type, 'Anonymous');
- } else if (type != null) {
- return 'NotImplementedInDevtools';
- } else {
- return 'Element';
- }
- }
- }
- var MAX_PREVIEW_STRING_LENGTH = 50;
- function truncateForDisplay(string) {
- var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_PREVIEW_STRING_LENGTH;
- if (string.length > length) {
- return string.substr(0, length) + '…';
- } else {
- return string;
- }
- } // Attempts to mimic Chrome's inline preview for values.
- // For example, the following value...
- // {
- // foo: 123,
- // bar: "abc",
- // baz: [true, false],
- // qux: { ab: 1, cd: 2 }
- // };
- //
- // Would show a preview of...
- // {foo: 123, bar: "abc", baz: Array(2), qux: {…}}
- //
- // And the following value...
- // [
- // 123,
- // "abc",
- // [true, false],
- // { foo: 123, bar: "abc" }
- // ];
- //
- // Would show a preview of...
- // [123, "abc", Array(2), {…}]
- function formatDataForPreview(data, showFormattedValue) {
- if (data != null && hasOwnProperty.call(data, _hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].type)) {
- return showFormattedValue ? data[_hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].preview_long] : data[_hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].preview_short];
- }
- var type = getDataType(data);
- switch (type) {
- case 'html_element':
- return "<".concat(truncateForDisplay(data.tagName.toLowerCase()), " />");
- case 'function':
- return truncateForDisplay("\u0192 ".concat(typeof data.name === 'function' ? '' : data.name, "() {}"));
- case 'string':
- return "\"".concat(data, "\"");
- case 'bigint':
- return truncateForDisplay(data.toString() + 'n');
- case 'regexp':
- return truncateForDisplay(data.toString());
- case 'symbol':
- return truncateForDisplay(data.toString());
- case 'react_element':
- return "<".concat(truncateForDisplay(getDisplayNameForReactElement(data) || 'Unknown'), " />");
- case 'array_buffer':
- return "ArrayBuffer(".concat(data.byteLength, ")");
- case 'data_view':
- return "DataView(".concat(data.buffer.byteLength, ")");
- case 'array':
- if (showFormattedValue) {
- var formatted = '';
- for (var i = 0; i < data.length; i++) {
- if (i > 0) {
- formatted += ', ';
- }
- formatted += formatDataForPreview(data[i], false);
- if (formatted.length > MAX_PREVIEW_STRING_LENGTH) {
- // Prevent doing a lot of unnecessary iteration...
- break;
- }
- }
- return "[".concat(truncateForDisplay(formatted), "]");
- } else {
- var length = hasOwnProperty.call(data, _hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].size) ? data[_hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].size] : data.length;
- return "Array(".concat(length, ")");
- }
- case 'typed_array':
- var shortName = "".concat(data.constructor.name, "(").concat(data.length, ")");
- if (showFormattedValue) {
- var _formatted = '';
- for (var _i = 0; _i < data.length; _i++) {
- if (_i > 0) {
- _formatted += ', ';
- }
- _formatted += data[_i];
- if (_formatted.length > MAX_PREVIEW_STRING_LENGTH) {
- // Prevent doing a lot of unnecessary iteration...
- break;
- }
- }
- return "".concat(shortName, " [").concat(truncateForDisplay(_formatted), "]");
- } else {
- return shortName;
- }
- case 'iterator':
- var name = data.constructor.name;
- if (showFormattedValue) {
- // TRICKY
- // Don't use [...spread] syntax for this purpose.
- // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
- // Other types (e.g. typed arrays, Sets) will not spread correctly.
- var array = Array.from(data);
- var _formatted2 = '';
- for (var _i2 = 0; _i2 < array.length; _i2++) {
- var entryOrEntries = array[_i2];
- if (_i2 > 0) {
- _formatted2 += ', ';
- } // TRICKY
- // Browsers display Maps and Sets differently.
- // To mimic their behavior, detect if we've been given an entries tuple.
- // Map(2) {"abc" => 123, "def" => 123}
- // Set(2) {"abc", 123}
- if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(entryOrEntries)) {
- var key = formatDataForPreview(entryOrEntries[0], true);
- var value = formatDataForPreview(entryOrEntries[1], false);
- _formatted2 += "".concat(key, " => ").concat(value);
- } else {
- _formatted2 += formatDataForPreview(entryOrEntries, false);
- }
- if (_formatted2.length > MAX_PREVIEW_STRING_LENGTH) {
- // Prevent doing a lot of unnecessary iteration...
- break;
- }
- }
- return "".concat(name, "(").concat(data.size, ") {").concat(truncateForDisplay(_formatted2), "}");
- } else {
- return "".concat(name, "(").concat(data.size, ")");
- }
- case 'opaque_iterator':
- {
- return data[Symbol.toStringTag];
- }
- case 'date':
- return data.toString();
- case 'object':
- if (showFormattedValue) {
- var keys = Array.from(getAllEnumerableKeys(data)).sort(alphaSortKeys);
- var _formatted3 = '';
- for (var _i3 = 0; _i3 < keys.length; _i3++) {
- var _key = keys[_i3];
- if (_i3 > 0) {
- _formatted3 += ', ';
- }
- _formatted3 += "".concat(_key.toString(), ": ").concat(formatDataForPreview(data[_key], false));
- if (_formatted3.length > MAX_PREVIEW_STRING_LENGTH) {
- // Prevent doing a lot of unnecessary iteration...
- break;
- }
- }
- return "{".concat(truncateForDisplay(_formatted3), "}");
- } else {
- return '{…}';
- }
- case 'boolean':
- case 'number':
- case 'infinity':
- case 'nan':
- case 'null':
- case 'undefined':
- return data;
- default:
- try {
- return truncateForDisplay(String(data));
- } catch (error) {
- return 'unserializable';
- }
- }
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(17)))
- /***/ }),
- /* 1 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ElementTypeClass; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ElementTypeContext; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return ElementTypeFunction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return ElementTypeForwardRef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ElementTypeHostComponent; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return ElementTypeMemo; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return ElementTypeOtherOrUnknown; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return ElementTypeProfiler; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return ElementTypeRoot; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return ElementTypeSuspense; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return ElementTypeSuspenseList; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return ElementTypeTracingMarker; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ComponentFilterElementType; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ComponentFilterDisplayName; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ComponentFilterLocation; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ComponentFilterHOC; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return StrictMode; });
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // WARNING
- // The values below are referenced by ComponentFilters (which are saved via localStorage).
- // Do not change them or it will break previously saved user customizations.
- // If new element types are added, use new numbers rather than re-ordering existing ones.
- //
- // Changing these types is also a backwards breaking change for the standalone shell,
- // since the frontend and backend must share the same values-
- // and the backend is embedded in certain environments (like React Native).
- var ElementTypeClass = 1;
- var ElementTypeContext = 2;
- var ElementTypeFunction = 5;
- var ElementTypeForwardRef = 6;
- var ElementTypeHostComponent = 7;
- var ElementTypeMemo = 8;
- var ElementTypeOtherOrUnknown = 9;
- var ElementTypeProfiler = 10;
- var ElementTypeRoot = 11;
- var ElementTypeSuspense = 12;
- var ElementTypeSuspenseList = 13;
- var ElementTypeTracingMarker = 14; // Different types of elements displayed in the Elements tree.
- // These types may be used to visually distinguish types,
- // or to enable/disable certain functionality.
- // WARNING
- // The values below are referenced by ComponentFilters (which are saved via localStorage).
- // Do not change them or it will break previously saved user customizations.
- // If new filter types are added, use new numbers rather than re-ordering existing ones.
- var ComponentFilterElementType = 1;
- var ComponentFilterDisplayName = 2;
- var ComponentFilterLocation = 3;
- var ComponentFilterHOC = 4;
- var StrictMode = 1;
- /***/ }),
- /* 2 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export CHROME_WEBSTORE_EXTENSION_ID */
- /* unused harmony export INTERNAL_EXTENSION_ID */
- /* unused harmony export LOCAL_EXTENSION_ID */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return __DEBUG__; });
- /* unused harmony export __PERFORMANCE_PROFILE__ */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return TREE_OPERATION_ADD; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return TREE_OPERATION_REMOVE; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return TREE_OPERATION_REORDER_CHILDREN; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return TREE_OPERATION_UPDATE_TREE_BASE_DURATION; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return TREE_OPERATION_REMOVE_ROOT; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return TREE_OPERATION_SET_SUBTREE_MODE; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return PROFILING_FLAG_BASIC_SUPPORT; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return PROFILING_FLAG_TIMELINE_SUPPORT; });
- /* unused harmony export LOCAL_STORAGE_DEFAULT_TAB_KEY */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return SESSION_STORAGE_LAST_SELECTION_KEY; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return LOCAL_STORAGE_OPEN_IN_EDITOR_URL; });
- /* unused harmony export LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return SESSION_STORAGE_RELOAD_AND_PROFILE_KEY; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS; });
- /* unused harmony export LOCAL_STORAGE_BROWSER_THEME */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY; });
- /* unused harmony export LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE; });
- /* unused harmony export PROFILER_EXPORT_VERSION */
- /* unused harmony export CHANGE_LOG_URL */
- /* unused harmony export UNSUPPORTED_VERSION_URL */
- /* unused harmony export REACT_DEVTOOLS_WORKPLACE_URL */
- /* unused harmony export THEME_STYLES */
- /* unused harmony export COMFORTABLE_LINE_HEIGHT */
- /* unused harmony export COMPACT_LINE_HEIGHT */
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var CHROME_WEBSTORE_EXTENSION_ID = 'fmkadmapgofadopljbjfkapdkoienihi';
- var INTERNAL_EXTENSION_ID = 'dnjnjgbfilfphmojnmhliehogmojhclc';
- var LOCAL_EXTENSION_ID = 'ikiahnapldjmdmpkmfhjdjilojjhgcbf'; // Flip this flag to true to enable verbose console debug logging.
- var __DEBUG__ = false; // Flip this flag to true to enable performance.mark() and performance.measure() timings.
- var __PERFORMANCE_PROFILE__ = false;
- var TREE_OPERATION_ADD = 1;
- var TREE_OPERATION_REMOVE = 2;
- var TREE_OPERATION_REORDER_CHILDREN = 3;
- var TREE_OPERATION_UPDATE_TREE_BASE_DURATION = 4;
- var TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS = 5;
- var TREE_OPERATION_REMOVE_ROOT = 6;
- var TREE_OPERATION_SET_SUBTREE_MODE = 7;
- var PROFILING_FLAG_BASIC_SUPPORT = 1;
- var PROFILING_FLAG_TIMELINE_SUPPORT = 2;
- var LOCAL_STORAGE_DEFAULT_TAB_KEY = 'React::DevTools::defaultTab';
- var LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY = 'React::DevTools::componentFilters';
- var SESSION_STORAGE_LAST_SELECTION_KEY = 'React::DevTools::lastSelection';
- var LOCAL_STORAGE_OPEN_IN_EDITOR_URL = 'React::DevTools::openInEditorUrl';
- var LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY = 'React::DevTools::parseHookNames';
- var SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY = 'React::DevTools::recordChangeDescriptions';
- var SESSION_STORAGE_RELOAD_AND_PROFILE_KEY = 'React::DevTools::reloadAndProfile';
- var LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS = 'React::DevTools::breakOnConsoleErrors';
- var LOCAL_STORAGE_BROWSER_THEME = 'React::DevTools::theme';
- var LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY = 'React::DevTools::appendComponentStack';
- var LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY = 'React::DevTools::showInlineWarningsAndErrors';
- var LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY = 'React::DevTools::traceUpdatesEnabled';
- var LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE = 'React::DevTools::hideConsoleLogsInStrictMode';
- var PROFILER_EXPORT_VERSION = 5;
- var CHANGE_LOG_URL = 'https://github.com/facebook/react/blob/main/packages/react-devtools/CHANGELOG.md';
- var UNSUPPORTED_VERSION_URL = 'https://reactjs.org/blog/2019/08/15/new-react-devtools.html#how-do-i-get-the-old-version-back';
- var REACT_DEVTOOLS_WORKPLACE_URL = 'https://fburl.com/react-devtools-workplace-group';
- var THEME_STYLES = {
- light: {
- '--color-attribute-name': '#ef6632',
- '--color-attribute-name-not-editable': '#23272f',
- '--color-attribute-name-inverted': 'rgba(255, 255, 255, 0.7)',
- '--color-attribute-value': '#1a1aa6',
- '--color-attribute-value-inverted': '#ffffff',
- '--color-attribute-editable-value': '#1a1aa6',
- '--color-background': '#ffffff',
- '--color-background-hover': 'rgba(0, 136, 250, 0.1)',
- '--color-background-inactive': '#e5e5e5',
- '--color-background-invalid': '#fff0f0',
- '--color-background-selected': '#0088fa',
- '--color-button-background': '#ffffff',
- '--color-button-background-focus': '#ededed',
- '--color-button': '#5f6673',
- '--color-button-disabled': '#cfd1d5',
- '--color-button-active': '#0088fa',
- '--color-button-focus': '#23272f',
- '--color-button-hover': '#23272f',
- '--color-border': '#eeeeee',
- '--color-commit-did-not-render-fill': '#cfd1d5',
- '--color-commit-did-not-render-fill-text': '#000000',
- '--color-commit-did-not-render-pattern': '#cfd1d5',
- '--color-commit-did-not-render-pattern-text': '#333333',
- '--color-commit-gradient-0': '#37afa9',
- '--color-commit-gradient-1': '#63b19e',
- '--color-commit-gradient-2': '#80b393',
- '--color-commit-gradient-3': '#97b488',
- '--color-commit-gradient-4': '#abb67d',
- '--color-commit-gradient-5': '#beb771',
- '--color-commit-gradient-6': '#cfb965',
- '--color-commit-gradient-7': '#dfba57',
- '--color-commit-gradient-8': '#efbb49',
- '--color-commit-gradient-9': '#febc38',
- '--color-commit-gradient-text': '#000000',
- '--color-component-name': '#6a51b2',
- '--color-component-name-inverted': '#ffffff',
- '--color-component-badge-background': 'rgba(0, 0, 0, 0.1)',
- '--color-component-badge-background-inverted': 'rgba(255, 255, 255, 0.25)',
- '--color-component-badge-count': '#777d88',
- '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)',
- '--color-console-error-badge-text': '#ffffff',
- '--color-console-error-background': '#fff0f0',
- '--color-console-error-border': '#ffd6d6',
- '--color-console-error-icon': '#eb3941',
- '--color-console-error-text': '#fe2e31',
- '--color-console-warning-badge-text': '#000000',
- '--color-console-warning-background': '#fffbe5',
- '--color-console-warning-border': '#fff5c1',
- '--color-console-warning-icon': '#f4bd00',
- '--color-console-warning-text': '#64460c',
- '--color-context-background': 'rgba(0,0,0,.9)',
- '--color-context-background-hover': 'rgba(255, 255, 255, 0.1)',
- '--color-context-background-selected': '#178fb9',
- '--color-context-border': '#3d424a',
- '--color-context-text': '#ffffff',
- '--color-context-text-selected': '#ffffff',
- '--color-dim': '#777d88',
- '--color-dimmer': '#cfd1d5',
- '--color-dimmest': '#eff0f1',
- '--color-error-background': 'hsl(0, 100%, 97%)',
- '--color-error-border': 'hsl(0, 100%, 92%)',
- '--color-error-text': '#ff0000',
- '--color-expand-collapse-toggle': '#777d88',
- '--color-link': '#0000ff',
- '--color-modal-background': 'rgba(255, 255, 255, 0.75)',
- '--color-bridge-version-npm-background': '#eff0f1',
- '--color-bridge-version-npm-text': '#000000',
- '--color-bridge-version-number': '#0088fa',
- '--color-primitive-hook-badge-background': '#e5e5e5',
- '--color-primitive-hook-badge-text': '#5f6673',
- '--color-record-active': '#fc3a4b',
- '--color-record-hover': '#3578e5',
- '--color-record-inactive': '#0088fa',
- '--color-resize-bar': '#eeeeee',
- '--color-resize-bar-active': '#dcdcdc',
- '--color-resize-bar-border': '#d1d1d1',
- '--color-resize-bar-dot': '#333333',
- '--color-timeline-internal-module': '#d1d1d1',
- '--color-timeline-internal-module-hover': '#c9c9c9',
- '--color-timeline-internal-module-text': '#444',
- '--color-timeline-native-event': '#ccc',
- '--color-timeline-native-event-hover': '#aaa',
- '--color-timeline-network-primary': '#fcf3dc',
- '--color-timeline-network-primary-hover': '#f0e7d1',
- '--color-timeline-network-secondary': '#efc457',
- '--color-timeline-network-secondary-hover': '#e3ba52',
- '--color-timeline-priority-background': '#f6f6f6',
- '--color-timeline-priority-border': '#eeeeee',
- '--color-timeline-user-timing': '#c9cacd',
- '--color-timeline-user-timing-hover': '#93959a',
- '--color-timeline-react-idle': '#d3e5f6',
- '--color-timeline-react-idle-hover': '#c3d9ef',
- '--color-timeline-react-render': '#9fc3f3',
- '--color-timeline-react-render-hover': '#83afe9',
- '--color-timeline-react-render-text': '#11365e',
- '--color-timeline-react-commit': '#c88ff0',
- '--color-timeline-react-commit-hover': '#b281d6',
- '--color-timeline-react-commit-text': '#3e2c4a',
- '--color-timeline-react-layout-effects': '#b281d6',
- '--color-timeline-react-layout-effects-hover': '#9d71bd',
- '--color-timeline-react-layout-effects-text': '#3e2c4a',
- '--color-timeline-react-passive-effects': '#b281d6',
- '--color-timeline-react-passive-effects-hover': '#9d71bd',
- '--color-timeline-react-passive-effects-text': '#3e2c4a',
- '--color-timeline-react-schedule': '#9fc3f3',
- '--color-timeline-react-schedule-hover': '#2683E2',
- '--color-timeline-react-suspense-rejected': '#f1cc14',
- '--color-timeline-react-suspense-rejected-hover': '#ffdf37',
- '--color-timeline-react-suspense-resolved': '#a6e59f',
- '--color-timeline-react-suspense-resolved-hover': '#89d281',
- '--color-timeline-react-suspense-unresolved': '#c9cacd',
- '--color-timeline-react-suspense-unresolved-hover': '#93959a',
- '--color-timeline-thrown-error': '#ee1638',
- '--color-timeline-thrown-error-hover': '#da1030',
- '--color-timeline-text-color': '#000000',
- '--color-timeline-text-dim-color': '#ccc',
- '--color-timeline-react-work-border': '#eeeeee',
- '--color-search-match': 'yellow',
- '--color-search-match-current': '#f7923b',
- '--color-selected-tree-highlight-active': 'rgba(0, 136, 250, 0.1)',
- '--color-selected-tree-highlight-inactive': 'rgba(0, 0, 0, 0.05)',
- '--color-scroll-caret': 'rgba(150, 150, 150, 0.5)',
- '--color-tab-selected-border': '#0088fa',
- '--color-text': '#000000',
- '--color-text-invalid': '#ff0000',
- '--color-text-selected': '#ffffff',
- '--color-toggle-background-invalid': '#fc3a4b',
- '--color-toggle-background-on': '#0088fa',
- '--color-toggle-background-off': '#cfd1d5',
- '--color-toggle-text': '#ffffff',
- '--color-warning-background': '#fb3655',
- '--color-warning-background-hover': '#f82042',
- '--color-warning-text-color': '#ffffff',
- '--color-warning-text-color-inverted': '#fd4d69',
- // The styles below should be kept in sync with 'root.css'
- // They are repeated there because they're used by e.g. tooltips or context menus
- // which get rendered outside of the DOM subtree (where normal theme/styles are written).
- '--color-scroll-thumb': '#c2c2c2',
- '--color-scroll-track': '#fafafa',
- '--color-tooltip-background': 'rgba(0, 0, 0, 0.9)',
- '--color-tooltip-text': '#ffffff'
- },
- dark: {
- '--color-attribute-name': '#9d87d2',
- '--color-attribute-name-not-editable': '#ededed',
- '--color-attribute-name-inverted': '#282828',
- '--color-attribute-value': '#cedae0',
- '--color-attribute-value-inverted': '#ffffff',
- '--color-attribute-editable-value': 'yellow',
- '--color-background': '#282c34',
- '--color-background-hover': 'rgba(255, 255, 255, 0.1)',
- '--color-background-inactive': '#3d424a',
- '--color-background-invalid': '#5c0000',
- '--color-background-selected': '#178fb9',
- '--color-button-background': '#282c34',
- '--color-button-background-focus': '#3d424a',
- '--color-button': '#afb3b9',
- '--color-button-active': '#61dafb',
- '--color-button-disabled': '#4f5766',
- '--color-button-focus': '#a2e9fc',
- '--color-button-hover': '#ededed',
- '--color-border': '#3d424a',
- '--color-commit-did-not-render-fill': '#777d88',
- '--color-commit-did-not-render-fill-text': '#000000',
- '--color-commit-did-not-render-pattern': '#666c77',
- '--color-commit-did-not-render-pattern-text': '#ffffff',
- '--color-commit-gradient-0': '#37afa9',
- '--color-commit-gradient-1': '#63b19e',
- '--color-commit-gradient-2': '#80b393',
- '--color-commit-gradient-3': '#97b488',
- '--color-commit-gradient-4': '#abb67d',
- '--color-commit-gradient-5': '#beb771',
- '--color-commit-gradient-6': '#cfb965',
- '--color-commit-gradient-7': '#dfba57',
- '--color-commit-gradient-8': '#efbb49',
- '--color-commit-gradient-9': '#febc38',
- '--color-commit-gradient-text': '#000000',
- '--color-component-name': '#61dafb',
- '--color-component-name-inverted': '#282828',
- '--color-component-badge-background': 'rgba(255, 255, 255, 0.25)',
- '--color-component-badge-background-inverted': 'rgba(0, 0, 0, 0.25)',
- '--color-component-badge-count': '#8f949d',
- '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)',
- '--color-console-error-badge-text': '#000000',
- '--color-console-error-background': '#290000',
- '--color-console-error-border': '#5c0000',
- '--color-console-error-icon': '#eb3941',
- '--color-console-error-text': '#fc7f7f',
- '--color-console-warning-badge-text': '#000000',
- '--color-console-warning-background': '#332b00',
- '--color-console-warning-border': '#665500',
- '--color-console-warning-icon': '#f4bd00',
- '--color-console-warning-text': '#f5f2ed',
- '--color-context-background': 'rgba(255,255,255,.95)',
- '--color-context-background-hover': 'rgba(0, 136, 250, 0.1)',
- '--color-context-background-selected': '#0088fa',
- '--color-context-border': '#eeeeee',
- '--color-context-text': '#000000',
- '--color-context-text-selected': '#ffffff',
- '--color-dim': '#8f949d',
- '--color-dimmer': '#777d88',
- '--color-dimmest': '#4f5766',
- '--color-error-background': '#200',
- '--color-error-border': '#900',
- '--color-error-text': '#f55',
- '--color-expand-collapse-toggle': '#8f949d',
- '--color-link': '#61dafb',
- '--color-modal-background': 'rgba(0, 0, 0, 0.75)',
- '--color-bridge-version-npm-background': 'rgba(0, 0, 0, 0.25)',
- '--color-bridge-version-npm-text': '#ffffff',
- '--color-bridge-version-number': 'yellow',
- '--color-primitive-hook-badge-background': 'rgba(0, 0, 0, 0.25)',
- '--color-primitive-hook-badge-text': 'rgba(255, 255, 255, 0.7)',
- '--color-record-active': '#fc3a4b',
- '--color-record-hover': '#a2e9fc',
- '--color-record-inactive': '#61dafb',
- '--color-resize-bar': '#282c34',
- '--color-resize-bar-active': '#31363f',
- '--color-resize-bar-border': '#3d424a',
- '--color-resize-bar-dot': '#cfd1d5',
- '--color-timeline-internal-module': '#303542',
- '--color-timeline-internal-module-hover': '#363b4a',
- '--color-timeline-internal-module-text': '#7f8899',
- '--color-timeline-native-event': '#b2b2b2',
- '--color-timeline-native-event-hover': '#949494',
- '--color-timeline-network-primary': '#fcf3dc',
- '--color-timeline-network-primary-hover': '#e3dbc5',
- '--color-timeline-network-secondary': '#efc457',
- '--color-timeline-network-secondary-hover': '#d6af4d',
- '--color-timeline-priority-background': '#1d2129',
- '--color-timeline-priority-border': '#282c34',
- '--color-timeline-user-timing': '#c9cacd',
- '--color-timeline-user-timing-hover': '#93959a',
- '--color-timeline-react-idle': '#3d485b',
- '--color-timeline-react-idle-hover': '#465269',
- '--color-timeline-react-render': '#2683E2',
- '--color-timeline-react-render-hover': '#1a76d4',
- '--color-timeline-react-render-text': '#11365e',
- '--color-timeline-react-commit': '#731fad',
- '--color-timeline-react-commit-hover': '#611b94',
- '--color-timeline-react-commit-text': '#e5c1ff',
- '--color-timeline-react-layout-effects': '#611b94',
- '--color-timeline-react-layout-effects-hover': '#51167a',
- '--color-timeline-react-layout-effects-text': '#e5c1ff',
- '--color-timeline-react-passive-effects': '#611b94',
- '--color-timeline-react-passive-effects-hover': '#51167a',
- '--color-timeline-react-passive-effects-text': '#e5c1ff',
- '--color-timeline-react-schedule': '#2683E2',
- '--color-timeline-react-schedule-hover': '#1a76d4',
- '--color-timeline-react-suspense-rejected': '#f1cc14',
- '--color-timeline-react-suspense-rejected-hover': '#e4c00f',
- '--color-timeline-react-suspense-resolved': '#a6e59f',
- '--color-timeline-react-suspense-resolved-hover': '#89d281',
- '--color-timeline-react-suspense-unresolved': '#c9cacd',
- '--color-timeline-react-suspense-unresolved-hover': '#93959a',
- '--color-timeline-thrown-error': '#fb3655',
- '--color-timeline-thrown-error-hover': '#f82042',
- '--color-timeline-text-color': '#282c34',
- '--color-timeline-text-dim-color': '#555b66',
- '--color-timeline-react-work-border': '#3d424a',
- '--color-search-match': 'yellow',
- '--color-search-match-current': '#f7923b',
- '--color-selected-tree-highlight-active': 'rgba(23, 143, 185, 0.15)',
- '--color-selected-tree-highlight-inactive': 'rgba(255, 255, 255, 0.05)',
- '--color-scroll-caret': '#4f5766',
- '--color-shadow': 'rgba(0, 0, 0, 0.5)',
- '--color-tab-selected-border': '#178fb9',
- '--color-text': '#ffffff',
- '--color-text-invalid': '#ff8080',
- '--color-text-selected': '#ffffff',
- '--color-toggle-background-invalid': '#fc3a4b',
- '--color-toggle-background-on': '#178fb9',
- '--color-toggle-background-off': '#777d88',
- '--color-toggle-text': '#ffffff',
- '--color-warning-background': '#ee1638',
- '--color-warning-background-hover': '#da1030',
- '--color-warning-text-color': '#ffffff',
- '--color-warning-text-color-inverted': '#ee1638',
- // The styles below should be kept in sync with 'root.css'
- // They are repeated there because they're used by e.g. tooltips or context menus
- // which get rendered outside of the DOM subtree (where normal theme/styles are written).
- '--color-scroll-thumb': '#afb3b9',
- '--color-scroll-track': '#313640',
- '--color-tooltip-background': 'rgba(255, 255, 255, 0.95)',
- '--color-tooltip-text': '#000000'
- },
- compact: {
- '--font-size-monospace-small': '9px',
- '--font-size-monospace-normal': '11px',
- '--font-size-monospace-large': '15px',
- '--font-size-sans-small': '10px',
- '--font-size-sans-normal': '12px',
- '--font-size-sans-large': '14px',
- '--line-height-data': '18px'
- },
- comfortable: {
- '--font-size-monospace-small': '10px',
- '--font-size-monospace-normal': '13px',
- '--font-size-monospace-large': '17px',
- '--font-size-sans-small': '12px',
- '--font-size-sans-normal': '14px',
- '--font-size-sans-large': '16px',
- '--line-height-data': '22px'
- }
- }; // HACK
- //
- // Sometimes the inline target is rendered before root styles are applied,
- // which would result in e.g. NaN itemSize being passed to react-window list.
- var COMFORTABLE_LINE_HEIGHT = parseInt(THEME_STYLES.comfortable['--line-height-data'], 10);
- var COMPACT_LINE_HEIGHT = parseInt(THEME_STYLES.compact['--line-height-data'], 10);
- /***/ }),
- /* 3 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONCURRENT_MODE_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CONCURRENT_MODE_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CONTEXT_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return CONTEXT_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return SERVER_CONTEXT_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return DEPRECATED_ASYNC_MODE_SYMBOL_STRING; });
- /* unused harmony export ELEMENT_NUMBER */
- /* unused harmony export ELEMENT_SYMBOL_STRING */
- /* unused harmony export DEBUG_TRACING_MODE_NUMBER */
- /* unused harmony export DEBUG_TRACING_MODE_SYMBOL_STRING */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return FORWARD_REF_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return FORWARD_REF_SYMBOL_STRING; });
- /* unused harmony export FRAGMENT_NUMBER */
- /* unused harmony export FRAGMENT_SYMBOL_STRING */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return LAZY_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return LAZY_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return MEMO_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return MEMO_SYMBOL_STRING; });
- /* unused harmony export PORTAL_NUMBER */
- /* unused harmony export PORTAL_SYMBOL_STRING */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return PROFILER_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return PROFILER_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return PROVIDER_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return PROVIDER_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return SCOPE_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return SCOPE_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return STRICT_MODE_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return STRICT_MODE_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return SUSPENSE_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return SUSPENSE_SYMBOL_STRING; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return SUSPENSE_LIST_NUMBER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SUSPENSE_LIST_SYMBOL_STRING; });
- /* unused harmony export SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED_SYMBOL_STRING */
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // This list should be kept updated to reflect additions to 'shared/ReactSymbols'.
- // DevTools can't import symbols from 'shared/ReactSymbols' directly for two reasons:
- // 1. DevTools requires symbols which may have been deleted in more recent versions (e.g. concurrent mode)
- // 2. DevTools must support both Symbol and numeric forms of each symbol;
- // Since e.g. standalone DevTools runs in a separate process, it can't rely on its own ES capabilities.
- var CONCURRENT_MODE_NUMBER = 0xeacf;
- var CONCURRENT_MODE_SYMBOL_STRING = 'Symbol(react.concurrent_mode)';
- var CONTEXT_NUMBER = 0xeace;
- var CONTEXT_SYMBOL_STRING = 'Symbol(react.context)';
- var SERVER_CONTEXT_SYMBOL_STRING = 'Symbol(react.server_context)';
- var DEPRECATED_ASYNC_MODE_SYMBOL_STRING = 'Symbol(react.async_mode)';
- var ELEMENT_NUMBER = 0xeac7;
- var ELEMENT_SYMBOL_STRING = 'Symbol(react.element)';
- var DEBUG_TRACING_MODE_NUMBER = 0xeae1;
- var DEBUG_TRACING_MODE_SYMBOL_STRING = 'Symbol(react.debug_trace_mode)';
- var FORWARD_REF_NUMBER = 0xead0;
- var FORWARD_REF_SYMBOL_STRING = 'Symbol(react.forward_ref)';
- var FRAGMENT_NUMBER = 0xeacb;
- var FRAGMENT_SYMBOL_STRING = 'Symbol(react.fragment)';
- var LAZY_NUMBER = 0xead4;
- var LAZY_SYMBOL_STRING = 'Symbol(react.lazy)';
- var MEMO_NUMBER = 0xead3;
- var MEMO_SYMBOL_STRING = 'Symbol(react.memo)';
- var PORTAL_NUMBER = 0xeaca;
- var PORTAL_SYMBOL_STRING = 'Symbol(react.portal)';
- var PROFILER_NUMBER = 0xead2;
- var PROFILER_SYMBOL_STRING = 'Symbol(react.profiler)';
- var PROVIDER_NUMBER = 0xeacd;
- var PROVIDER_SYMBOL_STRING = 'Symbol(react.provider)';
- var SCOPE_NUMBER = 0xead7;
- var SCOPE_SYMBOL_STRING = 'Symbol(react.scope)';
- var STRICT_MODE_NUMBER = 0xeacc;
- var STRICT_MODE_SYMBOL_STRING = 'Symbol(react.strict_mode)';
- var SUSPENSE_NUMBER = 0xead1;
- var SUSPENSE_SYMBOL_STRING = 'Symbol(react.suspense)';
- var SUSPENSE_LIST_NUMBER = 0xead8;
- var SUSPENSE_LIST_SYMBOL_STRING = 'Symbol(react.suspense_list)';
- var SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED_SYMBOL_STRING = 'Symbol(react.server_context.defaultValue)';
- /***/ }),
- /* 4 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ cleanForBridge; });
- __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ copyToClipboard; });
- __webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ copyWithDelete; });
- __webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ copyWithRename; });
- __webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ copyWithSet; });
- __webpack_require__.d(__webpack_exports__, "h", function() { return /* binding */ getEffectDurations; });
- __webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ formatWithStyles; });
- __webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ format; });
- __webpack_require__.d(__webpack_exports__, "k", function() { return /* binding */ isSynchronousXHRSupported; });
- __webpack_require__.d(__webpack_exports__, "i", function() { return /* binding */ gt; });
- __webpack_require__.d(__webpack_exports__, "j", function() { return /* binding */ gte; });
- // UNUSED EXPORTS: serializeToString
- // EXTERNAL MODULE: /Users/xch/dev/react/node_modules/clipboard-js/clipboard.js
- var clipboard = __webpack_require__(18);
- // CONCATENATED MODULE: /Users/xch/dev/react/node_modules/compare-versions/lib/esm/index.js
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- /**
- * Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
- * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
- * @param v1 - First version to compare
- * @param v2 - Second version to compare
- * @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
- */
- var compareVersions = function compareVersions(v1, v2) {
- // validate input and split into segments
- var n1 = validateAndParse(v1);
- var n2 = validateAndParse(v2); // pop off the patch
- var p1 = n1.pop();
- var p2 = n2.pop(); // validate numbers
- var r = compareSegments(n1, n2);
- if (r !== 0) return r; // validate pre-release
- if (p1 && p2) {
- return compareSegments(p1.split('.'), p2.split('.'));
- } else if (p1 || p2) {
- return p1 ? -1 : 1;
- }
- return 0;
- };
- /**
- * Validate [semver](https://semver.org/) version strings.
- *
- * @param version Version number to validate
- * @returns `true` if the version number is a valid semver version number, `false` otherwise.
- *
- * @example
- * ```
- * validate('1.0.0-rc.1'); // return true
- * validate('1.0-rc.1'); // return false
- * validate('foo'); // return false
- * ```
- */
- var validate = function validate(version) {
- return typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
- };
- /**
- * Compare [semver](https://semver.org/) version strings using the specified operator.
- *
- * @param v1 First version to compare
- * @param v2 Second version to compare
- * @param operator Allowed arithmetic operator to use
- * @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
- *
- * @example
- * ```
- * compare('10.1.8', '10.0.4', '>'); // return true
- * compare('10.0.1', '10.0.1', '='); // return true
- * compare('10.1.1', '10.2.2', '<'); // return true
- * compare('10.1.1', '10.2.2', '<='); // return true
- * compare('10.1.1', '10.2.2', '>='); // return false
- * ```
- */
- var compare = function compare(v1, v2, operator) {
- // validate input operator
- assertValidOperator(operator); // since result of compareVersions can only be -1 or 0 or 1
- // a simple map can be used to replace switch
- var res = compareVersions(v1, v2);
- return operatorResMap[operator].includes(res);
- };
- /**
- * Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range.
- *
- * @param version Version number to match
- * @param range Range pattern for version
- * @returns `true` if the version number is within the range, `false` otherwise.
- *
- * @example
- * ```
- * satisfies('1.1.0', '^1.0.0'); // return true
- * satisfies('1.1.0', '~1.0.0'); // return false
- * ```
- */
- var satisfies = function satisfies(version, range) {
- // if no range operator then "="
- var m = range.match(/^([<>=~^]+)/);
- var op = m ? m[1] : '='; // if gt/lt/eq then operator compare
- if (op !== '^' && op !== '~') return compare(version, range, op); // else range of either "~" or "^" is assumed
- var _validateAndParse = validateAndParse(version),
- _validateAndParse2 = _slicedToArray(_validateAndParse, 5),
- v1 = _validateAndParse2[0],
- v2 = _validateAndParse2[1],
- v3 = _validateAndParse2[2],
- vp = _validateAndParse2[4];
- var _validateAndParse3 = validateAndParse(range),
- _validateAndParse4 = _slicedToArray(_validateAndParse3, 5),
- r1 = _validateAndParse4[0],
- r2 = _validateAndParse4[1],
- r3 = _validateAndParse4[2],
- rp = _validateAndParse4[4];
- var v = [v1, v2, v3];
- var r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x']; // validate pre-release
- if (rp) {
- if (!vp) return false;
- if (compareSegments(v, r) !== 0) return false;
- if (compareSegments(vp.split('.'), rp.split('.')) === -1) return false;
- } // first non-zero number
- var nonZero = r.findIndex(function (v) {
- return v !== '0';
- }) + 1; // pointer to where segments can be >=
- var i = op === '~' ? 2 : nonZero > 1 ? nonZero : 1; // before pointer must be equal
- if (compareSegments(v.slice(0, i), r.slice(0, i)) !== 0) return false; // after pointer must be >=
- if (compareSegments(v.slice(i), r.slice(i)) === -1) return false;
- return true;
- };
- var semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
- var validateAndParse = function validateAndParse(version) {
- if (typeof version !== 'string') {
- throw new TypeError('Invalid argument expected string');
- }
- var match = version.match(semver);
- if (!match) {
- throw new Error("Invalid argument not valid semver ('".concat(version, "' received)"));
- }
- match.shift();
- return match;
- };
- var isWildcard = function isWildcard(s) {
- return s === '*' || s === 'x' || s === 'X';
- };
- var tryParse = function tryParse(v) {
- var n = parseInt(v, 10);
- return isNaN(n) ? v : n;
- };
- var forceType = function forceType(a, b) {
- return _typeof(a) !== _typeof(b) ? [String(a), String(b)] : [a, b];
- };
- var compareStrings = function compareStrings(a, b) {
- if (isWildcard(a) || isWildcard(b)) return 0;
- var _forceType = forceType(tryParse(a), tryParse(b)),
- _forceType2 = _slicedToArray(_forceType, 2),
- ap = _forceType2[0],
- bp = _forceType2[1];
- if (ap > bp) return 1;
- if (ap < bp) return -1;
- return 0;
- };
- var compareSegments = function compareSegments(a, b) {
- for (var i = 0; i < Math.max(a.length, b.length); i++) {
- var r = compareStrings(a[i] || '0', b[i] || '0');
- if (r !== 0) return r;
- }
- return 0;
- };
- var operatorResMap = {
- '>': [1],
- '>=': [0, 1],
- '=': [0],
- '<=': [-1, 0],
- '<': [-1]
- };
- var allowedOperators = Object.keys(operatorResMap);
- var assertValidOperator = function assertValidOperator(op) {
- if (typeof op !== 'string') {
- throw new TypeError("Invalid operator type, expected string but got ".concat(_typeof(op)));
- }
- if (allowedOperators.indexOf(op) === -1) {
- throw new Error("Invalid operator, expected one of ".concat(allowedOperators.join('|')));
- }
- };
- // EXTERNAL MODULE: ../react-devtools-shared/src/hydration.js
- var hydration = __webpack_require__(10);
- // EXTERNAL MODULE: ../shared/isArray.js
- var isArray = __webpack_require__(9);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/utils.js
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || utils_unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function utils_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return utils_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return utils_arrayLikeToArray(o, minLen); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return utils_arrayLikeToArray(arr); }
- function utils_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- function utils_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { utils_typeof = function _typeof(obj) { return typeof obj; }; } else { utils_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return utils_typeof(obj); }
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function cleanForBridge(data, isPathAllowed) {
- var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- if (data !== null) {
- var cleanedPaths = [];
- var unserializablePaths = [];
- var cleanedData = Object(hydration["a" /* dehydrate */])(data, cleanedPaths, unserializablePaths, path, isPathAllowed);
- return {
- data: cleanedData,
- cleaned: cleanedPaths,
- unserializable: unserializablePaths
- };
- } else {
- return null;
- }
- }
- function copyToClipboard(value) {
- var safeToCopy = serializeToString(value);
- var text = safeToCopy === undefined ? 'undefined' : safeToCopy;
- var clipboardCopyText = window.__REACT_DEVTOOLS_GLOBAL_HOOK__.clipboardCopyText; // On Firefox navigator.clipboard.writeText has to be called from
- // the content script js code (because it requires the clipboardWrite
- // permission to be allowed out of a "user handling" callback),
- // clipboardCopyText is an helper injected into the page from.
- // injectGlobalHook.
- if (typeof clipboardCopyText === 'function') {
- clipboardCopyText(text).catch(function (err) {});
- } else {
- Object(clipboard["copy"])(text);
- }
- }
- function copyWithDelete(obj, path) {
- var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- var key = path[index];
- var updated = Object(isArray["a" /* default */])(obj) ? obj.slice() : _objectSpread({}, obj);
- if (index + 1 === path.length) {
- if (Object(isArray["a" /* default */])(updated)) {
- updated.splice(key, 1);
- } else {
- delete updated[key];
- }
- } else {
- // $FlowFixMe number or string is fine here
- updated[key] = copyWithDelete(obj[key], path, index + 1);
- }
- return updated;
- } // This function expects paths to be the same except for the final value.
- // e.g. ['path', 'to', 'foo'] and ['path', 'to', 'bar']
- function copyWithRename(obj, oldPath, newPath) {
- var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- var oldKey = oldPath[index];
- var updated = Object(isArray["a" /* default */])(obj) ? obj.slice() : _objectSpread({}, obj);
- if (index + 1 === oldPath.length) {
- var newKey = newPath[index]; // $FlowFixMe number or string is fine here
- updated[newKey] = updated[oldKey];
- if (Object(isArray["a" /* default */])(updated)) {
- updated.splice(oldKey, 1);
- } else {
- delete updated[oldKey];
- }
- } else {
- // $FlowFixMe number or string is fine here
- updated[oldKey] = copyWithRename(obj[oldKey], oldPath, newPath, index + 1);
- }
- return updated;
- }
- function copyWithSet(obj, path, value) {
- var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- if (index >= path.length) {
- return value;
- }
- var key = path[index];
- var updated = Object(isArray["a" /* default */])(obj) ? obj.slice() : _objectSpread({}, obj); // $FlowFixMe number or string is fine here
- updated[key] = copyWithSet(obj[key], path, value, index + 1);
- return updated;
- }
- function getEffectDurations(root) {
- // Profiling durations are only available for certain builds.
- // If available, they'll be stored on the HostRoot.
- var effectDuration = null;
- var passiveEffectDuration = null;
- var hostRoot = root.current;
- if (hostRoot != null) {
- var stateNode = hostRoot.stateNode;
- if (stateNode != null) {
- effectDuration = stateNode.effectDuration != null ? stateNode.effectDuration : null;
- passiveEffectDuration = stateNode.passiveEffectDuration != null ? stateNode.passiveEffectDuration : null;
- }
- }
- return {
- effectDuration: effectDuration,
- passiveEffectDuration: passiveEffectDuration
- };
- }
- function serializeToString(data) {
- var cache = new Set(); // Use a custom replacer function to protect against circular references.
- return JSON.stringify(data, function (key, value) {
- if (utils_typeof(value) === 'object' && value !== null) {
- if (cache.has(value)) {
- return;
- }
- cache.add(value);
- }
- if (typeof value === 'bigint') {
- return value.toString() + 'n';
- }
- return value;
- });
- } // Formats an array of args with a style for console methods, using
- // the following algorithm:
- // 1. The first param is a string that contains %c
- // - Bail out and return the args without modifying the styles.
- // We don't want to affect styles that the developer deliberately set.
- // 2. The first param is a string that doesn't contain %c but contains
- // string formatting
- // - [`%c${args[0]}`, style, ...args.slice(1)]
- // - Note: we assume that the string formatting that the developer uses
- // is correct.
- // 3. The first param is a string that doesn't contain string formatting
- // OR is not a string
- // - Create a formatting string where:
- // boolean, string, symbol -> %s
- // number -> %f OR %i depending on if it's an int or float
- // default -> %o
- function formatWithStyles(inputArgs, style) {
- if (inputArgs === undefined || inputArgs === null || inputArgs.length === 0 || // Matches any of %c but not %%c
- typeof inputArgs[0] === 'string' && inputArgs[0].match(/([^%]|^)(%c)/g) || style === undefined) {
- return inputArgs;
- } // Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
- var REGEXP = /([^%]|^)((%%)*)(%([oOdisf]))/g;
- if (typeof inputArgs[0] === 'string' && inputArgs[0].match(REGEXP)) {
- return ["%c".concat(inputArgs[0]), style].concat(_toConsumableArray(inputArgs.slice(1)));
- } else {
- var firstArg = inputArgs.reduce(function (formatStr, elem, i) {
- if (i > 0) {
- formatStr += ' ';
- }
- switch (utils_typeof(elem)) {
- case 'string':
- case 'boolean':
- case 'symbol':
- return formatStr += '%s';
- case 'number':
- var formatting = Number.isInteger(elem) ? '%i' : '%f';
- return formatStr += formatting;
- default:
- return formatStr += '%o';
- }
- }, '%c');
- return [firstArg, style].concat(_toConsumableArray(inputArgs));
- }
- } // based on https://github.com/tmpfs/format-util/blob/0e62d430efb0a1c51448709abd3e2406c14d8401/format.js#L1
- // based on https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions
- // Implements s, d, i and f placeholders
- // NOTE: KEEP IN SYNC with src/hook.js
- function format(maybeMessage) {
- for (var _len = arguments.length, inputArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- inputArgs[_key - 1] = arguments[_key];
- }
- var args = inputArgs.slice();
- var formatted = String(maybeMessage); // If the first argument is a string, check for substitutions.
- if (typeof maybeMessage === 'string') {
- if (args.length) {
- var REGEXP = /(%?)(%([jds]))/g;
- formatted = formatted.replace(REGEXP, function (match, escaped, ptn, flag) {
- var arg = args.shift();
- switch (flag) {
- case 's':
- arg += '';
- break;
- case 'd':
- case 'i':
- arg = parseInt(arg, 10).toString();
- break;
- case 'f':
- arg = parseFloat(arg).toString();
- break;
- }
- if (!escaped) {
- return arg;
- }
- args.unshift(arg);
- return match;
- });
- }
- } // Arguments that remain after formatting.
- if (args.length) {
- for (var i = 0; i < args.length; i++) {
- formatted += ' ' + String(args[i]);
- }
- } // Update escaped %% values.
- formatted = formatted.replace(/%{2,2}/g, '%');
- return String(formatted);
- }
- function isSynchronousXHRSupported() {
- return !!(window.document && window.document.featurePolicy && window.document.featurePolicy.allowsFeature('sync-xhr'));
- }
- function gt() {
- var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
- var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
- return compareVersions(a, b) === 1;
- }
- function gte() {
- var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
- var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
- return compareVersions(a, b) > -1;
- }
- /***/ }),
- /* 5 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return localStorageGetItem; });
- /* unused harmony export localStorageRemoveItem */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return localStorageSetItem; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return sessionStorageGetItem; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return sessionStorageRemoveItem; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return sessionStorageSetItem; });
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function localStorageGetItem(key) {
- try {
- return localStorage.getItem(key);
- } catch (error) {
- return null;
- }
- }
- function localStorageRemoveItem(key) {
- try {
- localStorage.removeItem(key);
- } catch (error) {}
- }
- function localStorageSetItem(key, value) {
- try {
- return localStorage.setItem(key, value);
- } catch (error) {}
- }
- function sessionStorageGetItem(key) {
- try {
- return sessionStorage.getItem(key);
- } catch (error) {
- return null;
- }
- }
- function sessionStorageRemoveItem(key) {
- try {
- sessionStorage.removeItem(key);
- } catch (error) {}
- }
- function sessionStorageSetItem(key, value) {
- try {
- return sessionStorage.setItem(key, value);
- } catch (error) {}
- }
- /***/ }),
- /* 6 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var isArray = Array.isArray;
- /* harmony default export */ __webpack_exports__["a"] = (isArray);
- /***/ }),
- /* 7 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- if (true) {
- module.exports = __webpack_require__(25);
- } else {}
- /***/ }),
- /* 8 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export isStringComponentStack */
- /* unused harmony export dangerous_setTargetConsoleForTesting */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return registerRenderer; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return patch; });
- /* unused harmony export unpatch */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return patchForStrictMode; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return unpatchForStrictMode; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return patchConsoleUsingWindowValues; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return writeConsolePatchSettingsToWindow; });
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
- /* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
- /* harmony import */ var _DevToolsFiberComponentStack__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15);
- /* harmony import */ var react_devtools_feature_flags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11);
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0);
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var OVERRIDE_CONSOLE_METHODS = ['error', 'trace', 'warn'];
- var DIMMED_NODE_CONSOLE_COLOR = '\x1b[2m%s\x1b[0m'; // React's custom built component stack strings match "\s{4}in"
- // Chrome's prefix matches "\s{4}at"
- var PREFIX_REGEX = /\s{4}(in|at)\s{1}/; // Firefox and Safari have no prefix ("")
- // but we can fallback to looking for location info (e.g. "foo.js:12:345")
- var ROW_COLUMN_NUMBER_REGEX = /:\d+:\d+(\n|$)/;
- function isStringComponentStack(text) {
- return PREFIX_REGEX.test(text) || ROW_COLUMN_NUMBER_REGEX.test(text);
- }
- var STYLE_DIRECTIVE_REGEX = /^%c/; // This function tells whether or not the arguments for a console
- // method has been overridden by the patchForStrictMode function.
- // If it has we'll need to do some special formatting of the arguments
- // so the console color stays consistent
- function isStrictModeOverride(args, method) {
- return args.length >= 2 && STYLE_DIRECTIVE_REGEX.test(args[0]) && args[1] === "color: ".concat(getConsoleColor(method) || '');
- }
- function getConsoleColor(method) {
- switch (method) {
- case 'warn':
- return consoleSettingsRef.browserTheme === 'light' ? "rgba(250, 180, 50, 0.75)" : "rgba(250, 180, 50, 0.5)";
- case 'error':
- return consoleSettingsRef.browserTheme === 'light' ? "rgba(250, 123, 130, 0.75)" : "rgba(250, 123, 130, 0.5)";
- case 'log':
- default:
- return consoleSettingsRef.browserTheme === 'light' ? "rgba(125, 125, 125, 0.75)" : "rgba(125, 125, 125, 0.5)";
- }
- }
- var injectedRenderers = new Map();
- var targetConsole = console;
- var targetConsoleMethods = {};
- for (var method in console) {
- targetConsoleMethods[method] = console[method];
- }
- var unpatchFn = null;
- var isNode = false;
- try {
- isNode = undefined === global;
- } catch (error) {} // Enables e.g. Jest tests to inject a mock console object.
- function dangerous_setTargetConsoleForTesting(targetConsoleForTesting) {
- targetConsole = targetConsoleForTesting;
- targetConsoleMethods = {};
- for (var _method in targetConsole) {
- targetConsoleMethods[_method] = console[_method];
- }
- } // v16 renderers should use this method to inject internals necessary to generate a component stack.
- // These internals will be used if the console is patched.
- // Injecting them separately allows the console to easily be patched or un-patched later (at runtime).
- function registerRenderer(renderer, onErrorOrWarning) {
- var currentDispatcherRef = renderer.currentDispatcherRef,
- getCurrentFiber = renderer.getCurrentFiber,
- findFiberByHostInstance = renderer.findFiberByHostInstance,
- version = renderer.version; // Ignore React v15 and older because they don't expose a component stack anyway.
- if (typeof findFiberByHostInstance !== 'function') {
- return;
- } // currentDispatcherRef gets injected for v16.8+ to support hooks inspection.
- // getCurrentFiber gets injected for v16.9+.
- if (currentDispatcherRef != null && typeof getCurrentFiber === 'function') {
- var _getInternalReactCons = Object(_renderer__WEBPACK_IMPORTED_MODULE_1__[/* getInternalReactConstants */ "b"])(version),
- ReactTypeOfWork = _getInternalReactCons.ReactTypeOfWork;
- injectedRenderers.set(renderer, {
- currentDispatcherRef: currentDispatcherRef,
- getCurrentFiber: getCurrentFiber,
- workTagMap: ReactTypeOfWork,
- onErrorOrWarning: onErrorOrWarning
- });
- }
- }
- var consoleSettingsRef = {
- appendComponentStack: false,
- breakOnConsoleErrors: false,
- showInlineWarningsAndErrors: false,
- hideConsoleLogsInStrictMode: false,
- browserTheme: 'dark'
- };
- // Patches console methods to append component stack for the current fiber.
- // Call unpatch() to remove the injected behavior.
- function patch(_ref) {
- var appendComponentStack = _ref.appendComponentStack,
- breakOnConsoleErrors = _ref.breakOnConsoleErrors,
- showInlineWarningsAndErrors = _ref.showInlineWarningsAndErrors,
- hideConsoleLogsInStrictMode = _ref.hideConsoleLogsInStrictMode,
- browserTheme = _ref.browserTheme;
- // Settings may change after we've patched the console.
- // Using a shared ref allows the patch function to read the latest values.
- consoleSettingsRef.appendComponentStack = appendComponentStack;
- consoleSettingsRef.breakOnConsoleErrors = breakOnConsoleErrors;
- consoleSettingsRef.showInlineWarningsAndErrors = showInlineWarningsAndErrors;
- consoleSettingsRef.hideConsoleLogsInStrictMode = hideConsoleLogsInStrictMode;
- consoleSettingsRef.browserTheme = browserTheme;
- if (appendComponentStack || breakOnConsoleErrors || showInlineWarningsAndErrors) {
- if (unpatchFn !== null) {
- // Don't patch twice.
- return;
- }
- var originalConsoleMethods = {};
- unpatchFn = function unpatchFn() {
- for (var _method2 in originalConsoleMethods) {
- try {
- targetConsole[_method2] = originalConsoleMethods[_method2];
- } catch (error) {}
- }
- };
- OVERRIDE_CONSOLE_METHODS.forEach(function (method) {
- try {
- var originalMethod = originalConsoleMethods[method] = targetConsole[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__ ? targetConsole[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__ : targetConsole[method]; // $FlowFixMe[missing-local-annot]
- var overrideMethod = function overrideMethod() {
- var shouldAppendWarningStack = false;
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- if (method !== 'log') {
- if (consoleSettingsRef.appendComponentStack) {
- var lastArg = args.length > 0 ? args[args.length - 1] : null;
- var alreadyHasComponentStack = typeof lastArg === 'string' && isStringComponentStack(lastArg); // If we are ever called with a string that already has a component stack,
- // e.g. a React error/warning, don't append a second stack.
- shouldAppendWarningStack = !alreadyHasComponentStack;
- }
- }
- var shouldShowInlineWarningsAndErrors = consoleSettingsRef.showInlineWarningsAndErrors && (method === 'error' || method === 'warn'); // Search for the first renderer that has a current Fiber.
- // We don't handle the edge case of stacks for more than one (e.g. interleaved renderers?)
- // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- var _iterator = _createForOfIteratorHelper(injectedRenderers.values()),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _step$value = _step.value,
- currentDispatcherRef = _step$value.currentDispatcherRef,
- getCurrentFiber = _step$value.getCurrentFiber,
- onErrorOrWarning = _step$value.onErrorOrWarning,
- workTagMap = _step$value.workTagMap;
- var current = getCurrentFiber();
- if (current != null) {
- try {
- if (shouldShowInlineWarningsAndErrors) {
- // patch() is called by two places: (1) the hook and (2) the renderer backend.
- // The backend is what implements a message queue, so it's the only one that injects onErrorOrWarning.
- if (typeof onErrorOrWarning === 'function') {
- onErrorOrWarning(current, method, // Copy args before we mutate them (e.g. adding the component stack)
- args.slice());
- }
- }
- if (shouldAppendWarningStack) {
- var componentStack = Object(_DevToolsFiberComponentStack__WEBPACK_IMPORTED_MODULE_2__[/* getStackByFiberInDevAndProd */ "b"])(workTagMap, current, currentDispatcherRef);
- if (componentStack !== '') {
- if (isStrictModeOverride(args, method)) {
- args[0] = "".concat(args[0], " %s");
- args.push(componentStack);
- } else {
- args.push(componentStack);
- }
- }
- }
- } catch (error) {
- // Don't let a DevTools or React internal error interfere with logging.
- setTimeout(function () {
- throw error;
- }, 0);
- } finally {
- break;
- }
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- if (consoleSettingsRef.breakOnConsoleErrors) {
- // --- Welcome to debugging with React DevTools ---
- // This debugger statement means that you've enabled the "break on warnings" feature.
- // Use the browser's Call Stack panel to step out of this override function-
- // to where the original warning or error was logged.
- // eslint-disable-next-line no-debugger
- debugger;
- }
- originalMethod.apply(void 0, args);
- };
- overrideMethod.__REACT_DEVTOOLS_ORIGINAL_METHOD__ = originalMethod;
- originalMethod.__REACT_DEVTOOLS_OVERRIDE_METHOD__ = overrideMethod;
- targetConsole[method] = overrideMethod;
- } catch (error) {}
- });
- } else {
- unpatch();
- }
- } // Removed component stack patch from console methods.
- function unpatch() {
- if (unpatchFn !== null) {
- unpatchFn();
- unpatchFn = null;
- }
- }
- var unpatchForStrictModeFn = null; // NOTE: KEEP IN SYNC with src/hook.js:patchConsoleForInitialRenderInStrictMode
- function patchForStrictMode() {
- if (react_devtools_feature_flags__WEBPACK_IMPORTED_MODULE_3__[/* consoleManagedByDevToolsDuringStrictMode */ "a"]) {
- var overrideConsoleMethods = ['error', 'group', 'groupCollapsed', 'info', 'log', 'trace', 'warn'];
- if (unpatchForStrictModeFn !== null) {
- // Don't patch twice.
- return;
- }
- var originalConsoleMethods = {};
- unpatchForStrictModeFn = function unpatchForStrictModeFn() {
- for (var _method3 in originalConsoleMethods) {
- try {
- targetConsole[_method3] = originalConsoleMethods[_method3];
- } catch (error) {}
- }
- };
- overrideConsoleMethods.forEach(function (method) {
- try {
- var originalMethod = originalConsoleMethods[method] = targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ ? targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ : targetConsole[method]; // $FlowFixMe[missing-local-annot]
- var overrideMethod = function overrideMethod() {
- if (!consoleSettingsRef.hideConsoleLogsInStrictMode) {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- // Dim the text color of the double logs if we're not
- // hiding them.
- if (isNode) {
- originalMethod(DIMMED_NODE_CONSOLE_COLOR, _utils__WEBPACK_IMPORTED_MODULE_0__[/* format */ "f"].apply(void 0, args));
- } else {
- var color = getConsoleColor(method);
- if (color) {
- originalMethod.apply(void 0, _toConsumableArray(Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatWithStyles */ "g"])(args, "color: ".concat(color))));
- } else {
- throw Error('Console color is not defined');
- }
- }
- }
- };
- overrideMethod.__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ = originalMethod;
- originalMethod.__REACT_DEVTOOLS_STRICT_MODE_OVERRIDE_METHOD__ = overrideMethod;
- targetConsole[method] = overrideMethod;
- } catch (error) {}
- });
- }
- } // NOTE: KEEP IN SYNC with src/hook.js:unpatchConsoleForInitialRenderInStrictMode
- function unpatchForStrictMode() {
- if (react_devtools_feature_flags__WEBPACK_IMPORTED_MODULE_3__[/* consoleManagedByDevToolsDuringStrictMode */ "a"]) {
- if (unpatchForStrictModeFn !== null) {
- unpatchForStrictModeFn();
- unpatchForStrictModeFn = null;
- }
- }
- }
- function patchConsoleUsingWindowValues() {
- var _castBool, _castBool2, _castBool3, _castBool4, _castBrowserTheme;
- var appendComponentStack = (_castBool = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[/* castBool */ "a"])(window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__)) !== null && _castBool !== void 0 ? _castBool : true;
- var breakOnConsoleErrors = (_castBool2 = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[/* castBool */ "a"])(window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__)) !== null && _castBool2 !== void 0 ? _castBool2 : false;
- var showInlineWarningsAndErrors = (_castBool3 = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[/* castBool */ "a"])(window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__)) !== null && _castBool3 !== void 0 ? _castBool3 : true;
- var hideConsoleLogsInStrictMode = (_castBool4 = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[/* castBool */ "a"])(window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__)) !== null && _castBool4 !== void 0 ? _castBool4 : false;
- var browserTheme = (_castBrowserTheme = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[/* castBrowserTheme */ "b"])(window.__REACT_DEVTOOLS_BROWSER_THEME__)) !== null && _castBrowserTheme !== void 0 ? _castBrowserTheme : 'dark';
- patch({
- appendComponentStack: appendComponentStack,
- breakOnConsoleErrors: breakOnConsoleErrors,
- showInlineWarningsAndErrors: showInlineWarningsAndErrors,
- hideConsoleLogsInStrictMode: hideConsoleLogsInStrictMode,
- browserTheme: browserTheme
- });
- } // After receiving cached console patch settings from React Native, we set them on window.
- // When the console is initially patched (in renderer.js and hook.js), these values are read.
- // The browser extension (etc.) sets these values on window, but through another method.
- function writeConsolePatchSettingsToWindow(settings) {
- window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = settings.appendComponentStack;
- window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = settings.breakOnConsoleErrors;
- window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = settings.showInlineWarningsAndErrors;
- window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ = settings.hideConsoleLogsInStrictMode;
- window.__REACT_DEVTOOLS_BROWSER_THEME__ = settings.browserTheme;
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))
- /***/ }),
- /* 9 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
- function isArray(a) {
- return isArrayImpl(a);
- }
- /* harmony default export */ __webpack_exports__["a"] = (isArray);
- /***/ }),
- /* 10 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return meta; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dehydrate; });
- /* unused harmony export fillInPath */
- /* unused harmony export hydrate */
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var meta = {
- inspectable: Symbol('inspectable'),
- inspected: Symbol('inspected'),
- name: Symbol('name'),
- preview_long: Symbol('preview_long'),
- preview_short: Symbol('preview_short'),
- readonly: Symbol('readonly'),
- size: Symbol('size'),
- type: Symbol('type'),
- unserializable: Symbol('unserializable')
- };
- // This threshold determines the depth at which the bridge "dehydrates" nested data.
- // Dehydration means that we don't serialize the data for e.g. postMessage or stringify,
- // unless the frontend explicitly requests it (e.g. a user clicks to expand a props object).
- //
- // Reducing this threshold will improve the speed of initial component inspection,
- // but may decrease the responsiveness of expanding objects/arrays to inspect further.
- var LEVEL_THRESHOLD = 2;
- /**
- * Generate the dehydrated metadata for complex object instances
- */
- function createDehydrated(type, inspectable, data, cleaned, path) {
- cleaned.push(path);
- var dehydrated = {
- inspectable: inspectable,
- type: type,
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- name: !data.constructor || data.constructor.name === 'Object' ? '' : data.constructor.name
- };
- if (type === 'array' || type === 'typed_array') {
- dehydrated.size = data.length;
- } else if (type === 'object') {
- dehydrated.size = Object.keys(data).length;
- }
- if (type === 'iterator' || type === 'typed_array') {
- dehydrated.readonly = true;
- }
- return dehydrated;
- }
- /**
- * Strip out complex data (instances, functions, and data nested > LEVEL_THRESHOLD levels deep).
- * The paths of the stripped out objects are appended to the `cleaned` list.
- * On the other side of the barrier, the cleaned list is used to "re-hydrate" the cleaned representation into
- * an object with symbols as attributes, so that a sanitized object can be distinguished from a normal object.
- *
- * Input: {"some": {"attr": fn()}, "other": AnInstance}
- * Output: {
- * "some": {
- * "attr": {"name": the fn.name, type: "function"}
- * },
- * "other": {
- * "name": "AnInstance",
- * "type": "object",
- * },
- * }
- * and cleaned = [["some", "attr"], ["other"]]
- */
- function dehydrate(data, cleaned, unserializable, path, isPathAllowed) {
- var level = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
- var type = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getDataType */ "f"])(data);
- var isPathAllowedCheck;
- switch (type) {
- case 'html_element':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: data.tagName,
- type: type
- };
- case 'function':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: typeof data.name === 'function' || !data.name ? 'function' : data.name,
- type: type
- };
- case 'string':
- isPathAllowedCheck = isPathAllowed(path);
- if (isPathAllowedCheck) {
- return data;
- } else {
- return data.length <= 500 ? data : data.slice(0, 500) + '...';
- }
- case 'bigint':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: data.toString(),
- type: type
- };
- case 'symbol':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: data.toString(),
- type: type
- };
- // React Elements aren't very inspector-friendly,
- // and often contain private fields or circular references.
- case 'react_element':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getDisplayNameForReactElement */ "i"])(data) || 'Unknown',
- type: type
- };
- // ArrayBuffers error if you try to inspect them.
- case 'array_buffer':
- case 'data_view':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: type === 'data_view' ? 'DataView' : 'ArrayBuffer',
- size: data.byteLength,
- type: type
- };
- case 'array':
- isPathAllowedCheck = isPathAllowed(path);
- if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
- return createDehydrated(type, true, data, cleaned, path);
- }
- return data.map(function (item, i) {
- return dehydrate(item, cleaned, unserializable, path.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
- });
- case 'html_all_collection':
- case 'typed_array':
- case 'iterator':
- isPathAllowedCheck = isPathAllowed(path);
- if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
- return createDehydrated(type, true, data, cleaned, path);
- } else {
- var unserializableValue = {
- unserializable: true,
- type: type,
- readonly: true,
- size: type === 'typed_array' ? data.length : undefined,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: !data.constructor || data.constructor.name === 'Object' ? '' : data.constructor.name
- }; // TRICKY
- // Don't use [...spread] syntax for this purpose.
- // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
- // Other types (e.g. typed arrays, Sets) will not spread correctly.
- Array.from(data).forEach(function (item, i) {
- return (// $FlowFixMe[prop-missing] Unserializable doesn't have an index signature
- unserializableValue[i] = dehydrate(item, cleaned, unserializable, path.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1)
- );
- });
- unserializable.push(path);
- return unserializableValue;
- }
- case 'opaque_iterator':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: data[Symbol.toStringTag],
- type: type
- };
- case 'date':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: data.toString(),
- type: type
- };
- case 'regexp':
- cleaned.push(path);
- return {
- inspectable: false,
- preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, false),
- preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "d"])(data, true),
- name: data.toString(),
- type: type
- };
- case 'object':
- isPathAllowedCheck = isPathAllowed(path);
- if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
- return createDehydrated(type, true, data, cleaned, path);
- } else {
- var object = {};
- Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getAllEnumerableKeys */ "e"])(data).forEach(function (key) {
- var name = key.toString();
- object[name] = dehydrate(data[key], cleaned, unserializable, path.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
- });
- return object;
- }
- case 'infinity':
- case 'nan':
- case 'undefined':
- // Some values are lossy when sent through a WebSocket.
- // We dehydrate+rehydrate them to preserve their type.
- cleaned.push(path);
- return {
- type: type
- };
- default:
- return data;
- }
- }
- function fillInPath(object, data, path, value) {
- var target = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "j"])(object, path);
- if (target != null) {
- if (!target[meta.unserializable]) {
- delete target[meta.inspectable];
- delete target[meta.inspected];
- delete target[meta.name];
- delete target[meta.preview_long];
- delete target[meta.preview_short];
- delete target[meta.readonly];
- delete target[meta.size];
- delete target[meta.type];
- }
- }
- if (value !== null && data.unserializable.length > 0) {
- var unserializablePath = data.unserializable[0];
- var isMatch = unserializablePath.length === path.length;
- for (var i = 0; i < path.length; i++) {
- if (path[i] !== unserializablePath[i]) {
- isMatch = false;
- break;
- }
- }
- if (isMatch) {
- upgradeUnserializable(value, value);
- }
- }
- Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* setInObject */ "o"])(object, path, value);
- }
- function hydrate(object, cleaned, unserializable) {
- cleaned.forEach(function (path) {
- var length = path.length;
- var last = path[length - 1];
- var parent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "j"])(object, path.slice(0, length - 1));
- if (!parent || !parent.hasOwnProperty(last)) {
- return;
- }
- var value = parent[last];
- if (!value) {
- return;
- } else if (value.type === 'infinity') {
- parent[last] = Infinity;
- } else if (value.type === 'nan') {
- parent[last] = NaN;
- } else if (value.type === 'undefined') {
- parent[last] = undefined;
- } else {
- // Replace the string keys with Symbols so they're non-enumerable.
- var replaced = {};
- replaced[meta.inspectable] = !!value.inspectable;
- replaced[meta.inspected] = false;
- replaced[meta.name] = value.name;
- replaced[meta.preview_long] = value.preview_long;
- replaced[meta.preview_short] = value.preview_short;
- replaced[meta.size] = value.size;
- replaced[meta.readonly] = !!value.readonly;
- replaced[meta.type] = value.type;
- parent[last] = replaced;
- }
- });
- unserializable.forEach(function (path) {
- var length = path.length;
- var last = path[length - 1];
- var parent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "j"])(object, path.slice(0, length - 1));
- if (!parent || !parent.hasOwnProperty(last)) {
- return;
- }
- var node = parent[last];
- var replacement = _objectSpread({}, node);
- upgradeUnserializable(replacement, node);
- parent[last] = replacement;
- });
- return object;
- }
- function upgradeUnserializable(destination, source) {
- var _Object$definePropert;
- Object.defineProperties(destination, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, meta.inspected, {
- configurable: true,
- enumerable: false,
- value: !!source.inspected
- }), _defineProperty(_Object$definePropert, meta.name, {
- configurable: true,
- enumerable: false,
- value: source.name
- }), _defineProperty(_Object$definePropert, meta.preview_long, {
- configurable: true,
- enumerable: false,
- value: source.preview_long
- }), _defineProperty(_Object$definePropert, meta.preview_short, {
- configurable: true,
- enumerable: false,
- value: source.preview_short
- }), _defineProperty(_Object$definePropert, meta.size, {
- configurable: true,
- enumerable: false,
- value: source.size
- }), _defineProperty(_Object$definePropert, meta.readonly, {
- configurable: true,
- enumerable: false,
- value: !!source.readonly
- }), _defineProperty(_Object$definePropert, meta.type, {
- configurable: true,
- enumerable: false,
- value: source.type
- }), _defineProperty(_Object$definePropert, meta.unserializable, {
- configurable: true,
- enumerable: false,
- value: !!source.unserializable
- }), _Object$definePropert));
- delete destination.inspected;
- delete destination.name;
- delete destination.preview_long;
- delete destination.preview_short;
- delete destination.size;
- delete destination.readonly;
- delete destination.type;
- delete destination.unserializable;
- }
- /***/ }),
- /* 11 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return consoleManagedByDevToolsDuringStrictMode; });
- /* unused harmony export enableLogger */
- /* unused harmony export enableNamedHooksFeature */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return enableProfilerChangedHookIndices; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return enableStyleXFeatures; });
- /* unused harmony export isInternalFacebookBuild */
- /* unused harmony export enableProfilerComponentTree */
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- /************************************************************************
- * This file is forked between different DevTools implementations.
- * It should never be imported directly!
- * It should always be imported from "react-devtools-feature-flags".
- ************************************************************************/
- var consoleManagedByDevToolsDuringStrictMode = false;
- var enableLogger = false;
- var enableNamedHooksFeature = true;
- var enableProfilerChangedHookIndices = true;
- var enableStyleXFeatures = false;
- var isInternalFacebookBuild = false;
- var enableProfilerComponentTree = true;
- /************************************************************************
- * Do not edit the code below.
- * It ensures this fork exports the same types as the default flags file.
- ************************************************************************/
- // Flow magic to verify the exports of this file match the original version.
- null;
- /***/ }),
- /* 12 */
- /***/ (function(module, exports) {
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var g; // This works in non-strict mode
- g = function () {
- return this;
- }();
- try {
- // This works if eval is allowed (see CSP)
- g = g || new Function("return this")();
- } catch (e) {
- // This works if the window reference is available
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
- } // g can still be undefined, but nothing to do about it...
- // We return undefined, instead of nothing here, so it's
- // easier to handle this case. if(!global) { ...}
- module.exports = g;
- /***/ }),
- /* 13 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
- /** Used as references for various `Number` constants. */
- var NAN = 0 / 0;
- /** `Object#toString` result references. */
- var symbolTag = '[object Symbol]';
- /** Used to match leading and trailing whitespace. */
- var reTrim = /^\s+|\s+$/g;
- /** Used to detect bad signed hexadecimal string values. */
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- /** Used to detect binary string values. */
- var reIsBinary = /^0b[01]+$/i;
- /** Used to detect octal string values. */
- var reIsOctal = /^0o[0-7]+$/i;
- /** Built-in method references without a dependency on `root`. */
- var freeParseInt = parseInt;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global && global.Object === Object && global;
- /** Detect free variable `self`. */
- var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString = objectProto.toString;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max,
- nativeMin = Math.min;
- /**
- * Gets the timestamp of the number of milliseconds that have elapsed since
- * the Unix epoch (1 January 1970 00:00:00 UTC).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Date
- * @returns {number} Returns the timestamp.
- * @example
- *
- * _.defer(function(stamp) {
- * console.log(_.now() - stamp);
- * }, _.now());
- * // => Logs the number of milliseconds it took for the deferred invocation.
- */
- var now = function now() {
- return root.Date.now();
- };
- /**
- * Creates a debounced function that delays invoking `func` until after `wait`
- * milliseconds have elapsed since the last time the debounced function was
- * invoked. The debounced function comes with a `cancel` method to cancel
- * delayed `func` invocations and a `flush` method to immediately invoke them.
- * Provide `options` to indicate whether `func` should be invoked on the
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
- * with the last arguments provided to the debounced function. Subsequent
- * calls to the debounced function return the result of the last `func`
- * invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the debounced function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.debounce` and `_.throttle`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to debounce.
- * @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=false]
- * Specify invoking on the leading edge of the timeout.
- * @param {number} [options.maxWait]
- * The maximum time `func` is allowed to be delayed before it's invoked.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new debounced function.
- * @example
- *
- * // Avoid costly calculations while the window size is in flux.
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
- *
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
- * 'leading': true,
- * 'trailing': false
- * }));
- *
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
- * var source = new EventSource('/stream');
- * jQuery(source).on('message', debounced);
- *
- * // Cancel the trailing debounced invocation.
- * jQuery(window).on('popstate', debounced.cancel);
- */
- function debounce(func, wait, options) {
- var lastArgs,
- lastThis,
- maxWait,
- result,
- timerId,
- lastCallTime,
- lastInvokeTime = 0,
- leading = false,
- maxing = false,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- wait = toNumber(wait) || 0;
- if (isObject(options)) {
- leading = !!options.leading;
- maxing = 'maxWait' in options;
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs,
- thisArg = lastThis;
- lastArgs = lastThis = undefined;
- lastInvokeTime = time;
- result = func.apply(thisArg, args);
- return result;
- }
- function leadingEdge(time) {
- // Reset any `maxWait` timer.
- lastInvokeTime = time; // Start the timer for the trailing edge.
- timerId = setTimeout(timerExpired, wait); // Invoke the leading edge.
- return leading ? invokeFunc(time) : result;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime,
- result = wait - timeSinceLastCall;
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the
- // trailing edge, the system time has gone backwards and we're treating
- // it as the trailing edge, or we've hit the `maxWait` limit.
- return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
- }
- function timerExpired() {
- var time = now();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- } // Restart the timer.
- timerId = setTimeout(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been
- // debounced at least once.
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = undefined;
- return result;
- }
- function cancel() {
- if (timerId !== undefined) {
- clearTimeout(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = undefined;
- }
- function flush() {
- return timerId === undefined ? result : trailingEdge(now());
- }
- function debounced() {
- var time = now(),
- isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === undefined) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- // Handle invocations in a tight loop.
- timerId = setTimeout(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === undefined) {
- timerId = setTimeout(timerExpired, wait);
- }
- return result;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- /**
- * Creates a throttled function that only invokes `func` at most once per
- * every `wait` milliseconds. The throttled function comes with a `cancel`
- * method to cancel delayed `func` invocations and a `flush` method to
- * immediately invoke them. Provide `options` to indicate whether `func`
- * should be invoked on the leading and/or trailing edge of the `wait`
- * timeout. The `func` is invoked with the last arguments provided to the
- * throttled function. Subsequent calls to the throttled function return the
- * result of the last `func` invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the throttled function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.throttle` and `_.debounce`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to throttle.
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=true]
- * Specify invoking on the leading edge of the timeout.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new throttled function.
- * @example
- *
- * // Avoid excessively updating the position while scrolling.
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
- *
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
- * jQuery(element).on('click', throttled);
- *
- * // Cancel the trailing throttled invocation.
- * jQuery(window).on('popstate', throttled.cancel);
- */
- function throttle(func, wait, options) {
- var leading = true,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- if (isObject(options)) {
- leading = 'leading' in options ? !!options.leading : leading;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- return debounce(func, wait, {
- 'leading': leading,
- 'maxWait': wait,
- 'trailing': trailing
- });
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = _typeof(value);
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return !!value && _typeof(value) == 'object';
- }
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol(value) {
- return _typeof(value) == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
- }
- /**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */
- function toNumber(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject(other) ? other + '' : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, '');
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
- }
- module.exports = throttle;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))
- /***/ }),
- /* 14 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ getInternalReactConstants; });
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ attach; });
- // EXTERNAL MODULE: ../react-devtools-shared/src/types.js
- var types = __webpack_require__(1);
- // EXTERNAL MODULE: ../react-devtools-shared/src/utils.js
- var utils = __webpack_require__(0);
- // EXTERNAL MODULE: ../react-devtools-shared/src/storage.js
- var storage = __webpack_require__(5);
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/utils.js + 1 modules
- var backend_utils = __webpack_require__(4);
- // EXTERNAL MODULE: ../react-devtools-shared/src/constants.js
- var constants = __webpack_require__(2);
- // EXTERNAL MODULE: /Users/xch/dev/react/build/oss-experimental/react-debug-tools/index.js
- var react_debug_tools = __webpack_require__(20);
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/console.js
- var backend_console = __webpack_require__(8);
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/ReactSymbols.js
- var ReactSymbols = __webpack_require__(3);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/ReactFiberFlags.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // This list of flags must be synced with the following file:
- // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberFlags.js
- var NoFlags =
- /* */
- 0;
- var PerformedWork =
- /* */
- 1;
- var Placement =
- /* */
- 2;
- var DidCapture =
- /* */
- 128;
- var Hydrating =
- /* */
- 4096;
- // EXTERNAL MODULE: ../react-devtools-shared/src/config/DevToolsFeatureFlags.core-oss.js
- var DevToolsFeatureFlags_core_oss = __webpack_require__(11);
- // CONCATENATED MODULE: ../shared/objectIs.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- /**
- * inlined Object.is polyfill to avoid requiring consumers ship their own
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
- */
- function is(x, y) {
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
- ;
- }
- var objectIs = // $FlowFixMe[method-unbinding]
- typeof Object.is === 'function' ? Object.is : is;
- /* harmony default export */ var shared_objectIs = (objectIs);
- // CONCATENATED MODULE: ../shared/hasOwnProperty.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // $FlowFixMe[method-unbinding]
- var hasOwnProperty_hasOwnProperty = Object.prototype.hasOwnProperty;
- /* harmony default export */ var shared_hasOwnProperty = (hasOwnProperty_hasOwnProperty);
- // EXTERNAL MODULE: ../react-devtools-shared/src/isArray.js
- var isArray = __webpack_require__(6);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/StyleX/utils.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var cachedStyleNameToValueMap = new Map();
- function getStyleXData(data) {
- var sources = new Set();
- var resolvedStyles = {};
- crawlData(data, sources, resolvedStyles);
- return {
- sources: Array.from(sources).sort(),
- resolvedStyles: resolvedStyles
- };
- }
- function crawlData(data, sources, resolvedStyles) {
- if (data == null) {
- return;
- }
- if (Object(isArray["a" /* default */])(data)) {
- data.forEach(function (entry) {
- if (entry == null) {
- return;
- }
- if (Object(isArray["a" /* default */])(entry)) {
- crawlData(entry, sources, resolvedStyles);
- } else {
- crawlObjectProperties(entry, sources, resolvedStyles);
- }
- });
- } else {
- crawlObjectProperties(data, sources, resolvedStyles);
- }
- resolvedStyles = Object.fromEntries(Object.entries(resolvedStyles).sort());
- }
- function crawlObjectProperties(entry, sources, resolvedStyles) {
- var keys = Object.keys(entry);
- keys.forEach(function (key) {
- var value = entry[key];
- if (typeof value === 'string') {
- if (key === value) {
- // Special case; this key is the name of the style's source/file/module.
- sources.add(key);
- } else {
- resolvedStyles[key] = getPropertyValueForStyleName(value);
- }
- } else {
- var nestedStyle = {};
- resolvedStyles[key] = nestedStyle;
- crawlData([value], sources, nestedStyle);
- }
- });
- }
- function getPropertyValueForStyleName(styleName) {
- if (cachedStyleNameToValueMap.has(styleName)) {
- return cachedStyleNameToValueMap.get(styleName);
- }
- for (var styleSheetIndex = 0; styleSheetIndex < document.styleSheets.length; styleSheetIndex++) {
- var styleSheet = document.styleSheets[styleSheetIndex]; // $FlowFixMe Flow doesn't konw about these properties
- var rules = styleSheet.rules || styleSheet.cssRules; // $FlowFixMe `rules` is mixed
- for (var ruleIndex = 0; ruleIndex < rules.length; ruleIndex++) {
- // $FlowFixMe `rules` is mixed
- var rule = rules[ruleIndex]; // $FlowFixMe Flow doesn't konw about these properties
- var cssText = rule.cssText,
- selectorText = rule.selectorText,
- style = rule.style;
- if (selectorText != null) {
- if (selectorText.startsWith(".".concat(styleName))) {
- var match = cssText.match(/{ *([a-z\-]+):/);
- if (match !== null) {
- var property = match[1];
- var value = style.getPropertyValue(property);
- cachedStyleNameToValueMap.set(styleName, value);
- return value;
- } else {
- return null;
- }
- }
- }
- }
- }
- return null;
- }
- // EXTERNAL MODULE: ../shared/isArray.js
- var shared_isArray = __webpack_require__(9);
- // CONCATENATED MODULE: ../react-devtools-timeline/src/constants.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var REACT_TOTAL_NUM_LANES = 31; // Increment this number any time a backwards breaking change is made to the profiler metadata.
- var SCHEDULING_PROFILER_VERSION = 1;
- var SNAPSHOT_MAX_HEIGHT = 60;
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/DevToolsFiberComponentStack.js + 2 modules
- var DevToolsFiberComponentStack = __webpack_require__(15);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/profilingHooks.js
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // Add padding to the start/stop time of the profile.
- // This makes the UI nicer to use.
- var TIME_OFFSET = 10;
- var performanceTarget = null; // If performance exists and supports the subset of the User Timing API that we require.
- var supportsUserTiming = typeof performance !== 'undefined' && // $FlowFixMe[method-unbinding]
- typeof performance.mark === 'function' && // $FlowFixMe[method-unbinding]
- typeof performance.clearMarks === 'function';
- var supportsUserTimingV3 = false;
- if (supportsUserTiming) {
- var CHECK_V3_MARK = '__v3';
- var markOptions = {};
- Object.defineProperty(markOptions, 'startTime', {
- get: function get() {
- supportsUserTimingV3 = true;
- return 0;
- },
- set: function set() {}
- });
- try {
- // $FlowFixMe: Flow expects the User Timing level 2 API.
- performance.mark(CHECK_V3_MARK, markOptions);
- } catch (error) {// Ignore
- } finally {
- performance.clearMarks(CHECK_V3_MARK);
- }
- }
- if (supportsUserTimingV3) {
- performanceTarget = performance;
- } // Some environments (e.g. React Native / Hermes) don't support the performance API yet.
- var getCurrentTime = // $FlowFixMe[method-unbinding]
- (typeof performance === "undefined" ? "undefined" : _typeof(performance)) === 'object' && typeof performance.now === 'function' ? function () {
- return performance.now();
- } : function () {
- return Date.now();
- }; // Mocking the Performance Object (and User Timing APIs) for testing is fragile.
- // This API allows tests to directly override the User Timing APIs.
- function setPerformanceMock_ONLY_FOR_TESTING(performanceMock) {
- performanceTarget = performanceMock;
- supportsUserTiming = performanceMock !== null;
- supportsUserTimingV3 = performanceMock !== null;
- }
- function createProfilingHooks(_ref) {
- var getDisplayNameForFiber = _ref.getDisplayNameForFiber,
- getIsProfiling = _ref.getIsProfiling,
- getLaneLabelMap = _ref.getLaneLabelMap,
- workTagMap = _ref.workTagMap,
- currentDispatcherRef = _ref.currentDispatcherRef,
- reactVersion = _ref.reactVersion;
- var currentBatchUID = 0;
- var currentReactComponentMeasure = null;
- var currentReactMeasuresStack = [];
- var currentTimelineData = null;
- var currentFiberStacks = new Map();
- var isProfiling = false;
- var nextRenderShouldStartNewBatch = false;
- function getRelativeTime() {
- var currentTime = getCurrentTime();
- if (currentTimelineData) {
- if (currentTimelineData.startTime === 0) {
- currentTimelineData.startTime = currentTime - TIME_OFFSET;
- }
- return currentTime - currentTimelineData.startTime;
- }
- return 0;
- }
- function getInternalModuleRanges() {
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges === 'function') {
- // Ask the DevTools hook for module ranges that may have been reported by the current renderer(s).
- // Don't do this eagerly like the laneToLabelMap,
- // because some modules might not yet have registered their boundaries when the renderer is injected.
- var ranges = __REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges(); // This check would not be required,
- // except that it's possible for things to override __REACT_DEVTOOLS_GLOBAL_HOOK__.
- if (Object(shared_isArray["a" /* default */])(ranges)) {
- return ranges;
- }
- }
- return null;
- }
- function getTimelineData() {
- return currentTimelineData;
- }
- function laneToLanesArray(lanes) {
- var lanesArray = [];
- var lane = 1;
- for (var index = 0; index < REACT_TOTAL_NUM_LANES; index++) {
- if (lane & lanes) {
- lanesArray.push(lane);
- }
- lane *= 2;
- }
- return lanesArray;
- }
- var laneToLabelMap = typeof getLaneLabelMap === 'function' ? getLaneLabelMap() : null;
- function markMetadata() {
- markAndClear("--react-version-".concat(reactVersion));
- markAndClear("--profiler-version-".concat(SCHEDULING_PROFILER_VERSION));
- var ranges = getInternalModuleRanges();
- if (ranges) {
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i];
- if (Object(shared_isArray["a" /* default */])(range) && range.length === 2) {
- var _ranges$i = _slicedToArray(ranges[i], 2),
- startStackFrame = _ranges$i[0],
- stopStackFrame = _ranges$i[1];
- markAndClear("--react-internal-module-start-".concat(startStackFrame));
- markAndClear("--react-internal-module-stop-".concat(stopStackFrame));
- }
- }
- }
- if (laneToLabelMap != null) {
- var labels = Array.from(laneToLabelMap.values()).join(',');
- markAndClear("--react-lane-labels-".concat(labels));
- }
- }
- function markAndClear(markName) {
- // This method won't be called unless these functions are defined, so we can skip the extra typeof check.
- performanceTarget.mark(markName);
- performanceTarget.clearMarks(markName);
- }
- function recordReactMeasureStarted(type, lanes) {
- // Decide what depth thi work should be rendered at, based on what's on the top of the stack.
- // It's okay to render over top of "idle" work but everything else should be on its own row.
- var depth = 0;
- if (currentReactMeasuresStack.length > 0) {
- var top = currentReactMeasuresStack[currentReactMeasuresStack.length - 1];
- depth = top.type === 'render-idle' ? top.depth : top.depth + 1;
- }
- var lanesArray = laneToLanesArray(lanes);
- var reactMeasure = {
- type: type,
- batchUID: currentBatchUID,
- depth: depth,
- lanes: lanesArray,
- timestamp: getRelativeTime(),
- duration: 0
- };
- currentReactMeasuresStack.push(reactMeasure);
- if (currentTimelineData) {
- var _currentTimelineData = currentTimelineData,
- batchUIDToMeasuresMap = _currentTimelineData.batchUIDToMeasuresMap,
- laneToReactMeasureMap = _currentTimelineData.laneToReactMeasureMap;
- var reactMeasures = batchUIDToMeasuresMap.get(currentBatchUID);
- if (reactMeasures != null) {
- reactMeasures.push(reactMeasure);
- } else {
- batchUIDToMeasuresMap.set(currentBatchUID, [reactMeasure]);
- }
- lanesArray.forEach(function (lane) {
- reactMeasures = laneToReactMeasureMap.get(lane);
- if (reactMeasures) {
- reactMeasures.push(reactMeasure);
- }
- });
- }
- }
- function recordReactMeasureCompleted(type) {
- var currentTime = getRelativeTime();
- if (currentReactMeasuresStack.length === 0) {
- console.error('Unexpected type "%s" completed at %sms while currentReactMeasuresStack is empty.', type, currentTime); // Ignore work "completion" user timing mark that doesn't complete anything
- return;
- }
- var top = currentReactMeasuresStack.pop();
- if (top.type !== type) {
- console.error('Unexpected type "%s" completed at %sms before "%s" completed.', type, currentTime, top.type);
- } // $FlowFixMe This property should not be writable outside of this function.
- top.duration = currentTime - top.timestamp;
- if (currentTimelineData) {
- currentTimelineData.duration = getRelativeTime() + TIME_OFFSET;
- }
- }
- function markCommitStarted(lanes) {
- if (isProfiling) {
- recordReactMeasureStarted('commit', lanes); // TODO (timeline) Re-think this approach to "batching"; I don't think it works for Suspense or pre-rendering.
- // This issue applies to the User Timing data also.
- nextRenderShouldStartNewBatch = true;
- }
- if (supportsUserTimingV3) {
- markAndClear("--commit-start-".concat(lanes)); // Some metadata only needs to be logged once per session,
- // but if profiling information is being recorded via the Performance tab,
- // DevTools has no way of knowing when the recording starts.
- // Because of that, we log thie type of data periodically (once per commit).
- markMetadata();
- }
- }
- function markCommitStopped() {
- if (isProfiling) {
- recordReactMeasureCompleted('commit');
- recordReactMeasureCompleted('render-idle');
- }
- if (supportsUserTimingV3) {
- markAndClear('--commit-stop');
- }
- }
- function markComponentRenderStarted(fiber) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (isProfiling) {
- currentReactComponentMeasure = {
- componentName: componentName,
- duration: 0,
- timestamp: getRelativeTime(),
- type: 'render',
- warning: null
- };
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--component-render-start-".concat(componentName));
- }
- }
- }
- function markComponentRenderStopped() {
- if (isProfiling) {
- if (currentReactComponentMeasure) {
- if (currentTimelineData) {
- currentTimelineData.componentMeasures.push(currentReactComponentMeasure);
- } // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentReactComponentMeasure.duration = // $FlowFixMe[incompatible-use] found when upgrading Flow
- getRelativeTime() - currentReactComponentMeasure.timestamp;
- currentReactComponentMeasure = null;
- }
- }
- if (supportsUserTimingV3) {
- markAndClear('--component-render-stop');
- }
- }
- function markComponentLayoutEffectMountStarted(fiber) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (isProfiling) {
- currentReactComponentMeasure = {
- componentName: componentName,
- duration: 0,
- timestamp: getRelativeTime(),
- type: 'layout-effect-mount',
- warning: null
- };
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--component-layout-effect-mount-start-".concat(componentName));
- }
- }
- }
- function markComponentLayoutEffectMountStopped() {
- if (isProfiling) {
- if (currentReactComponentMeasure) {
- if (currentTimelineData) {
- currentTimelineData.componentMeasures.push(currentReactComponentMeasure);
- } // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentReactComponentMeasure.duration = // $FlowFixMe[incompatible-use] found when upgrading Flow
- getRelativeTime() - currentReactComponentMeasure.timestamp;
- currentReactComponentMeasure = null;
- }
- }
- if (supportsUserTimingV3) {
- markAndClear('--component-layout-effect-mount-stop');
- }
- }
- function markComponentLayoutEffectUnmountStarted(fiber) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (isProfiling) {
- currentReactComponentMeasure = {
- componentName: componentName,
- duration: 0,
- timestamp: getRelativeTime(),
- type: 'layout-effect-unmount',
- warning: null
- };
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--component-layout-effect-unmount-start-".concat(componentName));
- }
- }
- }
- function markComponentLayoutEffectUnmountStopped() {
- if (isProfiling) {
- if (currentReactComponentMeasure) {
- if (currentTimelineData) {
- currentTimelineData.componentMeasures.push(currentReactComponentMeasure);
- } // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentReactComponentMeasure.duration = // $FlowFixMe[incompatible-use] found when upgrading Flow
- getRelativeTime() - currentReactComponentMeasure.timestamp;
- currentReactComponentMeasure = null;
- }
- }
- if (supportsUserTimingV3) {
- markAndClear('--component-layout-effect-unmount-stop');
- }
- }
- function markComponentPassiveEffectMountStarted(fiber) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (isProfiling) {
- currentReactComponentMeasure = {
- componentName: componentName,
- duration: 0,
- timestamp: getRelativeTime(),
- type: 'passive-effect-mount',
- warning: null
- };
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--component-passive-effect-mount-start-".concat(componentName));
- }
- }
- }
- function markComponentPassiveEffectMountStopped() {
- if (isProfiling) {
- if (currentReactComponentMeasure) {
- if (currentTimelineData) {
- currentTimelineData.componentMeasures.push(currentReactComponentMeasure);
- } // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentReactComponentMeasure.duration = // $FlowFixMe[incompatible-use] found when upgrading Flow
- getRelativeTime() - currentReactComponentMeasure.timestamp;
- currentReactComponentMeasure = null;
- }
- }
- if (supportsUserTimingV3) {
- markAndClear('--component-passive-effect-mount-stop');
- }
- }
- function markComponentPassiveEffectUnmountStarted(fiber) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (isProfiling) {
- currentReactComponentMeasure = {
- componentName: componentName,
- duration: 0,
- timestamp: getRelativeTime(),
- type: 'passive-effect-unmount',
- warning: null
- };
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--component-passive-effect-unmount-start-".concat(componentName));
- }
- }
- }
- function markComponentPassiveEffectUnmountStopped() {
- if (isProfiling) {
- if (currentReactComponentMeasure) {
- if (currentTimelineData) {
- currentTimelineData.componentMeasures.push(currentReactComponentMeasure);
- } // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentReactComponentMeasure.duration = // $FlowFixMe[incompatible-use] found when upgrading Flow
- getRelativeTime() - currentReactComponentMeasure.timestamp;
- currentReactComponentMeasure = null;
- }
- }
- if (supportsUserTimingV3) {
- markAndClear('--component-passive-effect-unmount-stop');
- }
- }
- function markComponentErrored(fiber, thrownValue, lanes) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- var phase = fiber.alternate === null ? 'mount' : 'update';
- var message = '';
- if (thrownValue !== null && _typeof(thrownValue) === 'object' && typeof thrownValue.message === 'string') {
- message = thrownValue.message;
- } else if (typeof thrownValue === 'string') {
- message = thrownValue;
- }
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (currentTimelineData) {
- currentTimelineData.thrownErrors.push({
- componentName: componentName,
- message: message,
- phase: phase,
- timestamp: getRelativeTime(),
- type: 'thrown-error'
- });
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--error-".concat(componentName, "-").concat(phase, "-").concat(message));
- }
- }
- }
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe: Flow cannot handle polymorphic WeakMaps
- var wakeableIDs = new PossiblyWeakMap();
- var wakeableID = 0;
- function getWakeableID(wakeable) {
- if (!wakeableIDs.has(wakeable)) {
- wakeableIDs.set(wakeable, wakeableID++);
- }
- return wakeableIDs.get(wakeable);
- }
- function markComponentSuspended(fiber, wakeable, lanes) {
- if (isProfiling || supportsUserTimingV3) {
- var eventType = wakeableIDs.has(wakeable) ? 'resuspend' : 'suspend';
- var id = getWakeableID(wakeable);
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- var phase = fiber.alternate === null ? 'mount' : 'update'; // Following the non-standard fn.displayName convention,
- // frameworks like Relay may also annotate Promises with a displayName,
- // describing what operation/data the thrown Promise is related to.
- // When this is available we should pass it along to the Timeline.
- var displayName = wakeable.displayName || '';
- var suspenseEvent = null;
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- suspenseEvent = {
- componentName: componentName,
- depth: 0,
- duration: 0,
- id: "".concat(id),
- phase: phase,
- promiseName: displayName,
- resolution: 'unresolved',
- timestamp: getRelativeTime(),
- type: 'suspense',
- warning: null
- };
- if (currentTimelineData) {
- currentTimelineData.suspenseEvents.push(suspenseEvent);
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--suspense-".concat(eventType, "-").concat(id, "-").concat(componentName, "-").concat(phase, "-").concat(lanes, "-").concat(displayName));
- }
- wakeable.then(function () {
- if (suspenseEvent) {
- suspenseEvent.duration = getRelativeTime() - suspenseEvent.timestamp;
- suspenseEvent.resolution = 'resolved';
- }
- if (supportsUserTimingV3) {
- markAndClear("--suspense-resolved-".concat(id, "-").concat(componentName));
- }
- }, function () {
- if (suspenseEvent) {
- suspenseEvent.duration = getRelativeTime() - suspenseEvent.timestamp;
- suspenseEvent.resolution = 'rejected';
- }
- if (supportsUserTimingV3) {
- markAndClear("--suspense-rejected-".concat(id, "-").concat(componentName));
- }
- });
- }
- }
- function markLayoutEffectsStarted(lanes) {
- if (isProfiling) {
- recordReactMeasureStarted('layout-effects', lanes);
- }
- if (supportsUserTimingV3) {
- markAndClear("--layout-effects-start-".concat(lanes));
- }
- }
- function markLayoutEffectsStopped() {
- if (isProfiling) {
- recordReactMeasureCompleted('layout-effects');
- }
- if (supportsUserTimingV3) {
- markAndClear('--layout-effects-stop');
- }
- }
- function markPassiveEffectsStarted(lanes) {
- if (isProfiling) {
- recordReactMeasureStarted('passive-effects', lanes);
- }
- if (supportsUserTimingV3) {
- markAndClear("--passive-effects-start-".concat(lanes));
- }
- }
- function markPassiveEffectsStopped() {
- if (isProfiling) {
- recordReactMeasureCompleted('passive-effects');
- }
- if (supportsUserTimingV3) {
- markAndClear('--passive-effects-stop');
- }
- }
- function markRenderStarted(lanes) {
- if (isProfiling) {
- if (nextRenderShouldStartNewBatch) {
- nextRenderShouldStartNewBatch = false;
- currentBatchUID++;
- } // If this is a new batch of work, wrap an "idle" measure around it.
- // Log it before the "render" measure to preserve the stack ordering.
- if (currentReactMeasuresStack.length === 0 || currentReactMeasuresStack[currentReactMeasuresStack.length - 1].type !== 'render-idle') {
- recordReactMeasureStarted('render-idle', lanes);
- }
- recordReactMeasureStarted('render', lanes);
- }
- if (supportsUserTimingV3) {
- markAndClear("--render-start-".concat(lanes));
- }
- }
- function markRenderYielded() {
- if (isProfiling) {
- recordReactMeasureCompleted('render');
- }
- if (supportsUserTimingV3) {
- markAndClear('--render-yield');
- }
- }
- function markRenderStopped() {
- if (isProfiling) {
- recordReactMeasureCompleted('render');
- }
- if (supportsUserTimingV3) {
- markAndClear('--render-stop');
- }
- }
- function markRenderScheduled(lane) {
- if (isProfiling) {
- if (currentTimelineData) {
- currentTimelineData.schedulingEvents.push({
- lanes: laneToLanesArray(lane),
- timestamp: getRelativeTime(),
- type: 'schedule-render',
- warning: null
- });
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--schedule-render-".concat(lane));
- }
- }
- function markForceUpdateScheduled(fiber, lane) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (currentTimelineData) {
- currentTimelineData.schedulingEvents.push({
- componentName: componentName,
- lanes: laneToLanesArray(lane),
- timestamp: getRelativeTime(),
- type: 'schedule-force-update',
- warning: null
- });
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--schedule-forced-update-".concat(lane, "-").concat(componentName));
- }
- }
- }
- function getParentFibers(fiber) {
- var parents = [];
- var parent = fiber;
- while (parent !== null) {
- parents.push(parent);
- parent = parent.return;
- }
- return parents;
- }
- function markStateUpdateScheduled(fiber, lane) {
- if (isProfiling || supportsUserTimingV3) {
- var componentName = getDisplayNameForFiber(fiber) || 'Unknown';
- if (isProfiling) {
- // TODO (timeline) Record and cache component stack
- if (currentTimelineData) {
- var event = {
- componentName: componentName,
- // Store the parent fibers so we can post process
- // them after we finish profiling
- lanes: laneToLanesArray(lane),
- timestamp: getRelativeTime(),
- type: 'schedule-state-update',
- warning: null
- };
- currentFiberStacks.set(event, getParentFibers(fiber)); // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentTimelineData.schedulingEvents.push(event);
- }
- }
- if (supportsUserTimingV3) {
- markAndClear("--schedule-state-update-".concat(lane, "-").concat(componentName));
- }
- }
- }
- function toggleProfilingStatus(value) {
- if (isProfiling !== value) {
- isProfiling = value;
- if (isProfiling) {
- var internalModuleSourceToRanges = new Map();
- if (supportsUserTimingV3) {
- var ranges = getInternalModuleRanges();
- if (ranges) {
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i];
- if (Object(shared_isArray["a" /* default */])(range) && range.length === 2) {
- var _ranges$i2 = _slicedToArray(ranges[i], 2),
- startStackFrame = _ranges$i2[0],
- stopStackFrame = _ranges$i2[1];
- markAndClear("--react-internal-module-start-".concat(startStackFrame));
- markAndClear("--react-internal-module-stop-".concat(stopStackFrame));
- }
- }
- }
- }
- var laneToReactMeasureMap = new Map();
- var lane = 1;
- for (var index = 0; index < REACT_TOTAL_NUM_LANES; index++) {
- laneToReactMeasureMap.set(lane, []);
- lane *= 2;
- }
- currentBatchUID = 0;
- currentReactComponentMeasure = null;
- currentReactMeasuresStack = [];
- currentFiberStacks = new Map();
- currentTimelineData = {
- // Session wide metadata; only collected once.
- internalModuleSourceToRanges: internalModuleSourceToRanges,
- laneToLabelMap: laneToLabelMap || new Map(),
- reactVersion: reactVersion,
- // Data logged by React during profiling session.
- componentMeasures: [],
- schedulingEvents: [],
- suspenseEvents: [],
- thrownErrors: [],
- // Data inferred based on what React logs.
- batchUIDToMeasuresMap: new Map(),
- duration: 0,
- laneToReactMeasureMap: laneToReactMeasureMap,
- startTime: 0,
- // Data only available in Chrome profiles.
- flamechart: [],
- nativeEvents: [],
- networkMeasures: [],
- otherUserTimingMarks: [],
- snapshots: [],
- snapshotHeight: 0
- };
- nextRenderShouldStartNewBatch = true;
- } else {
- // Postprocess Profile data
- if (currentTimelineData !== null) {
- currentTimelineData.schedulingEvents.forEach(function (event) {
- if (event.type === 'schedule-state-update') {
- // TODO(luna): We can optimize this by creating a map of
- // fiber to component stack instead of generating the stack
- // for every fiber every time
- var fiberStack = currentFiberStacks.get(event);
- if (fiberStack && currentDispatcherRef != null) {
- event.componentStack = fiberStack.reduce(function (trace, fiber) {
- return trace + Object(DevToolsFiberComponentStack["a" /* describeFiber */])(workTagMap, fiber, currentDispatcherRef);
- }, '');
- }
- }
- });
- } // Clear the current fiber stacks so we don't hold onto the fibers
- // in memory after profiling finishes
- currentFiberStacks.clear();
- }
- }
- }
- return {
- getTimelineData: getTimelineData,
- profilingHooks: {
- markCommitStarted: markCommitStarted,
- markCommitStopped: markCommitStopped,
- markComponentRenderStarted: markComponentRenderStarted,
- markComponentRenderStopped: markComponentRenderStopped,
- markComponentPassiveEffectMountStarted: markComponentPassiveEffectMountStarted,
- markComponentPassiveEffectMountStopped: markComponentPassiveEffectMountStopped,
- markComponentPassiveEffectUnmountStarted: markComponentPassiveEffectUnmountStarted,
- markComponentPassiveEffectUnmountStopped: markComponentPassiveEffectUnmountStopped,
- markComponentLayoutEffectMountStarted: markComponentLayoutEffectMountStarted,
- markComponentLayoutEffectMountStopped: markComponentLayoutEffectMountStopped,
- markComponentLayoutEffectUnmountStarted: markComponentLayoutEffectUnmountStarted,
- markComponentLayoutEffectUnmountStopped: markComponentLayoutEffectUnmountStopped,
- markComponentErrored: markComponentErrored,
- markComponentSuspended: markComponentSuspended,
- markLayoutEffectsStarted: markLayoutEffectsStarted,
- markLayoutEffectsStopped: markLayoutEffectsStopped,
- markPassiveEffectsStarted: markPassiveEffectsStarted,
- markPassiveEffectsStopped: markPassiveEffectsStopped,
- markRenderStarted: markRenderStarted,
- markRenderYielded: markRenderYielded,
- markRenderStopped: markRenderStopped,
- markRenderScheduled: markRenderScheduled,
- markForceUpdateScheduled: markForceUpdateScheduled,
- markStateUpdateScheduled: markStateUpdateScheduled
- },
- toggleProfilingStatus: toggleProfilingStatus
- };
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/renderer.js
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function renderer_slicedToArray(arr, i) { return renderer_arrayWithHoles(arr) || renderer_iterableToArrayLimit(arr, i) || renderer_unsupportedIterableToArray(arr, i) || renderer_nonIterableRest(); }
- function renderer_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function renderer_iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
- function renderer_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || renderer_unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return renderer_arrayLikeToArray(arr); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = renderer_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
- function renderer_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return renderer_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return renderer_arrayLikeToArray(o, minLen); }
- function renderer_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- function renderer_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { renderer_typeof = function _typeof(obj) { return typeof obj; }; } else { renderer_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return renderer_typeof(obj); }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function getFiberFlags(fiber) {
- // The name of this field changed from "effectTag" to "flags"
- return fiber.flags !== undefined ? fiber.flags : fiber.effectTag;
- } // Some environments (e.g. React Native / Hermes) don't support the performance API yet.
- var renderer_getCurrentTime = // $FlowFixMe[method-unbinding]
- (typeof performance === "undefined" ? "undefined" : renderer_typeof(performance)) === 'object' && typeof performance.now === 'function' ? function () {
- return performance.now();
- } : function () {
- return Date.now();
- };
- function getInternalReactConstants(version) {
- // **********************************************************
- // The section below is copied from files in React repo.
- // Keep it in sync, and add version guards if it changes.
- //
- // Technically these priority levels are invalid for versions before 16.9,
- // but 16.9 is the first version to report priority level to DevTools,
- // so we can avoid checking for earlier versions and support pre-16.9 canary releases in the process.
- var ReactPriorityLevels = {
- ImmediatePriority: 99,
- UserBlockingPriority: 98,
- NormalPriority: 97,
- LowPriority: 96,
- IdlePriority: 95,
- NoPriority: 90
- };
- if (Object(backend_utils["i" /* gt */])(version, '17.0.2')) {
- ReactPriorityLevels = {
- ImmediatePriority: 1,
- UserBlockingPriority: 2,
- NormalPriority: 3,
- LowPriority: 4,
- IdlePriority: 5,
- NoPriority: 0
- };
- }
- var StrictModeBits = 0;
- if (Object(backend_utils["j" /* gte */])(version, '18.0.0-alpha')) {
- // 18+
- StrictModeBits = 24;
- } else if (Object(backend_utils["j" /* gte */])(version, '16.9.0')) {
- // 16.9 - 17
- StrictModeBits = 1;
- } else if (Object(backend_utils["j" /* gte */])(version, '16.3.0')) {
- // 16.3 - 16.8
- StrictModeBits = 2;
- }
- var ReactTypeOfWork = null; // **********************************************************
- // The section below is copied from files in React repo.
- // Keep it in sync, and add version guards if it changes.
- //
- // TODO Update the gt() check below to be gte() whichever the next version number is.
- // Currently the version in Git is 17.0.2 (but that version has not been/may not end up being released).
- if (Object(backend_utils["i" /* gt */])(version, '17.0.1')) {
- ReactTypeOfWork = {
- CacheComponent: 24,
- // Experimental
- ClassComponent: 1,
- ContextConsumer: 9,
- ContextProvider: 10,
- CoroutineComponent: -1,
- // Removed
- CoroutineHandlerPhase: -1,
- // Removed
- DehydratedSuspenseComponent: 18,
- // Behind a flag
- ForwardRef: 11,
- Fragment: 7,
- FunctionComponent: 0,
- HostComponent: 5,
- HostPortal: 4,
- HostRoot: 3,
- HostResource: 26,
- // In reality, 18.2+. But doesn't hurt to include it here
- HostSingleton: 27,
- // Same as above
- HostText: 6,
- IncompleteClassComponent: 17,
- IndeterminateComponent: 2,
- LazyComponent: 16,
- LegacyHiddenComponent: 23,
- MemoComponent: 14,
- Mode: 8,
- OffscreenComponent: 22,
- // Experimental
- Profiler: 12,
- ScopeComponent: 21,
- // Experimental
- SimpleMemoComponent: 15,
- SuspenseComponent: 13,
- SuspenseListComponent: 19,
- // Experimental
- TracingMarkerComponent: 25,
- // Experimental - This is technically in 18 but we don't
- // want to fork again so we're adding it here instead
- YieldComponent: -1 // Removed
- };
- } else if (Object(backend_utils["j" /* gte */])(version, '17.0.0-alpha')) {
- ReactTypeOfWork = {
- CacheComponent: -1,
- // Doesn't exist yet
- ClassComponent: 1,
- ContextConsumer: 9,
- ContextProvider: 10,
- CoroutineComponent: -1,
- // Removed
- CoroutineHandlerPhase: -1,
- // Removed
- DehydratedSuspenseComponent: 18,
- // Behind a flag
- ForwardRef: 11,
- Fragment: 7,
- FunctionComponent: 0,
- HostComponent: 5,
- HostPortal: 4,
- HostRoot: 3,
- HostResource: -1,
- // Doesn't exist yet
- HostSingleton: -1,
- // Doesn't exist yet
- HostText: 6,
- IncompleteClassComponent: 17,
- IndeterminateComponent: 2,
- LazyComponent: 16,
- LegacyHiddenComponent: 24,
- MemoComponent: 14,
- Mode: 8,
- OffscreenComponent: 23,
- // Experimental
- Profiler: 12,
- ScopeComponent: 21,
- // Experimental
- SimpleMemoComponent: 15,
- SuspenseComponent: 13,
- SuspenseListComponent: 19,
- // Experimental
- TracingMarkerComponent: -1,
- // Doesn't exist yet
- YieldComponent: -1 // Removed
- };
- } else if (Object(backend_utils["j" /* gte */])(version, '16.6.0-beta.0')) {
- ReactTypeOfWork = {
- CacheComponent: -1,
- // Doesn't exist yet
- ClassComponent: 1,
- ContextConsumer: 9,
- ContextProvider: 10,
- CoroutineComponent: -1,
- // Removed
- CoroutineHandlerPhase: -1,
- // Removed
- DehydratedSuspenseComponent: 18,
- // Behind a flag
- ForwardRef: 11,
- Fragment: 7,
- FunctionComponent: 0,
- HostComponent: 5,
- HostPortal: 4,
- HostRoot: 3,
- HostResource: -1,
- // Doesn't exist yet
- HostSingleton: -1,
- // Doesn't exist yet
- HostText: 6,
- IncompleteClassComponent: 17,
- IndeterminateComponent: 2,
- LazyComponent: 16,
- LegacyHiddenComponent: -1,
- MemoComponent: 14,
- Mode: 8,
- OffscreenComponent: -1,
- // Experimental
- Profiler: 12,
- ScopeComponent: -1,
- // Experimental
- SimpleMemoComponent: 15,
- SuspenseComponent: 13,
- SuspenseListComponent: 19,
- // Experimental
- TracingMarkerComponent: -1,
- // Doesn't exist yet
- YieldComponent: -1 // Removed
- };
- } else if (Object(backend_utils["j" /* gte */])(version, '16.4.3-alpha')) {
- ReactTypeOfWork = {
- CacheComponent: -1,
- // Doesn't exist yet
- ClassComponent: 2,
- ContextConsumer: 11,
- ContextProvider: 12,
- CoroutineComponent: -1,
- // Removed
- CoroutineHandlerPhase: -1,
- // Removed
- DehydratedSuspenseComponent: -1,
- // Doesn't exist yet
- ForwardRef: 13,
- Fragment: 9,
- FunctionComponent: 0,
- HostComponent: 7,
- HostPortal: 6,
- HostRoot: 5,
- HostResource: -1,
- // Doesn't exist yet
- HostSingleton: -1,
- // Doesn't exist yet
- HostText: 8,
- IncompleteClassComponent: -1,
- // Doesn't exist yet
- IndeterminateComponent: 4,
- LazyComponent: -1,
- // Doesn't exist yet
- LegacyHiddenComponent: -1,
- MemoComponent: -1,
- // Doesn't exist yet
- Mode: 10,
- OffscreenComponent: -1,
- // Experimental
- Profiler: 15,
- ScopeComponent: -1,
- // Experimental
- SimpleMemoComponent: -1,
- // Doesn't exist yet
- SuspenseComponent: 16,
- SuspenseListComponent: -1,
- // Doesn't exist yet
- TracingMarkerComponent: -1,
- // Doesn't exist yet
- YieldComponent: -1 // Removed
- };
- } else {
- ReactTypeOfWork = {
- CacheComponent: -1,
- // Doesn't exist yet
- ClassComponent: 2,
- ContextConsumer: 12,
- ContextProvider: 13,
- CoroutineComponent: 7,
- CoroutineHandlerPhase: 8,
- DehydratedSuspenseComponent: -1,
- // Doesn't exist yet
- ForwardRef: 14,
- Fragment: 10,
- FunctionComponent: 1,
- HostComponent: 5,
- HostPortal: 4,
- HostRoot: 3,
- HostResource: -1,
- // Doesn't exist yet
- HostSingleton: -1,
- // Doesn't exist yet
- HostText: 6,
- IncompleteClassComponent: -1,
- // Doesn't exist yet
- IndeterminateComponent: 0,
- LazyComponent: -1,
- // Doesn't exist yet
- LegacyHiddenComponent: -1,
- MemoComponent: -1,
- // Doesn't exist yet
- Mode: 11,
- OffscreenComponent: -1,
- // Experimental
- Profiler: 15,
- ScopeComponent: -1,
- // Experimental
- SimpleMemoComponent: -1,
- // Doesn't exist yet
- SuspenseComponent: 16,
- SuspenseListComponent: -1,
- // Doesn't exist yet
- TracingMarkerComponent: -1,
- // Doesn't exist yet
- YieldComponent: 9
- };
- } // **********************************************************
- // End of copied code.
- // **********************************************************
- function getTypeSymbol(type) {
- var symbolOrNumber = renderer_typeof(type) === 'object' && type !== null ? type.$$typeof : type;
- return renderer_typeof(symbolOrNumber) === 'symbol' ? // $FlowFixMe `toString()` doesn't match the type signature?
- symbolOrNumber.toString() : symbolOrNumber;
- }
- var _ReactTypeOfWork = ReactTypeOfWork,
- CacheComponent = _ReactTypeOfWork.CacheComponent,
- ClassComponent = _ReactTypeOfWork.ClassComponent,
- IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent,
- FunctionComponent = _ReactTypeOfWork.FunctionComponent,
- IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent,
- ForwardRef = _ReactTypeOfWork.ForwardRef,
- HostRoot = _ReactTypeOfWork.HostRoot,
- HostResource = _ReactTypeOfWork.HostResource,
- HostSingleton = _ReactTypeOfWork.HostSingleton,
- HostComponent = _ReactTypeOfWork.HostComponent,
- HostPortal = _ReactTypeOfWork.HostPortal,
- HostText = _ReactTypeOfWork.HostText,
- Fragment = _ReactTypeOfWork.Fragment,
- LazyComponent = _ReactTypeOfWork.LazyComponent,
- LegacyHiddenComponent = _ReactTypeOfWork.LegacyHiddenComponent,
- MemoComponent = _ReactTypeOfWork.MemoComponent,
- OffscreenComponent = _ReactTypeOfWork.OffscreenComponent,
- Profiler = _ReactTypeOfWork.Profiler,
- ScopeComponent = _ReactTypeOfWork.ScopeComponent,
- SimpleMemoComponent = _ReactTypeOfWork.SimpleMemoComponent,
- SuspenseComponent = _ReactTypeOfWork.SuspenseComponent,
- SuspenseListComponent = _ReactTypeOfWork.SuspenseListComponent,
- TracingMarkerComponent = _ReactTypeOfWork.TracingMarkerComponent;
- function resolveFiberType(type) {
- var typeSymbol = getTypeSymbol(type);
- switch (typeSymbol) {
- case ReactSymbols["j" /* MEMO_NUMBER */]:
- case ReactSymbols["k" /* MEMO_SYMBOL_STRING */]:
- // recursively resolving memo type in case of memo(forwardRef(Component))
- return resolveFiberType(type.type);
- case ReactSymbols["f" /* FORWARD_REF_NUMBER */]:
- case ReactSymbols["g" /* FORWARD_REF_SYMBOL_STRING */]:
- return type.render;
- default:
- return type;
- }
- } // NOTICE Keep in sync with shouldFilterFiber() and other get*ForFiber methods
- function getDisplayNameForFiber(fiber) {
- var elementType = fiber.elementType,
- type = fiber.type,
- tag = fiber.tag;
- var resolvedType = type;
- if (renderer_typeof(type) === 'object' && type !== null) {
- resolvedType = resolveFiberType(type);
- }
- var resolvedContext = null;
- switch (tag) {
- case CacheComponent:
- return 'Cache';
- case ClassComponent:
- case IncompleteClassComponent:
- return Object(utils["h" /* getDisplayName */])(resolvedType);
- case FunctionComponent:
- case IndeterminateComponent:
- return Object(utils["h" /* getDisplayName */])(resolvedType);
- case ForwardRef:
- return Object(utils["l" /* getWrappedDisplayName */])(elementType, resolvedType, 'ForwardRef', 'Anonymous');
- case HostRoot:
- var fiberRoot = fiber.stateNode;
- if (fiberRoot != null && fiberRoot._debugRootType !== null) {
- return fiberRoot._debugRootType;
- }
- return null;
- case HostComponent:
- case HostSingleton:
- case HostResource:
- return type;
- case HostPortal:
- case HostText:
- return null;
- case Fragment:
- return 'Fragment';
- case LazyComponent:
- // This display name will not be user visible.
- // Once a Lazy component loads its inner component, React replaces the tag and type.
- // This display name will only show up in console logs when DevTools DEBUG mode is on.
- return 'Lazy';
- case MemoComponent:
- case SimpleMemoComponent:
- // Display name in React does not use `Memo` as a wrapper but fallback name.
- return Object(utils["l" /* getWrappedDisplayName */])(elementType, resolvedType, 'Memo', 'Anonymous');
- case SuspenseComponent:
- return 'Suspense';
- case LegacyHiddenComponent:
- return 'LegacyHidden';
- case OffscreenComponent:
- return 'Offscreen';
- case ScopeComponent:
- return 'Scope';
- case SuspenseListComponent:
- return 'SuspenseList';
- case Profiler:
- return 'Profiler';
- case TracingMarkerComponent:
- return 'TracingMarker';
- default:
- var typeSymbol = getTypeSymbol(type);
- switch (typeSymbol) {
- case ReactSymbols["a" /* CONCURRENT_MODE_NUMBER */]:
- case ReactSymbols["b" /* CONCURRENT_MODE_SYMBOL_STRING */]:
- case ReactSymbols["e" /* DEPRECATED_ASYNC_MODE_SYMBOL_STRING */]:
- return null;
- case ReactSymbols["n" /* PROVIDER_NUMBER */]:
- case ReactSymbols["o" /* PROVIDER_SYMBOL_STRING */]:
- // 16.3.0 exposed the context object as "context"
- // PR #12501 changed it to "_context" for 16.3.1+
- // NOTE Keep in sync with inspectElementRaw()
- resolvedContext = fiber.type._context || fiber.type.context;
- return "".concat(resolvedContext.displayName || 'Context', ".Provider");
- case ReactSymbols["c" /* CONTEXT_NUMBER */]:
- case ReactSymbols["d" /* CONTEXT_SYMBOL_STRING */]:
- case ReactSymbols["r" /* SERVER_CONTEXT_SYMBOL_STRING */]:
- // 16.3-16.5 read from "type" because the Consumer is the actual context object.
- // 16.6+ should read from "type._context" because Consumer can be different (in DEV).
- // NOTE Keep in sync with inspectElementRaw()
- resolvedContext = fiber.type._context || fiber.type; // NOTE: TraceUpdatesBackendManager depends on the name ending in '.Consumer'
- // If you change the name, figure out a more resilient way to detect it.
- return "".concat(resolvedContext.displayName || 'Context', ".Consumer");
- case ReactSymbols["s" /* STRICT_MODE_NUMBER */]:
- case ReactSymbols["t" /* STRICT_MODE_SYMBOL_STRING */]:
- return null;
- case ReactSymbols["l" /* PROFILER_NUMBER */]:
- case ReactSymbols["m" /* PROFILER_SYMBOL_STRING */]:
- return "Profiler(".concat(fiber.memoizedProps.id, ")");
- case ReactSymbols["p" /* SCOPE_NUMBER */]:
- case ReactSymbols["q" /* SCOPE_SYMBOL_STRING */]:
- return 'Scope';
- default:
- // Unknown element type.
- // This may mean a new element type that has not yet been added to DevTools.
- return null;
- }
- }
- }
- return {
- getDisplayNameForFiber: getDisplayNameForFiber,
- getTypeSymbol: getTypeSymbol,
- ReactPriorityLevels: ReactPriorityLevels,
- ReactTypeOfWork: ReactTypeOfWork,
- StrictModeBits: StrictModeBits
- };
- } // Map of one or more Fibers in a pair to their unique id number.
- // We track both Fibers to support Fast Refresh,
- // which may forcefully replace one of the pair as part of hot reloading.
- // In that case it's still important to be able to locate the previous ID during subsequent renders.
- var fiberToIDMap = new Map(); // Map of id to one (arbitrary) Fiber in a pair.
- // This Map is used to e.g. get the display name for a Fiber or schedule an update,
- // operations that should be the same whether the current and work-in-progress Fiber is used.
- var idToArbitraryFiberMap = new Map();
- function attach(hook, rendererID, renderer, global) {
- // Newer versions of the reconciler package also specific reconciler version.
- // If that version number is present, use it.
- // Third party renderer versions may not match the reconciler version,
- // and the latter is what's important in terms of tags and symbols.
- var version = renderer.reconcilerVersion || renderer.version;
- var _getInternalReactCons = getInternalReactConstants(version),
- getDisplayNameForFiber = _getInternalReactCons.getDisplayNameForFiber,
- getTypeSymbol = _getInternalReactCons.getTypeSymbol,
- ReactPriorityLevels = _getInternalReactCons.ReactPriorityLevels,
- ReactTypeOfWork = _getInternalReactCons.ReactTypeOfWork,
- StrictModeBits = _getInternalReactCons.StrictModeBits;
- var CacheComponent = ReactTypeOfWork.CacheComponent,
- ClassComponent = ReactTypeOfWork.ClassComponent,
- ContextConsumer = ReactTypeOfWork.ContextConsumer,
- DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent,
- ForwardRef = ReactTypeOfWork.ForwardRef,
- Fragment = ReactTypeOfWork.Fragment,
- FunctionComponent = ReactTypeOfWork.FunctionComponent,
- HostRoot = ReactTypeOfWork.HostRoot,
- HostResource = ReactTypeOfWork.HostResource,
- HostSingleton = ReactTypeOfWork.HostSingleton,
- HostPortal = ReactTypeOfWork.HostPortal,
- HostComponent = ReactTypeOfWork.HostComponent,
- HostText = ReactTypeOfWork.HostText,
- IncompleteClassComponent = ReactTypeOfWork.IncompleteClassComponent,
- IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent,
- LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent,
- MemoComponent = ReactTypeOfWork.MemoComponent,
- OffscreenComponent = ReactTypeOfWork.OffscreenComponent,
- SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent,
- SuspenseComponent = ReactTypeOfWork.SuspenseComponent,
- SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent,
- TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent;
- var ImmediatePriority = ReactPriorityLevels.ImmediatePriority,
- UserBlockingPriority = ReactPriorityLevels.UserBlockingPriority,
- NormalPriority = ReactPriorityLevels.NormalPriority,
- LowPriority = ReactPriorityLevels.LowPriority,
- IdlePriority = ReactPriorityLevels.IdlePriority,
- NoPriority = ReactPriorityLevels.NoPriority;
- var getLaneLabelMap = renderer.getLaneLabelMap,
- injectProfilingHooks = renderer.injectProfilingHooks,
- overrideHookState = renderer.overrideHookState,
- overrideHookStateDeletePath = renderer.overrideHookStateDeletePath,
- overrideHookStateRenamePath = renderer.overrideHookStateRenamePath,
- overrideProps = renderer.overrideProps,
- overridePropsDeletePath = renderer.overridePropsDeletePath,
- overridePropsRenamePath = renderer.overridePropsRenamePath,
- scheduleRefresh = renderer.scheduleRefresh,
- setErrorHandler = renderer.setErrorHandler,
- setSuspenseHandler = renderer.setSuspenseHandler,
- scheduleUpdate = renderer.scheduleUpdate;
- var supportsTogglingError = typeof setErrorHandler === 'function' && typeof scheduleUpdate === 'function';
- var supportsTogglingSuspense = typeof setSuspenseHandler === 'function' && typeof scheduleUpdate === 'function';
- if (typeof scheduleRefresh === 'function') {
- // When Fast Refresh updates a component, the frontend may need to purge cached information.
- // For example, ASTs cached for the component (for named hooks) may no longer be valid.
- // Send a signal to the frontend to purge this cached information.
- // The "fastRefreshScheduled" dispatched is global (not Fiber or even Renderer specific).
- // This is less effecient since it means the front-end will need to purge the entire cache,
- // but this is probably an okay trade off in order to reduce coupling between the DevTools and Fast Refresh.
- renderer.scheduleRefresh = function () {
- try {
- hook.emit('fastRefreshScheduled');
- } finally {
- return scheduleRefresh.apply(void 0, arguments);
- }
- };
- }
- var getTimelineData = null;
- var toggleProfilingStatus = null;
- if (typeof injectProfilingHooks === 'function') {
- var response = createProfilingHooks({
- getDisplayNameForFiber: getDisplayNameForFiber,
- getIsProfiling: function getIsProfiling() {
- return isProfiling;
- },
- getLaneLabelMap: getLaneLabelMap,
- currentDispatcherRef: renderer.currentDispatcherRef,
- workTagMap: ReactTypeOfWork,
- reactVersion: version
- }); // Pass the Profiling hooks to the reconciler for it to call during render.
- injectProfilingHooks(response.profilingHooks); // Hang onto this toggle so we can notify the external methods of profiling status changes.
- getTimelineData = response.getTimelineData;
- toggleProfilingStatus = response.toggleProfilingStatus;
- } // Tracks Fibers with recently changed number of error/warning messages.
- // These collections store the Fiber rather than the ID,
- // in order to avoid generating an ID for Fibers that never get mounted
- // (due to e.g. Suspense or error boundaries).
- // onErrorOrWarning() adds Fibers and recordPendingErrorsAndWarnings() later clears them.
- var fibersWithChangedErrorOrWarningCounts = new Set();
- var pendingFiberToErrorsMap = new Map();
- var pendingFiberToWarningsMap = new Map(); // Mapping of fiber IDs to error/warning messages and counts.
- var fiberIDToErrorsMap = new Map();
- var fiberIDToWarningsMap = new Map();
- function clearErrorsAndWarnings() {
- // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- var _iterator = _createForOfIteratorHelper(fiberIDToErrorsMap.keys()),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var id = _step.value;
- var _fiber = idToArbitraryFiberMap.get(id);
- if (_fiber != null) {
- fibersWithChangedErrorOrWarningCounts.add(_fiber);
- updateMostRecentlyInspectedElementIfNecessary(id);
- }
- } // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- var _iterator2 = _createForOfIteratorHelper(fiberIDToWarningsMap.keys()),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _id = _step2.value;
- var _fiber2 = idToArbitraryFiberMap.get(_id);
- if (_fiber2 != null) {
- fibersWithChangedErrorOrWarningCounts.add(_fiber2);
- updateMostRecentlyInspectedElementIfNecessary(_id);
- }
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- fiberIDToErrorsMap.clear();
- fiberIDToWarningsMap.clear();
- flushPendingEvents();
- }
- function clearMessageCountHelper(fiberID, pendingFiberToMessageCountMap, fiberIDToMessageCountMap) {
- var fiber = idToArbitraryFiberMap.get(fiberID);
- if (fiber != null) {
- // Throw out any pending changes.
- pendingFiberToErrorsMap.delete(fiber);
- if (fiberIDToMessageCountMap.has(fiberID)) {
- fiberIDToMessageCountMap.delete(fiberID); // If previous flushed counts have changed, schedule an update too.
- fibersWithChangedErrorOrWarningCounts.add(fiber);
- flushPendingEvents();
- updateMostRecentlyInspectedElementIfNecessary(fiberID);
- } else {
- fibersWithChangedErrorOrWarningCounts.delete(fiber);
- }
- }
- }
- function clearErrorsForFiberID(fiberID) {
- clearMessageCountHelper(fiberID, pendingFiberToErrorsMap, fiberIDToErrorsMap);
- }
- function clearWarningsForFiberID(fiberID) {
- clearMessageCountHelper(fiberID, pendingFiberToWarningsMap, fiberIDToWarningsMap);
- }
- function updateMostRecentlyInspectedElementIfNecessary(fiberID) {
- if (mostRecentlyInspectedElement !== null && mostRecentlyInspectedElement.id === fiberID) {
- hasElementUpdatedSinceLastInspected = true;
- }
- } // Called when an error or warning is logged during render, commit, or passive (including unmount functions).
- function onErrorOrWarning(fiber, type, args) {
- if (type === 'error') {
- var maybeID = getFiberIDUnsafe(fiber); // if this is an error simulated by us to trigger error boundary, ignore
- if (maybeID != null && forceErrorForFiberIDs.get(maybeID) === true) {
- return;
- }
- }
- var message = backend_utils["f" /* format */].apply(void 0, _toConsumableArray(args));
- if (constants["s" /* __DEBUG__ */]) {
- debug('onErrorOrWarning', fiber, null, "".concat(type, ": \"").concat(message, "\""));
- } // Mark this Fiber as needed its warning/error count updated during the next flush.
- fibersWithChangedErrorOrWarningCounts.add(fiber); // Track the warning/error for later.
- var fiberMap = type === 'error' ? pendingFiberToErrorsMap : pendingFiberToWarningsMap;
- var messageMap = fiberMap.get(fiber);
- if (messageMap != null) {
- var count = messageMap.get(message) || 0;
- messageMap.set(message, count + 1);
- } else {
- fiberMap.set(fiber, new Map([[message, 1]]));
- } // Passive effects may trigger errors or warnings too;
- // In this case, we should wait until the rest of the passive effects have run,
- // but we shouldn't wait until the next commit because that might be a long time.
- // This would also cause "tearing" between an inspected Component and the tree view.
- // Then again we don't want to flush too soon because this could be an error during async rendering.
- // Use a debounce technique to ensure that we'll eventually flush.
- flushPendingErrorsAndWarningsAfterDelay();
- } // Patching the console enables DevTools to do a few useful things:
- // * Append component stacks to warnings and error messages
- // * Disable logging during re-renders to inspect hooks (see inspectHooksOfFiber)
- Object(backend_console["d" /* registerRenderer */])(renderer, onErrorOrWarning); // The renderer interface can't read these preferences directly,
- // because it is stored in localStorage within the context of the extension.
- // It relies on the extension to pass the preference through via the global.
- Object(backend_console["b" /* patchConsoleUsingWindowValues */])();
- var debug = function debug(name, fiber, parentFiber) {
- var extraString = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
- if (constants["s" /* __DEBUG__ */]) {
- var displayName = fiber.tag + ':' + (getDisplayNameForFiber(fiber) || 'null');
- var maybeID = getFiberIDUnsafe(fiber) || '<no id>';
- var parentDisplayName = parentFiber ? parentFiber.tag + ':' + (getDisplayNameForFiber(parentFiber) || 'null') : '';
- var maybeParentID = parentFiber ? getFiberIDUnsafe(parentFiber) || '<no-id>' : '';
- console.groupCollapsed("[renderer] %c".concat(name, " %c").concat(displayName, " (").concat(maybeID, ") %c").concat(parentFiber ? "".concat(parentDisplayName, " (").concat(maybeParentID, ")") : '', " %c").concat(extraString), 'color: red; font-weight: bold;', 'color: blue;', 'color: purple;', 'color: black;');
- console.log(new Error().stack.split('\n').slice(1).join('\n'));
- console.groupEnd();
- }
- }; // Configurable Components tree filters.
- var hideElementsWithDisplayNames = new Set();
- var hideElementsWithPaths = new Set();
- var hideElementsWithTypes = new Set(); // Highlight updates
- var traceUpdatesEnabled = false;
- var traceUpdatesForNodes = new Set();
- function applyComponentFilters(componentFilters) {
- hideElementsWithTypes.clear();
- hideElementsWithDisplayNames.clear();
- hideElementsWithPaths.clear();
- componentFilters.forEach(function (componentFilter) {
- if (!componentFilter.isEnabled) {
- return;
- }
- switch (componentFilter.type) {
- case types["a" /* ComponentFilterDisplayName */]:
- if (componentFilter.isValid && componentFilter.value !== '') {
- hideElementsWithDisplayNames.add(new RegExp(componentFilter.value, 'i'));
- }
- break;
- case types["b" /* ComponentFilterElementType */]:
- hideElementsWithTypes.add(componentFilter.value);
- break;
- case types["d" /* ComponentFilterLocation */]:
- if (componentFilter.isValid && componentFilter.value !== '') {
- hideElementsWithPaths.add(new RegExp(componentFilter.value, 'i'));
- }
- break;
- case types["c" /* ComponentFilterHOC */]:
- hideElementsWithDisplayNames.add(new RegExp('\\('));
- break;
- default:
- console.warn("Invalid component filter type \"".concat(componentFilter.type, "\""));
- break;
- }
- });
- } // The renderer interface can't read saved component filters directly,
- // because they are stored in localStorage within the context of the extension.
- // Instead it relies on the extension to pass filters through.
- if (window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ != null) {
- applyComponentFilters(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__);
- } else {
- // Unfortunately this feature is not expected to work for React Native for now.
- // It would be annoying for us to spam YellowBox warnings with unactionable stuff,
- // so for now just skip this message...
- //console.warn('⚛️ DevTools: Could not locate saved component filters');
- // Fallback to assuming the default filters in this case.
- applyComponentFilters(Object(utils["g" /* getDefaultComponentFilters */])());
- } // If necessary, we can revisit optimizing this operation.
- // For example, we could add a new recursive unmount tree operation.
- // The unmount operations are already significantly smaller than mount operations though.
- // This is something to keep in mind for later.
- function updateComponentFilters(componentFilters) {
- if (isProfiling) {
- // Re-mounting a tree while profiling is in progress might break a lot of assumptions.
- // If necessary, we could support this- but it doesn't seem like a necessary use case.
- throw Error('Cannot modify filter preferences while profiling');
- } // Recursively unmount all roots.
- hook.getFiberRoots(rendererID).forEach(function (root) {
- currentRootID = getOrGenerateFiberID(root.current); // The TREE_OPERATION_REMOVE_ROOT operation serves two purposes:
- // 1. It avoids sending unnecessary bridge traffic to clear a root.
- // 2. It preserves Fiber IDs when remounting (below) which in turn ID to error/warning mapping.
- pushOperation(constants["n" /* TREE_OPERATION_REMOVE_ROOT */]);
- flushPendingEvents(root);
- currentRootID = -1;
- });
- applyComponentFilters(componentFilters); // Reset pseudo counters so that new path selections will be persisted.
- rootDisplayNameCounter.clear(); // Recursively re-mount all roots with new filter criteria applied.
- hook.getFiberRoots(rendererID).forEach(function (root) {
- currentRootID = getOrGenerateFiberID(root.current);
- setRootPseudoKey(currentRootID, root.current);
- mountFiberRecursively(root.current, null, false, false);
- flushPendingEvents(root);
- currentRootID = -1;
- }); // Also re-evaluate all error and warning counts given the new filters.
- reevaluateErrorsAndWarnings();
- flushPendingEvents();
- } // NOTICE Keep in sync with get*ForFiber methods
- function shouldFilterFiber(fiber) {
- var _debugSource = fiber._debugSource,
- tag = fiber.tag,
- type = fiber.type,
- key = fiber.key;
- switch (tag) {
- case DehydratedSuspenseComponent:
- // TODO: ideally we would show dehydrated Suspense immediately.
- // However, it has some special behavior (like disconnecting
- // an alternate and turning into real Suspense) which breaks DevTools.
- // For now, ignore it, and only show it once it gets hydrated.
- // https://github.com/bvaughn/react-devtools-experimental/issues/197
- return true;
- case HostPortal:
- case HostText:
- case LegacyHiddenComponent:
- case OffscreenComponent:
- return true;
- case HostRoot:
- // It is never valid to filter the root element.
- return false;
- case Fragment:
- return key === null;
- default:
- var typeSymbol = getTypeSymbol(type);
- switch (typeSymbol) {
- case ReactSymbols["a" /* CONCURRENT_MODE_NUMBER */]:
- case ReactSymbols["b" /* CONCURRENT_MODE_SYMBOL_STRING */]:
- case ReactSymbols["e" /* DEPRECATED_ASYNC_MODE_SYMBOL_STRING */]:
- case ReactSymbols["s" /* STRICT_MODE_NUMBER */]:
- case ReactSymbols["t" /* STRICT_MODE_SYMBOL_STRING */]:
- return true;
- default:
- break;
- }
- }
- var elementType = getElementTypeForFiber(fiber);
- if (hideElementsWithTypes.has(elementType)) {
- return true;
- }
- if (hideElementsWithDisplayNames.size > 0) {
- var displayName = getDisplayNameForFiber(fiber);
- if (displayName != null) {
- // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- var _iterator3 = _createForOfIteratorHelper(hideElementsWithDisplayNames),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var displayNameRegExp = _step3.value;
- if (displayNameRegExp.test(displayName)) {
- return true;
- }
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- }
- }
- if (_debugSource != null && hideElementsWithPaths.size > 0) {
- var fileName = _debugSource.fileName; // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- var _iterator4 = _createForOfIteratorHelper(hideElementsWithPaths),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var pathRegExp = _step4.value;
- if (pathRegExp.test(fileName)) {
- return true;
- }
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- }
- return false;
- } // NOTICE Keep in sync with shouldFilterFiber() and other get*ForFiber methods
- function getElementTypeForFiber(fiber) {
- var type = fiber.type,
- tag = fiber.tag;
- switch (tag) {
- case ClassComponent:
- case IncompleteClassComponent:
- return types["e" /* ElementTypeClass */];
- case FunctionComponent:
- case IndeterminateComponent:
- return types["h" /* ElementTypeFunction */];
- case ForwardRef:
- return types["g" /* ElementTypeForwardRef */];
- case HostRoot:
- return types["m" /* ElementTypeRoot */];
- case HostComponent:
- case HostResource:
- case HostSingleton:
- return types["i" /* ElementTypeHostComponent */];
- case HostPortal:
- case HostText:
- case Fragment:
- return types["k" /* ElementTypeOtherOrUnknown */];
- case MemoComponent:
- case SimpleMemoComponent:
- return types["j" /* ElementTypeMemo */];
- case SuspenseComponent:
- return types["n" /* ElementTypeSuspense */];
- case SuspenseListComponent:
- return types["o" /* ElementTypeSuspenseList */];
- case TracingMarkerComponent:
- return types["p" /* ElementTypeTracingMarker */];
- default:
- var typeSymbol = getTypeSymbol(type);
- switch (typeSymbol) {
- case ReactSymbols["a" /* CONCURRENT_MODE_NUMBER */]:
- case ReactSymbols["b" /* CONCURRENT_MODE_SYMBOL_STRING */]:
- case ReactSymbols["e" /* DEPRECATED_ASYNC_MODE_SYMBOL_STRING */]:
- return types["k" /* ElementTypeOtherOrUnknown */];
- case ReactSymbols["n" /* PROVIDER_NUMBER */]:
- case ReactSymbols["o" /* PROVIDER_SYMBOL_STRING */]:
- return types["f" /* ElementTypeContext */];
- case ReactSymbols["c" /* CONTEXT_NUMBER */]:
- case ReactSymbols["d" /* CONTEXT_SYMBOL_STRING */]:
- return types["f" /* ElementTypeContext */];
- case ReactSymbols["s" /* STRICT_MODE_NUMBER */]:
- case ReactSymbols["t" /* STRICT_MODE_SYMBOL_STRING */]:
- return types["k" /* ElementTypeOtherOrUnknown */];
- case ReactSymbols["l" /* PROFILER_NUMBER */]:
- case ReactSymbols["m" /* PROFILER_SYMBOL_STRING */]:
- return types["l" /* ElementTypeProfiler */];
- default:
- return types["k" /* ElementTypeOtherOrUnknown */];
- }
- }
- } // When profiling is supported, we store the latest tree base durations for each Fiber.
- // This is so that we can quickly capture a snapshot of those values if profiling starts.
- // If we didn't store these values, we'd have to crawl the tree when profiling started,
- // and use a slow path to find each of the current Fibers.
- var idToTreeBaseDurationMap = new Map(); // When profiling is supported, we store the latest tree base durations for each Fiber.
- // This map enables us to filter these times by root when sending them to the frontend.
- var idToRootMap = new Map(); // When a mount or update is in progress, this value tracks the root that is being operated on.
- var currentRootID = -1; // Returns the unique ID for a Fiber or generates and caches a new one if the Fiber hasn't been seen before.
- // Once this method has been called for a Fiber, untrackFiberID() should always be called later to avoid leaking.
- function getOrGenerateFiberID(fiber) {
- var id = null;
- if (fiberToIDMap.has(fiber)) {
- id = fiberToIDMap.get(fiber);
- } else {
- var _alternate = fiber.alternate;
- if (_alternate !== null && fiberToIDMap.has(_alternate)) {
- id = fiberToIDMap.get(_alternate);
- }
- }
- var didGenerateID = false;
- if (id === null) {
- didGenerateID = true;
- id = Object(utils["k" /* getUID */])();
- } // This refinement is for Flow purposes only.
- var refinedID = id; // Make sure we're tracking this Fiber
- // e.g. if it just mounted or an error was logged during initial render.
- if (!fiberToIDMap.has(fiber)) {
- fiberToIDMap.set(fiber, refinedID);
- idToArbitraryFiberMap.set(refinedID, fiber);
- } // Also make sure we're tracking its alternate,
- // e.g. in case this is the first update after mount.
- var alternate = fiber.alternate;
- if (alternate !== null) {
- if (!fiberToIDMap.has(alternate)) {
- fiberToIDMap.set(alternate, refinedID);
- }
- }
- if (constants["s" /* __DEBUG__ */]) {
- if (didGenerateID) {
- debug('getOrGenerateFiberID()', fiber, fiber.return, 'Generated a new UID');
- }
- }
- return refinedID;
- } // Returns an ID if one has already been generated for the Fiber or throws.
- function getFiberIDThrows(fiber) {
- var maybeID = getFiberIDUnsafe(fiber);
- if (maybeID !== null) {
- return maybeID;
- }
- throw Error("Could not find ID for Fiber \"".concat(getDisplayNameForFiber(fiber) || '', "\""));
- } // Returns an ID if one has already been generated for the Fiber or null if one has not been generated.
- // Use this method while e.g. logging to avoid over-retaining Fibers.
- function getFiberIDUnsafe(fiber) {
- if (fiberToIDMap.has(fiber)) {
- return fiberToIDMap.get(fiber);
- } else {
- var alternate = fiber.alternate;
- if (alternate !== null && fiberToIDMap.has(alternate)) {
- return fiberToIDMap.get(alternate);
- }
- }
- return null;
- } // Removes a Fiber (and its alternate) from the Maps used to track their id.
- // This method should always be called when a Fiber is unmounting.
- function untrackFiberID(fiber) {
- if (constants["s" /* __DEBUG__ */]) {
- debug('untrackFiberID()', fiber, fiber.return, 'schedule after delay');
- } // Untrack Fibers after a slight delay in order to support a Fast Refresh edge case:
- // 1. Component type is updated and Fast Refresh schedules an update+remount.
- // 2. flushPendingErrorsAndWarningsAfterDelay() runs, sees the old Fiber is no longer mounted
- // (it's been disconnected by Fast Refresh), and calls untrackFiberID() to clear it from the Map.
- // 3. React flushes pending passive effects before it runs the next render,
- // which logs an error or warning, which causes a new ID to be generated for this Fiber.
- // 4. DevTools now tries to unmount the old Component with the new ID.
- //
- // The underlying problem here is the premature clearing of the Fiber ID,
- // but DevTools has no way to detect that a given Fiber has been scheduled for Fast Refresh.
- // (The "_debugNeedsRemount" flag won't necessarily be set.)
- //
- // The best we can do is to delay untracking by a small amount,
- // and give React time to process the Fast Refresh delay.
- untrackFibersSet.add(fiber); // React may detach alternate pointers during unmount;
- // Since our untracking code is async, we should explicily track the pending alternate here as well.
- var alternate = fiber.alternate;
- if (alternate !== null) {
- untrackFibersSet.add(alternate);
- }
- if (untrackFibersTimeoutID === null) {
- untrackFibersTimeoutID = setTimeout(untrackFibers, 1000);
- }
- }
- var untrackFibersSet = new Set();
- var untrackFibersTimeoutID = null;
- function untrackFibers() {
- if (untrackFibersTimeoutID !== null) {
- clearTimeout(untrackFibersTimeoutID);
- untrackFibersTimeoutID = null;
- }
- untrackFibersSet.forEach(function (fiber) {
- var fiberID = getFiberIDUnsafe(fiber);
- if (fiberID !== null) {
- idToArbitraryFiberMap.delete(fiberID); // Also clear any errors/warnings associated with this fiber.
- clearErrorsForFiberID(fiberID);
- clearWarningsForFiberID(fiberID);
- }
- fiberToIDMap.delete(fiber);
- var alternate = fiber.alternate;
- if (alternate !== null) {
- fiberToIDMap.delete(alternate);
- }
- if (forceErrorForFiberIDs.has(fiberID)) {
- forceErrorForFiberIDs.delete(fiberID);
- if (forceErrorForFiberIDs.size === 0 && setErrorHandler != null) {
- setErrorHandler(shouldErrorFiberAlwaysNull);
- }
- }
- });
- untrackFibersSet.clear();
- }
- function getChangeDescription(prevFiber, nextFiber) {
- switch (getElementTypeForFiber(nextFiber)) {
- case types["e" /* ElementTypeClass */]:
- case types["h" /* ElementTypeFunction */]:
- case types["j" /* ElementTypeMemo */]:
- case types["g" /* ElementTypeForwardRef */]:
- if (prevFiber === null) {
- return {
- context: null,
- didHooksChange: false,
- isFirstMount: true,
- props: null,
- state: null
- };
- } else {
- var data = {
- context: getContextChangedKeys(nextFiber),
- didHooksChange: false,
- isFirstMount: false,
- props: getChangedKeys(prevFiber.memoizedProps, nextFiber.memoizedProps),
- state: getChangedKeys(prevFiber.memoizedState, nextFiber.memoizedState)
- }; // Only traverse the hooks list once, depending on what info we're returning.
- if (DevToolsFeatureFlags_core_oss["b" /* enableProfilerChangedHookIndices */]) {
- var indices = getChangedHooksIndices(prevFiber.memoizedState, nextFiber.memoizedState);
- data.hooks = indices;
- data.didHooksChange = indices !== null && indices.length > 0;
- } else {
- data.didHooksChange = didHooksChange(prevFiber.memoizedState, nextFiber.memoizedState);
- }
- return data;
- }
- default:
- return null;
- }
- }
- function updateContextsForFiber(fiber) {
- switch (getElementTypeForFiber(fiber)) {
- case types["e" /* ElementTypeClass */]:
- case types["g" /* ElementTypeForwardRef */]:
- case types["h" /* ElementTypeFunction */]:
- case types["j" /* ElementTypeMemo */]:
- if (idToContextsMap !== null) {
- var id = getFiberIDThrows(fiber);
- var contexts = getContextsForFiber(fiber);
- if (contexts !== null) {
- // $FlowFixMe[incompatible-use] found when upgrading Flow
- idToContextsMap.set(id, contexts);
- }
- }
- break;
- default:
- break;
- }
- } // Differentiates between a null context value and no context.
- var NO_CONTEXT = {};
- function getContextsForFiber(fiber) {
- var legacyContext = NO_CONTEXT;
- var modernContext = NO_CONTEXT;
- switch (getElementTypeForFiber(fiber)) {
- case types["e" /* ElementTypeClass */]:
- var instance = fiber.stateNode;
- if (instance != null) {
- if (instance.constructor && instance.constructor.contextType != null) {
- modernContext = instance.context;
- } else {
- legacyContext = instance.context;
- if (legacyContext && Object.keys(legacyContext).length === 0) {
- legacyContext = NO_CONTEXT;
- }
- }
- }
- return [legacyContext, modernContext];
- case types["g" /* ElementTypeForwardRef */]:
- case types["h" /* ElementTypeFunction */]:
- case types["j" /* ElementTypeMemo */]:
- var dependencies = fiber.dependencies;
- if (dependencies && dependencies.firstContext) {
- modernContext = dependencies.firstContext;
- }
- return [legacyContext, modernContext];
- default:
- return null;
- }
- } // Record all contexts at the time profiling is started.
- // Fibers only store the current context value,
- // so we need to track them separately in order to determine changed keys.
- function crawlToInitializeContextsMap(fiber) {
- var id = getFiberIDUnsafe(fiber); // Not all Fibers in the subtree have mounted yet.
- // For example, Offscreen (hidden) or Suspense (suspended) subtrees won't yet be tracked.
- // We can safely skip these subtrees.
- if (id !== null) {
- updateContextsForFiber(fiber);
- var current = fiber.child;
- while (current !== null) {
- crawlToInitializeContextsMap(current);
- current = current.sibling;
- }
- }
- }
- function getContextChangedKeys(fiber) {
- if (idToContextsMap !== null) {
- var id = getFiberIDThrows(fiber); // $FlowFixMe[incompatible-use] found when upgrading Flow
- var prevContexts = idToContextsMap.has(id) ? // $FlowFixMe[incompatible-use] found when upgrading Flow
- idToContextsMap.get(id) : null;
- var nextContexts = getContextsForFiber(fiber);
- if (prevContexts == null || nextContexts == null) {
- return null;
- }
- var _prevContexts = renderer_slicedToArray(prevContexts, 2),
- prevLegacyContext = _prevContexts[0],
- prevModernContext = _prevContexts[1];
- var _nextContexts = renderer_slicedToArray(nextContexts, 2),
- nextLegacyContext = _nextContexts[0],
- nextModernContext = _nextContexts[1];
- switch (getElementTypeForFiber(fiber)) {
- case types["e" /* ElementTypeClass */]:
- if (prevContexts && nextContexts) {
- if (nextLegacyContext !== NO_CONTEXT) {
- return getChangedKeys(prevLegacyContext, nextLegacyContext);
- } else if (nextModernContext !== NO_CONTEXT) {
- return prevModernContext !== nextModernContext;
- }
- }
- break;
- case types["g" /* ElementTypeForwardRef */]:
- case types["h" /* ElementTypeFunction */]:
- case types["j" /* ElementTypeMemo */]:
- if (nextModernContext !== NO_CONTEXT) {
- var prevContext = prevModernContext;
- var nextContext = nextModernContext;
- while (prevContext && nextContext) {
- // Note this only works for versions of React that support this key (e.v. 18+)
- // For older versions, there's no good way to read the current context value after render has completed.
- // This is because React maintains a stack of context values during render,
- // but by the time DevTools is called, render has finished and the stack is empty.
- if (!shared_objectIs(prevContext.memoizedValue, nextContext.memoizedValue)) {
- return true;
- }
- prevContext = prevContext.next;
- nextContext = nextContext.next;
- }
- return false;
- }
- break;
- default:
- break;
- }
- }
- return null;
- }
- function isHookThatCanScheduleUpdate(hookObject) {
- var queue = hookObject.queue;
- if (!queue) {
- return false;
- }
- var boundHasOwnProperty = shared_hasOwnProperty.bind(queue); // Detect the shape of useState() or useReducer()
- // using the attributes that are unique to these hooks
- // but also stable (e.g. not tied to current Lanes implementation)
- var isStateOrReducer = boundHasOwnProperty('pending') && boundHasOwnProperty('dispatch') && typeof queue.dispatch === 'function'; // Detect useSyncExternalStore()
- var isSyncExternalStore = boundHasOwnProperty('value') && boundHasOwnProperty('getSnapshot') && typeof queue.getSnapshot === 'function'; // These are the only types of hooks that can schedule an update.
- return isStateOrReducer || isSyncExternalStore;
- }
- function didStatefulHookChange(prev, next) {
- var prevMemoizedState = prev.memoizedState;
- var nextMemoizedState = next.memoizedState;
- if (isHookThatCanScheduleUpdate(prev)) {
- return prevMemoizedState !== nextMemoizedState;
- }
- return false;
- }
- function didHooksChange(prev, next) {
- if (prev == null || next == null) {
- return false;
- } // We can't report anything meaningful for hooks changes.
- if (next.hasOwnProperty('baseState') && next.hasOwnProperty('memoizedState') && next.hasOwnProperty('next') && next.hasOwnProperty('queue')) {
- while (next !== null) {
- if (didStatefulHookChange(prev, next)) {
- return true;
- } else {
- next = next.next;
- prev = prev.next;
- }
- }
- }
- return false;
- }
- function getChangedHooksIndices(prev, next) {
- if (DevToolsFeatureFlags_core_oss["b" /* enableProfilerChangedHookIndices */]) {
- if (prev == null || next == null) {
- return null;
- }
- var indices = [];
- var index = 0;
- if (next.hasOwnProperty('baseState') && next.hasOwnProperty('memoizedState') && next.hasOwnProperty('next') && next.hasOwnProperty('queue')) {
- while (next !== null) {
- if (didStatefulHookChange(prev, next)) {
- indices.push(index);
- }
- next = next.next;
- prev = prev.next;
- index++;
- }
- }
- return indices;
- }
- return null;
- }
- function getChangedKeys(prev, next) {
- if (prev == null || next == null) {
- return null;
- } // We can't report anything meaningful for hooks changes.
- if (next.hasOwnProperty('baseState') && next.hasOwnProperty('memoizedState') && next.hasOwnProperty('next') && next.hasOwnProperty('queue')) {
- return null;
- }
- var keys = new Set([].concat(_toConsumableArray(Object.keys(prev)), _toConsumableArray(Object.keys(next))));
- var changedKeys = []; // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- var _iterator5 = _createForOfIteratorHelper(keys),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var key = _step5.value;
- if (prev[key] !== next[key]) {
- changedKeys.push(key);
- }
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- return changedKeys;
- } // eslint-disable-next-line no-unused-vars
- function didFiberRender(prevFiber, nextFiber) {
- switch (nextFiber.tag) {
- case ClassComponent:
- case FunctionComponent:
- case ContextConsumer:
- case MemoComponent:
- case SimpleMemoComponent:
- case ForwardRef:
- // For types that execute user code, we check PerformedWork effect.
- // We don't reflect bailouts (either referential or sCU) in DevTools.
- // eslint-disable-next-line no-bitwise
- return (getFiberFlags(nextFiber) & PerformedWork) === PerformedWork;
- // Note: ContextConsumer only gets PerformedWork effect in 16.3.3+
- // so it won't get highlighted with React 16.3.0 to 16.3.2.
- default:
- // For host components and other types, we compare inputs
- // to determine whether something is an update.
- return prevFiber.memoizedProps !== nextFiber.memoizedProps || prevFiber.memoizedState !== nextFiber.memoizedState || prevFiber.ref !== nextFiber.ref;
- }
- }
- var pendingOperations = [];
- var pendingRealUnmountedIDs = [];
- var pendingSimulatedUnmountedIDs = [];
- var pendingOperationsQueue = [];
- var pendingStringTable = new Map();
- var pendingStringTableLength = 0;
- var pendingUnmountedRootID = null;
- function pushOperation(op) {
- if (false) {}
- pendingOperations.push(op);
- }
- function shouldBailoutWithPendingOperations() {
- if (isProfiling) {
- if (currentCommitProfilingMetadata != null && currentCommitProfilingMetadata.durations.length > 0) {
- return false;
- }
- }
- return pendingOperations.length === 0 && pendingRealUnmountedIDs.length === 0 && pendingSimulatedUnmountedIDs.length === 0 && pendingUnmountedRootID === null;
- }
- function flushOrQueueOperations(operations) {
- if (shouldBailoutWithPendingOperations()) {
- return;
- }
- if (pendingOperationsQueue !== null) {
- pendingOperationsQueue.push(operations);
- } else {
- hook.emit('operations', operations);
- }
- }
- var flushPendingErrorsAndWarningsAfterDelayTimeoutID = null;
- function clearPendingErrorsAndWarningsAfterDelay() {
- if (flushPendingErrorsAndWarningsAfterDelayTimeoutID !== null) {
- clearTimeout(flushPendingErrorsAndWarningsAfterDelayTimeoutID);
- flushPendingErrorsAndWarningsAfterDelayTimeoutID = null;
- }
- }
- function flushPendingErrorsAndWarningsAfterDelay() {
- clearPendingErrorsAndWarningsAfterDelay();
- flushPendingErrorsAndWarningsAfterDelayTimeoutID = setTimeout(function () {
- flushPendingErrorsAndWarningsAfterDelayTimeoutID = null;
- if (pendingOperations.length > 0) {
- // On the off chance that something else has pushed pending operations,
- // we should bail on warnings; it's probably not safe to push midway.
- return;
- }
- recordPendingErrorsAndWarnings();
- if (shouldBailoutWithPendingOperations()) {
- // No warnings or errors to flush; we can bail out early here too.
- return;
- } // We can create a smaller operations array than flushPendingEvents()
- // because we only need to flush warning and error counts.
- // Only a few pieces of fixed information are required up front.
- var operations = new Array(3 + pendingOperations.length);
- operations[0] = rendererID;
- operations[1] = currentRootID;
- operations[2] = 0; // String table size
- for (var j = 0; j < pendingOperations.length; j++) {
- operations[3 + j] = pendingOperations[j];
- }
- flushOrQueueOperations(operations);
- pendingOperations.length = 0;
- }, 1000);
- }
- function reevaluateErrorsAndWarnings() {
- fibersWithChangedErrorOrWarningCounts.clear();
- fiberIDToErrorsMap.forEach(function (countMap, fiberID) {
- var fiber = idToArbitraryFiberMap.get(fiberID);
- if (fiber != null) {
- fibersWithChangedErrorOrWarningCounts.add(fiber);
- }
- });
- fiberIDToWarningsMap.forEach(function (countMap, fiberID) {
- var fiber = idToArbitraryFiberMap.get(fiberID);
- if (fiber != null) {
- fibersWithChangedErrorOrWarningCounts.add(fiber);
- }
- });
- recordPendingErrorsAndWarnings();
- }
- function mergeMapsAndGetCountHelper(fiber, fiberID, pendingFiberToMessageCountMap, fiberIDToMessageCountMap) {
- var newCount = 0;
- var messageCountMap = fiberIDToMessageCountMap.get(fiberID);
- var pendingMessageCountMap = pendingFiberToMessageCountMap.get(fiber);
- if (pendingMessageCountMap != null) {
- if (messageCountMap == null) {
- messageCountMap = pendingMessageCountMap;
- fiberIDToMessageCountMap.set(fiberID, pendingMessageCountMap);
- } else {
- // This Flow refinement should not be necessary and yet...
- var refinedMessageCountMap = messageCountMap;
- pendingMessageCountMap.forEach(function (pendingCount, message) {
- var previousCount = refinedMessageCountMap.get(message) || 0;
- refinedMessageCountMap.set(message, previousCount + pendingCount);
- });
- }
- }
- if (!shouldFilterFiber(fiber)) {
- if (messageCountMap != null) {
- messageCountMap.forEach(function (count) {
- newCount += count;
- });
- }
- }
- pendingFiberToMessageCountMap.delete(fiber);
- return newCount;
- }
- function recordPendingErrorsAndWarnings() {
- clearPendingErrorsAndWarningsAfterDelay();
- fibersWithChangedErrorOrWarningCounts.forEach(function (fiber) {
- var fiberID = getFiberIDUnsafe(fiber);
- if (fiberID === null) {// Don't send updates for Fibers that didn't mount due to e.g. Suspense or an error boundary.
- } else {
- var errorCount = mergeMapsAndGetCountHelper(fiber, fiberID, pendingFiberToErrorsMap, fiberIDToErrorsMap);
- var warningCount = mergeMapsAndGetCountHelper(fiber, fiberID, pendingFiberToWarningsMap, fiberIDToWarningsMap);
- pushOperation(constants["q" /* TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS */]);
- pushOperation(fiberID);
- pushOperation(errorCount);
- pushOperation(warningCount);
- } // Always clean up so that we don't leak.
- pendingFiberToErrorsMap.delete(fiber);
- pendingFiberToWarningsMap.delete(fiber);
- });
- fibersWithChangedErrorOrWarningCounts.clear();
- }
- function flushPendingEvents(root) {
- // Add any pending errors and warnings to the operations array.
- // We do this just before flushing, so we can ignore errors for no-longer-mounted Fibers.
- recordPendingErrorsAndWarnings();
- if (shouldBailoutWithPendingOperations()) {
- // If we aren't profiling, we can just bail out here.
- // No use sending an empty update over the bridge.
- //
- // The Profiler stores metadata for each commit and reconstructs the app tree per commit using:
- // (1) an initial tree snapshot and
- // (2) the operations array for each commit
- // Because of this, it's important that the operations and metadata arrays align,
- // So it's important not to omit even empty operations while profiling is active.
- return;
- }
- var numUnmountIDs = pendingRealUnmountedIDs.length + pendingSimulatedUnmountedIDs.length + (pendingUnmountedRootID === null ? 0 : 1);
- var operations = new Array( // Identify which renderer this update is coming from.
- 2 + // [rendererID, rootFiberID]
- // How big is the string table?
- 1 + // [stringTableLength]
- // Then goes the actual string table.
- pendingStringTableLength + ( // All unmounts are batched in a single message.
- // [TREE_OPERATION_REMOVE, removedIDLength, ...ids]
- numUnmountIDs > 0 ? 2 + numUnmountIDs : 0) + // Regular operations
- pendingOperations.length); // Identify which renderer this update is coming from.
- // This enables roots to be mapped to renderers,
- // Which in turn enables fiber props, states, and hooks to be inspected.
- var i = 0;
- operations[i++] = rendererID;
- operations[i++] = currentRootID; // Now fill in the string table.
- // [stringTableLength, str1Length, ...str1, str2Length, ...str2, ...]
- operations[i++] = pendingStringTableLength;
- pendingStringTable.forEach(function (entry, stringKey) {
- var encodedString = entry.encodedString; // Don't use the string length.
- // It won't work for multibyte characters (like emoji).
- var length = encodedString.length;
- operations[i++] = length;
- for (var j = 0; j < length; j++) {
- operations[i + j] = encodedString[j];
- }
- i += length;
- });
- if (numUnmountIDs > 0) {
- // All unmounts except roots are batched in a single message.
- operations[i++] = constants["m" /* TREE_OPERATION_REMOVE */]; // The first number is how many unmounted IDs we're gonna send.
- operations[i++] = numUnmountIDs; // Fill in the real unmounts in the reverse order.
- // They were inserted parents-first by React, but we want children-first.
- // So we traverse our array backwards.
- for (var j = pendingRealUnmountedIDs.length - 1; j >= 0; j--) {
- operations[i++] = pendingRealUnmountedIDs[j];
- } // Fill in the simulated unmounts (hidden Suspense subtrees) in their order.
- // (We want children to go before parents.)
- // They go *after* the real unmounts because we know for sure they won't be
- // children of already pushed "real" IDs. If they were, we wouldn't be able
- // to discover them during the traversal, as they would have been deleted.
- for (var _j = 0; _j < pendingSimulatedUnmountedIDs.length; _j++) {
- operations[i + _j] = pendingSimulatedUnmountedIDs[_j];
- }
- i += pendingSimulatedUnmountedIDs.length; // The root ID should always be unmounted last.
- if (pendingUnmountedRootID !== null) {
- operations[i] = pendingUnmountedRootID;
- i++;
- }
- } // Fill in the rest of the operations.
- for (var _j2 = 0; _j2 < pendingOperations.length; _j2++) {
- operations[i + _j2] = pendingOperations[_j2];
- }
- i += pendingOperations.length; // Let the frontend know about tree operations.
- flushOrQueueOperations(operations); // Reset all of the pending state now that we've told the frontend about it.
- pendingOperations.length = 0;
- pendingRealUnmountedIDs.length = 0;
- pendingSimulatedUnmountedIDs.length = 0;
- pendingUnmountedRootID = null;
- pendingStringTable.clear();
- pendingStringTableLength = 0;
- }
- function getStringID(string) {
- if (string === null) {
- return 0;
- }
- var existingEntry = pendingStringTable.get(string);
- if (existingEntry !== undefined) {
- return existingEntry.id;
- }
- var id = pendingStringTable.size + 1;
- var encodedString = Object(utils["p" /* utfEncodeString */])(string);
- pendingStringTable.set(string, {
- encodedString: encodedString,
- id: id
- }); // The string table total length needs to account both for the string length,
- // and for the array item that contains the length itself.
- //
- // Don't use string length for this table.
- // It won't work for multibyte characters (like emoji).
- pendingStringTableLength += encodedString.length + 1;
- return id;
- }
- function recordMount(fiber, parentFiber) {
- var isRoot = fiber.tag === HostRoot;
- var id = getOrGenerateFiberID(fiber);
- if (constants["s" /* __DEBUG__ */]) {
- debug('recordMount()', fiber, parentFiber);
- }
- var hasOwnerMetadata = fiber.hasOwnProperty('_debugOwner');
- var isProfilingSupported = fiber.hasOwnProperty('treeBaseDuration'); // Adding a new field here would require a bridge protocol version bump (a backwads breaking change).
- // Instead let's re-purpose a pre-existing field to carry more information.
- var profilingFlags = 0;
- if (isProfilingSupported) {
- profilingFlags = constants["g" /* PROFILING_FLAG_BASIC_SUPPORT */];
- if (typeof injectProfilingHooks === 'function') {
- profilingFlags |= constants["h" /* PROFILING_FLAG_TIMELINE_SUPPORT */];
- }
- }
- if (isRoot) {
- pushOperation(constants["l" /* TREE_OPERATION_ADD */]);
- pushOperation(id);
- pushOperation(types["m" /* ElementTypeRoot */]);
- pushOperation((fiber.mode & StrictModeBits) !== 0 ? 1 : 0);
- pushOperation(profilingFlags);
- pushOperation(StrictModeBits !== 0 ? 1 : 0);
- pushOperation(hasOwnerMetadata ? 1 : 0);
- if (isProfiling) {
- if (displayNamesByRootID !== null) {
- displayNamesByRootID.set(id, getDisplayNameForRoot(fiber));
- }
- }
- } else {
- var key = fiber.key;
- var displayName = getDisplayNameForFiber(fiber);
- var elementType = getElementTypeForFiber(fiber);
- var _debugOwner = fiber._debugOwner; // Ideally we should call getFiberIDThrows() for _debugOwner,
- // since owners are almost always higher in the tree (and so have already been processed),
- // but in some (rare) instances reported in open source, a descendant mounts before an owner.
- // Since this is a DEV only field it's probably okay to also just lazily generate and ID here if needed.
- // See https://github.com/facebook/react/issues/21445
- var ownerID = _debugOwner != null ? getOrGenerateFiberID(_debugOwner) : 0;
- var parentID = parentFiber ? getFiberIDThrows(parentFiber) : 0;
- var displayNameStringID = getStringID(displayName); // This check is a guard to handle a React element that has been modified
- // in such a way as to bypass the default stringification of the "key" property.
- var keyString = key === null ? null : String(key);
- var keyStringID = getStringID(keyString);
- pushOperation(constants["l" /* TREE_OPERATION_ADD */]);
- pushOperation(id);
- pushOperation(elementType);
- pushOperation(parentID);
- pushOperation(ownerID);
- pushOperation(displayNameStringID);
- pushOperation(keyStringID); // If this subtree has a new mode, let the frontend know.
- if ((fiber.mode & StrictModeBits) !== 0 && (parentFiber.mode & StrictModeBits) === 0) {
- pushOperation(constants["p" /* TREE_OPERATION_SET_SUBTREE_MODE */]);
- pushOperation(id);
- pushOperation(types["q" /* StrictMode */]);
- }
- }
- if (isProfilingSupported) {
- idToRootMap.set(id, currentRootID);
- recordProfilingDurations(fiber);
- }
- }
- function recordUnmount(fiber, isSimulated) {
- if (constants["s" /* __DEBUG__ */]) {
- debug('recordUnmount()', fiber, null, isSimulated ? 'unmount is simulated' : '');
- }
- if (trackedPathMatchFiber !== null) {
- // We're in the process of trying to restore previous selection.
- // If this fiber matched but is being unmounted, there's no use trying.
- // Reset the state so we don't keep holding onto it.
- if (fiber === trackedPathMatchFiber || fiber === trackedPathMatchFiber.alternate) {
- setTrackedPath(null);
- }
- }
- var unsafeID = getFiberIDUnsafe(fiber);
- if (unsafeID === null) {
- // If we've never seen this Fiber, it might be inside of a legacy render Suspense fragment (so the store is not even aware of it).
- // In that case we can just ignore it or it will cause errors later on.
- // One example of this is a Lazy component that never resolves before being unmounted.
- //
- // This also might indicate a Fast Refresh force-remount scenario.
- //
- // TODO: This is fragile and can obscure actual bugs.
- return;
- } // Flow refinement.
- var id = unsafeID;
- var isRoot = fiber.tag === HostRoot;
- if (isRoot) {
- // Roots must be removed only after all children (pending and simulated) have been removed.
- // So we track it separately.
- pendingUnmountedRootID = id;
- } else if (!shouldFilterFiber(fiber)) {
- // To maintain child-first ordering,
- // we'll push it into one of these queues,
- // and later arrange them in the correct order.
- if (isSimulated) {
- pendingSimulatedUnmountedIDs.push(id);
- } else {
- pendingRealUnmountedIDs.push(id);
- }
- }
- if (!fiber._debugNeedsRemount) {
- untrackFiberID(fiber);
- var isProfilingSupported = fiber.hasOwnProperty('treeBaseDuration');
- if (isProfilingSupported) {
- idToRootMap.delete(id);
- idToTreeBaseDurationMap.delete(id);
- }
- }
- }
- function mountFiberRecursively(firstChild, parentFiber, traverseSiblings, traceNearestHostComponentUpdate) {
- // Iterate over siblings rather than recursing.
- // This reduces the chance of stack overflow for wide trees (e.g. lists with many items).
- var fiber = firstChild;
- while (fiber !== null) {
- // Generate an ID even for filtered Fibers, in case it's needed later (e.g. for Profiling).
- getOrGenerateFiberID(fiber);
- if (constants["s" /* __DEBUG__ */]) {
- debug('mountFiberRecursively()', fiber, parentFiber);
- } // If we have the tree selection from previous reload, try to match this Fiber.
- // Also remember whether to do the same for siblings.
- var mightSiblingsBeOnTrackedPath = updateTrackedPathStateBeforeMount(fiber);
- var shouldIncludeInTree = !shouldFilterFiber(fiber);
- if (shouldIncludeInTree) {
- recordMount(fiber, parentFiber);
- }
- if (traceUpdatesEnabled) {
- if (traceNearestHostComponentUpdate) {
- var elementType = getElementTypeForFiber(fiber); // If an ancestor updated, we should mark the nearest host nodes for highlighting.
- if (elementType === types["i" /* ElementTypeHostComponent */]) {
- traceUpdatesForNodes.add(fiber.stateNode);
- traceNearestHostComponentUpdate = false;
- }
- } // We intentionally do not re-enable the traceNearestHostComponentUpdate flag in this branch,
- // because we don't want to highlight every host node inside of a newly mounted subtree.
- }
- var isSuspense = fiber.tag === ReactTypeOfWork.SuspenseComponent;
- if (isSuspense) {
- var isTimedOut = fiber.memoizedState !== null;
- if (isTimedOut) {
- // Special case: if Suspense mounts in a timed-out state,
- // get the fallback child from the inner fragment and mount
- // it as if it was our own child. Updates handle this too.
- var primaryChildFragment = fiber.child;
- var fallbackChildFragment = primaryChildFragment ? primaryChildFragment.sibling : null;
- var fallbackChild = fallbackChildFragment ? fallbackChildFragment.child : null;
- if (fallbackChild !== null) {
- mountFiberRecursively(fallbackChild, shouldIncludeInTree ? fiber : parentFiber, true, traceNearestHostComponentUpdate);
- }
- } else {
- var primaryChild = null;
- var areSuspenseChildrenConditionallyWrapped = OffscreenComponent === -1;
- if (areSuspenseChildrenConditionallyWrapped) {
- primaryChild = fiber.child;
- } else if (fiber.child !== null) {
- primaryChild = fiber.child.child;
- }
- if (primaryChild !== null) {
- mountFiberRecursively(primaryChild, shouldIncludeInTree ? fiber : parentFiber, true, traceNearestHostComponentUpdate);
- }
- }
- } else {
- if (fiber.child !== null) {
- mountFiberRecursively(fiber.child, shouldIncludeInTree ? fiber : parentFiber, true, traceNearestHostComponentUpdate);
- }
- } // We're exiting this Fiber now, and entering its siblings.
- // If we have selection to restore, we might need to re-activate tracking.
- updateTrackedPathStateAfterMount(mightSiblingsBeOnTrackedPath);
- fiber = traverseSiblings ? fiber.sibling : null;
- }
- } // We use this to simulate unmounting for Suspense trees
- // when we switch from primary to fallback.
- function unmountFiberChildrenRecursively(fiber) {
- if (constants["s" /* __DEBUG__ */]) {
- debug('unmountFiberChildrenRecursively()', fiber);
- } // We might meet a nested Suspense on our way.
- var isTimedOutSuspense = fiber.tag === ReactTypeOfWork.SuspenseComponent && fiber.memoizedState !== null;
- var child = fiber.child;
- if (isTimedOutSuspense) {
- // If it's showing fallback tree, let's traverse it instead.
- var primaryChildFragment = fiber.child;
- var fallbackChildFragment = primaryChildFragment ? primaryChildFragment.sibling : null; // Skip over to the real Fiber child.
- child = fallbackChildFragment ? fallbackChildFragment.child : null;
- }
- while (child !== null) {
- // Record simulated unmounts children-first.
- // We skip nodes without return because those are real unmounts.
- if (child.return !== null) {
- unmountFiberChildrenRecursively(child);
- recordUnmount(child, true);
- }
- child = child.sibling;
- }
- }
- function recordProfilingDurations(fiber) {
- var id = getFiberIDThrows(fiber);
- var actualDuration = fiber.actualDuration,
- treeBaseDuration = fiber.treeBaseDuration;
- idToTreeBaseDurationMap.set(id, treeBaseDuration || 0);
- if (isProfiling) {
- var alternate = fiber.alternate; // It's important to update treeBaseDuration even if the current Fiber did not render,
- // because it's possible that one of its descendants did.
- if (alternate == null || treeBaseDuration !== alternate.treeBaseDuration) {
- // Tree base duration updates are included in the operations typed array.
- // So we have to convert them from milliseconds to microseconds so we can send them as ints.
- var convertedTreeBaseDuration = Math.floor((treeBaseDuration || 0) * 1000);
- pushOperation(constants["r" /* TREE_OPERATION_UPDATE_TREE_BASE_DURATION */]);
- pushOperation(id);
- pushOperation(convertedTreeBaseDuration);
- }
- if (alternate == null || didFiberRender(alternate, fiber)) {
- if (actualDuration != null) {
- // The actual duration reported by React includes time spent working on children.
- // This is useful information, but it's also useful to be able to exclude child durations.
- // The frontend can't compute this, since the immediate children may have been filtered out.
- // So we need to do this on the backend.
- // Note that this calculated self duration is not the same thing as the base duration.
- // The two are calculated differently (tree duration does not accumulate).
- var selfDuration = actualDuration;
- var child = fiber.child;
- while (child !== null) {
- selfDuration -= child.actualDuration || 0;
- child = child.sibling;
- } // If profiling is active, store durations for elements that were rendered during the commit.
- // Note that we should do this for any fiber we performed work on, regardless of its actualDuration value.
- // In some cases actualDuration might be 0 for fibers we worked on (particularly if we're using Date.now)
- // In other cases (e.g. Memo) actualDuration might be greater than 0 even if we "bailed out".
- var metadata = currentCommitProfilingMetadata;
- metadata.durations.push(id, actualDuration, selfDuration);
- metadata.maxActualDuration = Math.max(metadata.maxActualDuration, actualDuration);
- if (recordChangeDescriptions) {
- var changeDescription = getChangeDescription(alternate, fiber);
- if (changeDescription !== null) {
- if (metadata.changeDescriptions !== null) {
- metadata.changeDescriptions.set(id, changeDescription);
- }
- }
- updateContextsForFiber(fiber);
- }
- }
- }
- }
- }
- function recordResetChildren(fiber, childSet) {
- if (constants["s" /* __DEBUG__ */]) {
- debug('recordResetChildren()', childSet, fiber);
- } // The frontend only really cares about the displayName, key, and children.
- // The first two don't really change, so we are only concerned with the order of children here.
- // This is trickier than a simple comparison though, since certain types of fibers are filtered.
- var nextChildren = []; // This is a naive implementation that shallowly recourses children.
- // We might want to revisit this if it proves to be too inefficient.
- var child = childSet;
- while (child !== null) {
- findReorderedChildrenRecursively(child, nextChildren);
- child = child.sibling;
- }
- var numChildren = nextChildren.length;
- if (numChildren < 2) {
- // No need to reorder.
- return;
- }
- pushOperation(constants["o" /* TREE_OPERATION_REORDER_CHILDREN */]);
- pushOperation(getFiberIDThrows(fiber));
- pushOperation(numChildren);
- for (var i = 0; i < nextChildren.length; i++) {
- pushOperation(nextChildren[i]);
- }
- }
- function findReorderedChildrenRecursively(fiber, nextChildren) {
- if (!shouldFilterFiber(fiber)) {
- nextChildren.push(getFiberIDThrows(fiber));
- } else {
- var child = fiber.child;
- var isTimedOutSuspense = fiber.tag === SuspenseComponent && fiber.memoizedState !== null;
- if (isTimedOutSuspense) {
- // Special case: if Suspense mounts in a timed-out state,
- // get the fallback child from the inner fragment,
- // and skip over the primary child.
- var primaryChildFragment = fiber.child;
- var fallbackChildFragment = primaryChildFragment ? primaryChildFragment.sibling : null;
- var fallbackChild = fallbackChildFragment ? fallbackChildFragment.child : null;
- if (fallbackChild !== null) {
- child = fallbackChild;
- }
- }
- while (child !== null) {
- findReorderedChildrenRecursively(child, nextChildren);
- child = child.sibling;
- }
- }
- } // Returns whether closest unfiltered fiber parent needs to reset its child list.
- function updateFiberRecursively(nextFiber, prevFiber, parentFiber, traceNearestHostComponentUpdate) {
- var id = getOrGenerateFiberID(nextFiber);
- if (constants["s" /* __DEBUG__ */]) {
- debug('updateFiberRecursively()', nextFiber, parentFiber);
- }
- if (traceUpdatesEnabled) {
- var elementType = getElementTypeForFiber(nextFiber);
- if (traceNearestHostComponentUpdate) {
- // If an ancestor updated, we should mark the nearest host nodes for highlighting.
- if (elementType === types["i" /* ElementTypeHostComponent */]) {
- traceUpdatesForNodes.add(nextFiber.stateNode);
- traceNearestHostComponentUpdate = false;
- }
- } else {
- if (elementType === types["h" /* ElementTypeFunction */] || elementType === types["e" /* ElementTypeClass */] || elementType === types["f" /* ElementTypeContext */] || elementType === types["j" /* ElementTypeMemo */] || elementType === types["g" /* ElementTypeForwardRef */]) {
- // Otherwise if this is a traced ancestor, flag for the nearest host descendant(s).
- traceNearestHostComponentUpdate = didFiberRender(prevFiber, nextFiber);
- }
- }
- }
- if (mostRecentlyInspectedElement !== null && mostRecentlyInspectedElement.id === id && didFiberRender(prevFiber, nextFiber)) {
- // If this Fiber has updated, clear cached inspected data.
- // If it is inspected again, it may need to be re-run to obtain updated hooks values.
- hasElementUpdatedSinceLastInspected = true;
- }
- var shouldIncludeInTree = !shouldFilterFiber(nextFiber);
- var isSuspense = nextFiber.tag === SuspenseComponent;
- var shouldResetChildren = false; // The behavior of timed-out Suspense trees is unique.
- // Rather than unmount the timed out content (and possibly lose important state),
- // React re-parents this content within a hidden Fragment while the fallback is showing.
- // This behavior doesn't need to be observable in the DevTools though.
- // It might even result in a bad user experience for e.g. node selection in the Elements panel.
- // The easiest fix is to strip out the intermediate Fragment fibers,
- // so the Elements panel and Profiler don't need to special case them.
- // Suspense components only have a non-null memoizedState if they're timed-out.
- var prevDidTimeout = isSuspense && prevFiber.memoizedState !== null;
- var nextDidTimeOut = isSuspense && nextFiber.memoizedState !== null; // The logic below is inspired by the code paths in updateSuspenseComponent()
- // inside ReactFiberBeginWork in the React source code.
- if (prevDidTimeout && nextDidTimeOut) {
- // Fallback -> Fallback:
- // 1. Reconcile fallback set.
- var nextFiberChild = nextFiber.child;
- var nextFallbackChildSet = nextFiberChild ? nextFiberChild.sibling : null; // Note: We can't use nextFiber.child.sibling.alternate
- // because the set is special and alternate may not exist.
- var prevFiberChild = prevFiber.child;
- var prevFallbackChildSet = prevFiberChild ? prevFiberChild.sibling : null;
- if (nextFallbackChildSet != null && prevFallbackChildSet != null && updateFiberRecursively(nextFallbackChildSet, prevFallbackChildSet, nextFiber, traceNearestHostComponentUpdate)) {
- shouldResetChildren = true;
- }
- } else if (prevDidTimeout && !nextDidTimeOut) {
- // Fallback -> Primary:
- // 1. Unmount fallback set
- // Note: don't emulate fallback unmount because React actually did it.
- // 2. Mount primary set
- var nextPrimaryChildSet = nextFiber.child;
- if (nextPrimaryChildSet !== null) {
- mountFiberRecursively(nextPrimaryChildSet, shouldIncludeInTree ? nextFiber : parentFiber, true, traceNearestHostComponentUpdate);
- }
- shouldResetChildren = true;
- } else if (!prevDidTimeout && nextDidTimeOut) {
- // Primary -> Fallback:
- // 1. Hide primary set
- // This is not a real unmount, so it won't get reported by React.
- // We need to manually walk the previous tree and record unmounts.
- unmountFiberChildrenRecursively(prevFiber); // 2. Mount fallback set
- var _nextFiberChild = nextFiber.child;
- var _nextFallbackChildSet = _nextFiberChild ? _nextFiberChild.sibling : null;
- if (_nextFallbackChildSet != null) {
- mountFiberRecursively(_nextFallbackChildSet, shouldIncludeInTree ? nextFiber : parentFiber, true, traceNearestHostComponentUpdate);
- shouldResetChildren = true;
- }
- } else {
- // Common case: Primary -> Primary.
- // This is the same code path as for non-Suspense fibers.
- if (nextFiber.child !== prevFiber.child) {
- // If the first child is different, we need to traverse them.
- // Each next child will be either a new child (mount) or an alternate (update).
- var nextChild = nextFiber.child;
- var prevChildAtSameIndex = prevFiber.child;
- while (nextChild) {
- // We already know children will be referentially different because
- // they are either new mounts or alternates of previous children.
- // Schedule updates and mounts depending on whether alternates exist.
- // We don't track deletions here because they are reported separately.
- if (nextChild.alternate) {
- var prevChild = nextChild.alternate;
- if (updateFiberRecursively(nextChild, prevChild, shouldIncludeInTree ? nextFiber : parentFiber, traceNearestHostComponentUpdate)) {
- // If a nested tree child order changed but it can't handle its own
- // child order invalidation (e.g. because it's filtered out like host nodes),
- // propagate the need to reset child order upwards to this Fiber.
- shouldResetChildren = true;
- } // However we also keep track if the order of the children matches
- // the previous order. They are always different referentially, but
- // if the instances line up conceptually we'll want to know that.
- if (prevChild !== prevChildAtSameIndex) {
- shouldResetChildren = true;
- }
- } else {
- mountFiberRecursively(nextChild, shouldIncludeInTree ? nextFiber : parentFiber, false, traceNearestHostComponentUpdate);
- shouldResetChildren = true;
- } // Try the next child.
- nextChild = nextChild.sibling; // Advance the pointer in the previous list so that we can
- // keep comparing if they line up.
- if (!shouldResetChildren && prevChildAtSameIndex !== null) {
- prevChildAtSameIndex = prevChildAtSameIndex.sibling;
- }
- } // If we have no more children, but used to, they don't line up.
- if (prevChildAtSameIndex !== null) {
- shouldResetChildren = true;
- }
- } else {
- if (traceUpdatesEnabled) {
- // If we're tracing updates and we've bailed out before reaching a host node,
- // we should fall back to recursively marking the nearest host descendants for highlight.
- if (traceNearestHostComponentUpdate) {
- var hostFibers = findAllCurrentHostFibers(getFiberIDThrows(nextFiber));
- hostFibers.forEach(function (hostFiber) {
- traceUpdatesForNodes.add(hostFiber.stateNode);
- });
- }
- }
- }
- }
- if (shouldIncludeInTree) {
- var isProfilingSupported = nextFiber.hasOwnProperty('treeBaseDuration');
- if (isProfilingSupported) {
- recordProfilingDurations(nextFiber);
- }
- }
- if (shouldResetChildren) {
- // We need to crawl the subtree for closest non-filtered Fibers
- // so that we can display them in a flat children set.
- if (shouldIncludeInTree) {
- // Normally, search for children from the rendered child.
- var nextChildSet = nextFiber.child;
- if (nextDidTimeOut) {
- // Special case: timed-out Suspense renders the fallback set.
- var _nextFiberChild2 = nextFiber.child;
- nextChildSet = _nextFiberChild2 ? _nextFiberChild2.sibling : null;
- }
- if (nextChildSet != null) {
- recordResetChildren(nextFiber, nextChildSet);
- } // We've handled the child order change for this Fiber.
- // Since it's included, there's no need to invalidate parent child order.
- return false;
- } else {
- // Let the closest unfiltered parent Fiber reset its child order instead.
- return true;
- }
- } else {
- return false;
- }
- }
- function cleanup() {// We don't patch any methods so there is no cleanup.
- }
- function rootSupportsProfiling(root) {
- if (root.memoizedInteractions != null) {
- // v16 builds include this field for the scheduler/tracing API.
- return true;
- } else if (root.current != null && root.current.hasOwnProperty('treeBaseDuration')) {
- // The scheduler/tracing API was removed in v17 though
- // so we need to check a non-root Fiber.
- return true;
- } else {
- return false;
- }
- }
- function flushInitialOperations() {
- var localPendingOperationsQueue = pendingOperationsQueue;
- pendingOperationsQueue = null;
- if (localPendingOperationsQueue !== null && localPendingOperationsQueue.length > 0) {
- // We may have already queued up some operations before the frontend connected
- // If so, let the frontend know about them.
- localPendingOperationsQueue.forEach(function (operations) {
- hook.emit('operations', operations);
- });
- } else {
- // Before the traversals, remember to start tracking
- // our path in case we have selection to restore.
- if (trackedPath !== null) {
- mightBeOnTrackedPath = true;
- } // If we have not been profiling, then we can just walk the tree and build up its current state as-is.
- hook.getFiberRoots(rendererID).forEach(function (root) {
- currentRootID = getOrGenerateFiberID(root.current);
- setRootPseudoKey(currentRootID, root.current); // Handle multi-renderer edge-case where only some v16 renderers support profiling.
- if (isProfiling && rootSupportsProfiling(root)) {
- // If profiling is active, store commit time and duration.
- // The frontend may request this information after profiling has stopped.
- currentCommitProfilingMetadata = {
- changeDescriptions: recordChangeDescriptions ? new Map() : null,
- durations: [],
- commitTime: renderer_getCurrentTime() - profilingStartTime,
- maxActualDuration: 0,
- priorityLevel: null,
- updaters: getUpdatersList(root),
- effectDuration: null,
- passiveEffectDuration: null
- };
- }
- mountFiberRecursively(root.current, null, false, false);
- flushPendingEvents(root);
- currentRootID = -1;
- });
- }
- }
- function getUpdatersList(root) {
- return root.memoizedUpdaters != null ? Array.from(root.memoizedUpdaters).filter(function (fiber) {
- return getFiberIDUnsafe(fiber) !== null;
- }).map(fiberToSerializedElement) : null;
- }
- function handleCommitFiberUnmount(fiber) {
- // If the untrackFiberSet already has the unmounted Fiber, this means we've already
- // recordedUnmount, so we don't need to do it again. If we don't do this, we might
- // end up double-deleting Fibers in some cases (like Legacy Suspense).
- if (!untrackFibersSet.has(fiber)) {
- // This is not recursive.
- // We can't traverse fibers after unmounting so instead
- // we rely on React telling us about each unmount.
- recordUnmount(fiber, false);
- }
- }
- function handlePostCommitFiberRoot(root) {
- if (isProfiling && rootSupportsProfiling(root)) {
- if (currentCommitProfilingMetadata !== null) {
- var _getEffectDurations = Object(backend_utils["h" /* getEffectDurations */])(root),
- effectDuration = _getEffectDurations.effectDuration,
- passiveEffectDuration = _getEffectDurations.passiveEffectDuration; // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentCommitProfilingMetadata.effectDuration = effectDuration; // $FlowFixMe[incompatible-use] found when upgrading Flow
- currentCommitProfilingMetadata.passiveEffectDuration = passiveEffectDuration;
- }
- }
- }
- function handleCommitFiberRoot(root, priorityLevel) {
- var current = root.current;
- var alternate = current.alternate; // Flush any pending Fibers that we are untracking before processing the new commit.
- // If we don't do this, we might end up double-deleting Fibers in some cases (like Legacy Suspense).
- untrackFibers();
- currentRootID = getOrGenerateFiberID(current); // Before the traversals, remember to start tracking
- // our path in case we have selection to restore.
- if (trackedPath !== null) {
- mightBeOnTrackedPath = true;
- }
- if (traceUpdatesEnabled) {
- traceUpdatesForNodes.clear();
- } // Handle multi-renderer edge-case where only some v16 renderers support profiling.
- var isProfilingSupported = rootSupportsProfiling(root);
- if (isProfiling && isProfilingSupported) {
- // If profiling is active, store commit time and duration.
- // The frontend may request this information after profiling has stopped.
- currentCommitProfilingMetadata = {
- changeDescriptions: recordChangeDescriptions ? new Map() : null,
- durations: [],
- commitTime: renderer_getCurrentTime() - profilingStartTime,
- maxActualDuration: 0,
- priorityLevel: priorityLevel == null ? null : formatPriorityLevel(priorityLevel),
- updaters: getUpdatersList(root),
- // Initialize to null; if new enough React version is running,
- // these values will be read during separate handlePostCommitFiberRoot() call.
- effectDuration: null,
- passiveEffectDuration: null
- };
- }
- if (alternate) {
- // TODO: relying on this seems a bit fishy.
- var wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null && // A dehydrated root is not considered mounted
- alternate.memoizedState.isDehydrated !== true;
- var isMounted = current.memoizedState != null && current.memoizedState.element != null && // A dehydrated root is not considered mounted
- current.memoizedState.isDehydrated !== true;
- if (!wasMounted && isMounted) {
- // Mount a new root.
- setRootPseudoKey(currentRootID, current);
- mountFiberRecursively(current, null, false, false);
- } else if (wasMounted && isMounted) {
- // Update an existing root.
- updateFiberRecursively(current, alternate, null, false);
- } else if (wasMounted && !isMounted) {
- // Unmount an existing root.
- removeRootPseudoKey(currentRootID);
- recordUnmount(current, false);
- }
- } else {
- // Mount a new root.
- setRootPseudoKey(currentRootID, current);
- mountFiberRecursively(current, null, false, false);
- }
- if (isProfiling && isProfilingSupported) {
- if (!shouldBailoutWithPendingOperations()) {
- var commitProfilingMetadata = rootToCommitProfilingMetadataMap.get(currentRootID);
- if (commitProfilingMetadata != null) {
- commitProfilingMetadata.push(currentCommitProfilingMetadata);
- } else {
- rootToCommitProfilingMetadataMap.set(currentRootID, [currentCommitProfilingMetadata]);
- }
- }
- } // We're done here.
- flushPendingEvents(root);
- if (traceUpdatesEnabled) {
- hook.emit('traceUpdates', traceUpdatesForNodes);
- }
- currentRootID = -1;
- }
- function findAllCurrentHostFibers(id) {
- var fibers = [];
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (!fiber) {
- return fibers;
- } // Next we'll drill down this component to find all HostComponent/Text.
- var node = fiber;
- while (true) {
- if (node.tag === HostComponent || node.tag === HostText) {
- fibers.push(node);
- } else if (node.child) {
- node.child.return = node;
- node = node.child;
- continue;
- }
- if (node === fiber) {
- return fibers;
- }
- while (!node.sibling) {
- if (!node.return || node.return === fiber) {
- return fibers;
- }
- node = node.return;
- }
- node.sibling.return = node.return;
- node = node.sibling;
- } // Flow needs the return here, but ESLint complains about it.
- // eslint-disable-next-line no-unreachable
- return fibers;
- }
- function findNativeNodesForFiberID(id) {
- try {
- var _fiber3 = findCurrentFiberUsingSlowPathById(id);
- if (_fiber3 === null) {
- return null;
- } // Special case for a timed-out Suspense.
- var isTimedOutSuspense = _fiber3.tag === SuspenseComponent && _fiber3.memoizedState !== null;
- if (isTimedOutSuspense) {
- // A timed-out Suspense's findDOMNode is useless.
- // Try our best to find the fallback directly.
- var maybeFallbackFiber = _fiber3.child && _fiber3.child.sibling;
- if (maybeFallbackFiber != null) {
- _fiber3 = maybeFallbackFiber;
- }
- }
- var hostFibers = findAllCurrentHostFibers(id);
- return hostFibers.map(function (hostFiber) {
- return hostFiber.stateNode;
- }).filter(Boolean);
- } catch (err) {
- // The fiber might have unmounted by now.
- return null;
- }
- }
- function getDisplayNameForFiberID(id) {
- var fiber = idToArbitraryFiberMap.get(id);
- return fiber != null ? getDisplayNameForFiber(fiber) : null;
- }
- function getFiberForNative(hostInstance) {
- return renderer.findFiberByHostInstance(hostInstance);
- }
- function getFiberIDForNative(hostInstance) {
- var findNearestUnfilteredAncestor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var fiber = renderer.findFiberByHostInstance(hostInstance);
- if (fiber != null) {
- if (findNearestUnfilteredAncestor) {
- while (fiber !== null && shouldFilterFiber(fiber)) {
- fiber = fiber.return;
- }
- }
- return getFiberIDThrows(fiber);
- }
- return null;
- } // This function is copied from React and should be kept in sync:
- // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberTreeReflection.js
- function assertIsMounted(fiber) {
- if (getNearestMountedFiber(fiber) !== fiber) {
- throw new Error('Unable to find node on an unmounted component.');
- }
- } // This function is copied from React and should be kept in sync:
- // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberTreeReflection.js
- function getNearestMountedFiber(fiber) {
- var node = fiber;
- var nearestMounted = fiber;
- if (!fiber.alternate) {
- // If there is no alternate, this might be a new tree that isn't inserted
- // yet. If it is, then it will have a pending insertion effect on it.
- var nextNode = node;
- do {
- node = nextNode;
- if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
- // This is an insertion or in-progress hydration. The nearest possible
- // mounted fiber is the parent but we need to continue to figure out
- // if that one is still mounted.
- nearestMounted = node.return;
- } // $FlowFixMe[incompatible-type] we bail out when we get a null
- nextNode = node.return;
- } while (nextNode);
- } else {
- while (node.return) {
- node = node.return;
- }
- }
- if (node.tag === HostRoot) {
- // TODO: Check if this was a nested HostRoot when used with
- // renderContainerIntoSubtree.
- return nearestMounted;
- } // If we didn't hit the root, that means that we're in an disconnected tree
- // that has been unmounted.
- return null;
- } // This function is copied from React and should be kept in sync:
- // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberTreeReflection.js
- // It would be nice if we updated React to inject this function directly (vs just indirectly via findDOMNode).
- // BEGIN copied code
- function findCurrentFiberUsingSlowPathById(id) {
- var fiber = idToArbitraryFiberMap.get(id);
- if (fiber == null) {
- console.warn("Could not find Fiber with id \"".concat(id, "\""));
- return null;
- }
- var alternate = fiber.alternate;
- if (!alternate) {
- // If there is no alternate, then we only need to check if it is mounted.
- var nearestMounted = getNearestMountedFiber(fiber);
- if (nearestMounted === null) {
- throw new Error('Unable to find node on an unmounted component.');
- }
- if (nearestMounted !== fiber) {
- return null;
- }
- return fiber;
- } // If we have two possible branches, we'll walk backwards up to the root
- // to see what path the root points to. On the way we may hit one of the
- // special cases and we'll deal with them.
- var a = fiber;
- var b = alternate;
- while (true) {
- var parentA = a.return;
- if (parentA === null) {
- // We're at the root.
- break;
- }
- var parentB = parentA.alternate;
- if (parentB === null) {
- // There is no alternate. This is an unusual case. Currently, it only
- // happens when a Suspense component is hidden. An extra fragment fiber
- // is inserted in between the Suspense fiber and its children. Skip
- // over this extra fragment fiber and proceed to the next parent.
- var nextParent = parentA.return;
- if (nextParent !== null) {
- a = b = nextParent;
- continue;
- } // If there's no parent, we're at the root.
- break;
- } // If both copies of the parent fiber point to the same child, we can
- // assume that the child is current. This happens when we bailout on low
- // priority: the bailed out fiber's child reuses the current child.
- if (parentA.child === parentB.child) {
- var child = parentA.child;
- while (child) {
- if (child === a) {
- // We've determined that A is the current branch.
- assertIsMounted(parentA);
- return fiber;
- }
- if (child === b) {
- // We've determined that B is the current branch.
- assertIsMounted(parentA);
- return alternate;
- }
- child = child.sibling;
- } // We should never have an alternate for any mounting node. So the only
- // way this could possibly happen is if this was unmounted, if at all.
- throw new Error('Unable to find node on an unmounted component.');
- }
- if (a.return !== b.return) {
- // The return pointer of A and the return pointer of B point to different
- // fibers. We assume that return pointers never criss-cross, so A must
- // belong to the child set of A.return, and B must belong to the child
- // set of B.return.
- a = parentA;
- b = parentB;
- } else {
- // The return pointers point to the same fiber. We'll have to use the
- // default, slow path: scan the child sets of each parent alternate to see
- // which child belongs to which set.
- //
- // Search parent A's child set
- var didFindChild = false;
- var _child = parentA.child;
- while (_child) {
- if (_child === a) {
- didFindChild = true;
- a = parentA;
- b = parentB;
- break;
- }
- if (_child === b) {
- didFindChild = true;
- b = parentA;
- a = parentB;
- break;
- }
- _child = _child.sibling;
- }
- if (!didFindChild) {
- // Search parent B's child set
- _child = parentB.child;
- while (_child) {
- if (_child === a) {
- didFindChild = true;
- a = parentB;
- b = parentA;
- break;
- }
- if (_child === b) {
- didFindChild = true;
- b = parentB;
- a = parentA;
- break;
- }
- _child = _child.sibling;
- }
- if (!didFindChild) {
- throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.');
- }
- }
- }
- if (a.alternate !== b) {
- throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.');
- }
- } // If the root is not a host container, we're in a disconnected tree. I.e.
- // unmounted.
- if (a.tag !== HostRoot) {
- throw new Error('Unable to find node on an unmounted component.');
- }
- if (a.stateNode.current === a) {
- // We've determined that A is the current branch.
- return fiber;
- } // Otherwise B has to be current branch.
- return alternate;
- } // END copied code
- function prepareViewAttributeSource(id, path) {
- if (isMostRecentlyInspectedElement(id)) {
- window.$attribute = Object(utils["j" /* getInObject */])(mostRecentlyInspectedElement, path);
- }
- }
- function prepareViewElementSource(id) {
- var fiber = idToArbitraryFiberMap.get(id);
- if (fiber == null) {
- console.warn("Could not find Fiber with id \"".concat(id, "\""));
- return;
- }
- var elementType = fiber.elementType,
- tag = fiber.tag,
- type = fiber.type;
- switch (tag) {
- case ClassComponent:
- case IncompleteClassComponent:
- case IndeterminateComponent:
- case FunctionComponent:
- global.$type = type;
- break;
- case ForwardRef:
- global.$type = type.render;
- break;
- case MemoComponent:
- case SimpleMemoComponent:
- global.$type = elementType != null && elementType.type != null ? elementType.type : type;
- break;
- default:
- global.$type = null;
- break;
- }
- }
- function fiberToSerializedElement(fiber) {
- return {
- displayName: getDisplayNameForFiber(fiber) || 'Anonymous',
- id: getFiberIDThrows(fiber),
- key: fiber.key,
- type: getElementTypeForFiber(fiber)
- };
- }
- function getOwnersList(id) {
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (fiber == null) {
- return null;
- }
- var _debugOwner = fiber._debugOwner;
- var owners = [fiberToSerializedElement(fiber)];
- if (_debugOwner) {
- var owner = _debugOwner;
- while (owner !== null) {
- owners.unshift(fiberToSerializedElement(owner));
- owner = owner._debugOwner || null;
- }
- }
- return owners;
- } // Fast path props lookup for React Native style editor.
- // Could use inspectElementRaw() but that would require shallow rendering hooks components,
- // and could also mess with memoization.
- function getInstanceAndStyle(id) {
- var instance = null;
- var style = null;
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (fiber !== null) {
- instance = fiber.stateNode;
- if (fiber.memoizedProps !== null) {
- style = fiber.memoizedProps.style;
- }
- }
- return {
- instance: instance,
- style: style
- };
- }
- function isErrorBoundary(fiber) {
- var tag = fiber.tag,
- type = fiber.type;
- switch (tag) {
- case ClassComponent:
- case IncompleteClassComponent:
- var instance = fiber.stateNode;
- return typeof type.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function';
- default:
- return false;
- }
- }
- function getNearestErrorBoundaryID(fiber) {
- var parent = fiber.return;
- while (parent !== null) {
- if (isErrorBoundary(parent)) {
- return getFiberIDUnsafe(parent);
- }
- parent = parent.return;
- }
- return null;
- }
- function inspectElementRaw(id) {
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (fiber == null) {
- return null;
- }
- var _debugOwner = fiber._debugOwner,
- _debugSource = fiber._debugSource,
- stateNode = fiber.stateNode,
- key = fiber.key,
- memoizedProps = fiber.memoizedProps,
- memoizedState = fiber.memoizedState,
- dependencies = fiber.dependencies,
- tag = fiber.tag,
- type = fiber.type;
- var elementType = getElementTypeForFiber(fiber);
- var usesHooks = (tag === FunctionComponent || tag === SimpleMemoComponent || tag === ForwardRef) && (!!memoizedState || !!dependencies); // TODO Show custom UI for Cache like we do for Suspense
- // For now, just hide state data entirely since it's not meant to be inspected.
- var showState = !usesHooks && tag !== CacheComponent;
- var typeSymbol = getTypeSymbol(type);
- var canViewSource = false;
- var context = null;
- if (tag === ClassComponent || tag === FunctionComponent || tag === IncompleteClassComponent || tag === IndeterminateComponent || tag === MemoComponent || tag === ForwardRef || tag === SimpleMemoComponent) {
- canViewSource = true;
- if (stateNode && stateNode.context != null) {
- // Don't show an empty context object for class components that don't use the context API.
- var shouldHideContext = elementType === types["e" /* ElementTypeClass */] && !(type.contextTypes || type.contextType);
- if (!shouldHideContext) {
- context = stateNode.context;
- }
- }
- } else if (typeSymbol === ReactSymbols["c" /* CONTEXT_NUMBER */] || typeSymbol === ReactSymbols["d" /* CONTEXT_SYMBOL_STRING */]) {
- // 16.3-16.5 read from "type" because the Consumer is the actual context object.
- // 16.6+ should read from "type._context" because Consumer can be different (in DEV).
- // NOTE Keep in sync with getDisplayNameForFiber()
- var consumerResolvedContext = type._context || type; // Global context value.
- context = consumerResolvedContext._currentValue || null; // Look for overridden value.
- var _current = fiber.return;
- while (_current !== null) {
- var currentType = _current.type;
- var currentTypeSymbol = getTypeSymbol(currentType);
- if (currentTypeSymbol === ReactSymbols["n" /* PROVIDER_NUMBER */] || currentTypeSymbol === ReactSymbols["o" /* PROVIDER_SYMBOL_STRING */]) {
- // 16.3.0 exposed the context object as "context"
- // PR #12501 changed it to "_context" for 16.3.1+
- // NOTE Keep in sync with getDisplayNameForFiber()
- var providerResolvedContext = currentType._context || currentType.context;
- if (providerResolvedContext === consumerResolvedContext) {
- context = _current.memoizedProps.value;
- break;
- }
- }
- _current = _current.return;
- }
- }
- var hasLegacyContext = false;
- if (context !== null) {
- hasLegacyContext = !!type.contextTypes; // To simplify hydration and display logic for context, wrap in a value object.
- // Otherwise simple values (e.g. strings, booleans) become harder to handle.
- context = {
- value: context
- };
- }
- var owners = null;
- if (_debugOwner) {
- owners = [];
- var owner = _debugOwner;
- while (owner !== null) {
- owners.push(fiberToSerializedElement(owner));
- owner = owner._debugOwner || null;
- }
- }
- var isTimedOutSuspense = tag === SuspenseComponent && memoizedState !== null;
- var hooks = null;
- if (usesHooks) {
- var originalConsoleMethods = {}; // Temporarily disable all console logging before re-running the hook.
- for (var method in console) {
- try {
- originalConsoleMethods[method] = console[method]; // $FlowFixMe[prop-missing]
- console[method] = function () {};
- } catch (error) {}
- }
- try {
- hooks = Object(react_debug_tools["inspectHooksOfFiber"])(fiber, renderer.currentDispatcherRef, true // Include source location info for hooks
- );
- } finally {
- // Restore original console functionality.
- for (var _method in originalConsoleMethods) {
- try {
- // $FlowFixMe[prop-missing]
- console[_method] = originalConsoleMethods[_method];
- } catch (error) {}
- }
- }
- }
- var rootType = null;
- var current = fiber;
- while (current.return !== null) {
- current = current.return;
- }
- var fiberRoot = current.stateNode;
- if (fiberRoot != null && fiberRoot._debugRootType !== null) {
- rootType = fiberRoot._debugRootType;
- }
- var errors = fiberIDToErrorsMap.get(id) || new Map();
- var warnings = fiberIDToWarningsMap.get(id) || new Map();
- var isErrored = (fiber.flags & DidCapture) !== NoFlags || forceErrorForFiberIDs.get(id) === true;
- var targetErrorBoundaryID;
- if (isErrorBoundary(fiber)) {
- // if the current inspected element is an error boundary,
- // either that we want to use it to toggle off error state
- // or that we allow to force error state on it if it's within another
- // error boundary
- targetErrorBoundaryID = isErrored ? id : getNearestErrorBoundaryID(fiber);
- } else {
- targetErrorBoundaryID = getNearestErrorBoundaryID(fiber);
- }
- var plugins = {
- stylex: null
- };
- if (DevToolsFeatureFlags_core_oss["c" /* enableStyleXFeatures */]) {
- if (memoizedProps.hasOwnProperty('xstyle')) {
- plugins.stylex = getStyleXData(memoizedProps.xstyle);
- }
- }
- return {
- id: id,
- // Does the current renderer support editable hooks and function props?
- canEditHooks: typeof overrideHookState === 'function',
- canEditFunctionProps: typeof overrideProps === 'function',
- // Does the current renderer support advanced editing interface?
- canEditHooksAndDeletePaths: typeof overrideHookStateDeletePath === 'function',
- canEditHooksAndRenamePaths: typeof overrideHookStateRenamePath === 'function',
- canEditFunctionPropsDeletePaths: typeof overridePropsDeletePath === 'function',
- canEditFunctionPropsRenamePaths: typeof overridePropsRenamePath === 'function',
- canToggleError: supportsTogglingError && targetErrorBoundaryID != null,
- // Is this error boundary in error state.
- isErrored: isErrored,
- targetErrorBoundaryID: targetErrorBoundaryID,
- canToggleSuspense: supportsTogglingSuspense && ( // If it's showing the real content, we can always flip fallback.
- !isTimedOutSuspense || // If it's showing fallback because we previously forced it to,
- // allow toggling it back to remove the fallback override.
- forceFallbackForSuspenseIDs.has(id)),
- // Can view component source location.
- canViewSource: canViewSource,
- // Does the component have legacy context attached to it.
- hasLegacyContext: hasLegacyContext,
- key: key != null ? key : null,
- displayName: getDisplayNameForFiber(fiber),
- type: elementType,
- // Inspectable properties.
- // TODO Review sanitization approach for the below inspectable values.
- context: context,
- hooks: hooks,
- props: memoizedProps,
- state: showState ? memoizedState : null,
- errors: Array.from(errors.entries()),
- warnings: Array.from(warnings.entries()),
- // List of owners
- owners: owners,
- // Location of component in source code.
- source: _debugSource || null,
- rootType: rootType,
- rendererPackageName: renderer.rendererPackageName,
- rendererVersion: renderer.version,
- plugins: plugins
- };
- }
- var mostRecentlyInspectedElement = null;
- var hasElementUpdatedSinceLastInspected = false;
- var currentlyInspectedPaths = {};
- function isMostRecentlyInspectedElement(id) {
- return mostRecentlyInspectedElement !== null && mostRecentlyInspectedElement.id === id;
- }
- function isMostRecentlyInspectedElementCurrent(id) {
- return isMostRecentlyInspectedElement(id) && !hasElementUpdatedSinceLastInspected;
- } // Track the intersection of currently inspected paths,
- // so that we can send their data along if the element is re-rendered.
- function mergeInspectedPaths(path) {
- var current = currentlyInspectedPaths;
- path.forEach(function (key) {
- if (!current[key]) {
- current[key] = {};
- }
- current = current[key];
- });
- }
- function createIsPathAllowed(key, secondaryCategory) {
- // This function helps prevent previously-inspected paths from being dehydrated in updates.
- // This is important to avoid a bad user experience where expanded toggles collapse on update.
- return function isPathAllowed(path) {
- switch (secondaryCategory) {
- case 'hooks':
- if (path.length === 1) {
- // Never dehydrate the "hooks" object at the top levels.
- return true;
- }
- if (path[path.length - 2] === 'hookSource' && path[path.length - 1] === 'fileName') {
- // It's important to preserve the full file name (URL) for hook sources
- // in case the user has enabled the named hooks feature.
- // Otherwise the frontend may end up with a partial URL which it can't load.
- return true;
- }
- if (path[path.length - 1] === 'subHooks' || path[path.length - 2] === 'subHooks') {
- // Dehydrating the 'subHooks' property makes the HooksTree UI a lot more complicated,
- // so it's easiest for now if we just don't break on this boundary.
- // We can always dehydrate a level deeper (in the value object).
- return true;
- }
- break;
- default:
- break;
- }
- var current = key === null ? currentlyInspectedPaths : currentlyInspectedPaths[key];
- if (!current) {
- return false;
- }
- for (var i = 0; i < path.length; i++) {
- current = current[path[i]];
- if (!current) {
- return false;
- }
- }
- return true;
- };
- }
- function updateSelectedElement(inspectedElement) {
- var hooks = inspectedElement.hooks,
- id = inspectedElement.id,
- props = inspectedElement.props;
- var fiber = idToArbitraryFiberMap.get(id);
- if (fiber == null) {
- console.warn("Could not find Fiber with id \"".concat(id, "\""));
- return;
- }
- var elementType = fiber.elementType,
- stateNode = fiber.stateNode,
- tag = fiber.tag,
- type = fiber.type;
- switch (tag) {
- case ClassComponent:
- case IncompleteClassComponent:
- case IndeterminateComponent:
- global.$r = stateNode;
- break;
- case FunctionComponent:
- global.$r = {
- hooks: hooks,
- props: props,
- type: type
- };
- break;
- case ForwardRef:
- global.$r = {
- hooks: hooks,
- props: props,
- type: type.render
- };
- break;
- case MemoComponent:
- case SimpleMemoComponent:
- global.$r = {
- hooks: hooks,
- props: props,
- type: elementType != null && elementType.type != null ? elementType.type : type
- };
- break;
- default:
- global.$r = null;
- break;
- }
- }
- function storeAsGlobal(id, path, count) {
- if (isMostRecentlyInspectedElement(id)) {
- var value = Object(utils["j" /* getInObject */])(mostRecentlyInspectedElement, path);
- var key = "$reactTemp".concat(count);
- window[key] = value;
- console.log(key);
- console.log(value);
- }
- }
- function copyElementPath(id, path) {
- if (isMostRecentlyInspectedElement(id)) {
- Object(backend_utils["b" /* copyToClipboard */])(Object(utils["j" /* getInObject */])(mostRecentlyInspectedElement, path));
- }
- }
- function inspectElement(requestID, id, path, forceFullData) {
- if (path !== null) {
- mergeInspectedPaths(path);
- }
- if (isMostRecentlyInspectedElement(id) && !forceFullData) {
- if (!hasElementUpdatedSinceLastInspected) {
- if (path !== null) {
- var secondaryCategory = null;
- if (path[0] === 'hooks') {
- secondaryCategory = 'hooks';
- } // If this element has not been updated since it was last inspected,
- // we can just return the subset of data in the newly-inspected path.
- return {
- id: id,
- responseID: requestID,
- type: 'hydrated-path',
- path: path,
- value: Object(backend_utils["a" /* cleanForBridge */])(Object(utils["j" /* getInObject */])(mostRecentlyInspectedElement, path), createIsPathAllowed(null, secondaryCategory), path)
- };
- } else {
- // If this element has not been updated since it was last inspected, we don't need to return it.
- // Instead we can just return the ID to indicate that it has not changed.
- return {
- id: id,
- responseID: requestID,
- type: 'no-change'
- };
- }
- }
- } else {
- currentlyInspectedPaths = {};
- }
- hasElementUpdatedSinceLastInspected = false;
- try {
- mostRecentlyInspectedElement = inspectElementRaw(id);
- } catch (error) {
- // the error name is synced with ReactDebugHooks
- if (error.name === 'ReactDebugToolsRenderError') {
- var message = 'Error rendering inspected element.';
- var stack; // Log error & cause for user to debug
- console.error(message + '\n\n', error);
- if (error.cause != null) {
- var _fiber4 = findCurrentFiberUsingSlowPathById(id);
- var componentName = _fiber4 != null ? getDisplayNameForFiber(_fiber4) : null;
- console.error('React DevTools encountered an error while trying to inspect hooks. ' + 'This is most likely caused by an error in current inspected component' + (componentName != null ? ": \"".concat(componentName, "\".") : '.') + '\nThe error thrown in the component is: \n\n', error.cause);
- if (error.cause instanceof Error) {
- message = error.cause.message || message;
- stack = error.cause.stack;
- }
- }
- return {
- type: 'error',
- errorType: 'user',
- id: id,
- responseID: requestID,
- message: message,
- stack: stack
- };
- } // the error name is synced with ReactDebugHooks
- if (error.name === 'ReactDebugToolsUnsupportedHookError') {
- return {
- type: 'error',
- errorType: 'unknown-hook',
- id: id,
- responseID: requestID,
- message: 'Unsupported hook in the react-debug-tools package: ' + error.message
- };
- } // Log Uncaught Error
- console.error('Error inspecting element.\n\n', error);
- return {
- type: 'error',
- errorType: 'uncaught',
- id: id,
- responseID: requestID,
- message: error.message,
- stack: error.stack
- };
- }
- if (mostRecentlyInspectedElement === null) {
- return {
- id: id,
- responseID: requestID,
- type: 'not-found'
- };
- } // Any time an inspected element has an update,
- // we should update the selected $r value as wel.
- // Do this before dehydration (cleanForBridge).
- updateSelectedElement(mostRecentlyInspectedElement); // Clone before cleaning so that we preserve the full data.
- // This will enable us to send patches without re-inspecting if hydrated paths are requested.
- // (Reducing how often we shallow-render is a better DX for function components that use hooks.)
- var cleanedInspectedElement = _objectSpread({}, mostRecentlyInspectedElement); // $FlowFixMe[prop-missing] found when upgrading Flow
- cleanedInspectedElement.context = Object(backend_utils["a" /* cleanForBridge */])(cleanedInspectedElement.context, createIsPathAllowed('context', null)); // $FlowFixMe[prop-missing] found when upgrading Flow
- cleanedInspectedElement.hooks = Object(backend_utils["a" /* cleanForBridge */])(cleanedInspectedElement.hooks, createIsPathAllowed('hooks', 'hooks')); // $FlowFixMe[prop-missing] found when upgrading Flow
- cleanedInspectedElement.props = Object(backend_utils["a" /* cleanForBridge */])(cleanedInspectedElement.props, createIsPathAllowed('props', null)); // $FlowFixMe[prop-missing] found when upgrading Flow
- cleanedInspectedElement.state = Object(backend_utils["a" /* cleanForBridge */])(cleanedInspectedElement.state, createIsPathAllowed('state', null));
- return {
- id: id,
- responseID: requestID,
- type: 'full-data',
- // $FlowFixMe[prop-missing] found when upgrading Flow
- value: cleanedInspectedElement
- };
- }
- function logElementToConsole(id) {
- var result = isMostRecentlyInspectedElementCurrent(id) ? mostRecentlyInspectedElement : inspectElementRaw(id);
- if (result === null) {
- console.warn("Could not find Fiber with id \"".concat(id, "\""));
- return;
- }
- var supportsGroup = typeof console.groupCollapsed === 'function';
- if (supportsGroup) {
- console.groupCollapsed("[Click to expand] %c<".concat(result.displayName || 'Component', " />"), // --dom-tag-name-color is the CSS variable Chrome styles HTML elements with in the console.
- 'color: var(--dom-tag-name-color); font-weight: normal;');
- }
- if (result.props !== null) {
- console.log('Props:', result.props);
- }
- if (result.state !== null) {
- console.log('State:', result.state);
- }
- if (result.hooks !== null) {
- console.log('Hooks:', result.hooks);
- }
- var nativeNodes = findNativeNodesForFiberID(id);
- if (nativeNodes !== null) {
- console.log('Nodes:', nativeNodes);
- }
- if (result.source !== null) {
- console.log('Location:', result.source);
- }
- if (window.chrome || /firefox/i.test(navigator.userAgent)) {
- console.log('Right-click any value to save it as a global variable for further inspection.');
- }
- if (supportsGroup) {
- console.groupEnd();
- }
- }
- function deletePath(type, id, hookID, path) {
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (fiber !== null) {
- var instance = fiber.stateNode;
- switch (type) {
- case 'context':
- // To simplify hydration and display of primitive context values (e.g. number, string)
- // the inspectElement() method wraps context in a {value: ...} object.
- // We need to remove the first part of the path (the "value") before continuing.
- path = path.slice(1);
- switch (fiber.tag) {
- case ClassComponent:
- if (path.length === 0) {// Simple context value (noop)
- } else {
- Object(utils["c" /* deletePathInObject */])(instance.context, path);
- }
- instance.forceUpdate();
- break;
- case FunctionComponent:
- // Function components using legacy context are not editable
- // because there's no instance on which to create a cloned, mutated context.
- break;
- }
- break;
- case 'hooks':
- if (typeof overrideHookStateDeletePath === 'function') {
- overrideHookStateDeletePath(fiber, hookID, path);
- }
- break;
- case 'props':
- if (instance === null) {
- if (typeof overridePropsDeletePath === 'function') {
- overridePropsDeletePath(fiber, path);
- }
- } else {
- fiber.pendingProps = Object(backend_utils["c" /* copyWithDelete */])(instance.props, path);
- instance.forceUpdate();
- }
- break;
- case 'state':
- Object(utils["c" /* deletePathInObject */])(instance.state, path);
- instance.forceUpdate();
- break;
- }
- }
- }
- function renamePath(type, id, hookID, oldPath, newPath) {
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (fiber !== null) {
- var instance = fiber.stateNode;
- switch (type) {
- case 'context':
- // To simplify hydration and display of primitive context values (e.g. number, string)
- // the inspectElement() method wraps context in a {value: ...} object.
- // We need to remove the first part of the path (the "value") before continuing.
- oldPath = oldPath.slice(1);
- newPath = newPath.slice(1);
- switch (fiber.tag) {
- case ClassComponent:
- if (oldPath.length === 0) {// Simple context value (noop)
- } else {
- Object(utils["n" /* renamePathInObject */])(instance.context, oldPath, newPath);
- }
- instance.forceUpdate();
- break;
- case FunctionComponent:
- // Function components using legacy context are not editable
- // because there's no instance on which to create a cloned, mutated context.
- break;
- }
- break;
- case 'hooks':
- if (typeof overrideHookStateRenamePath === 'function') {
- overrideHookStateRenamePath(fiber, hookID, oldPath, newPath);
- }
- break;
- case 'props':
- if (instance === null) {
- if (typeof overridePropsRenamePath === 'function') {
- overridePropsRenamePath(fiber, oldPath, newPath);
- }
- } else {
- fiber.pendingProps = Object(backend_utils["d" /* copyWithRename */])(instance.props, oldPath, newPath);
- instance.forceUpdate();
- }
- break;
- case 'state':
- Object(utils["n" /* renamePathInObject */])(instance.state, oldPath, newPath);
- instance.forceUpdate();
- break;
- }
- }
- }
- function overrideValueAtPath(type, id, hookID, path, value) {
- var fiber = findCurrentFiberUsingSlowPathById(id);
- if (fiber !== null) {
- var instance = fiber.stateNode;
- switch (type) {
- case 'context':
- // To simplify hydration and display of primitive context values (e.g. number, string)
- // the inspectElement() method wraps context in a {value: ...} object.
- // We need to remove the first part of the path (the "value") before continuing.
- path = path.slice(1);
- switch (fiber.tag) {
- case ClassComponent:
- if (path.length === 0) {
- // Simple context value
- instance.context = value;
- } else {
- Object(utils["o" /* setInObject */])(instance.context, path, value);
- }
- instance.forceUpdate();
- break;
- case FunctionComponent:
- // Function components using legacy context are not editable
- // because there's no instance on which to create a cloned, mutated context.
- break;
- }
- break;
- case 'hooks':
- if (typeof overrideHookState === 'function') {
- overrideHookState(fiber, hookID, path, value);
- }
- break;
- case 'props':
- switch (fiber.tag) {
- case ClassComponent:
- fiber.pendingProps = Object(backend_utils["e" /* copyWithSet */])(instance.props, path, value);
- instance.forceUpdate();
- break;
- default:
- if (typeof overrideProps === 'function') {
- overrideProps(fiber, path, value);
- }
- break;
- }
- break;
- case 'state':
- switch (fiber.tag) {
- case ClassComponent:
- Object(utils["o" /* setInObject */])(instance.state, path, value);
- instance.forceUpdate();
- break;
- }
- break;
- }
- }
- }
- var currentCommitProfilingMetadata = null;
- var displayNamesByRootID = null;
- var idToContextsMap = null;
- var initialTreeBaseDurationsMap = null;
- var initialIDToRootMap = null;
- var isProfiling = false;
- var profilingStartTime = 0;
- var recordChangeDescriptions = false;
- var rootToCommitProfilingMetadataMap = null;
- function getProfilingData() {
- var dataForRoots = [];
- if (rootToCommitProfilingMetadataMap === null) {
- throw Error('getProfilingData() called before any profiling data was recorded');
- }
- rootToCommitProfilingMetadataMap.forEach(function (commitProfilingMetadata, rootID) {
- var commitData = [];
- var initialTreeBaseDurations = [];
- var displayName = displayNamesByRootID !== null && displayNamesByRootID.get(rootID) || 'Unknown';
- if (initialTreeBaseDurationsMap != null) {
- initialTreeBaseDurationsMap.forEach(function (treeBaseDuration, id) {
- if (initialIDToRootMap != null && initialIDToRootMap.get(id) === rootID) {
- // We don't need to convert milliseconds to microseconds in this case,
- // because the profiling summary is JSON serialized.
- initialTreeBaseDurations.push([id, treeBaseDuration]);
- }
- });
- }
- commitProfilingMetadata.forEach(function (commitProfilingData, commitIndex) {
- var changeDescriptions = commitProfilingData.changeDescriptions,
- durations = commitProfilingData.durations,
- effectDuration = commitProfilingData.effectDuration,
- maxActualDuration = commitProfilingData.maxActualDuration,
- passiveEffectDuration = commitProfilingData.passiveEffectDuration,
- priorityLevel = commitProfilingData.priorityLevel,
- commitTime = commitProfilingData.commitTime,
- updaters = commitProfilingData.updaters;
- var fiberActualDurations = [];
- var fiberSelfDurations = [];
- for (var i = 0; i < durations.length; i += 3) {
- var fiberID = durations[i];
- fiberActualDurations.push([fiberID, durations[i + 1]]);
- fiberSelfDurations.push([fiberID, durations[i + 2]]);
- }
- commitData.push({
- changeDescriptions: changeDescriptions !== null ? Array.from(changeDescriptions.entries()) : null,
- duration: maxActualDuration,
- effectDuration: effectDuration,
- fiberActualDurations: fiberActualDurations,
- fiberSelfDurations: fiberSelfDurations,
- passiveEffectDuration: passiveEffectDuration,
- priorityLevel: priorityLevel,
- timestamp: commitTime,
- updaters: updaters
- });
- });
- dataForRoots.push({
- commitData: commitData,
- displayName: displayName,
- initialTreeBaseDurations: initialTreeBaseDurations,
- rootID: rootID
- });
- });
- var timelineData = null;
- if (typeof getTimelineData === 'function') {
- var currentTimelineData = getTimelineData();
- if (currentTimelineData) {
- var batchUIDToMeasuresMap = currentTimelineData.batchUIDToMeasuresMap,
- internalModuleSourceToRanges = currentTimelineData.internalModuleSourceToRanges,
- laneToLabelMap = currentTimelineData.laneToLabelMap,
- laneToReactMeasureMap = currentTimelineData.laneToReactMeasureMap,
- rest = _objectWithoutProperties(currentTimelineData, ["batchUIDToMeasuresMap", "internalModuleSourceToRanges", "laneToLabelMap", "laneToReactMeasureMap"]);
- timelineData = _objectSpread(_objectSpread({}, rest), {}, {
- // Most of the data is safe to parse as-is,
- // but we need to convert the nested Arrays back to Maps.
- // Most of the data is safe to serialize as-is,
- // but we need to convert the Maps to nested Arrays.
- batchUIDToMeasuresKeyValueArray: Array.from(batchUIDToMeasuresMap.entries()),
- internalModuleSourceToRanges: Array.from(internalModuleSourceToRanges.entries()),
- laneToLabelKeyValueArray: Array.from(laneToLabelMap.entries()),
- laneToReactMeasureKeyValueArray: Array.from(laneToReactMeasureMap.entries())
- });
- }
- }
- return {
- dataForRoots: dataForRoots,
- rendererID: rendererID,
- timelineData: timelineData
- };
- }
- function startProfiling(shouldRecordChangeDescriptions) {
- if (isProfiling) {
- return;
- }
- recordChangeDescriptions = shouldRecordChangeDescriptions; // Capture initial values as of the time profiling starts.
- // It's important we snapshot both the durations and the id-to-root map,
- // since either of these may change during the profiling session
- // (e.g. when a fiber is re-rendered or when a fiber gets removed).
- displayNamesByRootID = new Map();
- initialTreeBaseDurationsMap = new Map(idToTreeBaseDurationMap);
- initialIDToRootMap = new Map(idToRootMap);
- idToContextsMap = new Map();
- hook.getFiberRoots(rendererID).forEach(function (root) {
- var rootID = getFiberIDThrows(root.current);
- displayNamesByRootID.set(rootID, getDisplayNameForRoot(root.current));
- if (shouldRecordChangeDescriptions) {
- // Record all contexts at the time profiling is started.
- // Fibers only store the current context value,
- // so we need to track them separately in order to determine changed keys.
- crawlToInitializeContextsMap(root.current);
- }
- });
- isProfiling = true;
- profilingStartTime = renderer_getCurrentTime();
- rootToCommitProfilingMetadataMap = new Map();
- if (toggleProfilingStatus !== null) {
- toggleProfilingStatus(true);
- }
- }
- function stopProfiling() {
- isProfiling = false;
- recordChangeDescriptions = false;
- if (toggleProfilingStatus !== null) {
- toggleProfilingStatus(false);
- }
- } // Automatically start profiling so that we don't miss timing info from initial "mount".
- if (Object(storage["c" /* sessionStorageGetItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]) === 'true') {
- startProfiling(Object(storage["c" /* sessionStorageGetItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]) === 'true');
- } // React will switch between these implementations depending on whether
- // we have any manually suspended/errored-out Fibers or not.
- function shouldErrorFiberAlwaysNull() {
- return null;
- } // Map of id and its force error status: true (error), false (toggled off),
- // null (do nothing)
- var forceErrorForFiberIDs = new Map();
- function shouldErrorFiberAccordingToMap(fiber) {
- if (typeof setErrorHandler !== 'function') {
- throw new Error('Expected overrideError() to not get called for earlier React versions.');
- }
- var id = getFiberIDUnsafe(fiber);
- if (id === null) {
- return null;
- }
- var status = null;
- if (forceErrorForFiberIDs.has(id)) {
- status = forceErrorForFiberIDs.get(id);
- if (status === false) {
- // TRICKY overrideError adds entries to this Map,
- // so ideally it would be the method that clears them too,
- // but that would break the functionality of the feature,
- // since DevTools needs to tell React to act differently than it normally would
- // (don't just re-render the failed boundary, but reset its errored state too).
- // So we can only clear it after telling React to reset the state.
- // Technically this is premature and we should schedule it for later,
- // since the render could always fail without committing the updated error boundary,
- // but since this is a DEV-only feature, the simplicity is worth the trade off.
- forceErrorForFiberIDs.delete(id);
- if (forceErrorForFiberIDs.size === 0) {
- // Last override is gone. Switch React back to fast path.
- setErrorHandler(shouldErrorFiberAlwaysNull);
- }
- }
- }
- return status;
- }
- function overrideError(id, forceError) {
- if (typeof setErrorHandler !== 'function' || typeof scheduleUpdate !== 'function') {
- throw new Error('Expected overrideError() to not get called for earlier React versions.');
- }
- forceErrorForFiberIDs.set(id, forceError);
- if (forceErrorForFiberIDs.size === 1) {
- // First override is added. Switch React to slower path.
- setErrorHandler(shouldErrorFiberAccordingToMap);
- }
- var fiber = idToArbitraryFiberMap.get(id);
- if (fiber != null) {
- scheduleUpdate(fiber);
- }
- }
- function shouldSuspendFiberAlwaysFalse() {
- return false;
- }
- var forceFallbackForSuspenseIDs = new Set();
- function shouldSuspendFiberAccordingToSet(fiber) {
- var maybeID = getFiberIDUnsafe(fiber);
- return maybeID !== null && forceFallbackForSuspenseIDs.has(maybeID);
- }
- function overrideSuspense(id, forceFallback) {
- if (typeof setSuspenseHandler !== 'function' || typeof scheduleUpdate !== 'function') {
- throw new Error('Expected overrideSuspense() to not get called for earlier React versions.');
- }
- if (forceFallback) {
- forceFallbackForSuspenseIDs.add(id);
- if (forceFallbackForSuspenseIDs.size === 1) {
- // First override is added. Switch React to slower path.
- setSuspenseHandler(shouldSuspendFiberAccordingToSet);
- }
- } else {
- forceFallbackForSuspenseIDs.delete(id);
- if (forceFallbackForSuspenseIDs.size === 0) {
- // Last override is gone. Switch React back to fast path.
- setSuspenseHandler(shouldSuspendFiberAlwaysFalse);
- }
- }
- var fiber = idToArbitraryFiberMap.get(id);
- if (fiber != null) {
- scheduleUpdate(fiber);
- }
- } // Remember if we're trying to restore the selection after reload.
- // In that case, we'll do some extra checks for matching mounts.
- var trackedPath = null;
- var trackedPathMatchFiber = null;
- var trackedPathMatchDepth = -1;
- var mightBeOnTrackedPath = false;
- function setTrackedPath(path) {
- if (path === null) {
- trackedPathMatchFiber = null;
- trackedPathMatchDepth = -1;
- mightBeOnTrackedPath = false;
- }
- trackedPath = path;
- } // We call this before traversing a new mount.
- // It remembers whether this Fiber is the next best match for tracked path.
- // The return value signals whether we should keep matching siblings or not.
- function updateTrackedPathStateBeforeMount(fiber) {
- if (trackedPath === null || !mightBeOnTrackedPath) {
- // Fast path: there's nothing to track so do nothing and ignore siblings.
- return false;
- }
- var returnFiber = fiber.return;
- var returnAlternate = returnFiber !== null ? returnFiber.alternate : null; // By now we know there's some selection to restore, and this is a new Fiber.
- // Is this newly mounted Fiber a direct child of the current best match?
- // (This will also be true for new roots if we haven't matched anything yet.)
- if (trackedPathMatchFiber === returnFiber || trackedPathMatchFiber === returnAlternate && returnAlternate !== null) {
- // Is this the next Fiber we should select? Let's compare the frames.
- var actualFrame = getPathFrame(fiber); // $FlowFixMe[incompatible-use] found when upgrading Flow
- var expectedFrame = trackedPath[trackedPathMatchDepth + 1];
- if (expectedFrame === undefined) {
- throw new Error('Expected to see a frame at the next depth.');
- }
- if (actualFrame.index === expectedFrame.index && actualFrame.key === expectedFrame.key && actualFrame.displayName === expectedFrame.displayName) {
- // We have our next match.
- trackedPathMatchFiber = fiber;
- trackedPathMatchDepth++; // Are we out of frames to match?
- // $FlowFixMe[incompatible-use] found when upgrading Flow
- if (trackedPathMatchDepth === trackedPath.length - 1) {
- // There's nothing that can possibly match afterwards.
- // Don't check the children.
- mightBeOnTrackedPath = false;
- } else {
- // Check the children, as they might reveal the next match.
- mightBeOnTrackedPath = true;
- } // In either case, since we have a match, we don't need
- // to check the siblings. They'll never match.
- return false;
- }
- } // This Fiber's parent is on the path, but this Fiber itself isn't.
- // There's no need to check its children--they won't be on the path either.
- mightBeOnTrackedPath = false; // However, one of its siblings may be on the path so keep searching.
- return true;
- }
- function updateTrackedPathStateAfterMount(mightSiblingsBeOnTrackedPath) {
- // updateTrackedPathStateBeforeMount() told us whether to match siblings.
- // Now that we're entering siblings, let's use that information.
- mightBeOnTrackedPath = mightSiblingsBeOnTrackedPath;
- } // Roots don't have a real persistent identity.
- // A root's "pseudo key" is "childDisplayName:indexWithThatName".
- // For example, "App:0" or, in case of similar roots, "Story:0", "Story:1", etc.
- // We will use this to try to disambiguate roots when restoring selection between reloads.
- var rootPseudoKeys = new Map();
- var rootDisplayNameCounter = new Map();
- function setRootPseudoKey(id, fiber) {
- var name = getDisplayNameForRoot(fiber);
- var counter = rootDisplayNameCounter.get(name) || 0;
- rootDisplayNameCounter.set(name, counter + 1);
- var pseudoKey = "".concat(name, ":").concat(counter);
- rootPseudoKeys.set(id, pseudoKey);
- }
- function removeRootPseudoKey(id) {
- var pseudoKey = rootPseudoKeys.get(id);
- if (pseudoKey === undefined) {
- throw new Error('Expected root pseudo key to be known.');
- }
- var name = pseudoKey.substring(0, pseudoKey.lastIndexOf(':'));
- var counter = rootDisplayNameCounter.get(name);
- if (counter === undefined) {
- throw new Error('Expected counter to be known.');
- }
- if (counter > 1) {
- rootDisplayNameCounter.set(name, counter - 1);
- } else {
- rootDisplayNameCounter.delete(name);
- }
- rootPseudoKeys.delete(id);
- }
- function getDisplayNameForRoot(fiber) {
- var preferredDisplayName = null;
- var fallbackDisplayName = null;
- var child = fiber.child; // Go at most three levels deep into direct children
- // while searching for a child that has a displayName.
- for (var i = 0; i < 3; i++) {
- if (child === null) {
- break;
- }
- var displayName = getDisplayNameForFiber(child);
- if (displayName !== null) {
- // Prefer display names that we get from user-defined components.
- // We want to avoid using e.g. 'Suspense' unless we find nothing else.
- if (typeof child.type === 'function') {
- // There's a few user-defined tags, but we'll prefer the ones
- // that are usually explicitly named (function or class components).
- preferredDisplayName = displayName;
- } else if (fallbackDisplayName === null) {
- fallbackDisplayName = displayName;
- }
- }
- if (preferredDisplayName !== null) {
- break;
- }
- child = child.child;
- }
- return preferredDisplayName || fallbackDisplayName || 'Anonymous';
- }
- function getPathFrame(fiber) {
- var key = fiber.key;
- var displayName = getDisplayNameForFiber(fiber);
- var index = fiber.index;
- switch (fiber.tag) {
- case HostRoot:
- // Roots don't have a real displayName, index, or key.
- // Instead, we'll use the pseudo key (childDisplayName:indexWithThatName).
- var id = getFiberIDThrows(fiber);
- var pseudoKey = rootPseudoKeys.get(id);
- if (pseudoKey === undefined) {
- throw new Error('Expected mounted root to have known pseudo key.');
- }
- displayName = pseudoKey;
- break;
- case HostComponent:
- displayName = fiber.type;
- break;
- default:
- break;
- }
- return {
- displayName: displayName,
- key: key,
- index: index
- };
- } // Produces a serializable representation that does a best effort
- // of identifying a particular Fiber between page reloads.
- // The return path will contain Fibers that are "invisible" to the store
- // because their keys and indexes are important to restoring the selection.
- function getPathForElement(id) {
- var fiber = idToArbitraryFiberMap.get(id);
- if (fiber == null) {
- return null;
- }
- var keyPath = [];
- while (fiber !== null) {
- // $FlowFixMe[incompatible-call] found when upgrading Flow
- keyPath.push(getPathFrame(fiber)); // $FlowFixMe[incompatible-use] found when upgrading Flow
- fiber = fiber.return;
- }
- keyPath.reverse();
- return keyPath;
- }
- function getBestMatchForTrackedPath() {
- if (trackedPath === null) {
- // Nothing to match.
- return null;
- }
- if (trackedPathMatchFiber === null) {
- // We didn't find anything.
- return null;
- } // Find the closest Fiber store is aware of.
- var fiber = trackedPathMatchFiber;
- while (fiber !== null && shouldFilterFiber(fiber)) {
- fiber = fiber.return;
- }
- if (fiber === null) {
- return null;
- }
- return {
- id: getFiberIDThrows(fiber),
- // $FlowFixMe[incompatible-use] found when upgrading Flow
- isFullMatch: trackedPathMatchDepth === trackedPath.length - 1
- };
- }
- var formatPriorityLevel = function formatPriorityLevel(priorityLevel) {
- if (priorityLevel == null) {
- return 'Unknown';
- }
- switch (priorityLevel) {
- case ImmediatePriority:
- return 'Immediate';
- case UserBlockingPriority:
- return 'User-Blocking';
- case NormalPriority:
- return 'Normal';
- case LowPriority:
- return 'Low';
- case IdlePriority:
- return 'Idle';
- case NoPriority:
- default:
- return 'Unknown';
- }
- };
- function setTraceUpdatesEnabled(isEnabled) {
- traceUpdatesEnabled = isEnabled;
- }
- return {
- cleanup: cleanup,
- clearErrorsAndWarnings: clearErrorsAndWarnings,
- clearErrorsForFiberID: clearErrorsForFiberID,
- clearWarningsForFiberID: clearWarningsForFiberID,
- copyElementPath: copyElementPath,
- deletePath: deletePath,
- findNativeNodesForFiberID: findNativeNodesForFiberID,
- flushInitialOperations: flushInitialOperations,
- getBestMatchForTrackedPath: getBestMatchForTrackedPath,
- getDisplayNameForFiberID: getDisplayNameForFiberID,
- getFiberForNative: getFiberForNative,
- getFiberIDForNative: getFiberIDForNative,
- getInstanceAndStyle: getInstanceAndStyle,
- getOwnersList: getOwnersList,
- getPathForElement: getPathForElement,
- getProfilingData: getProfilingData,
- handleCommitFiberRoot: handleCommitFiberRoot,
- handleCommitFiberUnmount: handleCommitFiberUnmount,
- handlePostCommitFiberRoot: handlePostCommitFiberRoot,
- inspectElement: inspectElement,
- logElementToConsole: logElementToConsole,
- patchConsoleForStrictMode: backend_console["c" /* patchForStrictMode */],
- prepareViewAttributeSource: prepareViewAttributeSource,
- prepareViewElementSource: prepareViewElementSource,
- overrideError: overrideError,
- overrideSuspense: overrideSuspense,
- overrideValueAtPath: overrideValueAtPath,
- renamePath: renamePath,
- renderer: renderer,
- setTraceUpdatesEnabled: setTraceUpdatesEnabled,
- setTrackedPath: setTrackedPath,
- startProfiling: startProfiling,
- stopProfiling: stopProfiling,
- storeAsGlobal: storeAsGlobal,
- unpatchConsoleForStrictMode: backend_console["e" /* unpatchForStrictMode */],
- updateComponentFilters: updateComponentFilters
- };
- }
- /***/ }),
- /* 15 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ describeFiber; });
- __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ getStackByFiberInDevAndProd; });
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/ReactSymbols.js
- var ReactSymbols = __webpack_require__(3);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsConsolePatching.js
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // This is a DevTools fork of shared/ConsolePatchingDev.
- // The shared console patching code is DEV-only.
- // We can't use it since DevTools only ships production builds.
- // Helpers to patch console.logs to avoid logging during side-effect free
- // replaying on render function. This currently only patches the object
- // lazily which won't cover if the log function was extracted eagerly.
- // We could also eagerly patch the method.
- var disabledDepth = 0;
- var prevLog;
- var prevInfo;
- var prevWarn;
- var prevError;
- var prevGroup;
- var prevGroupCollapsed;
- var prevGroupEnd;
- function disabledLog() {}
- disabledLog.__reactDisabledLog = true;
- function disableLogs() {
- if (disabledDepth === 0) {
- /* eslint-disable react-internal/no-production-logging */
- prevLog = console.log;
- prevInfo = console.info;
- prevWarn = console.warn;
- prevError = console.error;
- prevGroup = console.group;
- prevGroupCollapsed = console.groupCollapsed;
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
- var props = {
- configurable: true,
- enumerable: true,
- value: disabledLog,
- writable: true
- }; // $FlowFixMe Flow thinks console is immutable.
- Object.defineProperties(console, {
- info: props,
- log: props,
- warn: props,
- error: props,
- group: props,
- groupCollapsed: props,
- groupEnd: props
- });
- /* eslint-enable react-internal/no-production-logging */
- }
- disabledDepth++;
- }
- function reenableLogs() {
- disabledDepth--;
- if (disabledDepth === 0) {
- /* eslint-disable react-internal/no-production-logging */
- var props = {
- configurable: true,
- enumerable: true,
- writable: true
- }; // $FlowFixMe Flow thinks console is immutable.
- Object.defineProperties(console, {
- log: _objectSpread(_objectSpread({}, props), {}, {
- value: prevLog
- }),
- info: _objectSpread(_objectSpread({}, props), {}, {
- value: prevInfo
- }),
- warn: _objectSpread(_objectSpread({}, props), {}, {
- value: prevWarn
- }),
- error: _objectSpread(_objectSpread({}, props), {}, {
- value: prevError
- }),
- group: _objectSpread(_objectSpread({}, props), {}, {
- value: prevGroup
- }),
- groupCollapsed: _objectSpread(_objectSpread({}, props), {}, {
- value: prevGroupCollapsed
- }),
- groupEnd: _objectSpread(_objectSpread({}, props), {}, {
- value: prevGroupEnd
- })
- });
- /* eslint-enable react-internal/no-production-logging */
- }
- if (disabledDepth < 0) {
- console.error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
- }
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsComponentStackFrame.js
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // This is a DevTools fork of ReactComponentStackFrame.
- // This fork enables DevTools to use the same "native" component stack format,
- // while still maintaining support for multiple renderer versions
- // (which use different values for ReactTypeOfWork).
- // The shared console patching code is DEV-only.
- // We can't use it since DevTools only ships production builds.
- var prefix;
- function describeBuiltInComponentFrame(name, ownerFn) {
- if (prefix === undefined) {
- // Extract the VM specific prefix used by each line.
- try {
- throw Error();
- } catch (x) {
- var match = x.stack.trim().match(/\n( *(at )?)/);
- prefix = match && match[1] || '';
- }
- } // We use the prefix to ensure our stacks line up with native stack frames.
- return '\n' + prefix + name;
- }
- var reentry = false;
- var componentFrameCache;
- if (false) { var PossiblyWeakMap; }
- function describeNativeComponentFrame(fn, construct, currentDispatcherRef) {
- // If something asked for a stack inside a fake render, it should get ignored.
- if (!fn || reentry) {
- return '';
- }
- if (false) { var frame; }
- var control;
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
- Error.prepareStackTrace = undefined;
- reentry = true; // Override the dispatcher so effects scheduled by this shallow render are thrown away.
- //
- // Note that unlike the code this was forked from (in ReactComponentStackFrame)
- // DevTools should override the dispatcher even when DevTools is compiled in production mode,
- // because the app itself may be in development mode and log errors/warnings.
- var previousDispatcher = currentDispatcherRef.current;
- currentDispatcherRef.current = null;
- disableLogs();
- try {
- // This should throw.
- if (construct) {
- // Something should be setting the props in the constructor.
- var Fake = function Fake() {
- throw Error();
- }; // $FlowFixMe
- Object.defineProperty(Fake.prototype, 'props', {
- set: function set() {
- // We use a throwing setter instead of frozen or non-writable props
- // because that won't throw in a non-strict mode function.
- throw Error();
- }
- });
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === 'object' && Reflect.construct) {
- // We construct a different control for this case to include any extra
- // frames added by the construct call.
- try {
- Reflect.construct(Fake, []);
- } catch (x) {
- control = x;
- }
- Reflect.construct(fn, [], Fake);
- } else {
- try {
- Fake.call();
- } catch (x) {
- control = x;
- } // $FlowFixMe[prop-missing] found when upgrading Flow
- fn.call(Fake.prototype);
- }
- } else {
- try {
- throw Error();
- } catch (x) {
- control = x;
- }
- fn();
- }
- } catch (sample) {
- // This is inlined manually because closure doesn't do it for us.
- if (sample && control && typeof sample.stack === 'string') {
- // This extracts the first frame from the sample that isn't also in the control.
- // Skipping one frame that we assume is the frame that calls the two.
- var sampleLines = sample.stack.split('\n');
- var controlLines = control.stack.split('\n');
- var s = sampleLines.length - 1;
- var c = controlLines.length - 1;
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
- // We expect at least one stack frame to be shared.
- // Typically this will be the root most one. However, stack frames may be
- // cut off due to maximum stack limits. In this case, one maybe cut off
- // earlier than the other. We assume that the sample is longer or the same
- // and there for cut off earlier. So we should find the root most frame in
- // the sample somewhere in the control.
- c--;
- }
- for (; s >= 1 && c >= 0; s--, c--) {
- // Next we find the first one that isn't the same which should be the
- // frame that called our sample function and the control.
- if (sampleLines[s] !== controlLines[c]) {
- // In V8, the first line is describing the message but other VMs don't.
- // If we're about to return the first line, and the control is also on the same
- // line, that's a pretty good indicator that our sample threw at same line as
- // the control. I.e. before we entered the sample frame. So we ignore this result.
- // This can happen if you passed a class to function component, or non-function.
- if (s !== 1 || c !== 1) {
- do {
- s--;
- c--; // We may still have similar intermediate frames from the construct call.
- // The next one that isn't the same should be our match though.
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
- if (false) {} // Return the line we found.
- return _frame;
- }
- } while (s >= 1 && c >= 0);
- }
- break;
- }
- }
- }
- } finally {
- reentry = false;
- Error.prepareStackTrace = previousPrepareStackTrace;
- currentDispatcherRef.current = previousDispatcher;
- reenableLogs();
- } // Fallback to just using the name if we couldn't make it throw.
- var name = fn ? fn.displayName || fn.name : '';
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
- if (false) {}
- return syntheticFrame;
- }
- function describeClassComponentFrame(ctor, ownerFn, currentDispatcherRef) {
- return describeNativeComponentFrame(ctor, true, currentDispatcherRef);
- }
- function describeFunctionComponentFrame(fn, ownerFn, currentDispatcherRef) {
- return describeNativeComponentFrame(fn, false, currentDispatcherRef);
- }
- function shouldConstruct(Component) {
- var prototype = Component.prototype;
- return !!(prototype && prototype.isReactComponent);
- }
- function describeUnknownElementTypeFrameInDEV(type, ownerFn, currentDispatcherRef) {
- if (true) {
- return '';
- }
- if (type == null) {
- return '';
- }
- if (typeof type === 'function') {
- return describeNativeComponentFrame(type, shouldConstruct(type), currentDispatcherRef);
- }
- if (typeof type === 'string') {
- return describeBuiltInComponentFrame(type, ownerFn);
- }
- switch (type) {
- case ReactSymbols["w" /* SUSPENSE_NUMBER */]:
- case ReactSymbols["x" /* SUSPENSE_SYMBOL_STRING */]:
- return describeBuiltInComponentFrame('Suspense', ownerFn);
- case ReactSymbols["u" /* SUSPENSE_LIST_NUMBER */]:
- case ReactSymbols["v" /* SUSPENSE_LIST_SYMBOL_STRING */]:
- return describeBuiltInComponentFrame('SuspenseList', ownerFn);
- }
- if (_typeof(type) === 'object') {
- switch (type.$$typeof) {
- case ReactSymbols["f" /* FORWARD_REF_NUMBER */]:
- case ReactSymbols["g" /* FORWARD_REF_SYMBOL_STRING */]:
- return describeFunctionComponentFrame(type.render, ownerFn, currentDispatcherRef);
- case ReactSymbols["j" /* MEMO_NUMBER */]:
- case ReactSymbols["k" /* MEMO_SYMBOL_STRING */]:
- // Memo may contain any component type so we recursively resolve it.
- return describeUnknownElementTypeFrameInDEV(type.type, ownerFn, currentDispatcherRef);
- case ReactSymbols["h" /* LAZY_NUMBER */]:
- case ReactSymbols["i" /* LAZY_SYMBOL_STRING */]:
- {
- var lazyComponent = type;
- var payload = lazyComponent._payload;
- var init = lazyComponent._init;
- try {
- // Lazy may contain any component type so we recursively resolve it.
- return describeUnknownElementTypeFrameInDEV(init(payload), ownerFn, currentDispatcherRef);
- } catch (x) {}
- }
- }
- }
- return '';
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsFiberComponentStack.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // This is a DevTools fork of ReactFiberComponentStack.
- // This fork enables DevTools to use the same "native" component stack format,
- // while still maintaining support for multiple renderer versions
- // (which use different values for ReactTypeOfWork).
- function describeFiber(workTagMap, workInProgress, currentDispatcherRef) {
- var HostComponent = workTagMap.HostComponent,
- LazyComponent = workTagMap.LazyComponent,
- SuspenseComponent = workTagMap.SuspenseComponent,
- SuspenseListComponent = workTagMap.SuspenseListComponent,
- FunctionComponent = workTagMap.FunctionComponent,
- IndeterminateComponent = workTagMap.IndeterminateComponent,
- SimpleMemoComponent = workTagMap.SimpleMemoComponent,
- ForwardRef = workTagMap.ForwardRef,
- ClassComponent = workTagMap.ClassComponent;
- var owner = false ? undefined : null;
- switch (workInProgress.tag) {
- case HostComponent:
- return describeBuiltInComponentFrame(workInProgress.type, owner);
- case LazyComponent:
- return describeBuiltInComponentFrame('Lazy', owner);
- case SuspenseComponent:
- return describeBuiltInComponentFrame('Suspense', owner);
- case SuspenseListComponent:
- return describeBuiltInComponentFrame('SuspenseList', owner);
- case FunctionComponent:
- case IndeterminateComponent:
- case SimpleMemoComponent:
- return describeFunctionComponentFrame(workInProgress.type, owner, currentDispatcherRef);
- case ForwardRef:
- return describeFunctionComponentFrame(workInProgress.type.render, owner, currentDispatcherRef);
- case ClassComponent:
- return describeClassComponentFrame(workInProgress.type, owner, currentDispatcherRef);
- default:
- return '';
- }
- }
- function getStackByFiberInDevAndProd(workTagMap, workInProgress, currentDispatcherRef) {
- try {
- var info = '';
- var node = workInProgress;
- do {
- info += describeFiber(workTagMap, node, currentDispatcherRef); // $FlowFixMe[incompatible-type] we bail out when we get a null
- node = node.return;
- } while (node);
- return info;
- } catch (x) {
- return '\nError generating stack: ' + x.message + '\n' + x.stack;
- }
- }
- /***/ }),
- /* 16 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export REACT_ELEMENT_TYPE */
- /* unused harmony export REACT_PORTAL_TYPE */
- /* unused harmony export REACT_FRAGMENT_TYPE */
- /* unused harmony export REACT_STRICT_MODE_TYPE */
- /* unused harmony export REACT_PROFILER_TYPE */
- /* unused harmony export REACT_PROVIDER_TYPE */
- /* unused harmony export REACT_CONTEXT_TYPE */
- /* unused harmony export REACT_SERVER_CONTEXT_TYPE */
- /* unused harmony export REACT_FORWARD_REF_TYPE */
- /* unused harmony export REACT_SUSPENSE_TYPE */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return REACT_SUSPENSE_LIST_TYPE; });
- /* unused harmony export REACT_MEMO_TYPE */
- /* unused harmony export REACT_LAZY_TYPE */
- /* unused harmony export REACT_SCOPE_TYPE */
- /* unused harmony export REACT_DEBUG_TRACING_MODE_TYPE */
- /* unused harmony export REACT_OFFSCREEN_TYPE */
- /* unused harmony export REACT_LEGACY_HIDDEN_TYPE */
- /* unused harmony export REACT_CACHE_TYPE */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return REACT_TRACING_MARKER_TYPE; });
- /* unused harmony export REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED */
- /* unused harmony export REACT_MEMO_CACHE_SENTINEL */
- /* unused harmony export getIteratorFn */
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // ATTENTION
- // When adding new symbols to this file,
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
- // The Symbol used to tag the ReactElement-like types.
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
- var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
- var REACT_SCOPE_TYPE = Symbol.for('react.scope');
- var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode');
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
- var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden');
- var REACT_CACHE_TYPE = Symbol.for('react.cache');
- var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker');
- var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
- var REACT_MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel');
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
- function getIteratorFn(maybeIterable) {
- if (maybeIterable === null || _typeof(maybeIterable) !== 'object') {
- return null;
- }
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
- if (typeof maybeIterator === 'function') {
- return maybeIterator;
- }
- return null;
- }
- /***/ }),
- /* 17 */
- /***/ (function(module, exports) {
- // shim for using process in browser
- var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
- // don't break things. But we need to wrap it in a try catch in case it is
- // wrapped in strict mode code which doesn't define any globals. It's inside a
- // function because try/catches deoptimize in certain engines.
- var cachedSetTimeout;
- var cachedClearTimeout;
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout() {
- throw new Error('clearTimeout has not been defined');
- }
- (function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
- })();
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- } // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- } // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue.length;
- while (len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- }; // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
- function noop() {}
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
- process.prependListener = noop;
- process.prependOnceListener = noop;
- process.listeners = function (name) {
- return [];
- };
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
- process.cwd = function () {
- return '/';
- };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function () {
- return 0;
- };
- /***/ }),
- /* 18 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(setImmediate) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Import support https://stackoverflow.com/questions/13673346/supporting-both-commonjs-and-amd
- (function (name, definition) {
- if (true) {
- module.exports = definition();
- } else {}
- })("clipboard", function () {
- if (typeof document === 'undefined' || !document.addEventListener) {
- return null;
- }
- var clipboard = {};
- clipboard.copy = function () {
- var _intercept = false;
- var _data = null; // Map from data type (e.g. "text/html") to value.
- var _bogusSelection = false;
- function cleanup() {
- _intercept = false;
- _data = null;
- if (_bogusSelection) {
- window.getSelection().removeAllRanges();
- }
- _bogusSelection = false;
- }
- document.addEventListener("copy", function (e) {
- if (_intercept) {
- for (var key in _data) {
- e.clipboardData.setData(key, _data[key]);
- }
- e.preventDefault();
- }
- }); // Workaround for Safari: https://bugs.webkit.org/show_bug.cgi?id=156529
- function bogusSelect() {
- var sel = document.getSelection(); // If "nothing" is selected...
- if (!document.queryCommandEnabled("copy") && sel.isCollapsed) {
- // ... temporarily select the entire body.
- //
- // We select the entire body because:
- // - it's guaranteed to exist,
- // - it works (unlike, say, document.head, or phantom element that is
- // not inserted into the DOM),
- // - it doesn't seem to flicker (due to the synchronous copy event), and
- // - it avoids modifying the DOM (can trigger mutation observers).
- //
- // Because we can't do proper feature detection (we already checked
- // document.queryCommandEnabled("copy") , which actually gives a false
- // negative for Blink when nothing is selected) and UA sniffing is not
- // reliable (a lot of UA strings contain "Safari"), this will also
- // happen for some browsers other than Safari. :-()
- var range = document.createRange();
- range.selectNodeContents(document.body);
- sel.removeAllRanges();
- sel.addRange(range);
- _bogusSelection = true;
- }
- }
- ;
- return function (data) {
- return new Promise(function (resolve, reject) {
- _intercept = true;
- if (typeof data === "string") {
- _data = {
- "text/plain": data
- };
- } else if (data instanceof Node) {
- _data = {
- "text/html": new XMLSerializer().serializeToString(data)
- };
- } else if (data instanceof Object) {
- _data = data;
- } else {
- reject("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings.");
- }
- function triggerCopy(tryBogusSelect) {
- try {
- if (document.execCommand("copy")) {
- // document.execCommand is synchronous: http://www.w3.org/TR/2015/WD-clipboard-apis-20150421/#integration-with-rich-text-editing-apis
- // So we can call resolve() back here.
- cleanup();
- resolve();
- } else {
- if (!tryBogusSelect) {
- bogusSelect();
- triggerCopy(true);
- } else {
- cleanup();
- throw new Error("Unable to copy. Perhaps it's not available in your browser?");
- }
- }
- } catch (e) {
- cleanup();
- reject(e);
- }
- }
- triggerCopy(false);
- });
- };
- }();
- clipboard.paste = function () {
- var _intercept = false;
- var _resolve;
- var _dataType;
- document.addEventListener("paste", function (e) {
- if (_intercept) {
- _intercept = false;
- e.preventDefault();
- var resolve = _resolve;
- _resolve = null;
- resolve(e.clipboardData.getData(_dataType));
- }
- });
- return function (dataType) {
- return new Promise(function (resolve, reject) {
- _intercept = true;
- _resolve = resolve;
- _dataType = dataType || "text/plain";
- try {
- if (!document.execCommand("paste")) {
- _intercept = false;
- reject(new Error("Unable to paste. Pasting only works in Internet Explorer at the moment."));
- }
- } catch (e) {
- _intercept = false;
- reject(new Error(e));
- }
- });
- };
- }(); // Handle IE behaviour.
- if (typeof ClipboardEvent === "undefined" && typeof window.clipboardData !== "undefined" && typeof window.clipboardData.setData !== "undefined") {
- /*! promise-polyfill 2.0.1 */
- (function (a) {
- function b(a, b) {
- return function () {
- a.apply(b, arguments);
- };
- }
- function c(a) {
- if ("object" != _typeof(this)) throw new TypeError("Promises must be constructed via new");
- if ("function" != typeof a) throw new TypeError("not a function");
- this._state = null, this._value = null, this._deferreds = [], i(a, b(e, this), b(f, this));
- }
- function d(a) {
- var b = this;
- return null === this._state ? void this._deferreds.push(a) : void j(function () {
- var c = b._state ? a.onFulfilled : a.onRejected;
- if (null === c) return void (b._state ? a.resolve : a.reject)(b._value);
- var d;
- try {
- d = c(b._value);
- } catch (e) {
- return void a.reject(e);
- }
- a.resolve(d);
- });
- }
- function e(a) {
- try {
- if (a === this) throw new TypeError("A promise cannot be resolved with itself.");
- if (a && ("object" == _typeof(a) || "function" == typeof a)) {
- var c = a.then;
- if ("function" == typeof c) return void i(b(c, a), b(e, this), b(f, this));
- }
- this._state = !0, this._value = a, g.call(this);
- } catch (d) {
- f.call(this, d);
- }
- }
- function f(a) {
- this._state = !1, this._value = a, g.call(this);
- }
- function g() {
- for (var a = 0, b = this._deferreds.length; b > a; a++) {
- d.call(this, this._deferreds[a]);
- }
- this._deferreds = null;
- }
- function h(a, b, c, d) {
- this.onFulfilled = "function" == typeof a ? a : null, this.onRejected = "function" == typeof b ? b : null, this.resolve = c, this.reject = d;
- }
- function i(a, b, c) {
- var d = !1;
- try {
- a(function (a) {
- d || (d = !0, b(a));
- }, function (a) {
- d || (d = !0, c(a));
- });
- } catch (e) {
- if (d) return;
- d = !0, c(e);
- }
- }
- var j = c.immediateFn || "function" == typeof setImmediate && setImmediate || function (a) {
- setTimeout(a, 1);
- },
- k = Array.isArray || function (a) {
- return "[object Array]" === Object.prototype.toString.call(a);
- };
- c.prototype["catch"] = function (a) {
- return this.then(null, a);
- }, c.prototype.then = function (a, b) {
- var e = this;
- return new c(function (c, f) {
- d.call(e, new h(a, b, c, f));
- });
- }, c.all = function () {
- var a = Array.prototype.slice.call(1 === arguments.length && k(arguments[0]) ? arguments[0] : arguments);
- return new c(function (b, c) {
- function d(f, g) {
- try {
- if (g && ("object" == _typeof(g) || "function" == typeof g)) {
- var h = g.then;
- if ("function" == typeof h) return void h.call(g, function (a) {
- d(f, a);
- }, c);
- }
- a[f] = g, 0 === --e && b(a);
- } catch (i) {
- c(i);
- }
- }
- if (0 === a.length) return b([]);
- for (var e = a.length, f = 0; f < a.length; f++) {
- d(f, a[f]);
- }
- });
- }, c.resolve = function (a) {
- return a && "object" == _typeof(a) && a.constructor === c ? a : new c(function (b) {
- b(a);
- });
- }, c.reject = function (a) {
- return new c(function (b, c) {
- c(a);
- });
- }, c.race = function (a) {
- return new c(function (b, c) {
- for (var d = 0, e = a.length; e > d; d++) {
- a[d].then(b, c);
- }
- });
- }, true && module.exports ? module.exports = c : a.Promise || (a.Promise = c);
- })(this);
- clipboard.copy = function (data) {
- return new Promise(function (resolve, reject) {
- // IE supports string and URL types: https://msdn.microsoft.com/en-us/library/ms536744(v=vs.85).aspx
- // We only support the string type for now.
- if (typeof data !== "string" && !("text/plain" in data)) {
- throw new Error("You must provide a text/plain type.");
- }
- var strData = typeof data === "string" ? data : data["text/plain"];
- var copySucceeded = window.clipboardData.setData("Text", strData);
- if (copySucceeded) {
- resolve();
- } else {
- reject(new Error("Copying was rejected."));
- }
- });
- };
- clipboard.paste = function () {
- return new Promise(function (resolve, reject) {
- var strData = window.clipboardData.getData("Text");
- if (strData) {
- resolve(strData);
- } else {
- // The user rejected the paste request.
- reject(new Error("Pasting was rejected."));
- }
- });
- };
- }
- return clipboard;
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(21).setImmediate))
- /***/ }),
- /* 19 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // A linked list to keep track of recently-used-ness
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- var Yallist = __webpack_require__(23);
- var MAX = Symbol('max');
- var LENGTH = Symbol('length');
- var LENGTH_CALCULATOR = Symbol('lengthCalculator');
- var ALLOW_STALE = Symbol('allowStale');
- var MAX_AGE = Symbol('maxAge');
- var DISPOSE = Symbol('dispose');
- var NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
- var LRU_LIST = Symbol('lruList');
- var CACHE = Symbol('cache');
- var UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
- var naiveLength = function naiveLength() {
- return 1;
- }; // lruList is a yallist where the head is the youngest
- // item, and the tail is the oldest. the list contains the Hit
- // objects as the entries.
- // Each Hit object has a reference to its Yallist.Node. This
- // never changes.
- //
- // cache is a Map (or PseudoMap) that matches the keys to
- // the Yallist.Node object.
- var LRUCache = /*#__PURE__*/function () {
- function LRUCache(options) {
- _classCallCheck(this, LRUCache);
- if (typeof options === 'number') options = {
- max: options
- };
- if (!options) options = {};
- if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number'); // Kind of weird to have a default max of Infinity, but oh well.
- var max = this[MAX] = options.max || Infinity;
- var lc = options.length || naiveLength;
- this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;
- this[ALLOW_STALE] = options.stale || false;
- if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');
- this[MAX_AGE] = options.maxAge || 0;
- this[DISPOSE] = options.dispose;
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
- this.reset();
- } // resize the cache when the max changes.
- _createClass(LRUCache, [{
- key: "rforEach",
- value: function rforEach(fn, thisp) {
- thisp = thisp || this;
- for (var walker = this[LRU_LIST].tail; walker !== null;) {
- var prev = walker.prev;
- forEachStep(this, fn, walker, thisp);
- walker = prev;
- }
- }
- }, {
- key: "forEach",
- value: function forEach(fn, thisp) {
- thisp = thisp || this;
- for (var walker = this[LRU_LIST].head; walker !== null;) {
- var next = walker.next;
- forEachStep(this, fn, walker, thisp);
- walker = next;
- }
- }
- }, {
- key: "keys",
- value: function keys() {
- return this[LRU_LIST].toArray().map(function (k) {
- return k.key;
- });
- }
- }, {
- key: "values",
- value: function values() {
- return this[LRU_LIST].toArray().map(function (k) {
- return k.value;
- });
- }
- }, {
- key: "reset",
- value: function reset() {
- var _this = this;
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
- this[LRU_LIST].forEach(function (hit) {
- return _this[DISPOSE](hit.key, hit.value);
- });
- }
- this[CACHE] = new Map(); // hash of items by key
- this[LRU_LIST] = new Yallist(); // list of items in order of use recency
- this[LENGTH] = 0; // length of items in the list
- }
- }, {
- key: "dump",
- value: function dump() {
- var _this2 = this;
- return this[LRU_LIST].map(function (hit) {
- return isStale(_this2, hit) ? false : {
- k: hit.key,
- v: hit.value,
- e: hit.now + (hit.maxAge || 0)
- };
- }).toArray().filter(function (h) {
- return h;
- });
- }
- }, {
- key: "dumpLru",
- value: function dumpLru() {
- return this[LRU_LIST];
- }
- }, {
- key: "set",
- value: function set(key, value, maxAge) {
- maxAge = maxAge || this[MAX_AGE];
- if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');
- var now = maxAge ? Date.now() : 0;
- var len = this[LENGTH_CALCULATOR](value, key);
- if (this[CACHE].has(key)) {
- if (len > this[MAX]) {
- _del(this, this[CACHE].get(key));
- return false;
- }
- var node = this[CACHE].get(key);
- var item = node.value; // dispose of the old one before overwriting
- // split out into 2 ifs for better coverage tracking
- if (this[DISPOSE]) {
- if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);
- }
- item.now = now;
- item.maxAge = maxAge;
- item.value = value;
- this[LENGTH] += len - item.length;
- item.length = len;
- this.get(key);
- trim(this);
- return true;
- }
- var hit = new Entry(key, value, len, now, maxAge); // oversized objects fall out of cache automatically.
- if (hit.length > this[MAX]) {
- if (this[DISPOSE]) this[DISPOSE](key, value);
- return false;
- }
- this[LENGTH] += hit.length;
- this[LRU_LIST].unshift(hit);
- this[CACHE].set(key, this[LRU_LIST].head);
- trim(this);
- return true;
- }
- }, {
- key: "has",
- value: function has(key) {
- if (!this[CACHE].has(key)) return false;
- var hit = this[CACHE].get(key).value;
- return !isStale(this, hit);
- }
- }, {
- key: "get",
- value: function get(key) {
- return _get(this, key, true);
- }
- }, {
- key: "peek",
- value: function peek(key) {
- return _get(this, key, false);
- }
- }, {
- key: "pop",
- value: function pop() {
- var node = this[LRU_LIST].tail;
- if (!node) return null;
- _del(this, node);
- return node.value;
- }
- }, {
- key: "del",
- value: function del(key) {
- _del(this, this[CACHE].get(key));
- }
- }, {
- key: "load",
- value: function load(arr) {
- // reset the cache
- this.reset();
- var now = Date.now(); // A previous serialized cache has the most recent items first
- for (var l = arr.length - 1; l >= 0; l--) {
- var hit = arr[l];
- var expiresAt = hit.e || 0;
- if (expiresAt === 0) // the item was created without expiration in a non aged cache
- this.set(hit.k, hit.v);else {
- var maxAge = expiresAt - now; // dont add already expired items
- if (maxAge > 0) {
- this.set(hit.k, hit.v, maxAge);
- }
- }
- }
- }
- }, {
- key: "prune",
- value: function prune() {
- var _this3 = this;
- this[CACHE].forEach(function (value, key) {
- return _get(_this3, key, false);
- });
- }
- }, {
- key: "max",
- set: function set(mL) {
- if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');
- this[MAX] = mL || Infinity;
- trim(this);
- },
- get: function get() {
- return this[MAX];
- }
- }, {
- key: "allowStale",
- set: function set(allowStale) {
- this[ALLOW_STALE] = !!allowStale;
- },
- get: function get() {
- return this[ALLOW_STALE];
- }
- }, {
- key: "maxAge",
- set: function set(mA) {
- if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');
- this[MAX_AGE] = mA;
- trim(this);
- },
- get: function get() {
- return this[MAX_AGE];
- } // resize the cache when the lengthCalculator changes.
- }, {
- key: "lengthCalculator",
- set: function set(lC) {
- var _this4 = this;
- if (typeof lC !== 'function') lC = naiveLength;
- if (lC !== this[LENGTH_CALCULATOR]) {
- this[LENGTH_CALCULATOR] = lC;
- this[LENGTH] = 0;
- this[LRU_LIST].forEach(function (hit) {
- hit.length = _this4[LENGTH_CALCULATOR](hit.value, hit.key);
- _this4[LENGTH] += hit.length;
- });
- }
- trim(this);
- },
- get: function get() {
- return this[LENGTH_CALCULATOR];
- }
- }, {
- key: "length",
- get: function get() {
- return this[LENGTH];
- }
- }, {
- key: "itemCount",
- get: function get() {
- return this[LRU_LIST].length;
- }
- }]);
- return LRUCache;
- }();
- var _get = function _get(self, key, doUse) {
- var node = self[CACHE].get(key);
- if (node) {
- var hit = node.value;
- if (isStale(self, hit)) {
- _del(self, node);
- if (!self[ALLOW_STALE]) return undefined;
- } else {
- if (doUse) {
- if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();
- self[LRU_LIST].unshiftNode(node);
- }
- }
- return hit.value;
- }
- };
- var isStale = function isStale(self, hit) {
- if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;
- var diff = Date.now() - hit.now;
- return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
- };
- var trim = function trim(self) {
- if (self[LENGTH] > self[MAX]) {
- for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {
- // We know that we're about to delete this one, and also
- // what the next least recently used key will be, so just
- // go ahead and set it now.
- var prev = walker.prev;
- _del(self, walker);
- walker = prev;
- }
- }
- };
- var _del = function _del(self, node) {
- if (node) {
- var hit = node.value;
- if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);
- self[LENGTH] -= hit.length;
- self[CACHE].delete(hit.key);
- self[LRU_LIST].removeNode(node);
- }
- };
- var Entry = function Entry(key, value, length, now, maxAge) {
- _classCallCheck(this, Entry);
- this.key = key;
- this.value = value;
- this.length = length;
- this.now = now;
- this.maxAge = maxAge || 0;
- };
- var forEachStep = function forEachStep(self, fn, node, thisp) {
- var hit = node.value;
- if (isStale(self, hit)) {
- _del(self, node);
- if (!self[ALLOW_STALE]) hit = undefined;
- }
- if (hit) fn.call(thisp, hit.value, hit.key, self);
- };
- module.exports = LRUCache;
- /***/ }),
- /* 20 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- if (true) {
- module.exports = __webpack_require__(26);
- } else {}
- /***/ }),
- /* 21 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {var scope = typeof global !== "undefined" && global || typeof self !== "undefined" && self || window;
- var apply = Function.prototype.apply; // DOM APIs, for completeness
- exports.setTimeout = function () {
- return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
- };
- exports.setInterval = function () {
- return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
- };
- exports.clearTimeout = exports.clearInterval = function (timeout) {
- if (timeout) {
- timeout.close();
- }
- };
- function Timeout(id, clearFn) {
- this._id = id;
- this._clearFn = clearFn;
- }
- Timeout.prototype.unref = Timeout.prototype.ref = function () {};
- Timeout.prototype.close = function () {
- this._clearFn.call(scope, this._id);
- }; // Does not start the time, just sets up the members needed.
- exports.enroll = function (item, msecs) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = msecs;
- };
- exports.unenroll = function (item) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = -1;
- };
- exports._unrefActive = exports.active = function (item) {
- clearTimeout(item._idleTimeoutId);
- var msecs = item._idleTimeout;
- if (msecs >= 0) {
- item._idleTimeoutId = setTimeout(function onTimeout() {
- if (item._onTimeout) item._onTimeout();
- }, msecs);
- }
- }; // setimmediate attaches itself to the global object
- __webpack_require__(22); // On some exotic environments, it's not clear which object `setimmediate` was
- // able to install onto. Search each possibility in the same order as the
- // `setimmediate` library.
- exports.setImmediate = typeof self !== "undefined" && self.setImmediate || typeof global !== "undefined" && global.setImmediate || this && this.setImmediate;
- exports.clearImmediate = typeof self !== "undefined" && self.clearImmediate || typeof global !== "undefined" && global.clearImmediate || this && this.clearImmediate;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))
- /***/ }),
- /* 22 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
- "use strict";
- if (global.setImmediate) {
- return;
- }
- var nextHandle = 1; // Spec says greater than zero
- var tasksByHandle = {};
- var currentlyRunningATask = false;
- var doc = global.document;
- var registerImmediate;
- function setImmediate(callback) {
- // Callback can either be a function or a string
- if (typeof callback !== "function") {
- callback = new Function("" + callback);
- } // Copy function arguments
- var args = new Array(arguments.length - 1);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i + 1];
- } // Store and register the task
- var task = {
- callback: callback,
- args: args
- };
- tasksByHandle[nextHandle] = task;
- registerImmediate(nextHandle);
- return nextHandle++;
- }
- function clearImmediate(handle) {
- delete tasksByHandle[handle];
- }
- function run(task) {
- var callback = task.callback;
- var args = task.args;
- switch (args.length) {
- case 0:
- callback();
- break;
- case 1:
- callback(args[0]);
- break;
- case 2:
- callback(args[0], args[1]);
- break;
- case 3:
- callback(args[0], args[1], args[2]);
- break;
- default:
- callback.apply(undefined, args);
- break;
- }
- }
- function runIfPresent(handle) {
- // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
- // So if we're currently running a task, we'll need to delay this invocation.
- if (currentlyRunningATask) {
- // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
- // "too much recursion" error.
- setTimeout(runIfPresent, 0, handle);
- } else {
- var task = tasksByHandle[handle];
- if (task) {
- currentlyRunningATask = true;
- try {
- run(task);
- } finally {
- clearImmediate(handle);
- currentlyRunningATask = false;
- }
- }
- }
- }
- function installNextTickImplementation() {
- registerImmediate = function registerImmediate(handle) {
- process.nextTick(function () {
- runIfPresent(handle);
- });
- };
- }
- function canUsePostMessage() {
- // The test against `importScripts` prevents this implementation from being installed inside a web worker,
- // where `global.postMessage` means something completely different and can't be used for this purpose.
- if (global.postMessage && !global.importScripts) {
- var postMessageIsAsynchronous = true;
- var oldOnMessage = global.onmessage;
- global.onmessage = function () {
- postMessageIsAsynchronous = false;
- };
- global.postMessage("", "*");
- global.onmessage = oldOnMessage;
- return postMessageIsAsynchronous;
- }
- }
- function installPostMessageImplementation() {
- // Installs an event handler on `global` for the `message` event: see
- // * https://developer.mozilla.org/en/DOM/window.postMessage
- // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
- var messagePrefix = "setImmediate$" + Math.random() + "$";
- var onGlobalMessage = function onGlobalMessage(event) {
- if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
- runIfPresent(+event.data.slice(messagePrefix.length));
- }
- };
- if (global.addEventListener) {
- global.addEventListener("message", onGlobalMessage, false);
- } else {
- global.attachEvent("onmessage", onGlobalMessage);
- }
- registerImmediate = function registerImmediate(handle) {
- global.postMessage(messagePrefix + handle, "*");
- };
- }
- function installMessageChannelImplementation() {
- var channel = new MessageChannel();
- channel.port1.onmessage = function (event) {
- var handle = event.data;
- runIfPresent(handle);
- };
- registerImmediate = function registerImmediate(handle) {
- channel.port2.postMessage(handle);
- };
- }
- function installReadyStateChangeImplementation() {
- var html = doc.documentElement;
- registerImmediate = function registerImmediate(handle) {
- // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
- // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
- var script = doc.createElement("script");
- script.onreadystatechange = function () {
- runIfPresent(handle);
- script.onreadystatechange = null;
- html.removeChild(script);
- script = null;
- };
- html.appendChild(script);
- };
- }
- function installSetTimeoutImplementation() {
- registerImmediate = function registerImmediate(handle) {
- setTimeout(runIfPresent, 0, handle);
- };
- } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
- var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
- attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments.
- if ({}.toString.call(global.process) === "[object process]") {
- // For Node.js before 0.9
- installNextTickImplementation();
- } else if (canUsePostMessage()) {
- // For non-IE10 modern browsers
- installPostMessageImplementation();
- } else if (global.MessageChannel) {
- // For web workers, where supported
- installMessageChannelImplementation();
- } else if (doc && "onreadystatechange" in doc.createElement("script")) {
- // For IE 6–8
- installReadyStateChangeImplementation();
- } else {
- // For older browsers
- installSetTimeoutImplementation();
- }
- attachTo.setImmediate = setImmediate;
- attachTo.clearImmediate = clearImmediate;
- })(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self);
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12), __webpack_require__(17)))
- /***/ }),
- /* 23 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = Yallist;
- Yallist.Node = Node;
- Yallist.create = Yallist;
- function Yallist(list) {
- var self = this;
- if (!(self instanceof Yallist)) {
- self = new Yallist();
- }
- self.tail = null;
- self.head = null;
- self.length = 0;
- if (list && typeof list.forEach === 'function') {
- list.forEach(function (item) {
- self.push(item);
- });
- } else if (arguments.length > 0) {
- for (var i = 0, l = arguments.length; i < l; i++) {
- self.push(arguments[i]);
- }
- }
- return self;
- }
- Yallist.prototype.removeNode = function (node) {
- if (node.list !== this) {
- throw new Error('removing node which does not belong to this list');
- }
- var next = node.next;
- var prev = node.prev;
- if (next) {
- next.prev = prev;
- }
- if (prev) {
- prev.next = next;
- }
- if (node === this.head) {
- this.head = next;
- }
- if (node === this.tail) {
- this.tail = prev;
- }
- node.list.length--;
- node.next = null;
- node.prev = null;
- node.list = null;
- return next;
- };
- Yallist.prototype.unshiftNode = function (node) {
- if (node === this.head) {
- return;
- }
- if (node.list) {
- node.list.removeNode(node);
- }
- var head = this.head;
- node.list = this;
- node.next = head;
- if (head) {
- head.prev = node;
- }
- this.head = node;
- if (!this.tail) {
- this.tail = node;
- }
- this.length++;
- };
- Yallist.prototype.pushNode = function (node) {
- if (node === this.tail) {
- return;
- }
- if (node.list) {
- node.list.removeNode(node);
- }
- var tail = this.tail;
- node.list = this;
- node.prev = tail;
- if (tail) {
- tail.next = node;
- }
- this.tail = node;
- if (!this.head) {
- this.head = node;
- }
- this.length++;
- };
- Yallist.prototype.push = function () {
- for (var i = 0, l = arguments.length; i < l; i++) {
- push(this, arguments[i]);
- }
- return this.length;
- };
- Yallist.prototype.unshift = function () {
- for (var i = 0, l = arguments.length; i < l; i++) {
- unshift(this, arguments[i]);
- }
- return this.length;
- };
- Yallist.prototype.pop = function () {
- if (!this.tail) {
- return undefined;
- }
- var res = this.tail.value;
- this.tail = this.tail.prev;
- if (this.tail) {
- this.tail.next = null;
- } else {
- this.head = null;
- }
- this.length--;
- return res;
- };
- Yallist.prototype.shift = function () {
- if (!this.head) {
- return undefined;
- }
- var res = this.head.value;
- this.head = this.head.next;
- if (this.head) {
- this.head.prev = null;
- } else {
- this.tail = null;
- }
- this.length--;
- return res;
- };
- Yallist.prototype.forEach = function (fn, thisp) {
- thisp = thisp || this;
- for (var walker = this.head, i = 0; walker !== null; i++) {
- fn.call(thisp, walker.value, i, this);
- walker = walker.next;
- }
- };
- Yallist.prototype.forEachReverse = function (fn, thisp) {
- thisp = thisp || this;
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
- fn.call(thisp, walker.value, i, this);
- walker = walker.prev;
- }
- };
- Yallist.prototype.get = function (n) {
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
- // abort out of the list early if we hit a cycle
- walker = walker.next;
- }
- if (i === n && walker !== null) {
- return walker.value;
- }
- };
- Yallist.prototype.getReverse = function (n) {
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
- // abort out of the list early if we hit a cycle
- walker = walker.prev;
- }
- if (i === n && walker !== null) {
- return walker.value;
- }
- };
- Yallist.prototype.map = function (fn, thisp) {
- thisp = thisp || this;
- var res = new Yallist();
- for (var walker = this.head; walker !== null;) {
- res.push(fn.call(thisp, walker.value, this));
- walker = walker.next;
- }
- return res;
- };
- Yallist.prototype.mapReverse = function (fn, thisp) {
- thisp = thisp || this;
- var res = new Yallist();
- for (var walker = this.tail; walker !== null;) {
- res.push(fn.call(thisp, walker.value, this));
- walker = walker.prev;
- }
- return res;
- };
- Yallist.prototype.reduce = function (fn, initial) {
- var acc;
- var walker = this.head;
- if (arguments.length > 1) {
- acc = initial;
- } else if (this.head) {
- walker = this.head.next;
- acc = this.head.value;
- } else {
- throw new TypeError('Reduce of empty list with no initial value');
- }
- for (var i = 0; walker !== null; i++) {
- acc = fn(acc, walker.value, i);
- walker = walker.next;
- }
- return acc;
- };
- Yallist.prototype.reduceReverse = function (fn, initial) {
- var acc;
- var walker = this.tail;
- if (arguments.length > 1) {
- acc = initial;
- } else if (this.tail) {
- walker = this.tail.prev;
- acc = this.tail.value;
- } else {
- throw new TypeError('Reduce of empty list with no initial value');
- }
- for (var i = this.length - 1; walker !== null; i--) {
- acc = fn(acc, walker.value, i);
- walker = walker.prev;
- }
- return acc;
- };
- Yallist.prototype.toArray = function () {
- var arr = new Array(this.length);
- for (var i = 0, walker = this.head; walker !== null; i++) {
- arr[i] = walker.value;
- walker = walker.next;
- }
- return arr;
- };
- Yallist.prototype.toArrayReverse = function () {
- var arr = new Array(this.length);
- for (var i = 0, walker = this.tail; walker !== null; i++) {
- arr[i] = walker.value;
- walker = walker.prev;
- }
- return arr;
- };
- Yallist.prototype.slice = function (from, to) {
- to = to || this.length;
- if (to < 0) {
- to += this.length;
- }
- from = from || 0;
- if (from < 0) {
- from += this.length;
- }
- var ret = new Yallist();
- if (to < from || to < 0) {
- return ret;
- }
- if (from < 0) {
- from = 0;
- }
- if (to > this.length) {
- to = this.length;
- }
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
- walker = walker.next;
- }
- for (; walker !== null && i < to; i++, walker = walker.next) {
- ret.push(walker.value);
- }
- return ret;
- };
- Yallist.prototype.sliceReverse = function (from, to) {
- to = to || this.length;
- if (to < 0) {
- to += this.length;
- }
- from = from || 0;
- if (from < 0) {
- from += this.length;
- }
- var ret = new Yallist();
- if (to < from || to < 0) {
- return ret;
- }
- if (from < 0) {
- from = 0;
- }
- if (to > this.length) {
- to = this.length;
- }
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
- walker = walker.prev;
- }
- for (; walker !== null && i > from; i--, walker = walker.prev) {
- ret.push(walker.value);
- }
- return ret;
- };
- Yallist.prototype.splice = function (start, deleteCount
- /*, ...nodes */
- ) {
- if (start > this.length) {
- start = this.length - 1;
- }
- if (start < 0) {
- start = this.length + start;
- }
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
- walker = walker.next;
- }
- var ret = [];
- for (var i = 0; walker && i < deleteCount; i++) {
- ret.push(walker.value);
- walker = this.removeNode(walker);
- }
- if (walker === null) {
- walker = this.tail;
- }
- if (walker !== this.head && walker !== this.tail) {
- walker = walker.prev;
- }
- for (var i = 2; i < arguments.length; i++) {
- walker = insert(this, walker, arguments[i]);
- }
- return ret;
- };
- Yallist.prototype.reverse = function () {
- var head = this.head;
- var tail = this.tail;
- for (var walker = head; walker !== null; walker = walker.prev) {
- var p = walker.prev;
- walker.prev = walker.next;
- walker.next = p;
- }
- this.head = tail;
- this.tail = head;
- return this;
- };
- function insert(self, node, value) {
- var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
- if (inserted.next === null) {
- self.tail = inserted;
- }
- if (inserted.prev === null) {
- self.head = inserted;
- }
- self.length++;
- return inserted;
- }
- function push(self, item) {
- self.tail = new Node(item, self.tail, null, self);
- if (!self.head) {
- self.head = self.tail;
- }
- self.length++;
- }
- function unshift(self, item) {
- self.head = new Node(item, null, self.head, self);
- if (!self.tail) {
- self.tail = self.head;
- }
- self.length++;
- }
- function Node(value, prev, next, list) {
- if (!(this instanceof Node)) {
- return new Node(value, prev, next, list);
- }
- this.list = list;
- this.value = value;
- if (prev) {
- prev.next = this;
- this.prev = prev;
- } else {
- this.prev = null;
- }
- if (next) {
- next.prev = this;
- this.next = next;
- } else {
- this.next = null;
- }
- }
- try {
- // add if support for Symbol.iterator is present
- __webpack_require__(24)(Yallist);
- } catch (er) {}
- /***/ }),
- /* 24 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = function (Yallist) {
- Yallist.prototype[Symbol.iterator] = /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
- var walker;
- return regeneratorRuntime.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- walker = this.head;
- case 1:
- if (!walker) {
- _context.next = 7;
- break;
- }
- _context.next = 4;
- return walker.value;
- case 4:
- walker = walker.next;
- _context.next = 1;
- break;
- case 7:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- });
- };
- /***/ }),
- /* 25 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * @license React
- * react-is.production.min.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var b = Symbol.for("react.element"),
- c = Symbol.for("react.portal"),
- d = Symbol.for("react.fragment"),
- e = Symbol.for("react.strict_mode"),
- f = Symbol.for("react.profiler"),
- g = Symbol.for("react.provider"),
- h = Symbol.for("react.context"),
- k = Symbol.for("react.server_context"),
- l = Symbol.for("react.forward_ref"),
- m = Symbol.for("react.suspense"),
- n = Symbol.for("react.suspense_list"),
- p = Symbol.for("react.memo"),
- q = Symbol.for("react.lazy"),
- t = Symbol.for("react.offscreen"),
- u = Symbol.for("react.cache"),
- v = Symbol.for("react.client.reference");
- function w(a) {
- if ("object" === _typeof(a) && null !== a) {
- var r = a.$$typeof;
- switch (r) {
- case b:
- switch (a = a.type, a) {
- case d:
- case f:
- case e:
- case m:
- case n:
- return a;
- default:
- switch (a = a && a.$$typeof, a) {
- case k:
- case h:
- case l:
- case q:
- case p:
- case g:
- return a;
- default:
- return r;
- }
- }
- case c:
- return r;
- }
- }
- }
- exports.ContextConsumer = h;
- exports.ContextProvider = g;
- exports.Element = b;
- exports.ForwardRef = l;
- exports.Fragment = d;
- exports.Lazy = q;
- exports.Memo = p;
- exports.Portal = c;
- exports.Profiler = f;
- exports.StrictMode = e;
- exports.Suspense = m;
- exports.SuspenseList = n;
- exports.isAsyncMode = function () {
- return !1;
- };
- exports.isConcurrentMode = function () {
- return !1;
- };
- exports.isContextConsumer = function (a) {
- return w(a) === h;
- };
- exports.isContextProvider = function (a) {
- return w(a) === g;
- };
- exports.isElement = function (a) {
- return "object" === _typeof(a) && null !== a && a.$$typeof === b;
- };
- exports.isForwardRef = function (a) {
- return w(a) === l;
- };
- exports.isFragment = function (a) {
- return w(a) === d;
- };
- exports.isLazy = function (a) {
- return w(a) === q;
- };
- exports.isMemo = function (a) {
- return w(a) === p;
- };
- exports.isPortal = function (a) {
- return w(a) === c;
- };
- exports.isProfiler = function (a) {
- return w(a) === f;
- };
- exports.isStrictMode = function (a) {
- return w(a) === e;
- };
- exports.isSuspense = function (a) {
- return w(a) === m;
- };
- exports.isSuspenseList = function (a) {
- return w(a) === n;
- };
- exports.isValidElementType = function (a) {
- return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || a === u || "object" === _typeof(a) && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === v || void 0 !== a.getModuleId) ? !0 : !1;
- };
- exports.typeOf = w;
- /***/ }),
- /* 26 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * @license React
- * react-debug-tools.production.min.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var h = __webpack_require__(27),
- p = __webpack_require__(29),
- q = Object.assign,
- w = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
- x = [],
- y = null;
- function z() {
- if (null === y) {
- var a = new Map();
- try {
- A.useContext({
- _currentValue: null
- }), A.useState(null), A.useReducer(function (a) {
- return a;
- }, null), A.useRef(null), "function" === typeof A.useCacheRefresh && A.useCacheRefresh(), A.useLayoutEffect(function () {}), A.useInsertionEffect(function () {}), A.useEffect(function () {}), A.useImperativeHandle(void 0, function () {
- return null;
- }), A.useDebugValue(null), A.useCallback(function () {}), A.useMemo(function () {
- return null;
- });
- } finally {
- var b = x;
- x = [];
- }
- for (var e = 0; e < b.length; e++) {
- var g = b[e];
- a.set(g.primitive, h.parse(g.stackError));
- }
- y = a;
- }
- return y;
- }
- var B = null;
- function C() {
- var a = B;
- null !== a && (B = a.next);
- return a;
- }
- var A = {
- readContext: function readContext(a) {
- return a._currentValue;
- },
- useCacheRefresh: function useCacheRefresh() {
- var a = C();
- x.push({
- primitive: "CacheRefresh",
- stackError: Error(),
- value: null !== a ? a.memoizedState : function () {}
- });
- return function () {};
- },
- useCallback: function useCallback(a) {
- var b = C();
- x.push({
- primitive: "Callback",
- stackError: Error(),
- value: null !== b ? b.memoizedState[0] : a
- });
- return a;
- },
- useContext: function useContext(a) {
- x.push({
- primitive: "Context",
- stackError: Error(),
- value: a._currentValue
- });
- return a._currentValue;
- },
- useEffect: function useEffect(a) {
- C();
- x.push({
- primitive: "Effect",
- stackError: Error(),
- value: a
- });
- },
- useImperativeHandle: function useImperativeHandle(a) {
- C();
- var b = void 0;
- null !== a && "object" === _typeof(a) && (b = a.current);
- x.push({
- primitive: "ImperativeHandle",
- stackError: Error(),
- value: b
- });
- },
- useDebugValue: function useDebugValue(a, b) {
- x.push({
- primitive: "DebugValue",
- stackError: Error(),
- value: "function" === typeof b ? b(a) : a
- });
- },
- useLayoutEffect: function useLayoutEffect(a) {
- C();
- x.push({
- primitive: "LayoutEffect",
- stackError: Error(),
- value: a
- });
- },
- useInsertionEffect: function useInsertionEffect(a) {
- C();
- x.push({
- primitive: "InsertionEffect",
- stackError: Error(),
- value: a
- });
- },
- useMemo: function useMemo(a) {
- var b = C();
- a = null !== b ? b.memoizedState[0] : a();
- x.push({
- primitive: "Memo",
- stackError: Error(),
- value: a
- });
- return a;
- },
- useReducer: function useReducer(a, b, e) {
- a = C();
- b = null !== a ? a.memoizedState : void 0 !== e ? e(b) : b;
- x.push({
- primitive: "Reducer",
- stackError: Error(),
- value: b
- });
- return [b, function () {}];
- },
- useRef: function useRef(a) {
- var b = C();
- a = null !== b ? b.memoizedState : {
- current: a
- };
- x.push({
- primitive: "Ref",
- stackError: Error(),
- value: a.current
- });
- return a;
- },
- useState: function useState(a) {
- var b = C();
- a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a;
- x.push({
- primitive: "State",
- stackError: Error(),
- value: a
- });
- return [a, function () {}];
- },
- useTransition: function useTransition() {
- C();
- C();
- x.push({
- primitive: "Transition",
- stackError: Error(),
- value: void 0
- });
- return [!1, function () {}];
- },
- useMutableSource: function useMutableSource(a, b) {
- C();
- C();
- C();
- C();
- a = b(a._source);
- x.push({
- primitive: "MutableSource",
- stackError: Error(),
- value: a
- });
- return a;
- },
- useSyncExternalStore: function useSyncExternalStore(a, b) {
- C();
- C();
- a = b();
- x.push({
- primitive: "SyncExternalStore",
- stackError: Error(),
- value: a
- });
- return a;
- },
- useDeferredValue: function useDeferredValue(a) {
- var b = C();
- x.push({
- primitive: "DeferredValue",
- stackError: Error(),
- value: null !== b ? b.memoizedState : a
- });
- return a;
- },
- useId: function useId() {
- var a = C();
- a = null !== a ? a.memoizedState : "";
- x.push({
- primitive: "Id",
- stackError: Error(),
- value: a
- });
- return a;
- }
- },
- D = {
- get: function get(a, b) {
- if (a.hasOwnProperty(b)) return a[b];
- a = Error("Missing method in Dispatcher: " + b);
- a.name = "ReactDebugToolsUnsupportedHookError";
- throw a;
- }
- },
- E = "undefined" === typeof Proxy ? A : new Proxy(A, D),
- F = 0;
- function G(a, b, e) {
- var g = b[e].source,
- c = 0;
- a: for (; c < a.length; c++) {
- if (a[c].source === g) {
- for (var l = e + 1, r = c + 1; l < b.length && r < a.length; l++, r++) {
- if (a[r].source !== b[l].source) continue a;
- }
- return c;
- }
- }
- return -1;
- }
- function H(a, b) {
- if (!a) return !1;
- b = "use" + b;
- return a.length < b.length ? !1 : a.lastIndexOf(b) === a.length - b.length;
- }
- function I(a, b, e) {
- for (var g = [], c = null, l = g, r = 0, t = [], v = 0; v < b.length; v++) {
- var u = b[v];
- var d = a;
- var k = h.parse(u.stackError);
- b: {
- var m = k,
- n = G(m, d, F);
- if (-1 !== n) d = n;else {
- for (var f = 0; f < d.length && 5 > f; f++) {
- if (n = G(m, d, f), -1 !== n) {
- F = f;
- d = n;
- break b;
- }
- }
- d = -1;
- }
- }
- b: {
- m = k;
- n = z().get(u.primitive);
- if (void 0 !== n) for (f = 0; f < n.length && f < m.length; f++) {
- if (n[f].source !== m[f].source) {
- f < m.length - 1 && H(m[f].functionName, u.primitive) && f++;
- f < m.length - 1 && H(m[f].functionName, u.primitive) && f++;
- m = f;
- break b;
- }
- }
- m = -1;
- }
- k = -1 === d || -1 === m || 2 > d - m ? null : k.slice(m, d - 1);
- if (null !== k) {
- d = 0;
- if (null !== c) {
- for (; d < k.length && d < c.length && k[k.length - d - 1].source === c[c.length - d - 1].source;) {
- d++;
- }
- for (c = c.length - 1; c > d; c--) {
- l = t.pop();
- }
- }
- for (c = k.length - d - 1; 1 <= c; c--) {
- d = [], m = k[c], (n = k[c - 1].functionName) ? (f = n.lastIndexOf("."), -1 === f && (f = 0), "use" === n.substr(f, 3) && (f += 3), n = n.substr(f)) : n = "", n = {
- id: null,
- isStateEditable: !1,
- name: n,
- value: void 0,
- subHooks: d
- }, e && (n.hookSource = {
- lineNumber: m.lineNumber,
- columnNumber: m.columnNumber,
- functionName: m.functionName,
- fileName: m.fileName
- }), l.push(n), t.push(l), l = d;
- }
- c = k;
- }
- d = u.primitive;
- u = {
- id: "Context" === d || "DebugValue" === d ? null : r++,
- isStateEditable: "Reducer" === d || "State" === d,
- name: d,
- value: u.value,
- subHooks: []
- };
- e && (d = {
- lineNumber: null,
- functionName: null,
- fileName: null,
- columnNumber: null
- }, k && 1 <= k.length && (k = k[0], d.lineNumber = k.lineNumber, d.functionName = k.functionName, d.fileName = k.fileName, d.columnNumber = k.columnNumber), u.hookSource = d);
- l.push(u);
- }
- J(g, null);
- return g;
- }
- function J(a, b) {
- for (var e = [], g = 0; g < a.length; g++) {
- var c = a[g];
- "DebugValue" === c.name && 0 === c.subHooks.length ? (a.splice(g, 1), g--, e.push(c)) : J(c.subHooks, c);
- }
- null !== b && (1 === e.length ? b.value = e[0].value : 1 < e.length && (b.value = e.map(function (a) {
- return a.value;
- })));
- }
- function K(a) {
- if (a instanceof Error && "ReactDebugToolsUnsupportedHookError" === a.name) throw a;
- var b = Error("Error rendering inspected component", {
- cause: a
- });
- b.name = "ReactDebugToolsRenderError";
- b.cause = a;
- throw b;
- }
- function L(a, b, e) {
- var g = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : !1;
- null == e && (e = w.ReactCurrentDispatcher);
- var c = e.current;
- e.current = E;
- try {
- var l = Error();
- a(b);
- } catch (t) {
- K(t);
- } finally {
- var r = x;
- x = [];
- e.current = c;
- }
- c = h.parse(l);
- return I(c, r, g);
- }
- function M(a) {
- a.forEach(function (a, e) {
- return e._currentValue = a;
- });
- }
- exports.inspectHooks = L;
- exports.inspectHooksOfFiber = function (a, b) {
- var e = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : !1;
- null == b && (b = w.ReactCurrentDispatcher);
- if (0 !== a.tag && 15 !== a.tag && 11 !== a.tag) throw Error("Unknown Fiber. Needs to be a function component to inspect hooks.");
- z();
- var g = a.type,
- c = a.memoizedProps;
- if (g !== a.elementType && g && g.defaultProps) {
- c = q({}, c);
- var l = g.defaultProps;
- for (r in l) {
- void 0 === c[r] && (c[r] = l[r]);
- }
- }
- B = a.memoizedState;
- var r = new Map();
- try {
- for (l = a; l;) {
- if (10 === l.tag) {
- var t = l.type._context;
- r.has(t) || (r.set(t, t._currentValue), t._currentValue = l.memoizedProps.value);
- }
- l = l.return;
- }
- if (11 === a.tag) {
- var v = g.render;
- g = c;
- var u = a.ref;
- t = b;
- var d = t.current;
- t.current = E;
- try {
- var k = Error();
- v(g, u);
- } catch (f) {
- K(f);
- } finally {
- var m = x;
- x = [];
- t.current = d;
- }
- var n = h.parse(k);
- return I(n, m, e);
- }
- return L(g, c, b, e);
- } finally {
- B = null, M(r);
- }
- };
- /***/ }),
- /* 27 */
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- (function (root, factory) {
- 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
- /* istanbul ignore next */
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(28)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- })(this, function ErrorStackParser(StackFrame) {
- 'use strict';
- var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
- var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
- return {
- /**
- * Given an Error object, extract the most information from it.
- *
- * @param {Error} error object
- * @return {Array} of StackFrames
- */
- parse: function ErrorStackParser$$parse(error) {
- if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
- return this.parseOpera(error);
- } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
- return this.parseV8OrIE(error);
- } else if (error.stack) {
- return this.parseFFOrSafari(error);
- } else {
- throw new Error('Cannot parse given Error object');
- }
- },
- // Separate line and column numbers from a string of the form: (URI:Line:Column)
- extractLocation: function ErrorStackParser$$extractLocation(urlLike) {
- // Fail-fast but return locations like "(native)"
- if (urlLike.indexOf(':') === -1) {
- return [urlLike];
- }
- var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
- var parts = regExp.exec(urlLike.replace(/[()]/g, ''));
- return [parts[1], parts[2] || undefined, parts[3] || undefined];
- },
- parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
- var filtered = error.stack.split('\n').filter(function (line) {
- return !!line.match(CHROME_IE_STACK_REGEXP);
- }, this);
- return filtered.map(function (line) {
- if (line.indexOf('(eval ') > -1) {
- // Throw away eval information until we implement stacktrace.js/stackframe#8
- line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
- }
- var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '('); // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
- // case it has spaces in it, as the string is split on \s+ later on
- var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/); // remove the parenthesized location from the line, if it was matched
- sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
- var tokens = sanitizedLine.split(/\s+/).slice(1); // if a location was matched, pass it to extractLocation() otherwise pop the last token
- var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
- var functionName = tokens.join(' ') || undefined;
- var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
- return new StackFrame({
- functionName: functionName,
- fileName: fileName,
- lineNumber: locationParts[1],
- columnNumber: locationParts[2],
- source: line
- });
- }, this);
- },
- parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
- var filtered = error.stack.split('\n').filter(function (line) {
- return !line.match(SAFARI_NATIVE_CODE_REGEXP);
- }, this);
- return filtered.map(function (line) {
- // Throw away eval information until we implement stacktrace.js/stackframe#8
- if (line.indexOf(' > eval') > -1) {
- line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
- }
- if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
- // Safari eval frames only have function names and nothing else
- return new StackFrame({
- functionName: line
- });
- } else {
- var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
- var matches = line.match(functionNameRegex);
- var functionName = matches && matches[1] ? matches[1] : undefined;
- var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
- return new StackFrame({
- functionName: functionName,
- fileName: locationParts[0],
- lineNumber: locationParts[1],
- columnNumber: locationParts[2],
- source: line
- });
- }
- }, this);
- },
- parseOpera: function ErrorStackParser$$parseOpera(e) {
- if (!e.stacktrace || e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) {
- return this.parseOpera9(e);
- } else if (!e.stack) {
- return this.parseOpera10(e);
- } else {
- return this.parseOpera11(e);
- }
- },
- parseOpera9: function ErrorStackParser$$parseOpera9(e) {
- var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
- var lines = e.message.split('\n');
- var result = [];
- for (var i = 2, len = lines.length; i < len; i += 2) {
- var match = lineRE.exec(lines[i]);
- if (match) {
- result.push(new StackFrame({
- fileName: match[2],
- lineNumber: match[1],
- source: lines[i]
- }));
- }
- }
- return result;
- },
- parseOpera10: function ErrorStackParser$$parseOpera10(e) {
- var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
- var lines = e.stacktrace.split('\n');
- var result = [];
- for (var i = 0, len = lines.length; i < len; i += 2) {
- var match = lineRE.exec(lines[i]);
- if (match) {
- result.push(new StackFrame({
- functionName: match[3] || undefined,
- fileName: match[2],
- lineNumber: match[1],
- source: lines[i]
- }));
- }
- }
- return result;
- },
- // Opera 10.65+ Error.stack very similar to FF/Safari
- parseOpera11: function ErrorStackParser$$parseOpera11(error) {
- var filtered = error.stack.split('\n').filter(function (line) {
- return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
- }, this);
- return filtered.map(function (line) {
- var tokens = line.split('@');
- var locationParts = this.extractLocation(tokens.pop());
- var functionCall = tokens.shift() || '';
- var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, '$2').replace(/\([^)]*\)/g, '') || undefined;
- var argsRaw;
- if (functionCall.match(/\(([^)]*)\)/)) {
- argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1');
- }
- var args = argsRaw === undefined || argsRaw === '[arguments not available]' ? undefined : argsRaw.split(',');
- return new StackFrame({
- functionName: functionName,
- args: args,
- fileName: locationParts[0],
- lineNumber: locationParts[1],
- columnNumber: locationParts[2],
- source: line
- });
- }, this);
- }
- };
- });
- /***/ }),
- /* 28 */
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- (function (root, factory) {
- 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
- /* istanbul ignore next */
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- })(this, function () {
- 'use strict';
- function _isNumber(n) {
- return !isNaN(parseFloat(n)) && isFinite(n);
- }
- function _capitalize(str) {
- return str.charAt(0).toUpperCase() + str.substring(1);
- }
- function _getter(p) {
- return function () {
- return this[p];
- };
- }
- var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];
- var numericProps = ['columnNumber', 'lineNumber'];
- var stringProps = ['fileName', 'functionName', 'source'];
- var arrayProps = ['args'];
- var props = booleanProps.concat(numericProps, stringProps, arrayProps);
- function StackFrame(obj) {
- if (!obj) return;
- for (var i = 0; i < props.length; i++) {
- if (obj[props[i]] !== undefined) {
- this['set' + _capitalize(props[i])](obj[props[i]]);
- }
- }
- }
- StackFrame.prototype = {
- getArgs: function getArgs() {
- return this.args;
- },
- setArgs: function setArgs(v) {
- if (Object.prototype.toString.call(v) !== '[object Array]') {
- throw new TypeError('Args must be an Array');
- }
- this.args = v;
- },
- getEvalOrigin: function getEvalOrigin() {
- return this.evalOrigin;
- },
- setEvalOrigin: function setEvalOrigin(v) {
- if (v instanceof StackFrame) {
- this.evalOrigin = v;
- } else if (v instanceof Object) {
- this.evalOrigin = new StackFrame(v);
- } else {
- throw new TypeError('Eval Origin must be an Object or StackFrame');
- }
- },
- toString: function toString() {
- var fileName = this.getFileName() || '';
- var lineNumber = this.getLineNumber() || '';
- var columnNumber = this.getColumnNumber() || '';
- var functionName = this.getFunctionName() || '';
- if (this.getIsEval()) {
- if (fileName) {
- return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
- }
- return '[eval]:' + lineNumber + ':' + columnNumber;
- }
- if (functionName) {
- return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
- }
- return fileName + ':' + lineNumber + ':' + columnNumber;
- }
- };
- StackFrame.fromString = function StackFrame$$fromString(str) {
- var argsStartIndex = str.indexOf('(');
- var argsEndIndex = str.lastIndexOf(')');
- var functionName = str.substring(0, argsStartIndex);
- var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');
- var locationString = str.substring(argsEndIndex + 1);
- if (locationString.indexOf('@') === 0) {
- var parts = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(locationString, '');
- var fileName = parts[1];
- var lineNumber = parts[2];
- var columnNumber = parts[3];
- }
- return new StackFrame({
- functionName: functionName,
- args: args || undefined,
- fileName: fileName,
- lineNumber: lineNumber || undefined,
- columnNumber: columnNumber || undefined
- });
- };
- for (var i = 0; i < booleanProps.length; i++) {
- StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);
- StackFrame.prototype['set' + _capitalize(booleanProps[i])] = function (p) {
- return function (v) {
- this[p] = Boolean(v);
- };
- }(booleanProps[i]);
- }
- for (var j = 0; j < numericProps.length; j++) {
- StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);
- StackFrame.prototype['set' + _capitalize(numericProps[j])] = function (p) {
- return function (v) {
- if (!_isNumber(v)) {
- throw new TypeError(p + ' must be a Number');
- }
- this[p] = Number(v);
- };
- }(numericProps[j]);
- }
- for (var k = 0; k < stringProps.length; k++) {
- StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);
- StackFrame.prototype['set' + _capitalize(stringProps[k])] = function (p) {
- return function (v) {
- this[p] = String(v);
- };
- }(stringProps[k]);
- }
- return StackFrame;
- });
- /***/ }),
- /* 29 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- if (true) {
- module.exports = __webpack_require__(30);
- } else {}
- /***/ }),
- /* 30 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * @license React
- * react.production.min.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var l = Symbol.for("react.element"),
- n = Symbol.for("react.portal"),
- p = Symbol.for("react.fragment"),
- q = Symbol.for("react.strict_mode"),
- r = Symbol.for("react.profiler"),
- t = Symbol.for("react.provider"),
- u = Symbol.for("react.context"),
- v = Symbol.for("react.server_context"),
- w = Symbol.for("react.forward_ref"),
- x = Symbol.for("react.suspense"),
- y = Symbol.for("react.suspense_list"),
- z = Symbol.for("react.memo"),
- A = Symbol.for("react.lazy"),
- aa = Symbol.for("react.debug_trace_mode"),
- ba = Symbol.for("react.offscreen"),
- ca = Symbol.for("react.cache"),
- B = Symbol.for("react.default_value"),
- C = Symbol.iterator;
- function da(a) {
- if (null === a || "object" !== _typeof(a)) return null;
- a = C && a[C] || a["@@iterator"];
- return "function" === typeof a ? a : null;
- }
- var D = {
- isMounted: function isMounted() {
- return !1;
- },
- enqueueForceUpdate: function enqueueForceUpdate() {},
- enqueueReplaceState: function enqueueReplaceState() {},
- enqueueSetState: function enqueueSetState() {}
- },
- E = Object.assign,
- F = {};
- function G(a, b, d) {
- this.props = a;
- this.context = b;
- this.refs = F;
- this.updater = d || D;
- }
- G.prototype.isReactComponent = {};
- G.prototype.setState = function (a, b) {
- if ("object" !== _typeof(a) && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
- this.updater.enqueueSetState(this, a, b, "setState");
- };
- G.prototype.forceUpdate = function (a) {
- this.updater.enqueueForceUpdate(this, a, "forceUpdate");
- };
- function H() {}
- H.prototype = G.prototype;
- function I(a, b, d) {
- this.props = a;
- this.context = b;
- this.refs = F;
- this.updater = d || D;
- }
- var J = I.prototype = new H();
- J.constructor = I;
- E(J, G.prototype);
- J.isPureReactComponent = !0;
- var K = Array.isArray,
- L = Object.prototype.hasOwnProperty,
- M = {
- current: null
- },
- N = {
- key: !0,
- ref: !0,
- __self: !0,
- __source: !0
- };
- function O(a, b, d) {
- var c,
- e = {},
- f = null,
- g = null;
- if (null != b) for (c in void 0 !== b.ref && (g = b.ref), void 0 !== b.key && (f = "" + b.key), b) {
- L.call(b, c) && !N.hasOwnProperty(c) && (e[c] = b[c]);
- }
- var h = arguments.length - 2;
- if (1 === h) e.children = d;else if (1 < h) {
- for (var k = Array(h), m = 0; m < h; m++) {
- k[m] = arguments[m + 2];
- }
- e.children = k;
- }
- if (a && a.defaultProps) for (c in h = a.defaultProps, h) {
- void 0 === e[c] && (e[c] = h[c]);
- }
- return {
- $$typeof: l,
- type: a,
- key: f,
- ref: g,
- props: e,
- _owner: M.current
- };
- }
- function ea(a, b) {
- return {
- $$typeof: l,
- type: a.type,
- key: b,
- ref: a.ref,
- props: a.props,
- _owner: a._owner
- };
- }
- function P(a) {
- return "object" === _typeof(a) && null !== a && a.$$typeof === l;
- }
- function escape(a) {
- var b = {
- "=": "=0",
- ":": "=2"
- };
- return "$" + a.replace(/[=:]/g, function (a) {
- return b[a];
- });
- }
- var Q = /\/+/g;
- function R(a, b) {
- return "object" === _typeof(a) && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
- }
- function S(a, b, d, c, e) {
- var f = _typeof(a);
- if ("undefined" === f || "boolean" === f) a = null;
- var g = !1;
- if (null === a) g = !0;else switch (f) {
- case "string":
- case "number":
- g = !0;
- break;
- case "object":
- switch (a.$$typeof) {
- case l:
- case n:
- g = !0;
- }
- }
- if (g) return g = a, e = e(g), a = "" === c ? "." + R(g, 0) : c, K(e) ? (d = "", null != a && (d = a.replace(Q, "$&/") + "/"), S(e, b, d, "", function (a) {
- return a;
- })) : null != e && (P(e) && (e = ea(e, d + (!e.key || g && g.key === e.key ? "" : ("" + e.key).replace(Q, "$&/") + "/") + a)), b.push(e)), 1;
- g = 0;
- c = "" === c ? "." : c + ":";
- if (K(a)) for (var h = 0; h < a.length; h++) {
- f = a[h];
- var k = c + R(f, h);
- g += S(f, b, d, k, e);
- } else if (k = da(a), "function" === typeof k) for (a = k.call(a), h = 0; !(f = a.next()).done;) {
- f = f.value, k = c + R(f, h++), g += S(f, b, d, k, e);
- } else if ("object" === f) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
- return g;
- }
- function T(a, b, d) {
- if (null == a) return a;
- var c = [],
- e = 0;
- S(a, c, "", "", function (a) {
- return b.call(d, a, e++);
- });
- return c;
- }
- function fa(a) {
- if (-1 === a._status) {
- var b = a._result;
- b = b();
- b.then(function (b) {
- if (0 === a._status || -1 === a._status) a._status = 1, a._result = b;
- }, function (b) {
- if (0 === a._status || -1 === a._status) a._status = 2, a._result = b;
- });
- -1 === a._status && (a._status = 0, a._result = b);
- }
- if (1 === a._status) return a._result.default;
- throw a._result;
- }
- var U = {
- current: null
- };
- function ha() {
- return new WeakMap();
- }
- function V() {
- return {
- s: 0,
- v: void 0,
- o: null,
- p: null
- };
- }
- var W = {
- current: null
- },
- X = {
- transition: null
- },
- Y = {
- ReactCurrentDispatcher: W,
- ReactCurrentCache: U,
- ReactCurrentBatchConfig: X,
- ReactCurrentOwner: M,
- ContextRegistry: {}
- },
- Z = Y.ContextRegistry;
- exports.Children = {
- map: T,
- forEach: function forEach(a, b, d) {
- T(a, function () {
- b.apply(this, arguments);
- }, d);
- },
- count: function count(a) {
- var b = 0;
- T(a, function () {
- b++;
- });
- return b;
- },
- toArray: function toArray(a) {
- return T(a, function (a) {
- return a;
- }) || [];
- },
- only: function only(a) {
- if (!P(a)) throw Error("React.Children.only expected to receive a single React element child.");
- return a;
- }
- };
- exports.Component = G;
- exports.Fragment = p;
- exports.Profiler = r;
- exports.PureComponent = I;
- exports.StrictMode = q;
- exports.Suspense = x;
- exports.SuspenseList = y;
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Y;
- exports.cache = function (a) {
- return function () {
- var b = U.current;
- if (!b) return a.apply(null, arguments);
- var d = b.getCacheForType(ha);
- b = d.get(a);
- void 0 === b && (b = V(), d.set(a, b));
- d = 0;
- for (var c = arguments.length; d < c; d++) {
- var e = arguments[d];
- if ("function" === typeof e || "object" === _typeof(e) && null !== e) {
- var f = b.o;
- null === f && (b.o = f = new WeakMap());
- b = f.get(e);
- void 0 === b && (b = V(), f.set(e, b));
- } else f = b.p, null === f && (b.p = f = new Map()), b = f.get(e), void 0 === b && (b = V(), f.set(e, b));
- }
- if (1 === b.s) return b.v;
- if (2 === b.s) throw b.v;
- try {
- var g = a.apply(null, arguments);
- d = b;
- d.s = 1;
- return d.v = g;
- } catch (h) {
- throw g = b, g.s = 2, g.v = h, h;
- }
- };
- };
- exports.cloneElement = function (a, b, d) {
- if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
- var c = E({}, a.props),
- e = a.key,
- f = a.ref,
- g = a._owner;
- if (null != b) {
- void 0 !== b.ref && (f = b.ref, g = M.current);
- void 0 !== b.key && (e = "" + b.key);
- if (a.type && a.type.defaultProps) var h = a.type.defaultProps;
- for (k in b) {
- L.call(b, k) && !N.hasOwnProperty(k) && (c[k] = void 0 === b[k] && void 0 !== h ? h[k] : b[k]);
- }
- }
- var k = arguments.length - 2;
- if (1 === k) c.children = d;else if (1 < k) {
- h = Array(k);
- for (var m = 0; m < k; m++) {
- h[m] = arguments[m + 2];
- }
- c.children = h;
- }
- return {
- $$typeof: l,
- type: a.type,
- key: e,
- ref: f,
- props: c,
- _owner: g
- };
- };
- exports.createContext = function (a) {
- a = {
- $$typeof: u,
- _currentValue: a,
- _currentValue2: a,
- _threadCount: 0,
- Provider: null,
- Consumer: null,
- _defaultValue: null,
- _globalName: null
- };
- a.Provider = {
- $$typeof: t,
- _context: a
- };
- return a.Consumer = a;
- };
- exports.createElement = O;
- exports.createFactory = function (a) {
- var b = O.bind(null, a);
- b.type = a;
- return b;
- };
- exports.createRef = function () {
- return {
- current: null
- };
- };
- exports.createServerContext = function (a, b) {
- var d = !0;
- if (!Z[a]) {
- d = !1;
- var c = {
- $$typeof: v,
- _currentValue: b,
- _currentValue2: b,
- _defaultValue: b,
- _threadCount: 0,
- Provider: null,
- Consumer: null,
- _globalName: a
- };
- c.Provider = {
- $$typeof: t,
- _context: c
- };
- Z[a] = c;
- }
- c = Z[a];
- if (c._defaultValue === B) c._defaultValue = b, c._currentValue === B && (c._currentValue = b), c._currentValue2 === B && (c._currentValue2 = b);else if (d) throw Error("ServerContext: " + a + " already defined");
- return c;
- };
- exports.experimental_useEffectEvent = function (a) {
- return W.current.useEffectEvent(a);
- };
- exports.forwardRef = function (a) {
- return {
- $$typeof: w,
- render: a
- };
- };
- exports.isValidElement = P;
- exports.lazy = function (a) {
- return {
- $$typeof: A,
- _payload: {
- _status: -1,
- _result: a
- },
- _init: fa
- };
- };
- exports.memo = function (a, b) {
- return {
- $$typeof: z,
- type: a,
- compare: void 0 === b ? null : b
- };
- };
- exports.startTransition = function (a) {
- var b = X.transition;
- X.transition = {};
- try {
- a();
- } finally {
- X.transition = b;
- }
- };
- exports.unstable_Cache = ca;
- exports.unstable_DebugTracingMode = aa;
- exports.unstable_Offscreen = ba;
- exports.unstable_act = function () {
- throw Error("act(...) is not supported in production builds of React.");
- };
- exports.unstable_getCacheForType = function (a) {
- var b = U.current;
- return b ? b.getCacheForType(a) : a();
- };
- exports.unstable_getCacheSignal = function () {
- var a = U.current;
- return a ? a.getCacheSignal() : (a = new AbortController(), a.abort(Error("This CacheSignal was requested outside React which means that it is immediately aborted.")), a.signal);
- };
- exports.unstable_useCacheRefresh = function () {
- return W.current.useCacheRefresh();
- };
- exports.unstable_useMemoCache = function (a) {
- return W.current.useMemoCache(a);
- };
- exports.use = function (a) {
- return W.current.use(a);
- };
- exports.useCallback = function (a, b) {
- return W.current.useCallback(a, b);
- };
- exports.useContext = function (a) {
- return W.current.useContext(a);
- };
- exports.useDebugValue = function () {};
- exports.useDeferredValue = function (a) {
- return W.current.useDeferredValue(a);
- };
- exports.useEffect = function (a, b) {
- return W.current.useEffect(a, b);
- };
- exports.useId = function () {
- return W.current.useId();
- };
- exports.useImperativeHandle = function (a, b, d) {
- return W.current.useImperativeHandle(a, b, d);
- };
- exports.useInsertionEffect = function (a, b) {
- return W.current.useInsertionEffect(a, b);
- };
- exports.useLayoutEffect = function (a, b) {
- return W.current.useLayoutEffect(a, b);
- };
- exports.useMemo = function (a, b) {
- return W.current.useMemo(a, b);
- };
- exports.useReducer = function (a, b, d) {
- return W.current.useReducer(a, b, d);
- };
- exports.useRef = function (a) {
- return W.current.useRef(a);
- };
- exports.useState = function (a) {
- return W.current.useState(a);
- };
- exports.useSyncExternalStore = function (a, b, d) {
- return W.current.useSyncExternalStore(a, b, d);
- };
- exports.useTransition = function () {
- return W.current.useTransition();
- };
- exports.version = "18.3.0-experimental-53b1f69ba-20230209";
- /***/ }),
- /* 31 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "connectToDevTools", function() { return /* binding */ connectToDevTools; });
- // CONCATENATED MODULE: ../react-devtools-shared/src/events.js
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var EventEmitter = /*#__PURE__*/function () {
- function EventEmitter() {
- _classCallCheck(this, EventEmitter);
- _defineProperty(this, "listenersMap", new Map());
- }
- _createClass(EventEmitter, [{
- key: "addListener",
- value: function addListener(event, listener) {
- var listeners = this.listenersMap.get(event);
- if (listeners === undefined) {
- this.listenersMap.set(event, [listener]);
- } else {
- var index = listeners.indexOf(listener);
- if (index < 0) {
- listeners.push(listener);
- }
- }
- }
- }, {
- key: "emit",
- value: function emit(event) {
- var listeners = this.listenersMap.get(event);
- if (listeners !== undefined) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- if (listeners.length === 1) {
- // No need to clone or try/catch
- var listener = listeners[0];
- listener.apply(null, args);
- } else {
- var didThrow = false;
- var caughtError = null;
- var clonedListeners = Array.from(listeners);
- for (var i = 0; i < clonedListeners.length; i++) {
- var _listener = clonedListeners[i];
- try {
- _listener.apply(null, args);
- } catch (error) {
- if (caughtError === null) {
- didThrow = true;
- caughtError = error;
- }
- }
- }
- if (didThrow) {
- throw caughtError;
- }
- }
- }
- }
- }, {
- key: "removeAllListeners",
- value: function removeAllListeners() {
- this.listenersMap.clear();
- }
- }, {
- key: "removeListener",
- value: function removeListener(event, listener) {
- var listeners = this.listenersMap.get(event);
- if (listeners !== undefined) {
- var index = listeners.indexOf(listener);
- if (index >= 0) {
- listeners.splice(index, 1);
- }
- }
- }
- }]);
- return EventEmitter;
- }();
- // EXTERNAL MODULE: /Users/xch/dev/react/node_modules/lodash.throttle/index.js
- var lodash_throttle = __webpack_require__(13);
- var lodash_throttle_default = /*#__PURE__*/__webpack_require__.n(lodash_throttle);
- // EXTERNAL MODULE: ../react-devtools-shared/src/constants.js
- var constants = __webpack_require__(2);
- // EXTERNAL MODULE: ../react-devtools-shared/src/storage.js
- var storage = __webpack_require__(5);
- // CONCATENATED MODULE: /Users/xch/dev/react/node_modules/memoize-one/esm/index.js
- var simpleIsEqual = function simpleIsEqual(a, b) {
- return a === b;
- };
- /* harmony default export */ var esm = (function (resultFn) {
- var isEqual = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : simpleIsEqual;
- var lastThis = void 0;
- var lastArgs = [];
- var lastResult = void 0;
- var calledOnce = false;
- var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
- return isEqual(newArg, lastArgs[index]);
- };
- var result = function result() {
- for (var _len = arguments.length, newArgs = Array(_len), _key = 0; _key < _len; _key++) {
- newArgs[_key] = arguments[_key];
- }
- if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
- return lastResult;
- }
- calledOnce = true;
- lastThis = this;
- lastArgs = newArgs;
- lastResult = resultFn.apply(this, newArgs);
- return lastResult;
- };
- return result;
- });
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/utils.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // Get the window object for the document that a node belongs to,
- // or return null if it cannot be found (node not attached to DOM,
- // etc).
- function getOwnerWindow(node) {
- if (!node.ownerDocument) {
- return null;
- }
- return node.ownerDocument.defaultView;
- } // Get the iframe containing a node, or return null if it cannot
- // be found (node not within iframe, etc).
- function getOwnerIframe(node) {
- var nodeWindow = getOwnerWindow(node);
- if (nodeWindow) {
- return nodeWindow.frameElement;
- }
- return null;
- } // Get a bounding client rect for a node, with an
- // offset added to compensate for its border.
- function getBoundingClientRectWithBorderOffset(node) {
- var dimensions = getElementDimensions(node);
- return mergeRectOffsets([node.getBoundingClientRect(), {
- top: dimensions.borderTop,
- left: dimensions.borderLeft,
- bottom: dimensions.borderBottom,
- right: dimensions.borderRight,
- // This width and height won't get used by mergeRectOffsets (since this
- // is not the first rect in the array), but we set them so that this
- // object type checks as a ClientRect.
- width: 0,
- height: 0
- }]);
- } // Add together the top, left, bottom, and right properties of
- // each ClientRect, but keep the width and height of the first one.
- function mergeRectOffsets(rects) {
- return rects.reduce(function (previousRect, rect) {
- if (previousRect == null) {
- return rect;
- }
- return {
- top: previousRect.top + rect.top,
- left: previousRect.left + rect.left,
- width: previousRect.width,
- height: previousRect.height,
- bottom: previousRect.bottom + rect.bottom,
- right: previousRect.right + rect.right
- };
- });
- } // Calculate a boundingClientRect for a node relative to boundaryWindow,
- // taking into account any offsets caused by intermediate iframes.
- function getNestedBoundingClientRect(node, boundaryWindow) {
- var ownerIframe = getOwnerIframe(node);
- if (ownerIframe && ownerIframe !== boundaryWindow) {
- var rects = [node.getBoundingClientRect()];
- var currentIframe = ownerIframe;
- var onlyOneMore = false;
- while (currentIframe) {
- var rect = getBoundingClientRectWithBorderOffset(currentIframe);
- rects.push(rect);
- currentIframe = getOwnerIframe(currentIframe);
- if (onlyOneMore) {
- break;
- } // We don't want to calculate iframe offsets upwards beyond
- // the iframe containing the boundaryWindow, but we
- // need to calculate the offset relative to the boundaryWindow.
- if (currentIframe && getOwnerWindow(currentIframe) === boundaryWindow) {
- onlyOneMore = true;
- }
- }
- return mergeRectOffsets(rects);
- } else {
- return node.getBoundingClientRect();
- }
- }
- function getElementDimensions(domElement) {
- var calculatedStyle = window.getComputedStyle(domElement);
- return {
- borderLeft: parseInt(calculatedStyle.borderLeftWidth, 10),
- borderRight: parseInt(calculatedStyle.borderRightWidth, 10),
- borderTop: parseInt(calculatedStyle.borderTopWidth, 10),
- borderBottom: parseInt(calculatedStyle.borderBottomWidth, 10),
- marginLeft: parseInt(calculatedStyle.marginLeft, 10),
- marginRight: parseInt(calculatedStyle.marginRight, 10),
- marginTop: parseInt(calculatedStyle.marginTop, 10),
- marginBottom: parseInt(calculatedStyle.marginBottom, 10),
- paddingLeft: parseInt(calculatedStyle.paddingLeft, 10),
- paddingRight: parseInt(calculatedStyle.paddingRight, 10),
- paddingTop: parseInt(calculatedStyle.paddingTop, 10),
- paddingBottom: parseInt(calculatedStyle.paddingBottom, 10)
- };
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/Highlighter/Overlay.js
- function Overlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function Overlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function Overlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) Overlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) Overlay_defineProperties(Constructor, staticProps); return Constructor; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var Overlay_assign = Object.assign; // Note that the Overlay components are not affected by the active Theme,
- // because they highlight elements in the main Chrome window (outside of devtools).
- // The colors below were chosen to roughly match those used by Chrome devtools.
- var OverlayRect = /*#__PURE__*/function () {
- function OverlayRect(doc, container) {
- Overlay_classCallCheck(this, OverlayRect);
- this.node = doc.createElement('div');
- this.border = doc.createElement('div');
- this.padding = doc.createElement('div');
- this.content = doc.createElement('div');
- this.border.style.borderColor = overlayStyles.border;
- this.padding.style.borderColor = overlayStyles.padding;
- this.content.style.backgroundColor = overlayStyles.background;
- Overlay_assign(this.node.style, {
- borderColor: overlayStyles.margin,
- pointerEvents: 'none',
- position: 'fixed'
- });
- this.node.style.zIndex = '10000000';
- this.node.appendChild(this.border);
- this.border.appendChild(this.padding);
- this.padding.appendChild(this.content);
- container.appendChild(this.node);
- }
- Overlay_createClass(OverlayRect, [{
- key: "remove",
- value: function remove() {
- if (this.node.parentNode) {
- this.node.parentNode.removeChild(this.node);
- }
- }
- }, {
- key: "update",
- value: function update(box, dims) {
- boxWrap(dims, 'margin', this.node);
- boxWrap(dims, 'border', this.border);
- boxWrap(dims, 'padding', this.padding);
- Overlay_assign(this.content.style, {
- height: box.height - dims.borderTop - dims.borderBottom - dims.paddingTop - dims.paddingBottom + 'px',
- width: box.width - dims.borderLeft - dims.borderRight - dims.paddingLeft - dims.paddingRight + 'px'
- });
- Overlay_assign(this.node.style, {
- top: box.top - dims.marginTop + 'px',
- left: box.left - dims.marginLeft + 'px'
- });
- }
- }]);
- return OverlayRect;
- }();
- var OverlayTip = /*#__PURE__*/function () {
- function OverlayTip(doc, container) {
- Overlay_classCallCheck(this, OverlayTip);
- this.tip = doc.createElement('div');
- Overlay_assign(this.tip.style, {
- display: 'flex',
- flexFlow: 'row nowrap',
- backgroundColor: '#333740',
- borderRadius: '2px',
- fontFamily: '"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',
- fontWeight: 'bold',
- padding: '3px 5px',
- pointerEvents: 'none',
- position: 'fixed',
- fontSize: '12px',
- whiteSpace: 'nowrap'
- });
- this.nameSpan = doc.createElement('span');
- this.tip.appendChild(this.nameSpan);
- Overlay_assign(this.nameSpan.style, {
- color: '#ee78e6',
- borderRight: '1px solid #aaaaaa',
- paddingRight: '0.5rem',
- marginRight: '0.5rem'
- });
- this.dimSpan = doc.createElement('span');
- this.tip.appendChild(this.dimSpan);
- Overlay_assign(this.dimSpan.style, {
- color: '#d7d7d7'
- });
- this.tip.style.zIndex = '10000000';
- container.appendChild(this.tip);
- }
- Overlay_createClass(OverlayTip, [{
- key: "remove",
- value: function remove() {
- if (this.tip.parentNode) {
- this.tip.parentNode.removeChild(this.tip);
- }
- }
- }, {
- key: "updateText",
- value: function updateText(name, width, height) {
- this.nameSpan.textContent = name;
- this.dimSpan.textContent = Math.round(width) + 'px × ' + Math.round(height) + 'px';
- }
- }, {
- key: "updatePosition",
- value: function updatePosition(dims, bounds) {
- var tipRect = this.tip.getBoundingClientRect();
- var tipPos = findTipPos(dims, bounds, {
- width: tipRect.width,
- height: tipRect.height
- });
- Overlay_assign(this.tip.style, tipPos.style);
- }
- }]);
- return OverlayTip;
- }();
- var Overlay_Overlay = /*#__PURE__*/function () {
- function Overlay(agent) {
- Overlay_classCallCheck(this, Overlay);
- // Find the root window, because overlays are positioned relative to it.
- var currentWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
- this.window = currentWindow; // When opened in shells/dev, the tooltip should be bound by the app iframe, not by the topmost window.
- var tipBoundsWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
- this.tipBoundsWindow = tipBoundsWindow;
- var doc = currentWindow.document;
- this.container = doc.createElement('div');
- this.container.style.zIndex = '10000000';
- this.tip = new OverlayTip(doc, this.container);
- this.rects = [];
- this.agent = agent;
- doc.body.appendChild(this.container);
- }
- Overlay_createClass(Overlay, [{
- key: "remove",
- value: function remove() {
- this.tip.remove();
- this.rects.forEach(function (rect) {
- rect.remove();
- });
- this.rects.length = 0;
- if (this.container.parentNode) {
- this.container.parentNode.removeChild(this.container);
- }
- }
- }, {
- key: "inspect",
- value: function inspect(nodes, name) {
- var _this = this;
- // We can't get the size of text nodes or comment nodes. React as of v15
- // heavily uses comment nodes to delimit text.
- var elements = nodes.filter(function (node) {
- return node.nodeType === Node.ELEMENT_NODE;
- });
- while (this.rects.length > elements.length) {
- var rect = this.rects.pop();
- rect.remove();
- }
- if (elements.length === 0) {
- return;
- }
- while (this.rects.length < elements.length) {
- this.rects.push(new OverlayRect(this.window.document, this.container));
- }
- var outerBox = {
- top: Number.POSITIVE_INFINITY,
- right: Number.NEGATIVE_INFINITY,
- bottom: Number.NEGATIVE_INFINITY,
- left: Number.POSITIVE_INFINITY
- };
- elements.forEach(function (element, index) {
- var box = getNestedBoundingClientRect(element, _this.window);
- var dims = getElementDimensions(element);
- outerBox.top = Math.min(outerBox.top, box.top - dims.marginTop);
- outerBox.right = Math.max(outerBox.right, box.left + box.width + dims.marginRight);
- outerBox.bottom = Math.max(outerBox.bottom, box.top + box.height + dims.marginBottom);
- outerBox.left = Math.min(outerBox.left, box.left - dims.marginLeft);
- var rect = _this.rects[index];
- rect.update(box, dims);
- });
- if (!name) {
- name = elements[0].nodeName.toLowerCase();
- var node = elements[0];
- var rendererInterface = this.agent.getBestMatchingRendererInterface(node);
- if (rendererInterface) {
- var id = rendererInterface.getFiberIDForNative(node, true);
- if (id) {
- var ownerName = rendererInterface.getDisplayNameForFiberID(id, true);
- if (ownerName) {
- name += ' (in ' + ownerName + ')';
- }
- }
- }
- }
- this.tip.updateText(name, outerBox.right - outerBox.left, outerBox.bottom - outerBox.top);
- var tipBounds = getNestedBoundingClientRect(this.tipBoundsWindow.document.documentElement, this.window);
- this.tip.updatePosition({
- top: outerBox.top,
- left: outerBox.left,
- height: outerBox.bottom - outerBox.top,
- width: outerBox.right - outerBox.left
- }, {
- top: tipBounds.top + this.tipBoundsWindow.scrollY,
- left: tipBounds.left + this.tipBoundsWindow.scrollX,
- height: this.tipBoundsWindow.innerHeight,
- width: this.tipBoundsWindow.innerWidth
- });
- }
- }]);
- return Overlay;
- }();
- function findTipPos(dims, bounds, tipSize) {
- var tipHeight = Math.max(tipSize.height, 20);
- var tipWidth = Math.max(tipSize.width, 60);
- var margin = 5;
- var top;
- if (dims.top + dims.height + tipHeight <= bounds.top + bounds.height) {
- if (dims.top + dims.height < bounds.top + 0) {
- top = bounds.top + margin;
- } else {
- top = dims.top + dims.height + margin;
- }
- } else if (dims.top - tipHeight <= bounds.top + bounds.height) {
- if (dims.top - tipHeight - margin < bounds.top + margin) {
- top = bounds.top + margin;
- } else {
- top = dims.top - tipHeight - margin;
- }
- } else {
- top = bounds.top + bounds.height - tipHeight - margin;
- }
- var left = dims.left + margin;
- if (dims.left < bounds.left) {
- left = bounds.left + margin;
- }
- if (dims.left + tipWidth > bounds.left + bounds.width) {
- left = bounds.left + bounds.width - tipWidth - margin;
- }
- top += 'px';
- left += 'px';
- return {
- style: {
- top: top,
- left: left
- }
- };
- }
- function boxWrap(dims, what, node) {
- Overlay_assign(node.style, {
- borderTopWidth: dims[what + 'Top'] + 'px',
- borderLeftWidth: dims[what + 'Left'] + 'px',
- borderRightWidth: dims[what + 'Right'] + 'px',
- borderBottomWidth: dims[what + 'Bottom'] + 'px',
- borderStyle: 'solid'
- });
- }
- var overlayStyles = {
- background: 'rgba(120, 170, 210, 0.7)',
- padding: 'rgba(77, 200, 0, 0.3)',
- margin: 'rgba(255, 155, 0, 0.3)',
- border: 'rgba(255, 200, 50, 0.3)'
- };
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/Highlighter/Highlighter.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var SHOW_DURATION = 2000;
- var timeoutID = null;
- var overlay = null;
- function hideOverlay(agent) {
- if (window.document == null) {
- agent.emit('hideNativeHighlight');
- return;
- }
- timeoutID = null;
- if (overlay !== null) {
- overlay.remove();
- overlay = null;
- }
- }
- function showOverlay(elements, componentName, agent, hideAfterTimeout) {
- if (window.document == null) {
- if (elements != null && elements[0] != null) {
- agent.emit('showNativeHighlight', elements[0]);
- }
- return;
- }
- if (timeoutID !== null) {
- clearTimeout(timeoutID);
- }
- if (elements == null) {
- return;
- }
- if (overlay === null) {
- overlay = new Overlay_Overlay(agent);
- }
- overlay.inspect(elements, componentName);
- if (hideAfterTimeout) {
- timeoutID = setTimeout(function () {
- return hideOverlay(agent);
- }, SHOW_DURATION);
- }
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/Highlighter/index.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // This plug-in provides in-page highlighting of the selected element.
- // It is used by the browser extension and the standalone DevTools shell (when connected to a browser).
- // It is not currently the mechanism used to highlight React Native views.
- // That is done by the React Native Inspector component.
- var iframesListeningTo = new Set();
- function setupHighlighter(bridge, agent) {
- bridge.addListener('clearNativeElementHighlight', clearNativeElementHighlight);
- bridge.addListener('highlightNativeElement', highlightNativeElement);
- bridge.addListener('shutdown', stopInspectingNative);
- bridge.addListener('startInspectingNative', startInspectingNative);
- bridge.addListener('stopInspectingNative', stopInspectingNative);
- function startInspectingNative() {
- registerListenersOnWindow(window);
- }
- function registerListenersOnWindow(window) {
- // This plug-in may run in non-DOM environments (e.g. React Native).
- if (window && typeof window.addEventListener === 'function') {
- window.addEventListener('click', onClick, true);
- window.addEventListener('mousedown', onMouseEvent, true);
- window.addEventListener('mouseover', onMouseEvent, true);
- window.addEventListener('mouseup', onMouseEvent, true);
- window.addEventListener('pointerdown', onPointerDown, true);
- window.addEventListener('pointerover', onPointerOver, true);
- window.addEventListener('pointerup', onPointerUp, true);
- } else {
- agent.emit('startInspectingNative');
- }
- }
- function stopInspectingNative() {
- hideOverlay(agent);
- removeListenersOnWindow(window);
- iframesListeningTo.forEach(function (frame) {
- try {
- removeListenersOnWindow(frame.contentWindow);
- } catch (error) {// This can error when the iframe is on a cross-origin.
- }
- });
- iframesListeningTo = new Set();
- }
- function removeListenersOnWindow(window) {
- // This plug-in may run in non-DOM environments (e.g. React Native).
- if (window && typeof window.removeEventListener === 'function') {
- window.removeEventListener('click', onClick, true);
- window.removeEventListener('mousedown', onMouseEvent, true);
- window.removeEventListener('mouseover', onMouseEvent, true);
- window.removeEventListener('mouseup', onMouseEvent, true);
- window.removeEventListener('pointerdown', onPointerDown, true);
- window.removeEventListener('pointerover', onPointerOver, true);
- window.removeEventListener('pointerup', onPointerUp, true);
- } else {
- agent.emit('stopInspectingNative');
- }
- }
- function clearNativeElementHighlight() {
- hideOverlay(agent);
- }
- function highlightNativeElement(_ref) {
- var displayName = _ref.displayName,
- hideAfterTimeout = _ref.hideAfterTimeout,
- id = _ref.id,
- openNativeElementsPanel = _ref.openNativeElementsPanel,
- rendererID = _ref.rendererID,
- scrollIntoView = _ref.scrollIntoView;
- var renderer = agent.rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- }
- var nodes = null;
- if (renderer != null) {
- nodes = renderer.findNativeNodesForFiberID(id);
- }
- if (nodes != null && nodes[0] != null) {
- var node = nodes[0]; // $FlowFixMe[method-unbinding]
- if (scrollIntoView && typeof node.scrollIntoView === 'function') {
- // If the node isn't visible show it before highlighting it.
- // We may want to reconsider this; it might be a little disruptive.
- node.scrollIntoView({
- block: 'nearest',
- inline: 'nearest'
- });
- }
- showOverlay(nodes, displayName, agent, hideAfterTimeout);
- if (openNativeElementsPanel) {
- window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$0 = node;
- bridge.send('syncSelectionToNativeElementsPanel');
- }
- } else {
- hideOverlay(agent);
- }
- }
- function onClick(event) {
- event.preventDefault();
- event.stopPropagation();
- stopInspectingNative();
- bridge.send('stopInspectingNative', true);
- }
- function onMouseEvent(event) {
- event.preventDefault();
- event.stopPropagation();
- }
- function onPointerDown(event) {
- event.preventDefault();
- event.stopPropagation();
- selectFiberForNode(event.target);
- }
- function onPointerOver(event) {
- event.preventDefault();
- event.stopPropagation();
- var target = event.target;
- if (target.tagName === 'IFRAME') {
- var iframe = target;
- try {
- if (!iframesListeningTo.has(iframe)) {
- var _window = iframe.contentWindow;
- registerListenersOnWindow(_window);
- iframesListeningTo.add(iframe);
- }
- } catch (error) {// This can error when the iframe is on a cross-origin.
- }
- } // Don't pass the name explicitly.
- // It will be inferred from DOM tag and Fiber owner.
- showOverlay([target], null, agent, false);
- selectFiberForNode(target);
- }
- function onPointerUp(event) {
- event.preventDefault();
- event.stopPropagation();
- }
- var selectFiberForNode = lodash_throttle_default()(esm(function (node) {
- var id = agent.getIDForNode(node);
- if (id !== null) {
- bridge.send('selectFiber', id);
- }
- }), 200, // Don't change the selection in the very first 200ms
- // because those are usually unintentional as you lift the cursor.
- {
- leading: false
- });
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/TraceUpdates/canvas.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var OUTLINE_COLOR = '#f0f0f0'; // Note these colors are in sync with DevTools Profiler chart colors.
- var COLORS = ['#37afa9', '#63b19e', '#80b393', '#97b488', '#abb67d', '#beb771', '#cfb965', '#dfba57', '#efbb49', '#febc38'];
- var canvas = null;
- function draw(nodeToData, agent) {
- if (window.document == null) {
- var nodesToDraw = [];
- iterateNodes(nodeToData, function (_, color, node) {
- nodesToDraw.push({
- node: node,
- color: color
- });
- });
- agent.emit('drawTraceUpdates', nodesToDraw);
- return;
- }
- if (canvas === null) {
- initialize();
- }
- var canvasFlow = canvas;
- canvasFlow.width = window.innerWidth;
- canvasFlow.height = window.innerHeight;
- var context = canvasFlow.getContext('2d');
- context.clearRect(0, 0, canvasFlow.width, canvasFlow.height);
- iterateNodes(nodeToData, function (rect, color) {
- if (rect !== null) {
- drawBorder(context, rect, color);
- }
- });
- }
- function iterateNodes(nodeToData, execute) {
- nodeToData.forEach(function (_ref, node) {
- var count = _ref.count,
- rect = _ref.rect;
- var colorIndex = Math.min(COLORS.length - 1, count - 1);
- var color = COLORS[colorIndex];
- execute(rect, color, node);
- });
- }
- function drawBorder(context, rect, color) {
- var height = rect.height,
- left = rect.left,
- top = rect.top,
- width = rect.width; // outline
- context.lineWidth = 1;
- context.strokeStyle = OUTLINE_COLOR;
- context.strokeRect(left - 1, top - 1, width + 2, height + 2); // inset
- context.lineWidth = 1;
- context.strokeStyle = OUTLINE_COLOR;
- context.strokeRect(left + 1, top + 1, width - 1, height - 1);
- context.strokeStyle = color;
- context.setLineDash([0]); // border
- context.lineWidth = 1;
- context.strokeRect(left, top, width - 1, height - 1);
- context.setLineDash([0]);
- }
- function destroy(agent) {
- if (window.document == null) {
- agent.emit('disableTraceUpdates');
- return;
- }
- if (canvas !== null) {
- if (canvas.parentNode != null) {
- canvas.parentNode.removeChild(canvas);
- }
- canvas = null;
- }
- }
- function initialize() {
- canvas = window.document.createElement('canvas');
- canvas.style.cssText = "\n xx-background-color: red;\n xx-opacity: 0.5;\n bottom: 0;\n left: 0;\n pointer-events: none;\n position: fixed;\n right: 0;\n top: 0;\n z-index: 1000000000;\n ";
- var root = window.document.documentElement;
- root.insertBefore(canvas, root.firstChild);
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/TraceUpdates/index.js
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // How long the rect should be shown for?
- var DISPLAY_DURATION = 250; // What's the longest we are willing to show the overlay for?
- // This can be important if we're getting a flurry of events (e.g. scroll update).
- var MAX_DISPLAY_DURATION = 3000; // How long should a rect be considered valid for?
- var REMEASUREMENT_AFTER_DURATION = 250; // Some environments (e.g. React Native / Hermes) don't support the performance API yet.
- var getCurrentTime = // $FlowFixMe[method-unbinding]
- (typeof performance === "undefined" ? "undefined" : _typeof(performance)) === 'object' && typeof performance.now === 'function' ? function () {
- return performance.now();
- } : function () {
- return Date.now();
- };
- var nodeToData = new Map();
- var TraceUpdates_agent = null;
- var drawAnimationFrameID = null;
- var isEnabled = false;
- var redrawTimeoutID = null;
- function TraceUpdates_initialize(injectedAgent) {
- TraceUpdates_agent = injectedAgent;
- TraceUpdates_agent.addListener('traceUpdates', traceUpdates);
- }
- function toggleEnabled(value) {
- isEnabled = value;
- if (!isEnabled) {
- nodeToData.clear();
- if (drawAnimationFrameID !== null) {
- cancelAnimationFrame(drawAnimationFrameID);
- drawAnimationFrameID = null;
- }
- if (redrawTimeoutID !== null) {
- clearTimeout(redrawTimeoutID);
- redrawTimeoutID = null;
- }
- destroy(TraceUpdates_agent);
- }
- }
- function traceUpdates(nodes) {
- if (!isEnabled) {
- return;
- }
- nodes.forEach(function (node) {
- var data = nodeToData.get(node);
- var now = getCurrentTime();
- var lastMeasuredAt = data != null ? data.lastMeasuredAt : 0;
- var rect = data != null ? data.rect : null;
- if (rect === null || lastMeasuredAt + REMEASUREMENT_AFTER_DURATION < now) {
- lastMeasuredAt = now;
- rect = measureNode(node);
- }
- nodeToData.set(node, {
- count: data != null ? data.count + 1 : 1,
- expirationTime: data != null ? Math.min(now + MAX_DISPLAY_DURATION, data.expirationTime + DISPLAY_DURATION) : now + DISPLAY_DURATION,
- lastMeasuredAt: lastMeasuredAt,
- rect: rect
- });
- });
- if (redrawTimeoutID !== null) {
- clearTimeout(redrawTimeoutID);
- redrawTimeoutID = null;
- }
- if (drawAnimationFrameID === null) {
- drawAnimationFrameID = requestAnimationFrame(prepareToDraw);
- }
- }
- function prepareToDraw() {
- drawAnimationFrameID = null;
- redrawTimeoutID = null;
- var now = getCurrentTime();
- var earliestExpiration = Number.MAX_VALUE; // Remove any items that have already expired.
- nodeToData.forEach(function (data, node) {
- if (data.expirationTime < now) {
- nodeToData.delete(node);
- } else {
- earliestExpiration = Math.min(earliestExpiration, data.expirationTime);
- }
- });
- draw(nodeToData, TraceUpdates_agent);
- if (earliestExpiration !== Number.MAX_VALUE) {
- redrawTimeoutID = setTimeout(prepareToDraw, earliestExpiration - now);
- }
- }
- function measureNode(node) {
- if (!node || typeof node.getBoundingClientRect !== 'function') {
- return null;
- }
- var currentWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
- return getNestedBoundingClientRect(node, currentWindow);
- }
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/console.js
- var backend_console = __webpack_require__(8);
- // CONCATENATED MODULE: ../react-devtools-shared/src/bridge.js
- function bridge_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { bridge_typeof = function _typeof(obj) { return typeof obj; }; } else { bridge_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return bridge_typeof(obj); }
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- function bridge_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function bridge_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function bridge_createClass(Constructor, protoProps, staticProps) { if (protoProps) bridge_defineProperties(Constructor.prototype, protoProps); if (staticProps) bridge_defineProperties(Constructor, staticProps); return Constructor; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (bridge_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- function bridge_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var BATCH_DURATION = 100; // This message specifies the version of the DevTools protocol currently supported by the backend,
- // as well as the earliest NPM version (e.g. "4.13.0") that protocol is supported by on the frontend.
- // This enables an older frontend to display an upgrade message to users for a newer, unsupported backend.
- // Bump protocol version whenever a backwards breaking change is made
- // in the messages sent between BackendBridge and FrontendBridge.
- // This mapping is embedded in both frontend and backend builds.
- //
- // The backend protocol will always be the latest entry in the BRIDGE_PROTOCOL array.
- //
- // When an older frontend connects to a newer backend,
- // the backend can send the minNpmVersion and the frontend can display an NPM upgrade prompt.
- //
- // When a newer frontend connects with an older protocol version,
- // the frontend can use the embedded minNpmVersion/maxNpmVersion values to display a downgrade prompt.
- var BRIDGE_PROTOCOL = [// This version technically never existed,
- // but a backwards breaking change was added in 4.11,
- // so the safest guess to downgrade the frontend would be to version 4.10.
- {
- version: 0,
- minNpmVersion: '"<4.11.0"',
- maxNpmVersion: '"<4.11.0"'
- }, // Versions 4.11.x – 4.12.x contained the backwards breaking change,
- // but we didn't add the "fix" of checking the protocol version until 4.13,
- // so we don't recommend downgrading to 4.11 or 4.12.
- {
- version: 1,
- minNpmVersion: '4.13.0',
- maxNpmVersion: '4.21.0'
- }, // Version 2 adds a StrictMode-enabled and supports-StrictMode bits to add-root operation.
- {
- version: 2,
- minNpmVersion: '4.22.0',
- maxNpmVersion: null
- }];
- var currentBridgeProtocol = BRIDGE_PROTOCOL[BRIDGE_PROTOCOL.length - 1];
- var Bridge = /*#__PURE__*/function (_EventEmitter) {
- _inherits(Bridge, _EventEmitter);
- var _super = _createSuper(Bridge);
- function Bridge(wall) {
- var _this;
- bridge_classCallCheck(this, Bridge);
- _this = _super.call(this);
- bridge_defineProperty(_assertThisInitialized(_this), "_isShutdown", false);
- bridge_defineProperty(_assertThisInitialized(_this), "_messageQueue", []);
- bridge_defineProperty(_assertThisInitialized(_this), "_timeoutID", null);
- bridge_defineProperty(_assertThisInitialized(_this), "_wallUnlisten", null);
- bridge_defineProperty(_assertThisInitialized(_this), "_flush", function () {
- // This method is used after the bridge is marked as destroyed in shutdown sequence,
- // so we do not bail out if the bridge marked as destroyed.
- // It is a private method that the bridge ensures is only called at the right times.
- if (_this._timeoutID !== null) {
- clearTimeout(_this._timeoutID);
- _this._timeoutID = null;
- }
- if (_this._messageQueue.length) {
- for (var i = 0; i < _this._messageQueue.length; i += 2) {
- var _this$_wall;
- (_this$_wall = _this._wall).send.apply(_this$_wall, [_this._messageQueue[i]].concat(_toConsumableArray(_this._messageQueue[i + 1])));
- }
- _this._messageQueue.length = 0; // Check again for queued messages in BATCH_DURATION ms. This will keep
- // flushing in a loop as long as messages continue to be added. Once no
- // more are, the timer expires.
- _this._timeoutID = setTimeout(_this._flush, BATCH_DURATION);
- }
- });
- bridge_defineProperty(_assertThisInitialized(_this), "overrideValueAtPath", function (_ref) {
- var id = _ref.id,
- path = _ref.path,
- rendererID = _ref.rendererID,
- type = _ref.type,
- value = _ref.value;
- switch (type) {
- case 'context':
- _this.send('overrideContext', {
- id: id,
- path: path,
- rendererID: rendererID,
- wasForwarded: true,
- value: value
- });
- break;
- case 'hooks':
- _this.send('overrideHookState', {
- id: id,
- path: path,
- rendererID: rendererID,
- wasForwarded: true,
- value: value
- });
- break;
- case 'props':
- _this.send('overrideProps', {
- id: id,
- path: path,
- rendererID: rendererID,
- wasForwarded: true,
- value: value
- });
- break;
- case 'state':
- _this.send('overrideState', {
- id: id,
- path: path,
- rendererID: rendererID,
- wasForwarded: true,
- value: value
- });
- break;
- }
- });
- _this._wall = wall;
- _this._wallUnlisten = wall.listen(function (message) {
- if (message && message.event) {
- _assertThisInitialized(_this).emit(message.event, message.payload);
- }
- }) || null; // Temporarily support older standalone front-ends sending commands to newer embedded backends.
- // We do this because React Native embeds the React DevTools backend,
- // but cannot control which version of the frontend users use.
- _this.addListener('overrideValueAtPath', _this.overrideValueAtPath);
- return _this;
- } // Listening directly to the wall isn't advised.
- // It can be used to listen for legacy (v3) messages (since they use a different format).
- bridge_createClass(Bridge, [{
- key: "send",
- value: function send(event) {
- if (this._isShutdown) {
- console.warn("Cannot send message \"".concat(event, "\" through a Bridge that has been shutdown."));
- return;
- } // When we receive a message:
- // - we add it to our queue of messages to be sent
- // - if there hasn't been a message recently, we set a timer for 0 ms in
- // the future, allowing all messages created in the same tick to be sent
- // together
- // - if there *has* been a message flushed in the last BATCH_DURATION ms
- // (or we're waiting for our setTimeout-0 to fire), then _timeoutID will
- // be set, and we'll simply add to the queue and wait for that
- for (var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- payload[_key - 1] = arguments[_key];
- }
- this._messageQueue.push(event, payload);
- if (!this._timeoutID) {
- this._timeoutID = setTimeout(this._flush, 0);
- }
- }
- }, {
- key: "shutdown",
- value: function shutdown() {
- if (this._isShutdown) {
- console.warn('Bridge was already shutdown.');
- return;
- } // Queue the shutdown outgoing message for subscribers.
- this.send('shutdown'); // Mark this bridge as destroyed, i.e. disable its public API.
- this._isShutdown = true; // Disable the API inherited from EventEmitter that can add more listeners and send more messages.
- // $FlowFixMe This property is not writable.
- this.addListener = function () {}; // $FlowFixMe This property is not writable.
- this.emit = function () {}; // NOTE: There's also EventEmitter API like `on` and `prependListener` that we didn't add to our Flow type of EventEmitter.
- // Unsubscribe this bridge incoming message listeners to be sure, and so they don't have to do that.
- this.removeAllListeners(); // Stop accepting and emitting incoming messages from the wall.
- var wallUnlisten = this._wallUnlisten;
- if (wallUnlisten) {
- wallUnlisten();
- } // Synchronously flush all queued outgoing messages.
- // At this step the subscribers' code may run in this call stack.
- do {
- this._flush();
- } while (this._messageQueue.length); // Make sure once again that there is no dangling timer.
- if (this._timeoutID !== null) {
- clearTimeout(this._timeoutID);
- this._timeoutID = null;
- }
- }
- }, {
- key: "wall",
- get: function get() {
- return this._wall;
- }
- }]);
- return Bridge;
- }(EventEmitter);
- /* harmony default export */ var src_bridge = (Bridge);
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/utils.js + 1 modules
- var utils = __webpack_require__(4);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/agent.js
- function agent_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { agent_typeof = function _typeof(obj) { return typeof obj; }; } else { agent_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return agent_typeof(obj); }
- function agent_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function agent_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function agent_createClass(Constructor, protoProps, staticProps) { if (protoProps) agent_defineProperties(Constructor.prototype, protoProps); if (staticProps) agent_defineProperties(Constructor, staticProps); return Constructor; }
- function agent_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) agent_setPrototypeOf(subClass, superClass); }
- function agent_setPrototypeOf(o, p) { agent_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return agent_setPrototypeOf(o, p); }
- function agent_createSuper(Derived) { var hasNativeReflectConstruct = agent_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = agent_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = agent_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return agent_possibleConstructorReturn(this, result); }; }
- function agent_possibleConstructorReturn(self, call) { if (call && (agent_typeof(call) === "object" || typeof call === "function")) { return call; } return agent_assertThisInitialized(self); }
- function agent_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function agent_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- function agent_getPrototypeOf(o) { agent_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return agent_getPrototypeOf(o); }
- function agent_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var agent_debug = function debug(methodName) {
- if (constants["s" /* __DEBUG__ */]) {
- var _console;
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- (_console = console).log.apply(_console, ["%cAgent %c".concat(methodName), 'color: purple; font-weight: bold;', 'font-weight: bold;'].concat(args));
- }
- };
- var agent_Agent = /*#__PURE__*/function (_EventEmitter) {
- agent_inherits(Agent, _EventEmitter);
- var _super = agent_createSuper(Agent);
- function Agent(bridge) {
- var _this;
- agent_classCallCheck(this, Agent);
- _this = _super.call(this);
- agent_defineProperty(agent_assertThisInitialized(_this), "_isProfiling", false);
- agent_defineProperty(agent_assertThisInitialized(_this), "_recordChangeDescriptions", false);
- agent_defineProperty(agent_assertThisInitialized(_this), "_rendererInterfaces", {});
- agent_defineProperty(agent_assertThisInitialized(_this), "_persistedSelection", null);
- agent_defineProperty(agent_assertThisInitialized(_this), "_persistedSelectionMatch", null);
- agent_defineProperty(agent_assertThisInitialized(_this), "_traceUpdatesEnabled", false);
- agent_defineProperty(agent_assertThisInitialized(_this), "clearErrorsAndWarnings", function (_ref) {
- var rendererID = _ref.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\""));
- } else {
- renderer.clearErrorsAndWarnings();
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "clearErrorsForFiberID", function (_ref2) {
- var id = _ref2.id,
- rendererID = _ref2.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\""));
- } else {
- renderer.clearErrorsForFiberID(id);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "clearWarningsForFiberID", function (_ref3) {
- var id = _ref3.id,
- rendererID = _ref3.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\""));
- } else {
- renderer.clearWarningsForFiberID(id);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "copyElementPath", function (_ref4) {
- var id = _ref4.id,
- path = _ref4.path,
- rendererID = _ref4.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.copyElementPath(id, path);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "deletePath", function (_ref5) {
- var hookID = _ref5.hookID,
- id = _ref5.id,
- path = _ref5.path,
- rendererID = _ref5.rendererID,
- type = _ref5.type;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.deletePath(type, id, hookID, path);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "getBackendVersion", function () {
- var version = "4.27.2-7f747b80e";
- if (version) {
- _this._bridge.send('backendVersion', version);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "getBridgeProtocol", function () {
- _this._bridge.send('bridgeProtocol', currentBridgeProtocol);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "getProfilingData", function (_ref6) {
- var rendererID = _ref6.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\""));
- }
- _this._bridge.send('profilingData', renderer.getProfilingData());
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "getProfilingStatus", function () {
- _this._bridge.send('profilingStatus', _this._isProfiling);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "getOwnersList", function (_ref7) {
- var id = _ref7.id,
- rendererID = _ref7.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- var owners = renderer.getOwnersList(id);
- _this._bridge.send('ownersList', {
- id: id,
- owners: owners
- });
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "inspectElement", function (_ref8) {
- var forceFullData = _ref8.forceFullData,
- id = _ref8.id,
- path = _ref8.path,
- rendererID = _ref8.rendererID,
- requestID = _ref8.requestID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- _this._bridge.send('inspectedElement', renderer.inspectElement(requestID, id, path, forceFullData)); // When user selects an element, stop trying to restore the selection,
- // and instead remember the current selection for the next reload.
- if (_this._persistedSelectionMatch === null || _this._persistedSelectionMatch.id !== id) {
- _this._persistedSelection = null;
- _this._persistedSelectionMatch = null;
- renderer.setTrackedPath(null);
- _this._throttledPersistSelection(rendererID, id);
- } // TODO: If there was a way to change the selected DOM element
- // in native Elements tab without forcing a switch to it, we'd do it here.
- // For now, it doesn't seem like there is a way to do that:
- // https://github.com/bvaughn/react-devtools-experimental/issues/102
- // (Setting $0 doesn't work, and calling inspect() switches the tab.)
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "logElementToConsole", function (_ref9) {
- var id = _ref9.id,
- rendererID = _ref9.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.logElementToConsole(id);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideError", function (_ref10) {
- var id = _ref10.id,
- rendererID = _ref10.rendererID,
- forceError = _ref10.forceError;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.overrideError(id, forceError);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideSuspense", function (_ref11) {
- var id = _ref11.id,
- rendererID = _ref11.rendererID,
- forceFallback = _ref11.forceFallback;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.overrideSuspense(id, forceFallback);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideValueAtPath", function (_ref12) {
- var hookID = _ref12.hookID,
- id = _ref12.id,
- path = _ref12.path,
- rendererID = _ref12.rendererID,
- type = _ref12.type,
- value = _ref12.value;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.overrideValueAtPath(type, id, hookID, path, value);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideContext", function (_ref13) {
- var id = _ref13.id,
- path = _ref13.path,
- rendererID = _ref13.rendererID,
- wasForwarded = _ref13.wasForwarded,
- value = _ref13.value;
- // Don't forward a message that's already been forwarded by the front-end Bridge.
- // We only need to process the override command once!
- if (!wasForwarded) {
- _this.overrideValueAtPath({
- id: id,
- path: path,
- rendererID: rendererID,
- type: 'context',
- value: value
- });
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideHookState", function (_ref14) {
- var id = _ref14.id,
- hookID = _ref14.hookID,
- path = _ref14.path,
- rendererID = _ref14.rendererID,
- wasForwarded = _ref14.wasForwarded,
- value = _ref14.value;
- // Don't forward a message that's already been forwarded by the front-end Bridge.
- // We only need to process the override command once!
- if (!wasForwarded) {
- _this.overrideValueAtPath({
- id: id,
- path: path,
- rendererID: rendererID,
- type: 'hooks',
- value: value
- });
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideProps", function (_ref15) {
- var id = _ref15.id,
- path = _ref15.path,
- rendererID = _ref15.rendererID,
- wasForwarded = _ref15.wasForwarded,
- value = _ref15.value;
- // Don't forward a message that's already been forwarded by the front-end Bridge.
- // We only need to process the override command once!
- if (!wasForwarded) {
- _this.overrideValueAtPath({
- id: id,
- path: path,
- rendererID: rendererID,
- type: 'props',
- value: value
- });
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "overrideState", function (_ref16) {
- var id = _ref16.id,
- path = _ref16.path,
- rendererID = _ref16.rendererID,
- wasForwarded = _ref16.wasForwarded,
- value = _ref16.value;
- // Don't forward a message that's already been forwarded by the front-end Bridge.
- // We only need to process the override command once!
- if (!wasForwarded) {
- _this.overrideValueAtPath({
- id: id,
- path: path,
- rendererID: rendererID,
- type: 'state',
- value: value
- });
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "reloadAndProfile", function (recordChangeDescriptions) {
- Object(storage["e" /* sessionStorageSetItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */], 'true');
- Object(storage["e" /* sessionStorageSetItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */], recordChangeDescriptions ? 'true' : 'false'); // This code path should only be hit if the shell has explicitly told the Store that it supports profiling.
- // In that case, the shell must also listen for this specific message to know when it needs to reload the app.
- // The agent can't do this in a way that is renderer agnostic.
- _this._bridge.send('reloadAppForProfiling');
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "renamePath", function (_ref17) {
- var hookID = _ref17.hookID,
- id = _ref17.id,
- newPath = _ref17.newPath,
- oldPath = _ref17.oldPath,
- rendererID = _ref17.rendererID,
- type = _ref17.type;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.renamePath(type, id, hookID, oldPath, newPath);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "setTraceUpdatesEnabled", function (traceUpdatesEnabled) {
- _this._traceUpdatesEnabled = traceUpdatesEnabled;
- toggleEnabled(traceUpdatesEnabled);
- for (var rendererID in _this._rendererInterfaces) {
- var renderer = _this._rendererInterfaces[rendererID];
- renderer.setTraceUpdatesEnabled(traceUpdatesEnabled);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "syncSelectionFromNativeElementsPanel", function () {
- var target = window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$0;
- if (target == null) {
- return;
- }
- _this.selectNode(target);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "shutdown", function () {
- // Clean up the overlay if visible, and associated events.
- _this.emit('shutdown');
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "startProfiling", function (recordChangeDescriptions) {
- _this._recordChangeDescriptions = recordChangeDescriptions;
- _this._isProfiling = true;
- for (var rendererID in _this._rendererInterfaces) {
- var renderer = _this._rendererInterfaces[rendererID];
- renderer.startProfiling(recordChangeDescriptions);
- }
- _this._bridge.send('profilingStatus', _this._isProfiling);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "stopProfiling", function () {
- _this._isProfiling = false;
- _this._recordChangeDescriptions = false;
- for (var rendererID in _this._rendererInterfaces) {
- var renderer = _this._rendererInterfaces[rendererID];
- renderer.stopProfiling();
- }
- _this._bridge.send('profilingStatus', _this._isProfiling);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "stopInspectingNative", function (selected) {
- _this._bridge.send('stopInspectingNative', selected);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "storeAsGlobal", function (_ref18) {
- var count = _ref18.count,
- id = _ref18.id,
- path = _ref18.path,
- rendererID = _ref18.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.storeAsGlobal(id, path, count);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "updateConsolePatchSettings", function (_ref19) {
- var appendComponentStack = _ref19.appendComponentStack,
- breakOnConsoleErrors = _ref19.breakOnConsoleErrors,
- showInlineWarningsAndErrors = _ref19.showInlineWarningsAndErrors,
- hideConsoleLogsInStrictMode = _ref19.hideConsoleLogsInStrictMode,
- browserTheme = _ref19.browserTheme;
- // If the frontend preferences have changed,
- // or in the case of React Native- if the backend is just finding out the preferences-
- // then reinstall the console overrides.
- // It's safe to call `patchConsole` multiple times.
- Object(backend_console["a" /* patch */])({
- appendComponentStack: appendComponentStack,
- breakOnConsoleErrors: breakOnConsoleErrors,
- showInlineWarningsAndErrors: showInlineWarningsAndErrors,
- hideConsoleLogsInStrictMode: hideConsoleLogsInStrictMode,
- browserTheme: browserTheme
- });
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "updateComponentFilters", function (componentFilters) {
- for (var rendererID in _this._rendererInterfaces) {
- var renderer = _this._rendererInterfaces[rendererID];
- renderer.updateComponentFilters(componentFilters);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "viewAttributeSource", function (_ref20) {
- var id = _ref20.id,
- path = _ref20.path,
- rendererID = _ref20.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.prepareViewAttributeSource(id, path);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "viewElementSource", function (_ref21) {
- var id = _ref21.id,
- rendererID = _ref21.rendererID;
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\" for element \"").concat(id, "\""));
- } else {
- renderer.prepareViewElementSource(id);
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "onTraceUpdates", function (nodes) {
- _this.emit('traceUpdates', nodes);
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "onFastRefreshScheduled", function () {
- if (constants["s" /* __DEBUG__ */]) {
- agent_debug('onFastRefreshScheduled');
- }
- _this._bridge.send('fastRefreshScheduled');
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "onHookOperations", function (operations) {
- if (constants["s" /* __DEBUG__ */]) {
- agent_debug('onHookOperations', "(".concat(operations.length, ") [").concat(operations.join(', '), "]"));
- } // TODO:
- // The chrome.runtime does not currently support transferables; it forces JSON serialization.
- // See bug https://bugs.chromium.org/p/chromium/issues/detail?id=927134
- //
- // Regarding transferables, the postMessage doc states:
- // If the ownership of an object is transferred, it becomes unusable (neutered)
- // in the context it was sent from and becomes available only to the worker it was sent to.
- //
- // Even though Chrome is eventually JSON serializing the array buffer,
- // using the transferable approach also sometimes causes it to throw:
- // DOMException: Failed to execute 'postMessage' on 'Window': ArrayBuffer at index 0 is already neutered.
- //
- // See bug https://github.com/bvaughn/react-devtools-experimental/issues/25
- //
- // The Store has a fallback in place that parses the message as JSON if the type isn't an array.
- // For now the simplest fix seems to be to not transfer the array.
- // This will negatively impact performance on Firefox so it's unfortunate,
- // but until we're able to fix the Chrome error mentioned above, it seems necessary.
- //
- // this._bridge.send('operations', operations, [operations.buffer]);
- _this._bridge.send('operations', operations);
- if (_this._persistedSelection !== null) {
- var rendererID = operations[0];
- if (_this._persistedSelection.rendererID === rendererID) {
- // Check if we can select a deeper match for the persisted selection.
- var renderer = _this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\""));
- } else {
- var prevMatch = _this._persistedSelectionMatch;
- var nextMatch = renderer.getBestMatchForTrackedPath();
- _this._persistedSelectionMatch = nextMatch;
- var prevMatchID = prevMatch !== null ? prevMatch.id : null;
- var nextMatchID = nextMatch !== null ? nextMatch.id : null;
- if (prevMatchID !== nextMatchID) {
- if (nextMatchID !== null) {
- // We moved forward, unlocking a deeper node.
- _this._bridge.send('selectFiber', nextMatchID);
- }
- }
- if (nextMatch !== null && nextMatch.isFullMatch) {
- // We've just unlocked the innermost selected node.
- // There's no point tracking it further.
- _this._persistedSelection = null;
- _this._persistedSelectionMatch = null;
- renderer.setTrackedPath(null);
- }
- }
- }
- }
- });
- agent_defineProperty(agent_assertThisInitialized(_this), "_throttledPersistSelection", lodash_throttle_default()(function (rendererID, id) {
- // This is throttled, so both renderer and selected ID
- // might not be available by the time we read them.
- // This is why we need the defensive checks here.
- var renderer = _this._rendererInterfaces[rendererID];
- var path = renderer != null ? renderer.getPathForElement(id) : null;
- if (path !== null) {
- Object(storage["e" /* sessionStorageSetItem */])(constants["i" /* SESSION_STORAGE_LAST_SELECTION_KEY */], JSON.stringify({
- rendererID: rendererID,
- path: path
- }));
- } else {
- Object(storage["d" /* sessionStorageRemoveItem */])(constants["i" /* SESSION_STORAGE_LAST_SELECTION_KEY */]);
- }
- }, 1000));
- if (Object(storage["c" /* sessionStorageGetItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]) === 'true') {
- _this._recordChangeDescriptions = Object(storage["c" /* sessionStorageGetItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]) === 'true';
- _this._isProfiling = true;
- Object(storage["d" /* sessionStorageRemoveItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]);
- Object(storage["d" /* sessionStorageRemoveItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]);
- }
- var persistedSelectionString = Object(storage["c" /* sessionStorageGetItem */])(constants["i" /* SESSION_STORAGE_LAST_SELECTION_KEY */]);
- if (persistedSelectionString != null) {
- _this._persistedSelection = JSON.parse(persistedSelectionString);
- }
- _this._bridge = bridge;
- bridge.addListener('clearErrorsAndWarnings', _this.clearErrorsAndWarnings);
- bridge.addListener('clearErrorsForFiberID', _this.clearErrorsForFiberID);
- bridge.addListener('clearWarningsForFiberID', _this.clearWarningsForFiberID);
- bridge.addListener('copyElementPath', _this.copyElementPath);
- bridge.addListener('deletePath', _this.deletePath);
- bridge.addListener('getBackendVersion', _this.getBackendVersion);
- bridge.addListener('getBridgeProtocol', _this.getBridgeProtocol);
- bridge.addListener('getProfilingData', _this.getProfilingData);
- bridge.addListener('getProfilingStatus', _this.getProfilingStatus);
- bridge.addListener('getOwnersList', _this.getOwnersList);
- bridge.addListener('inspectElement', _this.inspectElement);
- bridge.addListener('logElementToConsole', _this.logElementToConsole);
- bridge.addListener('overrideError', _this.overrideError);
- bridge.addListener('overrideSuspense', _this.overrideSuspense);
- bridge.addListener('overrideValueAtPath', _this.overrideValueAtPath);
- bridge.addListener('reloadAndProfile', _this.reloadAndProfile);
- bridge.addListener('renamePath', _this.renamePath);
- bridge.addListener('setTraceUpdatesEnabled', _this.setTraceUpdatesEnabled);
- bridge.addListener('startProfiling', _this.startProfiling);
- bridge.addListener('stopProfiling', _this.stopProfiling);
- bridge.addListener('storeAsGlobal', _this.storeAsGlobal);
- bridge.addListener('syncSelectionFromNativeElementsPanel', _this.syncSelectionFromNativeElementsPanel);
- bridge.addListener('shutdown', _this.shutdown);
- bridge.addListener('updateConsolePatchSettings', _this.updateConsolePatchSettings);
- bridge.addListener('updateComponentFilters', _this.updateComponentFilters);
- bridge.addListener('viewAttributeSource', _this.viewAttributeSource);
- bridge.addListener('viewElementSource', _this.viewElementSource); // Temporarily support older standalone front-ends sending commands to newer embedded backends.
- // We do this because React Native embeds the React DevTools backend,
- // but cannot control which version of the frontend users use.
- bridge.addListener('overrideContext', _this.overrideContext);
- bridge.addListener('overrideHookState', _this.overrideHookState);
- bridge.addListener('overrideProps', _this.overrideProps);
- bridge.addListener('overrideState', _this.overrideState);
- if (_this._isProfiling) {
- bridge.send('profilingStatus', true);
- } // Send the Bridge protocol and backend versions, after initialization, in case the frontend has already requested it.
- // The Store may be instantiated beore the agent.
- var _version = "4.27.2-7f747b80e";
- if (_version) {
- _this._bridge.send('backendVersion', _version);
- }
- _this._bridge.send('bridgeProtocol', currentBridgeProtocol); // Notify the frontend if the backend supports the Storage API (e.g. localStorage).
- // If not, features like reload-and-profile will not work correctly and must be disabled.
- var isBackendStorageAPISupported = false;
- try {
- localStorage.getItem('test');
- isBackendStorageAPISupported = true;
- } catch (error) {}
- bridge.send('isBackendStorageAPISupported', isBackendStorageAPISupported);
- bridge.send('isSynchronousXHRSupported', Object(utils["k" /* isSynchronousXHRSupported */])());
- setupHighlighter(bridge, agent_assertThisInitialized(_this));
- TraceUpdates_initialize(agent_assertThisInitialized(_this));
- return _this;
- }
- agent_createClass(Agent, [{
- key: "getInstanceAndStyle",
- value: function getInstanceAndStyle(_ref22) {
- var id = _ref22.id,
- rendererID = _ref22.rendererID;
- var renderer = this._rendererInterfaces[rendererID];
- if (renderer == null) {
- console.warn("Invalid renderer id \"".concat(rendererID, "\""));
- return null;
- }
- return renderer.getInstanceAndStyle(id);
- }
- }, {
- key: "getBestMatchingRendererInterface",
- value: function getBestMatchingRendererInterface(node) {
- var bestMatch = null;
- for (var rendererID in this._rendererInterfaces) {
- var renderer = this._rendererInterfaces[rendererID];
- var fiber = renderer.getFiberForNative(node);
- if (fiber !== null) {
- // check if fiber.stateNode is matching the original hostInstance
- if (fiber.stateNode === node) {
- return renderer;
- } else if (bestMatch === null) {
- bestMatch = renderer;
- }
- }
- } // if an exact match is not found, return the first valid renderer as fallback
- return bestMatch;
- }
- }, {
- key: "getIDForNode",
- value: function getIDForNode(node) {
- var rendererInterface = this.getBestMatchingRendererInterface(node);
- if (rendererInterface != null) {
- try {
- return rendererInterface.getFiberIDForNative(node, true);
- } catch (error) {// Some old React versions might throw if they can't find a match.
- // If so we should ignore it...
- }
- }
- return null;
- }
- }, {
- key: "selectNode",
- value: function selectNode(target) {
- var id = this.getIDForNode(target);
- if (id !== null) {
- this._bridge.send('selectFiber', id);
- }
- }
- }, {
- key: "setRendererInterface",
- value: function setRendererInterface(rendererID, rendererInterface) {
- this._rendererInterfaces[rendererID] = rendererInterface;
- if (this._isProfiling) {
- rendererInterface.startProfiling(this._recordChangeDescriptions);
- }
- rendererInterface.setTraceUpdatesEnabled(this._traceUpdatesEnabled); // When the renderer is attached, we need to tell it whether
- // we remember the previous selection that we'd like to restore.
- // It'll start tracking mounts for matches to the last selection path.
- var selection = this._persistedSelection;
- if (selection !== null && selection.rendererID === rendererID) {
- rendererInterface.setTrackedPath(selection.path);
- }
- }
- }, {
- key: "onUnsupportedRenderer",
- value: function onUnsupportedRenderer(rendererID) {
- this._bridge.send('unsupportedRendererVersion', rendererID);
- }
- }, {
- key: "rendererInterfaces",
- get: function get() {
- return this._rendererInterfaces;
- }
- }]);
- return Agent;
- }(EventEmitter);
- // CONCATENATED MODULE: ../react-devtools-shared/src/hook.js
- function hook_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { hook_typeof = function _typeof(obj) { return typeof obj; }; } else { hook_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return hook_typeof(obj); }
- function hook_toConsumableArray(arr) { return hook_arrayWithoutHoles(arr) || hook_iterableToArray(arr) || hook_unsupportedIterableToArray(arr) || hook_nonIterableSpread(); }
- function hook_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function hook_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return hook_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return hook_arrayLikeToArray(o, minLen); }
- function hook_iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
- function hook_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return hook_arrayLikeToArray(arr); }
- function hook_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- /**
- * Install the hook on window, which is an event emitter.
- * Note because Chrome content scripts cannot directly modify the window object,
- * we are evaling this function by inserting a script tag.
- * That's why we have to inline the whole event emitter implementation,
- * the string format implementation, and part of the console implementation here.
- *
- *
- */
- function installHook(target) {
- if (target.hasOwnProperty('__REACT_DEVTOOLS_GLOBAL_HOOK__')) {
- return null;
- }
- var targetConsole = console;
- var targetConsoleMethods = {};
- for (var method in console) {
- targetConsoleMethods[method] = console[method];
- }
- function dangerous_setTargetConsoleForTesting(targetConsoleForTesting) {
- targetConsole = targetConsoleForTesting;
- targetConsoleMethods = {};
- for (var _method in targetConsole) {
- targetConsoleMethods[_method] = console[_method];
- }
- }
- function detectReactBuildType(renderer) {
- try {
- if (typeof renderer.version === 'string') {
- // React DOM Fiber (16+)
- if (renderer.bundleType > 0) {
- // This is not a production build.
- // We are currently only using 0 (PROD) and 1 (DEV)
- // but might add 2 (PROFILE) in the future.
- return 'development';
- } // React 16 uses flat bundles. If we report the bundle as production
- // version, it means we also minified and envified it ourselves.
- return 'production'; // Note: There is still a risk that the CommonJS entry point has not
- // been envified or uglified. In this case the user would have *both*
- // development and production bundle, but only the prod one would run.
- // This would be really bad. We have a separate check for this because
- // it happens *outside* of the renderer injection. See `checkDCE` below.
- } // $FlowFixMe[method-unbinding]
- var _toString = Function.prototype.toString;
- if (renderer.Mount && renderer.Mount._renderNewRootComponent) {
- // React DOM Stack
- var renderRootCode = _toString.call(renderer.Mount._renderNewRootComponent); // Filter out bad results (if that is even possible):
- if (renderRootCode.indexOf('function') !== 0) {
- // Hope for the best if we're not sure.
- return 'production';
- } // Check for React DOM Stack < 15.1.0 in development.
- // If it contains "storedMeasure" call, it's wrapped in ReactPerf (DEV only).
- // This would be true even if it's minified, as method name still matches.
- if (renderRootCode.indexOf('storedMeasure') !== -1) {
- return 'development';
- } // For other versions (and configurations) it's not so easy.
- // Let's quickly exclude proper production builds.
- // If it contains a warning message, it's either a DEV build,
- // or an PROD build without proper dead code elimination.
- if (renderRootCode.indexOf('should be a pure function') !== -1) {
- // Now how do we tell a DEV build from a bad PROD build?
- // If we see NODE_ENV, we're going to assume this is a dev build
- // because most likely it is referring to an empty shim.
- if (renderRootCode.indexOf('NODE_ENV') !== -1) {
- return 'development';
- } // If we see "development", we're dealing with an envified DEV build
- // (such as the official React DEV UMD).
- if (renderRootCode.indexOf('development') !== -1) {
- return 'development';
- } // I've seen process.env.NODE_ENV !== 'production' being smartly
- // replaced by `true` in DEV by Webpack. I don't know how that
- // works but we can safely guard against it because `true` was
- // never used in the function source since it was written.
- if (renderRootCode.indexOf('true') !== -1) {
- return 'development';
- } // By now either it is a production build that has not been minified,
- // or (worse) this is a minified development build using non-standard
- // environment (e.g. "staging"). We're going to look at whether
- // the function argument name is mangled:
- if ( // 0.13 to 15
- renderRootCode.indexOf('nextElement') !== -1 || // 0.12
- renderRootCode.indexOf('nextComponent') !== -1) {
- // We can't be certain whether this is a development build or not,
- // but it is definitely unminified.
- return 'unminified';
- } else {
- // This is likely a minified development build.
- return 'development';
- }
- } // By now we know that it's envified and dead code elimination worked,
- // but what if it's still not minified? (Is this even possible?)
- // Let's check matches for the first argument name.
- if ( // 0.13 to 15
- renderRootCode.indexOf('nextElement') !== -1 || // 0.12
- renderRootCode.indexOf('nextComponent') !== -1) {
- return 'unminified';
- } // Seems like we're using the production version.
- // However, the branch above is Stack-only so this is 15 or earlier.
- return 'outdated';
- }
- } catch (err) {// Weird environments may exist.
- // This code needs a higher fault tolerance
- // because it runs even with closed DevTools.
- // TODO: should we catch errors in all injected code, and not just this part?
- }
- return 'production';
- }
- function checkDCE(fn) {
- // This runs for production versions of React.
- // Needs to be super safe.
- try {
- // $FlowFixMe[method-unbinding]
- var _toString2 = Function.prototype.toString;
- var code = _toString2.call(fn); // This is a string embedded in the passed function under DEV-only
- // condition. However the function executes only in PROD. Therefore,
- // if we see it, dead code elimination did not work.
- if (code.indexOf('^_^') > -1) {
- // Remember to report during next injection.
- hasDetectedBadDCE = true; // Bonus: throw an exception hoping that it gets picked up by a reporting system.
- // Not synchronously so that it doesn't break the calling code.
- setTimeout(function () {
- throw new Error('React is running in production mode, but dead code ' + 'elimination has not been applied. Read how to correctly ' + 'configure React for production: ' + 'https://reactjs.org/link/perf-use-production-build');
- });
- }
- } catch (err) {}
- } // NOTE: KEEP IN SYNC with src/backend/utils.js
- function formatWithStyles(inputArgs, style) {
- if (inputArgs === undefined || inputArgs === null || inputArgs.length === 0 || // Matches any of %c but not %%c
- typeof inputArgs[0] === 'string' && inputArgs[0].match(/([^%]|^)(%c)/g) || style === undefined) {
- return inputArgs;
- } // Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
- var REGEXP = /([^%]|^)((%%)*)(%([oOdisf]))/g;
- if (typeof inputArgs[0] === 'string' && inputArgs[0].match(REGEXP)) {
- return ["%c".concat(inputArgs[0]), style].concat(hook_toConsumableArray(inputArgs.slice(1)));
- } else {
- var firstArg = inputArgs.reduce(function (formatStr, elem, i) {
- if (i > 0) {
- formatStr += ' ';
- }
- switch (hook_typeof(elem)) {
- case 'string':
- case 'boolean':
- case 'symbol':
- return formatStr += '%s';
- case 'number':
- var formatting = Number.isInteger(elem) ? '%i' : '%f';
- return formatStr += formatting;
- default:
- return formatStr += '%o';
- }
- }, '%c');
- return [firstArg, style].concat(hook_toConsumableArray(inputArgs));
- }
- }
- var unpatchFn = null; // NOTE: KEEP IN SYNC with src/backend/console.js:patchForStrictMode
- // This function hides or dims console logs during the initial double renderer
- // in Strict Mode. We need this function because during initial render,
- // React and DevTools are connecting and the renderer interface isn't avaiable
- // and we want to be able to have consistent logging behavior for double logs
- // during the initial renderer.
- function patchConsoleForInitialRenderInStrictMode(_ref) {
- var hideConsoleLogsInStrictMode = _ref.hideConsoleLogsInStrictMode,
- browserTheme = _ref.browserTheme;
- var overrideConsoleMethods = ['error', 'group', 'groupCollapsed', 'info', 'log', 'trace', 'warn'];
- if (unpatchFn !== null) {
- // Don't patch twice.
- return;
- }
- var originalConsoleMethods = {};
- unpatchFn = function unpatchFn() {
- for (var _method2 in originalConsoleMethods) {
- try {
- targetConsole[_method2] = originalConsoleMethods[_method2];
- } catch (error) {}
- }
- };
- overrideConsoleMethods.forEach(function (method) {
- try {
- var originalMethod = originalConsoleMethods[method] = targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ ? targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ : targetConsole[method];
- var overrideMethod = function overrideMethod() {
- if (!hideConsoleLogsInStrictMode) {
- // Dim the text color of the double logs if we're not
- // hiding them.
- var color;
- switch (method) {
- case 'warn':
- color = browserTheme === 'light' ? "rgba(250, 180, 50, 0.75)" : "rgba(250, 180, 50, 0.5)";
- break;
- case 'error':
- color = browserTheme === 'light' ? "rgba(250, 123, 130, 0.75)" : "rgba(250, 123, 130, 0.5)";
- break;
- case 'log':
- default:
- color = browserTheme === 'light' ? "rgba(125, 125, 125, 0.75)" : "rgba(125, 125, 125, 0.5)";
- break;
- }
- if (color) {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- originalMethod.apply(void 0, hook_toConsumableArray(formatWithStyles(args, "color: ".concat(color))));
- } else {
- throw Error('Console color is not defined');
- }
- }
- };
- overrideMethod.__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ = originalMethod;
- originalMethod.__REACT_DEVTOOLS_STRICT_MODE_OVERRIDE_METHOD__ = overrideMethod;
- targetConsole[method] = overrideMethod;
- } catch (error) {}
- });
- } // NOTE: KEEP IN SYNC with src/backend/console.js:unpatchForStrictMode
- function unpatchConsoleForInitialRenderInStrictMode() {
- if (unpatchFn !== null) {
- unpatchFn();
- unpatchFn = null;
- }
- }
- var uidCounter = 0;
- function inject(renderer) {
- var id = ++uidCounter;
- renderers.set(id, renderer);
- var reactBuildType = hasDetectedBadDCE ? 'deadcode' : detectReactBuildType(renderer); // Patching the console enables DevTools to do a few useful things:
- // * Append component stacks to warnings and error messages
- // * Disabling or marking logs during a double render in Strict Mode
- // * Disable logging during re-renders to inspect hooks (see inspectHooksOfFiber)
- //
- // For React Native, we intentionally patch early (during injection).
- // This provides React Native developers with components stacks even if they don't run DevTools.
- //
- // This won't work for DOM though, since this entire file is eval'ed and inserted as a script tag.
- // In that case, we'll only patch parts of the console that are needed during the first render
- // and patch everything else later (when the frontend attaches).
- //
- // Don't patch in test environments because we don't want to interfere with Jest's own console overrides.
- //
- // Note that because this function is inlined, this conditional check must only use static booleans.
- // Otherwise the extension will throw with an undefined error.
- // (See comments in the try/catch below for more context on inlining.)
- if (true) {
- try {
- // The installHook() function is injected by being stringified in the browser,
- // so imports outside of this function do not get included.
- //
- // Normally we could check "typeof patchConsole === 'function'",
- // but Webpack wraps imports with an object (e.g. _backend_console__WEBPACK_IMPORTED_MODULE_0__)
- // and the object itself will be undefined as well for the reasons mentioned above,
- // so we use try/catch instead.
- Object(backend_console["d" /* registerRenderer */])(renderer);
- Object(backend_console["b" /* patchConsoleUsingWindowValues */])();
- } catch (error) {}
- } // If we have just reloaded to profile, we need to inject the renderer interface before the app loads.
- // Otherwise the renderer won't yet exist and we can skip this step.
- var attach = target.__REACT_DEVTOOLS_ATTACH__;
- if (typeof attach === 'function') {
- var rendererInterface = attach(hook, id, renderer, target);
- hook.rendererInterfaces.set(id, rendererInterface);
- }
- hook.emit('renderer', {
- id: id,
- renderer: renderer,
- reactBuildType: reactBuildType
- });
- return id;
- }
- var hasDetectedBadDCE = false;
- function sub(event, fn) {
- hook.on(event, fn);
- return function () {
- return hook.off(event, fn);
- };
- }
- function on(event, fn) {
- if (!listeners[event]) {
- listeners[event] = [];
- }
- listeners[event].push(fn);
- }
- function off(event, fn) {
- if (!listeners[event]) {
- return;
- }
- var index = listeners[event].indexOf(fn);
- if (index !== -1) {
- listeners[event].splice(index, 1);
- }
- if (!listeners[event].length) {
- delete listeners[event];
- }
- }
- function emit(event, data) {
- if (listeners[event]) {
- listeners[event].map(function (fn) {
- return fn(data);
- });
- }
- }
- function getFiberRoots(rendererID) {
- var roots = fiberRoots;
- if (!roots[rendererID]) {
- roots[rendererID] = new Set();
- }
- return roots[rendererID];
- }
- function onCommitFiberUnmount(rendererID, fiber) {
- var rendererInterface = rendererInterfaces.get(rendererID);
- if (rendererInterface != null) {
- rendererInterface.handleCommitFiberUnmount(fiber);
- }
- }
- function onCommitFiberRoot(rendererID, root, priorityLevel) {
- var mountedRoots = hook.getFiberRoots(rendererID);
- var current = root.current;
- var isKnownRoot = mountedRoots.has(root);
- var isUnmounting = current.memoizedState == null || current.memoizedState.element == null; // Keep track of mounted roots so we can hydrate when DevTools connect.
- if (!isKnownRoot && !isUnmounting) {
- mountedRoots.add(root);
- } else if (isKnownRoot && isUnmounting) {
- mountedRoots.delete(root);
- }
- var rendererInterface = rendererInterfaces.get(rendererID);
- if (rendererInterface != null) {
- rendererInterface.handleCommitFiberRoot(root, priorityLevel);
- }
- }
- function onPostCommitFiberRoot(rendererID, root) {
- var rendererInterface = rendererInterfaces.get(rendererID);
- if (rendererInterface != null) {
- rendererInterface.handlePostCommitFiberRoot(root);
- }
- }
- function setStrictMode(rendererID, isStrictMode) {
- var rendererInterface = rendererInterfaces.get(rendererID);
- if (rendererInterface != null) {
- if (isStrictMode) {
- rendererInterface.patchConsoleForStrictMode();
- } else {
- rendererInterface.unpatchConsoleForStrictMode();
- }
- } else {
- // This should only happen during initial render in the extension before DevTools
- // finishes its handshake with the injected renderer
- if (isStrictMode) {
- var hideConsoleLogsInStrictMode = window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ === true;
- var browserTheme = window.__REACT_DEVTOOLS_BROWSER_THEME__;
- patchConsoleForInitialRenderInStrictMode({
- hideConsoleLogsInStrictMode: hideConsoleLogsInStrictMode,
- browserTheme: browserTheme
- });
- } else {
- unpatchConsoleForInitialRenderInStrictMode();
- }
- }
- }
- var openModuleRangesStack = [];
- var moduleRanges = [];
- function getTopStackFrameString(error) {
- var frames = error.stack.split('\n');
- var frame = frames.length > 1 ? frames[1] : null;
- return frame;
- }
- function getInternalModuleRanges() {
- return moduleRanges;
- }
- function registerInternalModuleStart(error) {
- var startStackFrame = getTopStackFrameString(error);
- if (startStackFrame !== null) {
- openModuleRangesStack.push(startStackFrame);
- }
- }
- function registerInternalModuleStop(error) {
- if (openModuleRangesStack.length > 0) {
- var startStackFrame = openModuleRangesStack.pop();
- var stopStackFrame = getTopStackFrameString(error);
- if (stopStackFrame !== null) {
- moduleRanges.push([startStackFrame, stopStackFrame]);
- }
- }
- } // TODO: More meaningful names for "rendererInterfaces" and "renderers".
- var fiberRoots = {};
- var rendererInterfaces = new Map();
- var listeners = {};
- var renderers = new Map();
- var hook = {
- rendererInterfaces: rendererInterfaces,
- listeners: listeners,
- // Fast Refresh for web relies on this.
- renderers: renderers,
- emit: emit,
- getFiberRoots: getFiberRoots,
- inject: inject,
- on: on,
- off: off,
- sub: sub,
- // This is a legacy flag.
- // React v16 checks the hook for this to ensure DevTools is new enough.
- supportsFiber: true,
- // React calls these methods.
- checkDCE: checkDCE,
- onCommitFiberUnmount: onCommitFiberUnmount,
- onCommitFiberRoot: onCommitFiberRoot,
- onPostCommitFiberRoot: onPostCommitFiberRoot,
- setStrictMode: setStrictMode,
- // Schedule Profiler runtime helpers.
- // These internal React modules to report their own boundaries
- // which in turn enables the profiler to dim or filter internal frames.
- getInternalModuleRanges: getInternalModuleRanges,
- registerInternalModuleStart: registerInternalModuleStart,
- registerInternalModuleStop: registerInternalModuleStop
- };
- if (false) {}
- Object.defineProperty(target, '__REACT_DEVTOOLS_GLOBAL_HOOK__', {
- // This property needs to be configurable for the test environment,
- // else we won't be able to delete and recreate it between tests.
- configurable: false,
- enumerable: false,
- get: function get() {
- return hook;
- }
- });
- return hook;
- }
- // EXTERNAL MODULE: ../react-devtools-shared/src/backend/renderer.js + 6 modules
- var backend_renderer = __webpack_require__(14);
- // EXTERNAL MODULE: ../react-devtools-shared/src/types.js
- var types = __webpack_require__(1);
- // EXTERNAL MODULE: ../react-devtools-shared/src/utils.js
- var src_utils = __webpack_require__(0);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/legacy/utils.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function decorate(object, attr, fn) {
- var old = object[attr]; // $FlowFixMe[missing-this-annot] webpack config needs to be updated to allow `this` type annotations
- object[attr] = function (instance) {
- return fn.call(this, old, arguments);
- };
- return old;
- }
- function decorateMany(source, fns) {
- var olds = {};
- for (var name in fns) {
- olds[name] = decorate(source, name, fns[name]);
- }
- return olds;
- }
- function restoreMany(source, olds) {
- for (var name in olds) {
- source[name] = olds[name];
- }
- } // $FlowFixMe[missing-this-annot] webpack config needs to be updated to allow `this` type annotations
- function forceUpdate(instance) {
- if (typeof instance.forceUpdate === 'function') {
- instance.forceUpdate();
- } else if (instance.updater != null && typeof instance.updater.enqueueForceUpdate === 'function') {
- instance.updater.enqueueForceUpdate(this, function () {}, 'forceUpdate');
- }
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/legacy/renderer.js
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { renderer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- function renderer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function renderer_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { renderer_typeof = function _typeof(obj) { return typeof obj; }; } else { renderer_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return renderer_typeof(obj); }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function getData(internalInstance) {
- var displayName = null;
- var key = null; // != used deliberately here to catch undefined and null
- if (internalInstance._currentElement != null) {
- if (internalInstance._currentElement.key) {
- key = String(internalInstance._currentElement.key);
- }
- var elementType = internalInstance._currentElement.type;
- if (typeof elementType === 'string') {
- displayName = elementType;
- } else if (typeof elementType === 'function') {
- displayName = Object(src_utils["h" /* getDisplayName */])(elementType);
- }
- }
- return {
- displayName: displayName,
- key: key
- };
- }
- function getElementType(internalInstance) {
- // != used deliberately here to catch undefined and null
- if (internalInstance._currentElement != null) {
- var elementType = internalInstance._currentElement.type;
- if (typeof elementType === 'function') {
- var publicInstance = internalInstance.getPublicInstance();
- if (publicInstance !== null) {
- return types["e" /* ElementTypeClass */];
- } else {
- return types["h" /* ElementTypeFunction */];
- }
- } else if (typeof elementType === 'string') {
- return types["i" /* ElementTypeHostComponent */];
- }
- }
- return types["k" /* ElementTypeOtherOrUnknown */];
- }
- function getChildren(internalInstance) {
- var children = []; // If the parent is a native node without rendered children, but with
- // multiple string children, then the `element` that gets passed in here is
- // a plain value -- a string or number.
- if (renderer_typeof(internalInstance) !== 'object') {// No children
- } else if (internalInstance._currentElement === null || internalInstance._currentElement === false) {// No children
- } else if (internalInstance._renderedComponent) {
- var child = internalInstance._renderedComponent;
- if (getElementType(child) !== types["k" /* ElementTypeOtherOrUnknown */]) {
- children.push(child);
- }
- } else if (internalInstance._renderedChildren) {
- var renderedChildren = internalInstance._renderedChildren;
- for (var name in renderedChildren) {
- var _child = renderedChildren[name];
- if (getElementType(_child) !== types["k" /* ElementTypeOtherOrUnknown */]) {
- children.push(_child);
- }
- }
- } // Note: we skip the case where children are just strings or numbers
- // because the new DevTools skips over host text nodes anyway.
- return children;
- }
- function renderer_attach(hook, rendererID, renderer, global) {
- var idToInternalInstanceMap = new Map();
- var internalInstanceToIDMap = new WeakMap();
- var internalInstanceToRootIDMap = new WeakMap();
- var getInternalIDForNative = null;
- var findNativeNodeForInternalID;
- var getFiberForNative = function getFiberForNative(node) {
- // Not implemented.
- return null;
- };
- if (renderer.ComponentTree) {
- getInternalIDForNative = function getInternalIDForNative(node, findNearestUnfilteredAncestor) {
- var internalInstance = renderer.ComponentTree.getClosestInstanceFromNode(node);
- return internalInstanceToIDMap.get(internalInstance) || null;
- };
- findNativeNodeForInternalID = function findNativeNodeForInternalID(id) {
- var internalInstance = idToInternalInstanceMap.get(id);
- return renderer.ComponentTree.getNodeFromInstance(internalInstance);
- };
- getFiberForNative = function getFiberForNative(node) {
- return renderer.ComponentTree.getClosestInstanceFromNode(node);
- };
- } else if (renderer.Mount.getID && renderer.Mount.getNode) {
- getInternalIDForNative = function getInternalIDForNative(node, findNearestUnfilteredAncestor) {
- // Not implemented.
- return null;
- };
- findNativeNodeForInternalID = function findNativeNodeForInternalID(id) {
- // Not implemented.
- return null;
- };
- }
- function getDisplayNameForFiberID(id) {
- var internalInstance = idToInternalInstanceMap.get(id);
- return internalInstance ? getData(internalInstance).displayName : null;
- }
- function getID(internalInstance) {
- if (renderer_typeof(internalInstance) !== 'object' || internalInstance === null) {
- throw new Error('Invalid internal instance: ' + internalInstance);
- }
- if (!internalInstanceToIDMap.has(internalInstance)) {
- var _id = Object(src_utils["k" /* getUID */])();
- internalInstanceToIDMap.set(internalInstance, _id);
- idToInternalInstanceMap.set(_id, internalInstance);
- }
- return internalInstanceToIDMap.get(internalInstance);
- }
- function areEqualArrays(a, b) {
- if (a.length !== b.length) {
- return false;
- }
- for (var i = 0; i < a.length; i++) {
- if (a[i] !== b[i]) {
- return false;
- }
- }
- return true;
- } // This is shared mutable state that lets us keep track of where we are.
- var parentIDStack = [];
- var oldReconcilerMethods = null;
- if (renderer.Reconciler) {
- // React 15
- oldReconcilerMethods = decorateMany(renderer.Reconciler, {
- mountComponent: function mountComponent(fn, args) {
- var internalInstance = args[0];
- var hostContainerInfo = args[3];
- if (getElementType(internalInstance) === types["k" /* ElementTypeOtherOrUnknown */]) {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- return fn.apply(this, args);
- }
- if (hostContainerInfo._topLevelWrapper === undefined) {
- // SSR
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- return fn.apply(this, args);
- }
- var id = getID(internalInstance); // Push the operation.
- var parentID = parentIDStack.length > 0 ? parentIDStack[parentIDStack.length - 1] : 0;
- recordMount(internalInstance, id, parentID);
- parentIDStack.push(id); // Remember the root.
- internalInstanceToRootIDMap.set(internalInstance, getID(hostContainerInfo._topLevelWrapper));
- try {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- var result = fn.apply(this, args);
- parentIDStack.pop();
- return result;
- } catch (err) {
- // $FlowFixMe[incompatible-type] found when upgrading Flow
- parentIDStack = [];
- throw err;
- } finally {
- if (parentIDStack.length === 0) {
- var rootID = internalInstanceToRootIDMap.get(internalInstance);
- if (rootID === undefined) {
- throw new Error('Expected to find root ID.');
- }
- flushPendingEvents(rootID);
- }
- }
- },
- performUpdateIfNecessary: function performUpdateIfNecessary(fn, args) {
- var internalInstance = args[0];
- if (getElementType(internalInstance) === types["k" /* ElementTypeOtherOrUnknown */]) {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- return fn.apply(this, args);
- }
- var id = getID(internalInstance);
- parentIDStack.push(id);
- var prevChildren = getChildren(internalInstance);
- try {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- var result = fn.apply(this, args);
- var nextChildren = getChildren(internalInstance);
- if (!areEqualArrays(prevChildren, nextChildren)) {
- // Push the operation
- recordReorder(internalInstance, id, nextChildren);
- }
- parentIDStack.pop();
- return result;
- } catch (err) {
- // $FlowFixMe[incompatible-type] found when upgrading Flow
- parentIDStack = [];
- throw err;
- } finally {
- if (parentIDStack.length === 0) {
- var rootID = internalInstanceToRootIDMap.get(internalInstance);
- if (rootID === undefined) {
- throw new Error('Expected to find root ID.');
- }
- flushPendingEvents(rootID);
- }
- }
- },
- receiveComponent: function receiveComponent(fn, args) {
- var internalInstance = args[0];
- if (getElementType(internalInstance) === types["k" /* ElementTypeOtherOrUnknown */]) {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- return fn.apply(this, args);
- }
- var id = getID(internalInstance);
- parentIDStack.push(id);
- var prevChildren = getChildren(internalInstance);
- try {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- var result = fn.apply(this, args);
- var nextChildren = getChildren(internalInstance);
- if (!areEqualArrays(prevChildren, nextChildren)) {
- // Push the operation
- recordReorder(internalInstance, id, nextChildren);
- }
- parentIDStack.pop();
- return result;
- } catch (err) {
- // $FlowFixMe[incompatible-type] found when upgrading Flow
- parentIDStack = [];
- throw err;
- } finally {
- if (parentIDStack.length === 0) {
- var rootID = internalInstanceToRootIDMap.get(internalInstance);
- if (rootID === undefined) {
- throw new Error('Expected to find root ID.');
- }
- flushPendingEvents(rootID);
- }
- }
- },
- unmountComponent: function unmountComponent(fn, args) {
- var internalInstance = args[0];
- if (getElementType(internalInstance) === types["k" /* ElementTypeOtherOrUnknown */]) {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- return fn.apply(this, args);
- }
- var id = getID(internalInstance);
- parentIDStack.push(id);
- try {
- // $FlowFixMe[object-this-reference] found when upgrading Flow
- var result = fn.apply(this, args);
- parentIDStack.pop(); // Push the operation.
- recordUnmount(internalInstance, id);
- return result;
- } catch (err) {
- // $FlowFixMe[incompatible-type] found when upgrading Flow
- parentIDStack = [];
- throw err;
- } finally {
- if (parentIDStack.length === 0) {
- var rootID = internalInstanceToRootIDMap.get(internalInstance);
- if (rootID === undefined) {
- throw new Error('Expected to find root ID.');
- }
- flushPendingEvents(rootID);
- }
- }
- }
- });
- }
- function cleanup() {
- if (oldReconcilerMethods !== null) {
- if (renderer.Component) {
- restoreMany(renderer.Component.Mixin, oldReconcilerMethods);
- } else {
- restoreMany(renderer.Reconciler, oldReconcilerMethods);
- }
- }
- oldReconcilerMethods = null;
- }
- function recordMount(internalInstance, id, parentID) {
- var isRoot = parentID === 0;
- if (constants["s" /* __DEBUG__ */]) {
- console.log('%crecordMount()', 'color: green; font-weight: bold;', id, getData(internalInstance).displayName);
- }
- if (isRoot) {
- // TODO Is this right? For all versions?
- var hasOwnerMetadata = internalInstance._currentElement != null && internalInstance._currentElement._owner != null;
- pushOperation(constants["l" /* TREE_OPERATION_ADD */]);
- pushOperation(id);
- pushOperation(types["m" /* ElementTypeRoot */]);
- pushOperation(0); // StrictMode compliant?
- pushOperation(0); // Profiling flag
- pushOperation(0); // StrictMode supported?
- pushOperation(hasOwnerMetadata ? 1 : 0);
- } else {
- var type = getElementType(internalInstance);
- var _getData = getData(internalInstance),
- displayName = _getData.displayName,
- key = _getData.key;
- var ownerID = internalInstance._currentElement != null && internalInstance._currentElement._owner != null ? getID(internalInstance._currentElement._owner) : 0;
- var displayNameStringID = getStringID(displayName);
- var keyStringID = getStringID(key);
- pushOperation(constants["l" /* TREE_OPERATION_ADD */]);
- pushOperation(id);
- pushOperation(type);
- pushOperation(parentID);
- pushOperation(ownerID);
- pushOperation(displayNameStringID);
- pushOperation(keyStringID);
- }
- }
- function recordReorder(internalInstance, id, nextChildren) {
- pushOperation(constants["o" /* TREE_OPERATION_REORDER_CHILDREN */]);
- pushOperation(id);
- var nextChildIDs = nextChildren.map(getID);
- pushOperation(nextChildIDs.length);
- for (var i = 0; i < nextChildIDs.length; i++) {
- pushOperation(nextChildIDs[i]);
- }
- }
- function recordUnmount(internalInstance, id) {
- pendingUnmountedIDs.push(id);
- idToInternalInstanceMap.delete(id);
- }
- function crawlAndRecordInitialMounts(id, parentID, rootID) {
- if (constants["s" /* __DEBUG__ */]) {
- console.group('crawlAndRecordInitialMounts() id:', id);
- }
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance != null) {
- internalInstanceToRootIDMap.set(internalInstance, rootID);
- recordMount(internalInstance, id, parentID);
- getChildren(internalInstance).forEach(function (child) {
- return crawlAndRecordInitialMounts(getID(child), id, rootID);
- });
- }
- if (constants["s" /* __DEBUG__ */]) {
- console.groupEnd();
- }
- }
- function flushInitialOperations() {
- // Crawl roots though and register any nodes that mounted before we were injected.
- var roots = renderer.Mount._instancesByReactRootID || renderer.Mount._instancesByContainerID;
- for (var key in roots) {
- var internalInstance = roots[key];
- var _id2 = getID(internalInstance);
- crawlAndRecordInitialMounts(_id2, 0, _id2);
- flushPendingEvents(_id2);
- }
- }
- var pendingOperations = [];
- var pendingStringTable = new Map();
- var pendingUnmountedIDs = [];
- var pendingStringTableLength = 0;
- var pendingUnmountedRootID = null;
- function flushPendingEvents(rootID) {
- if (pendingOperations.length === 0 && pendingUnmountedIDs.length === 0 && pendingUnmountedRootID === null) {
- return;
- }
- var numUnmountIDs = pendingUnmountedIDs.length + (pendingUnmountedRootID === null ? 0 : 1);
- var operations = new Array( // Identify which renderer this update is coming from.
- 2 + // [rendererID, rootFiberID]
- // How big is the string table?
- 1 + // [stringTableLength]
- // Then goes the actual string table.
- pendingStringTableLength + ( // All unmounts are batched in a single message.
- // [TREE_OPERATION_REMOVE, removedIDLength, ...ids]
- numUnmountIDs > 0 ? 2 + numUnmountIDs : 0) + // Mount operations
- pendingOperations.length); // Identify which renderer this update is coming from.
- // This enables roots to be mapped to renderers,
- // Which in turn enables fiber properations, states, and hooks to be inspected.
- var i = 0;
- operations[i++] = rendererID;
- operations[i++] = rootID; // Now fill in the string table.
- // [stringTableLength, str1Length, ...str1, str2Length, ...str2, ...]
- operations[i++] = pendingStringTableLength;
- pendingStringTable.forEach(function (value, key) {
- operations[i++] = key.length;
- var encodedKey = Object(src_utils["p" /* utfEncodeString */])(key);
- for (var j = 0; j < encodedKey.length; j++) {
- operations[i + j] = encodedKey[j];
- }
- i += key.length;
- });
- if (numUnmountIDs > 0) {
- // All unmounts except roots are batched in a single message.
- operations[i++] = constants["m" /* TREE_OPERATION_REMOVE */]; // The first number is how many unmounted IDs we're gonna send.
- operations[i++] = numUnmountIDs; // Fill in the unmounts
- for (var j = 0; j < pendingUnmountedIDs.length; j++) {
- operations[i++] = pendingUnmountedIDs[j];
- } // The root ID should always be unmounted last.
- if (pendingUnmountedRootID !== null) {
- operations[i] = pendingUnmountedRootID;
- i++;
- }
- } // Fill in the rest of the operations.
- for (var _j = 0; _j < pendingOperations.length; _j++) {
- operations[i + _j] = pendingOperations[_j];
- }
- i += pendingOperations.length;
- if (constants["s" /* __DEBUG__ */]) {
- Object(src_utils["m" /* printOperationsArray */])(operations);
- } // If we've already connected to the frontend, just pass the operations through.
- hook.emit('operations', operations);
- pendingOperations.length = 0;
- pendingUnmountedIDs = [];
- pendingUnmountedRootID = null;
- pendingStringTable.clear();
- pendingStringTableLength = 0;
- }
- function pushOperation(op) {
- if (false) {}
- pendingOperations.push(op);
- }
- function getStringID(str) {
- if (str === null) {
- return 0;
- }
- var existingID = pendingStringTable.get(str);
- if (existingID !== undefined) {
- return existingID;
- }
- var stringID = pendingStringTable.size + 1;
- pendingStringTable.set(str, stringID); // The string table total length needs to account
- // both for the string length, and for the array item
- // that contains the length itself. Hence + 1.
- pendingStringTableLength += str.length + 1;
- return stringID;
- }
- var currentlyInspectedElementID = null;
- var currentlyInspectedPaths = {}; // Track the intersection of currently inspected paths,
- // so that we can send their data along if the element is re-rendered.
- function mergeInspectedPaths(path) {
- var current = currentlyInspectedPaths;
- path.forEach(function (key) {
- if (!current[key]) {
- current[key] = {};
- }
- current = current[key];
- });
- }
- function createIsPathAllowed(key) {
- // This function helps prevent previously-inspected paths from being dehydrated in updates.
- // This is important to avoid a bad user experience where expanded toggles collapse on update.
- return function isPathAllowed(path) {
- var current = currentlyInspectedPaths[key];
- if (!current) {
- return false;
- }
- for (var i = 0; i < path.length; i++) {
- current = current[path[i]];
- if (!current) {
- return false;
- }
- }
- return true;
- };
- } // Fast path props lookup for React Native style editor.
- function getInstanceAndStyle(id) {
- var instance = null;
- var style = null;
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance != null) {
- instance = internalInstance._instance || null;
- var element = internalInstance._currentElement;
- if (element != null && element.props != null) {
- style = element.props.style || null;
- }
- }
- return {
- instance: instance,
- style: style
- };
- }
- function updateSelectedElement(id) {
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance == null) {
- console.warn("Could not find instance with id \"".concat(id, "\""));
- return;
- }
- switch (getElementType(internalInstance)) {
- case types["e" /* ElementTypeClass */]:
- global.$r = internalInstance._instance;
- break;
- case types["h" /* ElementTypeFunction */]:
- var element = internalInstance._currentElement;
- if (element == null) {
- console.warn("Could not find element with id \"".concat(id, "\""));
- return;
- }
- global.$r = {
- props: element.props,
- type: element.type
- };
- break;
- default:
- global.$r = null;
- break;
- }
- }
- function storeAsGlobal(id, path, count) {
- var inspectedElement = inspectElementRaw(id);
- if (inspectedElement !== null) {
- var value = Object(src_utils["j" /* getInObject */])(inspectedElement, path);
- var key = "$reactTemp".concat(count);
- window[key] = value;
- console.log(key);
- console.log(value);
- }
- }
- function copyElementPath(id, path) {
- var inspectedElement = inspectElementRaw(id);
- if (inspectedElement !== null) {
- Object(utils["b" /* copyToClipboard */])(Object(src_utils["j" /* getInObject */])(inspectedElement, path));
- }
- }
- function inspectElement(requestID, id, path, forceFullData) {
- if (forceFullData || currentlyInspectedElementID !== id) {
- currentlyInspectedElementID = id;
- currentlyInspectedPaths = {};
- }
- var inspectedElement = inspectElementRaw(id);
- if (inspectedElement === null) {
- return {
- id: id,
- responseID: requestID,
- type: 'not-found'
- };
- }
- if (path !== null) {
- mergeInspectedPaths(path);
- } // Any time an inspected element has an update,
- // we should update the selected $r value as wel.
- // Do this before dehydration (cleanForBridge).
- updateSelectedElement(id);
- inspectedElement.context = Object(utils["a" /* cleanForBridge */])(inspectedElement.context, createIsPathAllowed('context'));
- inspectedElement.props = Object(utils["a" /* cleanForBridge */])(inspectedElement.props, createIsPathAllowed('props'));
- inspectedElement.state = Object(utils["a" /* cleanForBridge */])(inspectedElement.state, createIsPathAllowed('state'));
- return {
- id: id,
- responseID: requestID,
- type: 'full-data',
- value: inspectedElement
- };
- }
- function inspectElementRaw(id) {
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance == null) {
- return null;
- }
- var _getData2 = getData(internalInstance),
- displayName = _getData2.displayName,
- key = _getData2.key;
- var type = getElementType(internalInstance);
- var context = null;
- var owners = null;
- var props = null;
- var state = null;
- var source = null;
- var element = internalInstance._currentElement;
- if (element !== null) {
- props = element.props;
- source = element._source != null ? element._source : null;
- var owner = element._owner;
- if (owner) {
- owners = [];
- while (owner != null) {
- owners.push({
- displayName: getData(owner).displayName || 'Unknown',
- id: getID(owner),
- key: element.key,
- type: getElementType(owner)
- });
- if (owner._currentElement) {
- owner = owner._currentElement._owner;
- }
- }
- }
- }
- var publicInstance = internalInstance._instance;
- if (publicInstance != null) {
- context = publicInstance.context || null;
- state = publicInstance.state || null;
- } // Not implemented
- var errors = [];
- var warnings = [];
- return {
- id: id,
- // Does the current renderer support editable hooks and function props?
- canEditHooks: false,
- canEditFunctionProps: false,
- // Does the current renderer support advanced editing interface?
- canEditHooksAndDeletePaths: false,
- canEditHooksAndRenamePaths: false,
- canEditFunctionPropsDeletePaths: false,
- canEditFunctionPropsRenamePaths: false,
- // Toggle error boundary did not exist in legacy versions
- canToggleError: false,
- isErrored: false,
- targetErrorBoundaryID: null,
- // Suspense did not exist in legacy versions
- canToggleSuspense: false,
- // Can view component source location.
- canViewSource: type === types["e" /* ElementTypeClass */] || type === types["h" /* ElementTypeFunction */],
- // Only legacy context exists in legacy versions.
- hasLegacyContext: true,
- displayName: displayName,
- type: type,
- key: key != null ? key : null,
- // Inspectable properties.
- context: context,
- hooks: null,
- props: props,
- state: state,
- errors: errors,
- warnings: warnings,
- // List of owners
- owners: owners,
- // Location of component in source code.
- source: source,
- rootType: null,
- rendererPackageName: null,
- rendererVersion: null,
- plugins: {
- stylex: null
- }
- };
- }
- function logElementToConsole(id) {
- var result = inspectElementRaw(id);
- if (result === null) {
- console.warn("Could not find element with id \"".concat(id, "\""));
- return;
- }
- var supportsGroup = typeof console.groupCollapsed === 'function';
- if (supportsGroup) {
- console.groupCollapsed("[Click to expand] %c<".concat(result.displayName || 'Component', " />"), // --dom-tag-name-color is the CSS variable Chrome styles HTML elements with in the console.
- 'color: var(--dom-tag-name-color); font-weight: normal;');
- }
- if (result.props !== null) {
- console.log('Props:', result.props);
- }
- if (result.state !== null) {
- console.log('State:', result.state);
- }
- if (result.context !== null) {
- console.log('Context:', result.context);
- }
- var nativeNode = findNativeNodeForInternalID(id);
- if (nativeNode !== null) {
- console.log('Node:', nativeNode);
- }
- if (window.chrome || /firefox/i.test(navigator.userAgent)) {
- console.log('Right-click any value to save it as a global variable for further inspection.');
- }
- if (supportsGroup) {
- console.groupEnd();
- }
- }
- function prepareViewAttributeSource(id, path) {
- var inspectedElement = inspectElementRaw(id);
- if (inspectedElement !== null) {
- window.$attribute = Object(src_utils["j" /* getInObject */])(inspectedElement, path);
- }
- }
- function prepareViewElementSource(id) {
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance == null) {
- console.warn("Could not find instance with id \"".concat(id, "\""));
- return;
- }
- var element = internalInstance._currentElement;
- if (element == null) {
- console.warn("Could not find element with id \"".concat(id, "\""));
- return;
- }
- global.$type = element.type;
- }
- function deletePath(type, id, hookID, path) {
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance != null) {
- var publicInstance = internalInstance._instance;
- if (publicInstance != null) {
- switch (type) {
- case 'context':
- Object(src_utils["c" /* deletePathInObject */])(publicInstance.context, path);
- forceUpdate(publicInstance);
- break;
- case 'hooks':
- throw new Error('Hooks not supported by this renderer');
- case 'props':
- var element = internalInstance._currentElement;
- internalInstance._currentElement = _objectSpread(_objectSpread({}, element), {}, {
- props: Object(utils["c" /* copyWithDelete */])(element.props, path)
- });
- forceUpdate(publicInstance);
- break;
- case 'state':
- Object(src_utils["c" /* deletePathInObject */])(publicInstance.state, path);
- forceUpdate(publicInstance);
- break;
- }
- }
- }
- }
- function renamePath(type, id, hookID, oldPath, newPath) {
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance != null) {
- var publicInstance = internalInstance._instance;
- if (publicInstance != null) {
- switch (type) {
- case 'context':
- Object(src_utils["n" /* renamePathInObject */])(publicInstance.context, oldPath, newPath);
- forceUpdate(publicInstance);
- break;
- case 'hooks':
- throw new Error('Hooks not supported by this renderer');
- case 'props':
- var element = internalInstance._currentElement;
- internalInstance._currentElement = _objectSpread(_objectSpread({}, element), {}, {
- props: Object(utils["d" /* copyWithRename */])(element.props, oldPath, newPath)
- });
- forceUpdate(publicInstance);
- break;
- case 'state':
- Object(src_utils["n" /* renamePathInObject */])(publicInstance.state, oldPath, newPath);
- forceUpdate(publicInstance);
- break;
- }
- }
- }
- }
- function overrideValueAtPath(type, id, hookID, path, value) {
- var internalInstance = idToInternalInstanceMap.get(id);
- if (internalInstance != null) {
- var publicInstance = internalInstance._instance;
- if (publicInstance != null) {
- switch (type) {
- case 'context':
- Object(src_utils["o" /* setInObject */])(publicInstance.context, path, value);
- forceUpdate(publicInstance);
- break;
- case 'hooks':
- throw new Error('Hooks not supported by this renderer');
- case 'props':
- var element = internalInstance._currentElement;
- internalInstance._currentElement = _objectSpread(_objectSpread({}, element), {}, {
- props: Object(utils["e" /* copyWithSet */])(element.props, path, value)
- });
- forceUpdate(publicInstance);
- break;
- case 'state':
- Object(src_utils["o" /* setInObject */])(publicInstance.state, path, value);
- forceUpdate(publicInstance);
- break;
- }
- }
- }
- } // v16+ only features
- var getProfilingData = function getProfilingData() {
- throw new Error('getProfilingData not supported by this renderer');
- };
- var handleCommitFiberRoot = function handleCommitFiberRoot() {
- throw new Error('handleCommitFiberRoot not supported by this renderer');
- };
- var handleCommitFiberUnmount = function handleCommitFiberUnmount() {
- throw new Error('handleCommitFiberUnmount not supported by this renderer');
- };
- var handlePostCommitFiberRoot = function handlePostCommitFiberRoot() {
- throw new Error('handlePostCommitFiberRoot not supported by this renderer');
- };
- var overrideError = function overrideError() {
- throw new Error('overrideError not supported by this renderer');
- };
- var overrideSuspense = function overrideSuspense() {
- throw new Error('overrideSuspense not supported by this renderer');
- };
- var startProfiling = function startProfiling() {// Do not throw, since this would break a multi-root scenario where v15 and v16 were both present.
- };
- var stopProfiling = function stopProfiling() {// Do not throw, since this would break a multi-root scenario where v15 and v16 were both present.
- };
- function getBestMatchForTrackedPath() {
- // Not implemented.
- return null;
- }
- function getPathForElement(id) {
- // Not implemented.
- return null;
- }
- function updateComponentFilters(componentFilters) {// Not implemented.
- }
- function setTraceUpdatesEnabled(enabled) {// Not implemented.
- }
- function setTrackedPath(path) {// Not implemented.
- }
- function getOwnersList(id) {
- // Not implemented.
- return null;
- }
- function clearErrorsAndWarnings() {// Not implemented
- }
- function clearErrorsForFiberID(id) {// Not implemented
- }
- function clearWarningsForFiberID(id) {// Not implemented
- }
- function patchConsoleForStrictMode() {}
- function unpatchConsoleForStrictMode() {}
- return {
- clearErrorsAndWarnings: clearErrorsAndWarnings,
- clearErrorsForFiberID: clearErrorsForFiberID,
- clearWarningsForFiberID: clearWarningsForFiberID,
- cleanup: cleanup,
- copyElementPath: copyElementPath,
- deletePath: deletePath,
- flushInitialOperations: flushInitialOperations,
- getBestMatchForTrackedPath: getBestMatchForTrackedPath,
- getDisplayNameForFiberID: getDisplayNameForFiberID,
- getFiberForNative: getFiberForNative,
- getFiberIDForNative: getInternalIDForNative,
- getInstanceAndStyle: getInstanceAndStyle,
- findNativeNodesForFiberID: function findNativeNodesForFiberID(id) {
- var nativeNode = findNativeNodeForInternalID(id);
- return nativeNode == null ? null : [nativeNode];
- },
- getOwnersList: getOwnersList,
- getPathForElement: getPathForElement,
- getProfilingData: getProfilingData,
- handleCommitFiberRoot: handleCommitFiberRoot,
- handleCommitFiberUnmount: handleCommitFiberUnmount,
- handlePostCommitFiberRoot: handlePostCommitFiberRoot,
- inspectElement: inspectElement,
- logElementToConsole: logElementToConsole,
- overrideError: overrideError,
- overrideSuspense: overrideSuspense,
- overrideValueAtPath: overrideValueAtPath,
- renamePath: renamePath,
- patchConsoleForStrictMode: patchConsoleForStrictMode,
- prepareViewAttributeSource: prepareViewAttributeSource,
- prepareViewElementSource: prepareViewElementSource,
- renderer: renderer,
- setTraceUpdatesEnabled: setTraceUpdatesEnabled,
- setTrackedPath: setTrackedPath,
- startProfiling: startProfiling,
- stopProfiling: stopProfiling,
- storeAsGlobal: storeAsGlobal,
- unpatchConsoleForStrictMode: unpatchConsoleForStrictMode,
- updateComponentFilters: updateComponentFilters
- };
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/index.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function initBackend(hook, agent, global) {
- if (hook == null) {
- // DevTools didn't get injected into this page (maybe b'c of the contentType).
- return function () {};
- }
- var subs = [hook.sub('renderer-attached', function (_ref) {
- var id = _ref.id,
- renderer = _ref.renderer,
- rendererInterface = _ref.rendererInterface;
- agent.setRendererInterface(id, rendererInterface); // Now that the Store and the renderer interface are connected,
- // it's time to flush the pending operation codes to the frontend.
- rendererInterface.flushInitialOperations();
- }), hook.sub('unsupported-renderer-version', function (id) {
- agent.onUnsupportedRenderer(id);
- }), hook.sub('fastRefreshScheduled', agent.onFastRefreshScheduled), hook.sub('operations', agent.onHookOperations), hook.sub('traceUpdates', agent.onTraceUpdates) // TODO Add additional subscriptions required for profiling mode
- ];
- var attachRenderer = function attachRenderer(id, renderer) {
- var rendererInterface = hook.rendererInterfaces.get(id); // Inject any not-yet-injected renderers (if we didn't reload-and-profile)
- if (rendererInterface == null) {
- if (typeof renderer.findFiberByHostInstance === 'function') {
- // react-reconciler v16+
- rendererInterface = Object(backend_renderer["a" /* attach */])(hook, id, renderer, global);
- } else if (renderer.ComponentTree) {
- // react-dom v15
- rendererInterface = renderer_attach(hook, id, renderer, global);
- } else {// Older react-dom or other unsupported renderer version
- }
- if (rendererInterface != null) {
- hook.rendererInterfaces.set(id, rendererInterface);
- }
- } // Notify the DevTools frontend about new renderers.
- // This includes any that were attached early (via __REACT_DEVTOOLS_ATTACH__).
- if (rendererInterface != null) {
- hook.emit('renderer-attached', {
- id: id,
- renderer: renderer,
- rendererInterface: rendererInterface
- });
- } else {
- hook.emit('unsupported-renderer-version', id);
- }
- }; // Connect renderers that have already injected themselves.
- hook.renderers.forEach(function (renderer, id) {
- attachRenderer(id, renderer);
- }); // Connect any new renderers that injected themselves.
- subs.push(hook.sub('renderer', function (_ref2) {
- var id = _ref2.id,
- renderer = _ref2.renderer;
- attachRenderer(id, renderer);
- }));
- hook.emit('react-devtools', agent);
- hook.reactDevtoolsAgent = agent;
- var onAgentShutdown = function onAgentShutdown() {
- subs.forEach(function (fn) {
- return fn();
- });
- hook.rendererInterfaces.forEach(function (rendererInterface) {
- rendererInterface.cleanup();
- });
- hook.reactDevtoolsAgent = null;
- };
- agent.addListener('shutdown', onAgentShutdown);
- subs.push(function () {
- agent.removeListener('shutdown', onAgentShutdown);
- });
- return function () {
- subs.forEach(function (fn) {
- return fn();
- });
- };
- }
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/NativeStyleEditor/resolveBoxStyle.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- /**
- * This mirrors react-native/Libraries/Inspector/resolveBoxStyle.js (but without RTL support).
- *
- * Resolve a style property into it's component parts, e.g.
- *
- * resolveBoxStyle('margin', {margin: 5, marginBottom: 10})
- * -> {top: 5, left: 5, right: 5, bottom: 10}
- */
- function resolveBoxStyle(prefix, style) {
- var hasParts = false;
- var result = {
- bottom: 0,
- left: 0,
- right: 0,
- top: 0
- };
- var styleForAll = style[prefix];
- if (styleForAll != null) {
- // eslint-disable-next-line no-for-of-loops/no-for-of-loops
- for (var _i = 0, _Object$keys = Object.keys(result); _i < _Object$keys.length; _i++) {
- var key = _Object$keys[_i];
- result[key] = styleForAll;
- }
- hasParts = true;
- }
- var styleForHorizontal = style[prefix + 'Horizontal'];
- if (styleForHorizontal != null) {
- result.left = styleForHorizontal;
- result.right = styleForHorizontal;
- hasParts = true;
- } else {
- var styleForLeft = style[prefix + 'Left'];
- if (styleForLeft != null) {
- result.left = styleForLeft;
- hasParts = true;
- }
- var styleForRight = style[prefix + 'Right'];
- if (styleForRight != null) {
- result.right = styleForRight;
- hasParts = true;
- }
- var styleForEnd = style[prefix + 'End'];
- if (styleForEnd != null) {
- // TODO RTL support
- result.right = styleForEnd;
- hasParts = true;
- }
- var styleForStart = style[prefix + 'Start'];
- if (styleForStart != null) {
- // TODO RTL support
- result.left = styleForStart;
- hasParts = true;
- }
- }
- var styleForVertical = style[prefix + 'Vertical'];
- if (styleForVertical != null) {
- result.bottom = styleForVertical;
- result.top = styleForVertical;
- hasParts = true;
- } else {
- var styleForBottom = style[prefix + 'Bottom'];
- if (styleForBottom != null) {
- result.bottom = styleForBottom;
- hasParts = true;
- }
- var styleForTop = style[prefix + 'Top'];
- if (styleForTop != null) {
- result.top = styleForTop;
- hasParts = true;
- }
- }
- return hasParts ? result : null;
- }
- // EXTERNAL MODULE: ../react-devtools-shared/src/isArray.js
- var isArray = __webpack_require__(6);
- // CONCATENATED MODULE: ../react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js
- function setupNativeStyleEditor_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { setupNativeStyleEditor_typeof = function _typeof(obj) { return typeof obj; }; } else { setupNativeStyleEditor_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return setupNativeStyleEditor_typeof(obj); }
- function setupNativeStyleEditor_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function setupNativeStyleEditor(bridge, agent, resolveNativeStyle, validAttributes) {
- bridge.addListener('NativeStyleEditor_measure', function (_ref) {
- var id = _ref.id,
- rendererID = _ref.rendererID;
- measureStyle(agent, bridge, resolveNativeStyle, id, rendererID);
- });
- bridge.addListener('NativeStyleEditor_renameAttribute', function (_ref2) {
- var id = _ref2.id,
- rendererID = _ref2.rendererID,
- oldName = _ref2.oldName,
- newName = _ref2.newName,
- value = _ref2.value;
- renameStyle(agent, id, rendererID, oldName, newName, value);
- setTimeout(function () {
- return measureStyle(agent, bridge, resolveNativeStyle, id, rendererID);
- });
- });
- bridge.addListener('NativeStyleEditor_setValue', function (_ref3) {
- var id = _ref3.id,
- rendererID = _ref3.rendererID,
- name = _ref3.name,
- value = _ref3.value;
- setStyle(agent, id, rendererID, name, value);
- setTimeout(function () {
- return measureStyle(agent, bridge, resolveNativeStyle, id, rendererID);
- });
- });
- bridge.send('isNativeStyleEditorSupported', {
- isSupported: true,
- validAttributes: validAttributes
- });
- }
- var EMPTY_BOX_STYLE = {
- top: 0,
- left: 0,
- right: 0,
- bottom: 0
- };
- var componentIDToStyleOverrides = new Map();
- function measureStyle(agent, bridge, resolveNativeStyle, id, rendererID) {
- var data = agent.getInstanceAndStyle({
- id: id,
- rendererID: rendererID
- });
- if (!data || !data.style) {
- bridge.send('NativeStyleEditor_styleAndLayout', {
- id: id,
- layout: null,
- style: null
- });
- return;
- }
- var instance = data.instance,
- style = data.style;
- var resolvedStyle = resolveNativeStyle(style); // If it's a host component we edited before, amend styles.
- var styleOverrides = componentIDToStyleOverrides.get(id);
- if (styleOverrides != null) {
- resolvedStyle = Object.assign({}, resolvedStyle, styleOverrides);
- }
- if (!instance || typeof instance.measure !== 'function') {
- bridge.send('NativeStyleEditor_styleAndLayout', {
- id: id,
- layout: null,
- style: resolvedStyle || null
- });
- return;
- }
- instance.measure(function (x, y, width, height, left, top) {
- // RN Android sometimes returns undefined here. Don't send measurements in this case.
- // https://github.com/jhen0409/react-native-debugger/issues/84#issuecomment-304611817
- if (typeof x !== 'number') {
- bridge.send('NativeStyleEditor_styleAndLayout', {
- id: id,
- layout: null,
- style: resolvedStyle || null
- });
- return;
- }
- var margin = resolvedStyle != null && resolveBoxStyle('margin', resolvedStyle) || EMPTY_BOX_STYLE;
- var padding = resolvedStyle != null && resolveBoxStyle('padding', resolvedStyle) || EMPTY_BOX_STYLE;
- bridge.send('NativeStyleEditor_styleAndLayout', {
- id: id,
- layout: {
- x: x,
- y: y,
- width: width,
- height: height,
- left: left,
- top: top,
- margin: margin,
- padding: padding
- },
- style: resolvedStyle || null
- });
- });
- }
- function shallowClone(object) {
- var cloned = {};
- for (var n in object) {
- cloned[n] = object[n];
- }
- return cloned;
- }
- function renameStyle(agent, id, rendererID, oldName, newName, value) {
- var _ref4;
- var data = agent.getInstanceAndStyle({
- id: id,
- rendererID: rendererID
- });
- if (!data || !data.style) {
- return;
- }
- var instance = data.instance,
- style = data.style;
- var newStyle = newName ? (_ref4 = {}, setupNativeStyleEditor_defineProperty(_ref4, oldName, undefined), setupNativeStyleEditor_defineProperty(_ref4, newName, value), _ref4) : setupNativeStyleEditor_defineProperty({}, oldName, undefined);
- var customStyle; // TODO It would be nice if the renderer interface abstracted this away somehow.
- if (instance !== null && typeof instance.setNativeProps === 'function') {
- // In the case of a host component, we need to use setNativeProps().
- // Remember to "correct" resolved styles when we read them next time.
- var styleOverrides = componentIDToStyleOverrides.get(id);
- if (!styleOverrides) {
- componentIDToStyleOverrides.set(id, newStyle);
- } else {
- Object.assign(styleOverrides, newStyle);
- } // TODO Fabric does not support setNativeProps; chat with Sebastian or Eli
- instance.setNativeProps({
- style: newStyle
- });
- } else if (Object(isArray["a" /* default */])(style)) {
- var lastIndex = style.length - 1;
- if (setupNativeStyleEditor_typeof(style[lastIndex]) === 'object' && !Object(isArray["a" /* default */])(style[lastIndex])) {
- customStyle = shallowClone(style[lastIndex]);
- delete customStyle[oldName];
- if (newName) {
- customStyle[newName] = value;
- } else {
- customStyle[oldName] = undefined;
- }
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style', lastIndex],
- value: customStyle
- });
- } else {
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style'],
- value: style.concat([newStyle])
- });
- }
- } else if (setupNativeStyleEditor_typeof(style) === 'object') {
- customStyle = shallowClone(style);
- delete customStyle[oldName];
- if (newName) {
- customStyle[newName] = value;
- } else {
- customStyle[oldName] = undefined;
- }
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style'],
- value: customStyle
- });
- } else {
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style'],
- value: [style, newStyle]
- });
- }
- agent.emit('hideNativeHighlight');
- }
- function setStyle(agent, id, rendererID, name, value) {
- var data = agent.getInstanceAndStyle({
- id: id,
- rendererID: rendererID
- });
- if (!data || !data.style) {
- return;
- }
- var instance = data.instance,
- style = data.style;
- var newStyle = setupNativeStyleEditor_defineProperty({}, name, value); // TODO It would be nice if the renderer interface abstracted this away somehow.
- if (instance !== null && typeof instance.setNativeProps === 'function') {
- // In the case of a host component, we need to use setNativeProps().
- // Remember to "correct" resolved styles when we read them next time.
- var styleOverrides = componentIDToStyleOverrides.get(id);
- if (!styleOverrides) {
- componentIDToStyleOverrides.set(id, newStyle);
- } else {
- Object.assign(styleOverrides, newStyle);
- } // TODO Fabric does not support setNativeProps; chat with Sebastian or Eli
- instance.setNativeProps({
- style: newStyle
- });
- } else if (Object(isArray["a" /* default */])(style)) {
- var lastLength = style.length - 1;
- if (setupNativeStyleEditor_typeof(style[lastLength]) === 'object' && !Object(isArray["a" /* default */])(style[lastLength])) {
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style', lastLength, name],
- value: value
- });
- } else {
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style'],
- value: style.concat([newStyle])
- });
- }
- } else {
- agent.overrideValueAtPath({
- type: 'props',
- id: id,
- rendererID: rendererID,
- path: ['style'],
- value: [style, newStyle]
- });
- }
- agent.emit('hideNativeHighlight');
- }
- // CONCATENATED MODULE: ./src/cachedSettings.js
- /**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // Note: all keys should be optional in this type, because users can use newer
- // versions of React DevTools with older versions of React Native, and the object
- // provided by React Native may not include all of this type's fields.
- function initializeUsingCachedSettings(devToolsSettingsManager) {
- initializeConsolePatchSettings(devToolsSettingsManager);
- }
- function initializeConsolePatchSettings(devToolsSettingsManager) {
- if (devToolsSettingsManager.getConsolePatchSettings == null) {
- return;
- }
- var consolePatchSettingsString = devToolsSettingsManager.getConsolePatchSettings();
- if (consolePatchSettingsString == null) {
- return;
- }
- var parsedConsolePatchSettings = parseConsolePatchSettings(consolePatchSettingsString);
- if (parsedConsolePatchSettings == null) {
- return;
- }
- Object(backend_console["f" /* writeConsolePatchSettingsToWindow */])(parsedConsolePatchSettings);
- }
- function parseConsolePatchSettings(consolePatchSettingsString) {
- var _castBool, _castBool2, _castBool3, _castBool4, _castBrowserTheme;
- var parsedValue = JSON.parse(consolePatchSettingsString !== null && consolePatchSettingsString !== void 0 ? consolePatchSettingsString : '{}');
- var appendComponentStack = parsedValue.appendComponentStack,
- breakOnConsoleErrors = parsedValue.breakOnConsoleErrors,
- showInlineWarningsAndErrors = parsedValue.showInlineWarningsAndErrors,
- hideConsoleLogsInStrictMode = parsedValue.hideConsoleLogsInStrictMode,
- browserTheme = parsedValue.browserTheme;
- return {
- appendComponentStack: (_castBool = Object(src_utils["a" /* castBool */])(appendComponentStack)) !== null && _castBool !== void 0 ? _castBool : true,
- breakOnConsoleErrors: (_castBool2 = Object(src_utils["a" /* castBool */])(breakOnConsoleErrors)) !== null && _castBool2 !== void 0 ? _castBool2 : false,
- showInlineWarningsAndErrors: (_castBool3 = Object(src_utils["a" /* castBool */])(showInlineWarningsAndErrors)) !== null && _castBool3 !== void 0 ? _castBool3 : true,
- hideConsoleLogsInStrictMode: (_castBool4 = Object(src_utils["a" /* castBool */])(hideConsoleLogsInStrictMode)) !== null && _castBool4 !== void 0 ? _castBool4 : false,
- browserTheme: (_castBrowserTheme = Object(src_utils["b" /* castBrowserTheme */])(browserTheme)) !== null && _castBrowserTheme !== void 0 ? _castBrowserTheme : 'dark'
- };
- }
- function cacheConsolePatchSettings(devToolsSettingsManager, value) {
- if (devToolsSettingsManager.setConsolePatchSettings == null) {
- return;
- }
- devToolsSettingsManager.setConsolePatchSettings(JSON.stringify(value));
- }
- // CONCATENATED MODULE: ./src/backend.js
- /**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- installHook(window);
- var backend_hook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
- var savedComponentFilters = Object(src_utils["g" /* getDefaultComponentFilters */])();
- function backend_debug(methodName) {
- if (constants["s" /* __DEBUG__ */]) {
- var _console;
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- (_console = console).log.apply(_console, ["%c[core/backend] %c".concat(methodName), 'color: teal; font-weight: bold;', 'font-weight: bold;'].concat(args));
- }
- }
- function connectToDevTools(options) {
- if (backend_hook == null) {
- // DevTools didn't get injected into this page (maybe b'c of the contentType).
- return;
- }
- var _ref = options || {},
- _ref$host = _ref.host,
- host = _ref$host === void 0 ? 'localhost' : _ref$host,
- nativeStyleEditorValidAttributes = _ref.nativeStyleEditorValidAttributes,
- _ref$useHttps = _ref.useHttps,
- useHttps = _ref$useHttps === void 0 ? false : _ref$useHttps,
- _ref$port = _ref.port,
- port = _ref$port === void 0 ? 8097 : _ref$port,
- websocket = _ref.websocket,
- _ref$resolveRNStyle = _ref.resolveRNStyle,
- resolveRNStyle = _ref$resolveRNStyle === void 0 ? null : _ref$resolveRNStyle,
- _ref$retryConnectionD = _ref.retryConnectionDelay,
- retryConnectionDelay = _ref$retryConnectionD === void 0 ? 2000 : _ref$retryConnectionD,
- _ref$isAppActive = _ref.isAppActive,
- isAppActive = _ref$isAppActive === void 0 ? function () {
- return true;
- } : _ref$isAppActive,
- devToolsSettingsManager = _ref.devToolsSettingsManager;
- var protocol = useHttps ? 'wss' : 'ws';
- var retryTimeoutID = null;
- function scheduleRetry() {
- if (retryTimeoutID === null) {
- // Two seconds because RN had issues with quick retries.
- retryTimeoutID = setTimeout(function () {
- return connectToDevTools(options);
- }, retryConnectionDelay);
- }
- }
- if (devToolsSettingsManager != null) {
- try {
- initializeUsingCachedSettings(devToolsSettingsManager);
- } catch (e) {
- // If we call a method on devToolsSettingsManager that throws, or if
- // is invalid data read out, don't throw and don't interrupt initialization
- console.error(e);
- }
- }
- if (!isAppActive()) {
- // If the app is in background, maybe retry later.
- // Don't actually attempt to connect until we're in foreground.
- scheduleRetry();
- return;
- }
- var bridge = null;
- var messageListeners = [];
- var uri = protocol + '://' + host + ':' + port; // If existing websocket is passed, use it.
- // This is necessary to support our custom integrations.
- // See D6251744.
- var ws = websocket ? websocket : new window.WebSocket(uri);
- ws.onclose = handleClose;
- ws.onerror = handleFailed;
- ws.onmessage = handleMessage;
- ws.onopen = function () {
- bridge = new src_bridge({
- listen: function listen(fn) {
- messageListeners.push(fn);
- return function () {
- var index = messageListeners.indexOf(fn);
- if (index >= 0) {
- messageListeners.splice(index, 1);
- }
- };
- },
- send: function send(event, payload, transferable) {
- if (ws.readyState === ws.OPEN) {
- if (constants["s" /* __DEBUG__ */]) {
- backend_debug('wall.send()', event, payload);
- }
- ws.send(JSON.stringify({
- event: event,
- payload: payload
- }));
- } else {
- if (constants["s" /* __DEBUG__ */]) {
- backend_debug('wall.send()', 'Shutting down bridge because of closed WebSocket connection');
- }
- if (bridge !== null) {
- bridge.shutdown();
- }
- scheduleRetry();
- }
- }
- });
- bridge.addListener('updateComponentFilters', function (componentFilters) {
- // Save filter changes in memory, in case DevTools is reloaded.
- // In that case, the renderer will already be using the updated values.
- // We'll lose these in between backend reloads but that can't be helped.
- savedComponentFilters = componentFilters;
- });
- if (devToolsSettingsManager != null && bridge != null) {
- bridge.addListener('updateConsolePatchSettings', function (consolePatchSettings) {
- return cacheConsolePatchSettings(devToolsSettingsManager, consolePatchSettings);
- });
- } // The renderer interface doesn't read saved component filters directly,
- // because they are generally stored in localStorage within the context of the extension.
- // Because of this it relies on the extension to pass filters.
- // In the case of the standalone DevTools being used with a website,
- // saved filters are injected along with the backend script tag so we shouldn't override them here.
- // This injection strategy doesn't work for React Native though.
- // Ideally the backend would save the filters itself, but RN doesn't provide a sync storage solution.
- // So for now we just fall back to using the default filters...
- if (window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ == null) {
- // $FlowFixMe[incompatible-use] found when upgrading Flow
- bridge.send('overrideComponentFilters', savedComponentFilters);
- } // TODO (npm-packages) Warn if "isBackendStorageAPISupported"
- // $FlowFixMe[incompatible-call] found when upgrading Flow
- var agent = new agent_Agent(bridge);
- agent.addListener('shutdown', function () {
- // If we received 'shutdown' from `agent`, we assume the `bridge` is already shutting down,
- // and that caused the 'shutdown' event on the `agent`, so we don't need to call `bridge.shutdown()` here.
- backend_hook.emit('shutdown');
- });
- initBackend(backend_hook, agent, window); // Setup React Native style editor if the environment supports it.
- if (resolveRNStyle != null || backend_hook.resolveRNStyle != null) {
- setupNativeStyleEditor( // $FlowFixMe[incompatible-call] found when upgrading Flow
- bridge, agent, resolveRNStyle || backend_hook.resolveRNStyle, nativeStyleEditorValidAttributes || backend_hook.nativeStyleEditorValidAttributes || null);
- } else {
- // Otherwise listen to detect if the environment later supports it.
- // For example, Flipper does not eagerly inject these values.
- // Instead it relies on the React Native Inspector to lazily inject them.
- var lazyResolveRNStyle;
- var lazyNativeStyleEditorValidAttributes;
- var initAfterTick = function initAfterTick() {
- if (bridge !== null) {
- setupNativeStyleEditor(bridge, agent, lazyResolveRNStyle, lazyNativeStyleEditorValidAttributes);
- }
- };
- if (!backend_hook.hasOwnProperty('resolveRNStyle')) {
- Object.defineProperty(backend_hook, 'resolveRNStyle', {
- enumerable: false,
- get: function get() {
- return lazyResolveRNStyle;
- },
- set: function set(value) {
- lazyResolveRNStyle = value;
- initAfterTick();
- }
- });
- }
- if (!backend_hook.hasOwnProperty('nativeStyleEditorValidAttributes')) {
- Object.defineProperty(backend_hook, 'nativeStyleEditorValidAttributes', {
- enumerable: false,
- get: function get() {
- return lazyNativeStyleEditorValidAttributes;
- },
- set: function set(value) {
- lazyNativeStyleEditorValidAttributes = value;
- initAfterTick();
- }
- });
- }
- }
- };
- function handleClose() {
- if (constants["s" /* __DEBUG__ */]) {
- backend_debug('WebSocket.onclose');
- }
- if (bridge !== null) {
- bridge.emit('shutdown');
- }
- scheduleRetry();
- }
- function handleFailed() {
- if (constants["s" /* __DEBUG__ */]) {
- backend_debug('WebSocket.onerror');
- }
- scheduleRetry();
- }
- function handleMessage(event) {
- var data;
- try {
- if (typeof event.data === 'string') {
- data = JSON.parse(event.data);
- if (constants["s" /* __DEBUG__ */]) {
- backend_debug('WebSocket.onmessage', data);
- }
- } else {
- throw Error();
- }
- } catch (e) {
- console.error('[React DevTools] Failed to parse JSON: ' + event.data);
- return;
- }
- messageListeners.forEach(function (fn) {
- try {
- fn(data);
- } catch (error) {
- // jsc doesn't play so well with tracebacks that go into eval'd code,
- // so the stack trace here will stop at the `eval()` call. Getting the
- // message that caused the error is the best we can do for now.
- console.log('[React DevTools] Error calling listener', data);
- console.log('error:', error);
- throw error;
- }
- });
- }
- }
- /***/ })
- /******/ ]);
- });
- //# sourceMappingURL=backend.js.map
|