chunk-3XPRMCCN.js 1021 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620
  1. var __defProp = Object.defineProperty;
  2. var __defProps = Object.defineProperties;
  3. var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  4. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  7. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  8. var __spreadValues = (a, b) => {
  9. for (var prop in b ||= {})
  10. if (__hasOwnProp.call(b, prop))
  11. __defNormalProp(a, prop, b[prop]);
  12. if (__getOwnPropSymbols)
  13. for (var prop of __getOwnPropSymbols(b)) {
  14. if (__propIsEnum.call(b, prop))
  15. __defNormalProp(a, prop, b[prop]);
  16. }
  17. return a;
  18. };
  19. var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
  20. var __objRest = (source, exclude) => {
  21. var target = {};
  22. for (var prop in source)
  23. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  24. target[prop] = source[prop];
  25. if (source != null && __getOwnPropSymbols)
  26. for (var prop of __getOwnPropSymbols(source)) {
  27. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  28. target[prop] = source[prop];
  29. }
  30. return target;
  31. };
  32. var __async = (__this, __arguments, generator) => {
  33. return new Promise((resolve, reject) => {
  34. var fulfilled = (value) => {
  35. try {
  36. step(generator.next(value));
  37. } catch (e) {
  38. reject(e);
  39. }
  40. };
  41. var rejected = (value) => {
  42. try {
  43. step(generator.throw(value));
  44. } catch (e) {
  45. reject(e);
  46. }
  47. };
  48. var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
  49. step((generator = generator.apply(__this, __arguments)).next());
  50. });
  51. };
  52. // node_modules/@angular/core/fesm2022/untracked-CS7WUAzb.mjs
  53. function defaultEquals(a, b) {
  54. return Object.is(a, b);
  55. }
  56. var activeConsumer = null;
  57. var inNotificationPhase = false;
  58. var epoch = 1;
  59. var SIGNAL = Symbol("SIGNAL");
  60. function setActiveConsumer(consumer) {
  61. const prev = activeConsumer;
  62. activeConsumer = consumer;
  63. return prev;
  64. }
  65. function getActiveConsumer() {
  66. return activeConsumer;
  67. }
  68. function isInNotificationPhase() {
  69. return inNotificationPhase;
  70. }
  71. var REACTIVE_NODE = {
  72. version: 0,
  73. lastCleanEpoch: 0,
  74. dirty: false,
  75. producerNode: void 0,
  76. producerLastReadVersion: void 0,
  77. producerIndexOfThis: void 0,
  78. nextProducerIndex: 0,
  79. liveConsumerNode: void 0,
  80. liveConsumerIndexOfThis: void 0,
  81. consumerAllowSignalWrites: false,
  82. consumerIsAlwaysLive: false,
  83. kind: "unknown",
  84. producerMustRecompute: () => false,
  85. producerRecomputeValue: () => {
  86. },
  87. consumerMarkedDirty: () => {
  88. },
  89. consumerOnSignalRead: () => {
  90. }
  91. };
  92. function producerAccessed(node) {
  93. if (inNotificationPhase) {
  94. throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : "");
  95. }
  96. if (activeConsumer === null) {
  97. return;
  98. }
  99. activeConsumer.consumerOnSignalRead(node);
  100. const idx = activeConsumer.nextProducerIndex++;
  101. assertConsumerNode(activeConsumer);
  102. if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
  103. if (consumerIsLive(activeConsumer)) {
  104. const staleProducer = activeConsumer.producerNode[idx];
  105. producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
  106. }
  107. }
  108. if (activeConsumer.producerNode[idx] !== node) {
  109. activeConsumer.producerNode[idx] = node;
  110. activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;
  111. }
  112. activeConsumer.producerLastReadVersion[idx] = node.version;
  113. }
  114. function producerIncrementEpoch() {
  115. epoch++;
  116. }
  117. function producerUpdateValueVersion(node) {
  118. if (consumerIsLive(node) && !node.dirty) {
  119. return;
  120. }
  121. if (!node.dirty && node.lastCleanEpoch === epoch) {
  122. return;
  123. }
  124. if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
  125. producerMarkClean(node);
  126. return;
  127. }
  128. node.producerRecomputeValue(node);
  129. producerMarkClean(node);
  130. }
  131. function producerNotifyConsumers(node) {
  132. if (node.liveConsumerNode === void 0) {
  133. return;
  134. }
  135. const prev = inNotificationPhase;
  136. inNotificationPhase = true;
  137. try {
  138. for (const consumer of node.liveConsumerNode) {
  139. if (!consumer.dirty) {
  140. consumerMarkDirty(consumer);
  141. }
  142. }
  143. } finally {
  144. inNotificationPhase = prev;
  145. }
  146. }
  147. function producerUpdatesAllowed() {
  148. return activeConsumer?.consumerAllowSignalWrites !== false;
  149. }
  150. function consumerMarkDirty(node) {
  151. node.dirty = true;
  152. producerNotifyConsumers(node);
  153. node.consumerMarkedDirty?.(node);
  154. }
  155. function producerMarkClean(node) {
  156. node.dirty = false;
  157. node.lastCleanEpoch = epoch;
  158. }
  159. function consumerBeforeComputation(node) {
  160. node && (node.nextProducerIndex = 0);
  161. return setActiveConsumer(node);
  162. }
  163. function consumerAfterComputation(node, prevConsumer) {
  164. setActiveConsumer(prevConsumer);
  165. if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
  166. return;
  167. }
  168. if (consumerIsLive(node)) {
  169. for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
  170. producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
  171. }
  172. }
  173. while (node.producerNode.length > node.nextProducerIndex) {
  174. node.producerNode.pop();
  175. node.producerLastReadVersion.pop();
  176. node.producerIndexOfThis.pop();
  177. }
  178. }
  179. function consumerPollProducersForChange(node) {
  180. assertConsumerNode(node);
  181. for (let i = 0; i < node.producerNode.length; i++) {
  182. const producer = node.producerNode[i];
  183. const seenVersion = node.producerLastReadVersion[i];
  184. if (seenVersion !== producer.version) {
  185. return true;
  186. }
  187. producerUpdateValueVersion(producer);
  188. if (seenVersion !== producer.version) {
  189. return true;
  190. }
  191. }
  192. return false;
  193. }
  194. function consumerDestroy(node) {
  195. assertConsumerNode(node);
  196. if (consumerIsLive(node)) {
  197. for (let i = 0; i < node.producerNode.length; i++) {
  198. producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
  199. }
  200. }
  201. node.producerNode.length = node.producerLastReadVersion.length = node.producerIndexOfThis.length = 0;
  202. if (node.liveConsumerNode) {
  203. node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0;
  204. }
  205. }
  206. function producerAddLiveConsumer(node, consumer, indexOfThis) {
  207. assertProducerNode(node);
  208. if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) {
  209. for (let i = 0; i < node.producerNode.length; i++) {
  210. node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);
  211. }
  212. }
  213. node.liveConsumerIndexOfThis.push(indexOfThis);
  214. return node.liveConsumerNode.push(consumer) - 1;
  215. }
  216. function producerRemoveLiveConsumerAtIndex(node, idx) {
  217. assertProducerNode(node);
  218. if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
  219. throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
  220. }
  221. if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) {
  222. for (let i = 0; i < node.producerNode.length; i++) {
  223. producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
  224. }
  225. }
  226. const lastIdx = node.liveConsumerNode.length - 1;
  227. node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
  228. node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
  229. node.liveConsumerNode.length--;
  230. node.liveConsumerIndexOfThis.length--;
  231. if (idx < node.liveConsumerNode.length) {
  232. const idxProducer = node.liveConsumerIndexOfThis[idx];
  233. const consumer = node.liveConsumerNode[idx];
  234. assertConsumerNode(consumer);
  235. consumer.producerIndexOfThis[idxProducer] = idx;
  236. }
  237. }
  238. function consumerIsLive(node) {
  239. return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;
  240. }
  241. function assertConsumerNode(node) {
  242. node.producerNode ??= [];
  243. node.producerIndexOfThis ??= [];
  244. node.producerLastReadVersion ??= [];
  245. }
  246. function assertProducerNode(node) {
  247. node.liveConsumerNode ??= [];
  248. node.liveConsumerIndexOfThis ??= [];
  249. }
  250. function isConsumerNode(node) {
  251. return node.producerNode !== void 0;
  252. }
  253. function createComputed(computation, equal) {
  254. const node = Object.create(COMPUTED_NODE);
  255. node.computation = computation;
  256. if (equal !== void 0) {
  257. node.equal = equal;
  258. }
  259. const computed2 = () => {
  260. producerUpdateValueVersion(node);
  261. producerAccessed(node);
  262. if (node.value === ERRORED) {
  263. throw node.error;
  264. }
  265. return node.value;
  266. };
  267. computed2[SIGNAL] = node;
  268. return computed2;
  269. }
  270. var UNSET = Symbol("UNSET");
  271. var COMPUTING = Symbol("COMPUTING");
  272. var ERRORED = Symbol("ERRORED");
  273. var COMPUTED_NODE = (() => {
  274. return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  275. value: UNSET,
  276. dirty: true,
  277. error: null,
  278. equal: defaultEquals,
  279. kind: "computed",
  280. producerMustRecompute(node) {
  281. return node.value === UNSET || node.value === COMPUTING;
  282. },
  283. producerRecomputeValue(node) {
  284. if (node.value === COMPUTING) {
  285. throw new Error("Detected cycle in computations.");
  286. }
  287. const oldValue = node.value;
  288. node.value = COMPUTING;
  289. const prevConsumer = consumerBeforeComputation(node);
  290. let newValue;
  291. let wasEqual = false;
  292. try {
  293. newValue = node.computation();
  294. setActiveConsumer(null);
  295. wasEqual = oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue);
  296. } catch (err) {
  297. newValue = ERRORED;
  298. node.error = err;
  299. } finally {
  300. consumerAfterComputation(node, prevConsumer);
  301. }
  302. if (wasEqual) {
  303. node.value = oldValue;
  304. return;
  305. }
  306. node.value = newValue;
  307. node.version++;
  308. }
  309. });
  310. })();
  311. function defaultThrowError() {
  312. throw new Error();
  313. }
  314. var throwInvalidWriteToSignalErrorFn = defaultThrowError;
  315. function throwInvalidWriteToSignalError(node) {
  316. throwInvalidWriteToSignalErrorFn(node);
  317. }
  318. function setThrowInvalidWriteToSignalError(fn) {
  319. throwInvalidWriteToSignalErrorFn = fn;
  320. }
  321. var postSignalSetFn = null;
  322. function createSignal(initialValue, equal) {
  323. const node = Object.create(SIGNAL_NODE);
  324. node.value = initialValue;
  325. if (equal !== void 0) {
  326. node.equal = equal;
  327. }
  328. const getter = () => {
  329. producerAccessed(node);
  330. return node.value;
  331. };
  332. getter[SIGNAL] = node;
  333. return getter;
  334. }
  335. function signalSetFn(node, newValue) {
  336. if (!producerUpdatesAllowed()) {
  337. throwInvalidWriteToSignalError(node);
  338. }
  339. if (!node.equal(node.value, newValue)) {
  340. node.value = newValue;
  341. signalValueChanged(node);
  342. }
  343. }
  344. function signalUpdateFn(node, updater) {
  345. if (!producerUpdatesAllowed()) {
  346. throwInvalidWriteToSignalError(node);
  347. }
  348. signalSetFn(node, updater(node.value));
  349. }
  350. var SIGNAL_NODE = (() => {
  351. return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  352. equal: defaultEquals,
  353. value: void 0,
  354. kind: "signal"
  355. });
  356. })();
  357. function signalValueChanged(node) {
  358. node.version++;
  359. producerIncrementEpoch();
  360. producerNotifyConsumers(node);
  361. postSignalSetFn?.();
  362. }
  363. function createLinkedSignal(sourceFn, computationFn, equalityFn) {
  364. const node = Object.create(LINKED_SIGNAL_NODE);
  365. node.source = sourceFn;
  366. node.computation = computationFn;
  367. if (equalityFn != void 0) {
  368. node.equal = equalityFn;
  369. }
  370. const linkedSignalGetter = () => {
  371. producerUpdateValueVersion(node);
  372. producerAccessed(node);
  373. if (node.value === ERRORED) {
  374. throw node.error;
  375. }
  376. return node.value;
  377. };
  378. const getter = linkedSignalGetter;
  379. getter[SIGNAL] = node;
  380. return getter;
  381. }
  382. function linkedSignalSetFn(node, newValue) {
  383. producerUpdateValueVersion(node);
  384. signalSetFn(node, newValue);
  385. producerMarkClean(node);
  386. }
  387. function linkedSignalUpdateFn(node, updater) {
  388. producerUpdateValueVersion(node);
  389. signalUpdateFn(node, updater);
  390. producerMarkClean(node);
  391. }
  392. var LINKED_SIGNAL_NODE = (() => {
  393. return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  394. value: UNSET,
  395. dirty: true,
  396. error: null,
  397. equal: defaultEquals,
  398. kind: "linkedSignal",
  399. producerMustRecompute(node) {
  400. return node.value === UNSET || node.value === COMPUTING;
  401. },
  402. producerRecomputeValue(node) {
  403. if (node.value === COMPUTING) {
  404. throw new Error("Detected cycle in computations.");
  405. }
  406. const oldValue = node.value;
  407. node.value = COMPUTING;
  408. const prevConsumer = consumerBeforeComputation(node);
  409. let newValue;
  410. try {
  411. const newSourceValue = node.source();
  412. const prev = oldValue === UNSET || oldValue === ERRORED ? void 0 : {
  413. source: node.sourceValue,
  414. value: oldValue
  415. };
  416. newValue = node.computation(newSourceValue, prev);
  417. node.sourceValue = newSourceValue;
  418. } catch (err) {
  419. newValue = ERRORED;
  420. node.error = err;
  421. } finally {
  422. consumerAfterComputation(node, prevConsumer);
  423. }
  424. if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
  425. node.value = oldValue;
  426. return;
  427. }
  428. node.value = newValue;
  429. node.version++;
  430. }
  431. });
  432. })();
  433. function setAlternateWeakRefImpl(impl) {
  434. }
  435. function untracked(nonReactiveReadsFn) {
  436. const prevConsumer = setActiveConsumer(null);
  437. try {
  438. return nonReactiveReadsFn();
  439. } finally {
  440. setActiveConsumer(prevConsumer);
  441. }
  442. }
  443. // node_modules/@angular/core/fesm2022/primitives/di.mjs
  444. var _currentInjector = void 0;
  445. function getCurrentInjector() {
  446. return _currentInjector;
  447. }
  448. function setCurrentInjector(injector) {
  449. const former = _currentInjector;
  450. _currentInjector = injector;
  451. return former;
  452. }
  453. var NOT_FOUND = Symbol("NotFound");
  454. // node_modules/@angular/core/fesm2022/primitives/signals.mjs
  455. function createWatch(fn, schedule, allowSignalWrites) {
  456. const node = Object.create(WATCH_NODE);
  457. if (allowSignalWrites) {
  458. node.consumerAllowSignalWrites = true;
  459. }
  460. node.fn = fn;
  461. node.schedule = schedule;
  462. const registerOnCleanup = (cleanupFn) => {
  463. node.cleanupFn = cleanupFn;
  464. };
  465. function isWatchNodeDestroyed(node2) {
  466. return node2.fn === null && node2.schedule === null;
  467. }
  468. function destroyWatchNode(node2) {
  469. if (!isWatchNodeDestroyed(node2)) {
  470. consumerDestroy(node2);
  471. node2.cleanupFn();
  472. node2.fn = null;
  473. node2.schedule = null;
  474. node2.cleanupFn = NOOP_CLEANUP_FN;
  475. }
  476. }
  477. const run = () => {
  478. if (node.fn === null) {
  479. return;
  480. }
  481. if (isInNotificationPhase()) {
  482. throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
  483. }
  484. node.dirty = false;
  485. if (node.hasRun && !consumerPollProducersForChange(node)) {
  486. return;
  487. }
  488. node.hasRun = true;
  489. const prevConsumer = consumerBeforeComputation(node);
  490. try {
  491. node.cleanupFn();
  492. node.cleanupFn = NOOP_CLEANUP_FN;
  493. node.fn(registerOnCleanup);
  494. } finally {
  495. consumerAfterComputation(node, prevConsumer);
  496. }
  497. };
  498. node.ref = {
  499. notify: () => consumerMarkDirty(node),
  500. run,
  501. cleanup: () => node.cleanupFn(),
  502. destroy: () => destroyWatchNode(node),
  503. [SIGNAL]: node
  504. };
  505. return node.ref;
  506. }
  507. var NOOP_CLEANUP_FN = () => {
  508. };
  509. var WATCH_NODE = (() => {
  510. return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  511. consumerIsAlwaysLive: true,
  512. consumerAllowSignalWrites: false,
  513. consumerMarkedDirty: (node) => {
  514. if (node.schedule !== null) {
  515. node.schedule(node.ref);
  516. }
  517. },
  518. hasRun: false,
  519. cleanupFn: NOOP_CLEANUP_FN
  520. });
  521. })();
  522. // node_modules/tslib/tslib.es6.mjs
  523. var extendStatics = function(d, b) {
  524. extendStatics = Object.setPrototypeOf || {
  525. __proto__: []
  526. } instanceof Array && function(d2, b2) {
  527. d2.__proto__ = b2;
  528. } || function(d2, b2) {
  529. for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
  530. };
  531. return extendStatics(d, b);
  532. };
  533. function __extends(d, b) {
  534. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  535. extendStatics(d, b);
  536. function __() {
  537. this.constructor = d;
  538. }
  539. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  540. }
  541. function __awaiter(thisArg, _arguments, P, generator) {
  542. function adopt(value) {
  543. return value instanceof P ? value : new P(function(resolve) {
  544. resolve(value);
  545. });
  546. }
  547. return new (P || (P = Promise))(function(resolve, reject) {
  548. function fulfilled(value) {
  549. try {
  550. step(generator.next(value));
  551. } catch (e) {
  552. reject(e);
  553. }
  554. }
  555. function rejected(value) {
  556. try {
  557. step(generator["throw"](value));
  558. } catch (e) {
  559. reject(e);
  560. }
  561. }
  562. function step(result) {
  563. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  564. }
  565. step((generator = generator.apply(thisArg, _arguments || [])).next());
  566. });
  567. }
  568. function __generator(thisArg, body) {
  569. var _ = {
  570. label: 0,
  571. sent: function() {
  572. if (t[0] & 1) throw t[1];
  573. return t[1];
  574. },
  575. trys: [],
  576. ops: []
  577. }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
  578. return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  579. return this;
  580. }), g;
  581. function verb(n) {
  582. return function(v) {
  583. return step([n, v]);
  584. };
  585. }
  586. function step(op) {
  587. if (f) throw new TypeError("Generator is already executing.");
  588. while (g && (g = 0, op[0] && (_ = 0)), _) try {
  589. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  590. if (y = 0, t) op = [op[0] & 2, t.value];
  591. switch (op[0]) {
  592. case 0:
  593. case 1:
  594. t = op;
  595. break;
  596. case 4:
  597. _.label++;
  598. return {
  599. value: op[1],
  600. done: false
  601. };
  602. case 5:
  603. _.label++;
  604. y = op[1];
  605. op = [0];
  606. continue;
  607. case 7:
  608. op = _.ops.pop();
  609. _.trys.pop();
  610. continue;
  611. default:
  612. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  613. _ = 0;
  614. continue;
  615. }
  616. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  617. _.label = op[1];
  618. break;
  619. }
  620. if (op[0] === 6 && _.label < t[1]) {
  621. _.label = t[1];
  622. t = op;
  623. break;
  624. }
  625. if (t && _.label < t[2]) {
  626. _.label = t[2];
  627. _.ops.push(op);
  628. break;
  629. }
  630. if (t[2]) _.ops.pop();
  631. _.trys.pop();
  632. continue;
  633. }
  634. op = body.call(thisArg, _);
  635. } catch (e) {
  636. op = [6, e];
  637. y = 0;
  638. } finally {
  639. f = t = 0;
  640. }
  641. if (op[0] & 5) throw op[1];
  642. return {
  643. value: op[0] ? op[1] : void 0,
  644. done: true
  645. };
  646. }
  647. }
  648. function __values(o) {
  649. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  650. if (m) return m.call(o);
  651. if (o && typeof o.length === "number") return {
  652. next: function() {
  653. if (o && i >= o.length) o = void 0;
  654. return {
  655. value: o && o[i++],
  656. done: !o
  657. };
  658. }
  659. };
  660. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  661. }
  662. function __read(o, n) {
  663. var m = typeof Symbol === "function" && o[Symbol.iterator];
  664. if (!m) return o;
  665. var i = m.call(o), r, ar = [], e;
  666. try {
  667. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  668. } catch (error) {
  669. e = {
  670. error
  671. };
  672. } finally {
  673. try {
  674. if (r && !r.done && (m = i["return"])) m.call(i);
  675. } finally {
  676. if (e) throw e.error;
  677. }
  678. }
  679. return ar;
  680. }
  681. function __spreadArray(to, from2, pack) {
  682. if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
  683. if (ar || !(i in from2)) {
  684. if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
  685. ar[i] = from2[i];
  686. }
  687. }
  688. return to.concat(ar || Array.prototype.slice.call(from2));
  689. }
  690. function __await(v) {
  691. return this instanceof __await ? (this.v = v, this) : new __await(v);
  692. }
  693. function __asyncGenerator(thisArg, _arguments, generator) {
  694. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  695. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  696. return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
  697. return this;
  698. }, i;
  699. function awaitReturn(f) {
  700. return function(v) {
  701. return Promise.resolve(v).then(f, reject);
  702. };
  703. }
  704. function verb(n, f) {
  705. if (g[n]) {
  706. i[n] = function(v) {
  707. return new Promise(function(a, b) {
  708. q.push([n, v, a, b]) > 1 || resume(n, v);
  709. });
  710. };
  711. if (f) i[n] = f(i[n]);
  712. }
  713. }
  714. function resume(n, v) {
  715. try {
  716. step(g[n](v));
  717. } catch (e) {
  718. settle(q[0][3], e);
  719. }
  720. }
  721. function step(r) {
  722. r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  723. }
  724. function fulfill(value) {
  725. resume("next", value);
  726. }
  727. function reject(value) {
  728. resume("throw", value);
  729. }
  730. function settle(f, v) {
  731. if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
  732. }
  733. }
  734. function __asyncValues(o) {
  735. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  736. var m = o[Symbol.asyncIterator], i;
  737. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
  738. return this;
  739. }, i);
  740. function verb(n) {
  741. i[n] = o[n] && function(v) {
  742. return new Promise(function(resolve, reject) {
  743. v = o[n](v), settle(resolve, reject, v.done, v.value);
  744. });
  745. };
  746. }
  747. function settle(resolve, reject, d, v) {
  748. Promise.resolve(v).then(function(v2) {
  749. resolve({
  750. value: v2,
  751. done: d
  752. });
  753. }, reject);
  754. }
  755. }
  756. // node_modules/rxjs/dist/esm5/internal/util/isFunction.js
  757. function isFunction(value) {
  758. return typeof value === "function";
  759. }
  760. // node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
  761. function createErrorClass(createImpl) {
  762. var _super = function(instance) {
  763. Error.call(instance);
  764. instance.stack = new Error().stack;
  765. };
  766. var ctorFunc = createImpl(_super);
  767. ctorFunc.prototype = Object.create(Error.prototype);
  768. ctorFunc.prototype.constructor = ctorFunc;
  769. return ctorFunc;
  770. }
  771. // node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
  772. var UnsubscriptionError = createErrorClass(function(_super) {
  773. return function UnsubscriptionErrorImpl(errors) {
  774. _super(this);
  775. this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
  776. return i + 1 + ") " + err.toString();
  777. }).join("\n ") : "";
  778. this.name = "UnsubscriptionError";
  779. this.errors = errors;
  780. };
  781. });
  782. // node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
  783. function arrRemove(arr, item) {
  784. if (arr) {
  785. var index = arr.indexOf(item);
  786. 0 <= index && arr.splice(index, 1);
  787. }
  788. }
  789. // node_modules/rxjs/dist/esm5/internal/Subscription.js
  790. var Subscription = function() {
  791. function Subscription2(initialTeardown) {
  792. this.initialTeardown = initialTeardown;
  793. this.closed = false;
  794. this._parentage = null;
  795. this._finalizers = null;
  796. }
  797. Subscription2.prototype.unsubscribe = function() {
  798. var e_1, _a, e_2, _b;
  799. var errors;
  800. if (!this.closed) {
  801. this.closed = true;
  802. var _parentage = this._parentage;
  803. if (_parentage) {
  804. this._parentage = null;
  805. if (Array.isArray(_parentage)) {
  806. try {
  807. for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
  808. var parent_1 = _parentage_1_1.value;
  809. parent_1.remove(this);
  810. }
  811. } catch (e_1_1) {
  812. e_1 = {
  813. error: e_1_1
  814. };
  815. } finally {
  816. try {
  817. if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
  818. } finally {
  819. if (e_1) throw e_1.error;
  820. }
  821. }
  822. } else {
  823. _parentage.remove(this);
  824. }
  825. }
  826. var initialFinalizer = this.initialTeardown;
  827. if (isFunction(initialFinalizer)) {
  828. try {
  829. initialFinalizer();
  830. } catch (e) {
  831. errors = e instanceof UnsubscriptionError ? e.errors : [e];
  832. }
  833. }
  834. var _finalizers = this._finalizers;
  835. if (_finalizers) {
  836. this._finalizers = null;
  837. try {
  838. for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
  839. var finalizer = _finalizers_1_1.value;
  840. try {
  841. execFinalizer(finalizer);
  842. } catch (err) {
  843. errors = errors !== null && errors !== void 0 ? errors : [];
  844. if (err instanceof UnsubscriptionError) {
  845. errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
  846. } else {
  847. errors.push(err);
  848. }
  849. }
  850. }
  851. } catch (e_2_1) {
  852. e_2 = {
  853. error: e_2_1
  854. };
  855. } finally {
  856. try {
  857. if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
  858. } finally {
  859. if (e_2) throw e_2.error;
  860. }
  861. }
  862. }
  863. if (errors) {
  864. throw new UnsubscriptionError(errors);
  865. }
  866. }
  867. };
  868. Subscription2.prototype.add = function(teardown) {
  869. var _a;
  870. if (teardown && teardown !== this) {
  871. if (this.closed) {
  872. execFinalizer(teardown);
  873. } else {
  874. if (teardown instanceof Subscription2) {
  875. if (teardown.closed || teardown._hasParent(this)) {
  876. return;
  877. }
  878. teardown._addParent(this);
  879. }
  880. (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
  881. }
  882. }
  883. };
  884. Subscription2.prototype._hasParent = function(parent) {
  885. var _parentage = this._parentage;
  886. return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
  887. };
  888. Subscription2.prototype._addParent = function(parent) {
  889. var _parentage = this._parentage;
  890. this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
  891. };
  892. Subscription2.prototype._removeParent = function(parent) {
  893. var _parentage = this._parentage;
  894. if (_parentage === parent) {
  895. this._parentage = null;
  896. } else if (Array.isArray(_parentage)) {
  897. arrRemove(_parentage, parent);
  898. }
  899. };
  900. Subscription2.prototype.remove = function(teardown) {
  901. var _finalizers = this._finalizers;
  902. _finalizers && arrRemove(_finalizers, teardown);
  903. if (teardown instanceof Subscription2) {
  904. teardown._removeParent(this);
  905. }
  906. };
  907. Subscription2.EMPTY = function() {
  908. var empty2 = new Subscription2();
  909. empty2.closed = true;
  910. return empty2;
  911. }();
  912. return Subscription2;
  913. }();
  914. var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
  915. function isSubscription(value) {
  916. return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
  917. }
  918. function execFinalizer(finalizer) {
  919. if (isFunction(finalizer)) {
  920. finalizer();
  921. } else {
  922. finalizer.unsubscribe();
  923. }
  924. }
  925. // node_modules/rxjs/dist/esm5/internal/config.js
  926. var config = {
  927. onUnhandledError: null,
  928. onStoppedNotification: null,
  929. Promise: void 0,
  930. useDeprecatedSynchronousErrorHandling: false,
  931. useDeprecatedNextContext: false
  932. };
  933. // node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
  934. var timeoutProvider = {
  935. setTimeout: function(handler, timeout2) {
  936. var args = [];
  937. for (var _i = 2; _i < arguments.length; _i++) {
  938. args[_i - 2] = arguments[_i];
  939. }
  940. var delegate = timeoutProvider.delegate;
  941. if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
  942. return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout2], __read(args)));
  943. }
  944. return setTimeout.apply(void 0, __spreadArray([handler, timeout2], __read(args)));
  945. },
  946. clearTimeout: function(handle) {
  947. var delegate = timeoutProvider.delegate;
  948. return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
  949. },
  950. delegate: void 0
  951. };
  952. // node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
  953. function reportUnhandledError(err) {
  954. timeoutProvider.setTimeout(function() {
  955. var onUnhandledError = config.onUnhandledError;
  956. if (onUnhandledError) {
  957. onUnhandledError(err);
  958. } else {
  959. throw err;
  960. }
  961. });
  962. }
  963. // node_modules/rxjs/dist/esm5/internal/util/noop.js
  964. function noop() {
  965. }
  966. // node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
  967. var COMPLETE_NOTIFICATION = function() {
  968. return createNotification("C", void 0, void 0);
  969. }();
  970. function errorNotification(error) {
  971. return createNotification("E", void 0, error);
  972. }
  973. function nextNotification(value) {
  974. return createNotification("N", value, void 0);
  975. }
  976. function createNotification(kind, value, error) {
  977. return {
  978. kind,
  979. value,
  980. error
  981. };
  982. }
  983. // node_modules/rxjs/dist/esm5/internal/util/errorContext.js
  984. var context = null;
  985. function errorContext(cb) {
  986. if (config.useDeprecatedSynchronousErrorHandling) {
  987. var isRoot = !context;
  988. if (isRoot) {
  989. context = {
  990. errorThrown: false,
  991. error: null
  992. };
  993. }
  994. cb();
  995. if (isRoot) {
  996. var _a = context, errorThrown = _a.errorThrown, error = _a.error;
  997. context = null;
  998. if (errorThrown) {
  999. throw error;
  1000. }
  1001. }
  1002. } else {
  1003. cb();
  1004. }
  1005. }
  1006. function captureError(err) {
  1007. if (config.useDeprecatedSynchronousErrorHandling && context) {
  1008. context.errorThrown = true;
  1009. context.error = err;
  1010. }
  1011. }
  1012. // node_modules/rxjs/dist/esm5/internal/Subscriber.js
  1013. var Subscriber = function(_super) {
  1014. __extends(Subscriber2, _super);
  1015. function Subscriber2(destination) {
  1016. var _this = _super.call(this) || this;
  1017. _this.isStopped = false;
  1018. if (destination) {
  1019. _this.destination = destination;
  1020. if (isSubscription(destination)) {
  1021. destination.add(_this);
  1022. }
  1023. } else {
  1024. _this.destination = EMPTY_OBSERVER;
  1025. }
  1026. return _this;
  1027. }
  1028. Subscriber2.create = function(next, error, complete) {
  1029. return new SafeSubscriber(next, error, complete);
  1030. };
  1031. Subscriber2.prototype.next = function(value) {
  1032. if (this.isStopped) {
  1033. handleStoppedNotification(nextNotification(value), this);
  1034. } else {
  1035. this._next(value);
  1036. }
  1037. };
  1038. Subscriber2.prototype.error = function(err) {
  1039. if (this.isStopped) {
  1040. handleStoppedNotification(errorNotification(err), this);
  1041. } else {
  1042. this.isStopped = true;
  1043. this._error(err);
  1044. }
  1045. };
  1046. Subscriber2.prototype.complete = function() {
  1047. if (this.isStopped) {
  1048. handleStoppedNotification(COMPLETE_NOTIFICATION, this);
  1049. } else {
  1050. this.isStopped = true;
  1051. this._complete();
  1052. }
  1053. };
  1054. Subscriber2.prototype.unsubscribe = function() {
  1055. if (!this.closed) {
  1056. this.isStopped = true;
  1057. _super.prototype.unsubscribe.call(this);
  1058. this.destination = null;
  1059. }
  1060. };
  1061. Subscriber2.prototype._next = function(value) {
  1062. this.destination.next(value);
  1063. };
  1064. Subscriber2.prototype._error = function(err) {
  1065. try {
  1066. this.destination.error(err);
  1067. } finally {
  1068. this.unsubscribe();
  1069. }
  1070. };
  1071. Subscriber2.prototype._complete = function() {
  1072. try {
  1073. this.destination.complete();
  1074. } finally {
  1075. this.unsubscribe();
  1076. }
  1077. };
  1078. return Subscriber2;
  1079. }(Subscription);
  1080. var _bind = Function.prototype.bind;
  1081. function bind(fn, thisArg) {
  1082. return _bind.call(fn, thisArg);
  1083. }
  1084. var ConsumerObserver = function() {
  1085. function ConsumerObserver2(partialObserver) {
  1086. this.partialObserver = partialObserver;
  1087. }
  1088. ConsumerObserver2.prototype.next = function(value) {
  1089. var partialObserver = this.partialObserver;
  1090. if (partialObserver.next) {
  1091. try {
  1092. partialObserver.next(value);
  1093. } catch (error) {
  1094. handleUnhandledError(error);
  1095. }
  1096. }
  1097. };
  1098. ConsumerObserver2.prototype.error = function(err) {
  1099. var partialObserver = this.partialObserver;
  1100. if (partialObserver.error) {
  1101. try {
  1102. partialObserver.error(err);
  1103. } catch (error) {
  1104. handleUnhandledError(error);
  1105. }
  1106. } else {
  1107. handleUnhandledError(err);
  1108. }
  1109. };
  1110. ConsumerObserver2.prototype.complete = function() {
  1111. var partialObserver = this.partialObserver;
  1112. if (partialObserver.complete) {
  1113. try {
  1114. partialObserver.complete();
  1115. } catch (error) {
  1116. handleUnhandledError(error);
  1117. }
  1118. }
  1119. };
  1120. return ConsumerObserver2;
  1121. }();
  1122. var SafeSubscriber = function(_super) {
  1123. __extends(SafeSubscriber2, _super);
  1124. function SafeSubscriber2(observerOrNext, error, complete) {
  1125. var _this = _super.call(this) || this;
  1126. var partialObserver;
  1127. if (isFunction(observerOrNext) || !observerOrNext) {
  1128. partialObserver = {
  1129. next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
  1130. error: error !== null && error !== void 0 ? error : void 0,
  1131. complete: complete !== null && complete !== void 0 ? complete : void 0
  1132. };
  1133. } else {
  1134. var context_1;
  1135. if (_this && config.useDeprecatedNextContext) {
  1136. context_1 = Object.create(observerOrNext);
  1137. context_1.unsubscribe = function() {
  1138. return _this.unsubscribe();
  1139. };
  1140. partialObserver = {
  1141. next: observerOrNext.next && bind(observerOrNext.next, context_1),
  1142. error: observerOrNext.error && bind(observerOrNext.error, context_1),
  1143. complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
  1144. };
  1145. } else {
  1146. partialObserver = observerOrNext;
  1147. }
  1148. }
  1149. _this.destination = new ConsumerObserver(partialObserver);
  1150. return _this;
  1151. }
  1152. return SafeSubscriber2;
  1153. }(Subscriber);
  1154. function handleUnhandledError(error) {
  1155. if (config.useDeprecatedSynchronousErrorHandling) {
  1156. captureError(error);
  1157. } else {
  1158. reportUnhandledError(error);
  1159. }
  1160. }
  1161. function defaultErrorHandler(err) {
  1162. throw err;
  1163. }
  1164. function handleStoppedNotification(notification, subscriber) {
  1165. var onStoppedNotification = config.onStoppedNotification;
  1166. onStoppedNotification && timeoutProvider.setTimeout(function() {
  1167. return onStoppedNotification(notification, subscriber);
  1168. });
  1169. }
  1170. var EMPTY_OBSERVER = {
  1171. closed: true,
  1172. next: noop,
  1173. error: defaultErrorHandler,
  1174. complete: noop
  1175. };
  1176. // node_modules/rxjs/dist/esm5/internal/symbol/observable.js
  1177. var observable = function() {
  1178. return typeof Symbol === "function" && Symbol.observable || "@@observable";
  1179. }();
  1180. // node_modules/rxjs/dist/esm5/internal/util/identity.js
  1181. function identity(x) {
  1182. return x;
  1183. }
  1184. // node_modules/rxjs/dist/esm5/internal/util/pipe.js
  1185. function pipeFromArray(fns) {
  1186. if (fns.length === 0) {
  1187. return identity;
  1188. }
  1189. if (fns.length === 1) {
  1190. return fns[0];
  1191. }
  1192. return function piped(input2) {
  1193. return fns.reduce(function(prev, fn) {
  1194. return fn(prev);
  1195. }, input2);
  1196. };
  1197. }
  1198. // node_modules/rxjs/dist/esm5/internal/Observable.js
  1199. var Observable = function() {
  1200. function Observable2(subscribe) {
  1201. if (subscribe) {
  1202. this._subscribe = subscribe;
  1203. }
  1204. }
  1205. Observable2.prototype.lift = function(operator) {
  1206. var observable2 = new Observable2();
  1207. observable2.source = this;
  1208. observable2.operator = operator;
  1209. return observable2;
  1210. };
  1211. Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
  1212. var _this = this;
  1213. var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
  1214. errorContext(function() {
  1215. var _a = _this, operator = _a.operator, source = _a.source;
  1216. subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
  1217. });
  1218. return subscriber;
  1219. };
  1220. Observable2.prototype._trySubscribe = function(sink) {
  1221. try {
  1222. return this._subscribe(sink);
  1223. } catch (err) {
  1224. sink.error(err);
  1225. }
  1226. };
  1227. Observable2.prototype.forEach = function(next, promiseCtor) {
  1228. var _this = this;
  1229. promiseCtor = getPromiseCtor(promiseCtor);
  1230. return new promiseCtor(function(resolve, reject) {
  1231. var subscriber = new SafeSubscriber({
  1232. next: function(value) {
  1233. try {
  1234. next(value);
  1235. } catch (err) {
  1236. reject(err);
  1237. subscriber.unsubscribe();
  1238. }
  1239. },
  1240. error: reject,
  1241. complete: resolve
  1242. });
  1243. _this.subscribe(subscriber);
  1244. });
  1245. };
  1246. Observable2.prototype._subscribe = function(subscriber) {
  1247. var _a;
  1248. return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
  1249. };
  1250. Observable2.prototype[observable] = function() {
  1251. return this;
  1252. };
  1253. Observable2.prototype.pipe = function() {
  1254. var operations = [];
  1255. for (var _i = 0; _i < arguments.length; _i++) {
  1256. operations[_i] = arguments[_i];
  1257. }
  1258. return pipeFromArray(operations)(this);
  1259. };
  1260. Observable2.prototype.toPromise = function(promiseCtor) {
  1261. var _this = this;
  1262. promiseCtor = getPromiseCtor(promiseCtor);
  1263. return new promiseCtor(function(resolve, reject) {
  1264. var value;
  1265. _this.subscribe(function(x) {
  1266. return value = x;
  1267. }, function(err) {
  1268. return reject(err);
  1269. }, function() {
  1270. return resolve(value);
  1271. });
  1272. });
  1273. };
  1274. Observable2.create = function(subscribe) {
  1275. return new Observable2(subscribe);
  1276. };
  1277. return Observable2;
  1278. }();
  1279. function getPromiseCtor(promiseCtor) {
  1280. var _a;
  1281. return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
  1282. }
  1283. function isObserver(value) {
  1284. return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
  1285. }
  1286. function isSubscriber(value) {
  1287. return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
  1288. }
  1289. // node_modules/rxjs/dist/esm5/internal/util/lift.js
  1290. function hasLift(source) {
  1291. return isFunction(source === null || source === void 0 ? void 0 : source.lift);
  1292. }
  1293. function operate(init) {
  1294. return function(source) {
  1295. if (hasLift(source)) {
  1296. return source.lift(function(liftedSource) {
  1297. try {
  1298. return init(liftedSource, this);
  1299. } catch (err) {
  1300. this.error(err);
  1301. }
  1302. });
  1303. }
  1304. throw new TypeError("Unable to lift unknown Observable type");
  1305. };
  1306. }
  1307. // node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js
  1308. function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
  1309. return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
  1310. }
  1311. var OperatorSubscriber = function(_super) {
  1312. __extends(OperatorSubscriber2, _super);
  1313. function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
  1314. var _this = _super.call(this, destination) || this;
  1315. _this.onFinalize = onFinalize;
  1316. _this.shouldUnsubscribe = shouldUnsubscribe;
  1317. _this._next = onNext ? function(value) {
  1318. try {
  1319. onNext(value);
  1320. } catch (err) {
  1321. destination.error(err);
  1322. }
  1323. } : _super.prototype._next;
  1324. _this._error = onError ? function(err) {
  1325. try {
  1326. onError(err);
  1327. } catch (err2) {
  1328. destination.error(err2);
  1329. } finally {
  1330. this.unsubscribe();
  1331. }
  1332. } : _super.prototype._error;
  1333. _this._complete = onComplete ? function() {
  1334. try {
  1335. onComplete();
  1336. } catch (err) {
  1337. destination.error(err);
  1338. } finally {
  1339. this.unsubscribe();
  1340. }
  1341. } : _super.prototype._complete;
  1342. return _this;
  1343. }
  1344. OperatorSubscriber2.prototype.unsubscribe = function() {
  1345. var _a;
  1346. if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
  1347. var closed_1 = this.closed;
  1348. _super.prototype.unsubscribe.call(this);
  1349. !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
  1350. }
  1351. };
  1352. return OperatorSubscriber2;
  1353. }(Subscriber);
  1354. // node_modules/rxjs/dist/esm5/internal/operators/refCount.js
  1355. function refCount() {
  1356. return operate(function(source, subscriber) {
  1357. var connection = null;
  1358. source._refCount++;
  1359. var refCounter = createOperatorSubscriber(subscriber, void 0, void 0, void 0, function() {
  1360. if (!source || source._refCount <= 0 || 0 < --source._refCount) {
  1361. connection = null;
  1362. return;
  1363. }
  1364. var sharedConnection = source._connection;
  1365. var conn = connection;
  1366. connection = null;
  1367. if (sharedConnection && (!conn || sharedConnection === conn)) {
  1368. sharedConnection.unsubscribe();
  1369. }
  1370. subscriber.unsubscribe();
  1371. });
  1372. source.subscribe(refCounter);
  1373. if (!refCounter.closed) {
  1374. connection = source.connect();
  1375. }
  1376. });
  1377. }
  1378. // node_modules/rxjs/dist/esm5/internal/observable/ConnectableObservable.js
  1379. var ConnectableObservable = function(_super) {
  1380. __extends(ConnectableObservable2, _super);
  1381. function ConnectableObservable2(source, subjectFactory) {
  1382. var _this = _super.call(this) || this;
  1383. _this.source = source;
  1384. _this.subjectFactory = subjectFactory;
  1385. _this._subject = null;
  1386. _this._refCount = 0;
  1387. _this._connection = null;
  1388. if (hasLift(source)) {
  1389. _this.lift = source.lift;
  1390. }
  1391. return _this;
  1392. }
  1393. ConnectableObservable2.prototype._subscribe = function(subscriber) {
  1394. return this.getSubject().subscribe(subscriber);
  1395. };
  1396. ConnectableObservable2.prototype.getSubject = function() {
  1397. var subject = this._subject;
  1398. if (!subject || subject.isStopped) {
  1399. this._subject = this.subjectFactory();
  1400. }
  1401. return this._subject;
  1402. };
  1403. ConnectableObservable2.prototype._teardown = function() {
  1404. this._refCount = 0;
  1405. var _connection = this._connection;
  1406. this._subject = this._connection = null;
  1407. _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
  1408. };
  1409. ConnectableObservable2.prototype.connect = function() {
  1410. var _this = this;
  1411. var connection = this._connection;
  1412. if (!connection) {
  1413. connection = this._connection = new Subscription();
  1414. var subject_1 = this.getSubject();
  1415. connection.add(this.source.subscribe(createOperatorSubscriber(subject_1, void 0, function() {
  1416. _this._teardown();
  1417. subject_1.complete();
  1418. }, function(err) {
  1419. _this._teardown();
  1420. subject_1.error(err);
  1421. }, function() {
  1422. return _this._teardown();
  1423. })));
  1424. if (connection.closed) {
  1425. this._connection = null;
  1426. connection = Subscription.EMPTY;
  1427. }
  1428. }
  1429. return connection;
  1430. };
  1431. ConnectableObservable2.prototype.refCount = function() {
  1432. return refCount()(this);
  1433. };
  1434. return ConnectableObservable2;
  1435. }(Observable);
  1436. // node_modules/rxjs/dist/esm5/internal/scheduler/performanceTimestampProvider.js
  1437. var performanceTimestampProvider = {
  1438. now: function() {
  1439. return (performanceTimestampProvider.delegate || performance).now();
  1440. },
  1441. delegate: void 0
  1442. };
  1443. // node_modules/rxjs/dist/esm5/internal/scheduler/animationFrameProvider.js
  1444. var animationFrameProvider = {
  1445. schedule: function(callback) {
  1446. var request = requestAnimationFrame;
  1447. var cancel = cancelAnimationFrame;
  1448. var delegate = animationFrameProvider.delegate;
  1449. if (delegate) {
  1450. request = delegate.requestAnimationFrame;
  1451. cancel = delegate.cancelAnimationFrame;
  1452. }
  1453. var handle = request(function(timestamp2) {
  1454. cancel = void 0;
  1455. callback(timestamp2);
  1456. });
  1457. return new Subscription(function() {
  1458. return cancel === null || cancel === void 0 ? void 0 : cancel(handle);
  1459. });
  1460. },
  1461. requestAnimationFrame: function() {
  1462. var args = [];
  1463. for (var _i = 0; _i < arguments.length; _i++) {
  1464. args[_i] = arguments[_i];
  1465. }
  1466. var delegate = animationFrameProvider.delegate;
  1467. return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
  1468. },
  1469. cancelAnimationFrame: function() {
  1470. var args = [];
  1471. for (var _i = 0; _i < arguments.length; _i++) {
  1472. args[_i] = arguments[_i];
  1473. }
  1474. var delegate = animationFrameProvider.delegate;
  1475. return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
  1476. },
  1477. delegate: void 0
  1478. };
  1479. // node_modules/rxjs/dist/esm5/internal/observable/dom/animationFrames.js
  1480. function animationFramesFactory(timestampProvider) {
  1481. return new Observable(function(subscriber) {
  1482. var provider = timestampProvider || performanceTimestampProvider;
  1483. var start = provider.now();
  1484. var id = 0;
  1485. var run = function() {
  1486. if (!subscriber.closed) {
  1487. id = animationFrameProvider.requestAnimationFrame(function(timestamp2) {
  1488. id = 0;
  1489. var now = provider.now();
  1490. subscriber.next({
  1491. timestamp: timestampProvider ? now : timestamp2,
  1492. elapsed: now - start
  1493. });
  1494. run();
  1495. });
  1496. }
  1497. };
  1498. run();
  1499. return function() {
  1500. if (id) {
  1501. animationFrameProvider.cancelAnimationFrame(id);
  1502. }
  1503. };
  1504. });
  1505. }
  1506. var DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
  1507. // node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js
  1508. var ObjectUnsubscribedError = createErrorClass(function(_super) {
  1509. return function ObjectUnsubscribedErrorImpl() {
  1510. _super(this);
  1511. this.name = "ObjectUnsubscribedError";
  1512. this.message = "object unsubscribed";
  1513. };
  1514. });
  1515. // node_modules/rxjs/dist/esm5/internal/Subject.js
  1516. var Subject = function(_super) {
  1517. __extends(Subject2, _super);
  1518. function Subject2() {
  1519. var _this = _super.call(this) || this;
  1520. _this.closed = false;
  1521. _this.currentObservers = null;
  1522. _this.observers = [];
  1523. _this.isStopped = false;
  1524. _this.hasError = false;
  1525. _this.thrownError = null;
  1526. return _this;
  1527. }
  1528. Subject2.prototype.lift = function(operator) {
  1529. var subject = new AnonymousSubject(this, this);
  1530. subject.operator = operator;
  1531. return subject;
  1532. };
  1533. Subject2.prototype._throwIfClosed = function() {
  1534. if (this.closed) {
  1535. throw new ObjectUnsubscribedError();
  1536. }
  1537. };
  1538. Subject2.prototype.next = function(value) {
  1539. var _this = this;
  1540. errorContext(function() {
  1541. var e_1, _a;
  1542. _this._throwIfClosed();
  1543. if (!_this.isStopped) {
  1544. if (!_this.currentObservers) {
  1545. _this.currentObservers = Array.from(_this.observers);
  1546. }
  1547. try {
  1548. for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
  1549. var observer = _c.value;
  1550. observer.next(value);
  1551. }
  1552. } catch (e_1_1) {
  1553. e_1 = {
  1554. error: e_1_1
  1555. };
  1556. } finally {
  1557. try {
  1558. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  1559. } finally {
  1560. if (e_1) throw e_1.error;
  1561. }
  1562. }
  1563. }
  1564. });
  1565. };
  1566. Subject2.prototype.error = function(err) {
  1567. var _this = this;
  1568. errorContext(function() {
  1569. _this._throwIfClosed();
  1570. if (!_this.isStopped) {
  1571. _this.hasError = _this.isStopped = true;
  1572. _this.thrownError = err;
  1573. var observers = _this.observers;
  1574. while (observers.length) {
  1575. observers.shift().error(err);
  1576. }
  1577. }
  1578. });
  1579. };
  1580. Subject2.prototype.complete = function() {
  1581. var _this = this;
  1582. errorContext(function() {
  1583. _this._throwIfClosed();
  1584. if (!_this.isStopped) {
  1585. _this.isStopped = true;
  1586. var observers = _this.observers;
  1587. while (observers.length) {
  1588. observers.shift().complete();
  1589. }
  1590. }
  1591. });
  1592. };
  1593. Subject2.prototype.unsubscribe = function() {
  1594. this.isStopped = this.closed = true;
  1595. this.observers = this.currentObservers = null;
  1596. };
  1597. Object.defineProperty(Subject2.prototype, "observed", {
  1598. get: function() {
  1599. var _a;
  1600. return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
  1601. },
  1602. enumerable: false,
  1603. configurable: true
  1604. });
  1605. Subject2.prototype._trySubscribe = function(subscriber) {
  1606. this._throwIfClosed();
  1607. return _super.prototype._trySubscribe.call(this, subscriber);
  1608. };
  1609. Subject2.prototype._subscribe = function(subscriber) {
  1610. this._throwIfClosed();
  1611. this._checkFinalizedStatuses(subscriber);
  1612. return this._innerSubscribe(subscriber);
  1613. };
  1614. Subject2.prototype._innerSubscribe = function(subscriber) {
  1615. var _this = this;
  1616. var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
  1617. if (hasError || isStopped) {
  1618. return EMPTY_SUBSCRIPTION;
  1619. }
  1620. this.currentObservers = null;
  1621. observers.push(subscriber);
  1622. return new Subscription(function() {
  1623. _this.currentObservers = null;
  1624. arrRemove(observers, subscriber);
  1625. });
  1626. };
  1627. Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
  1628. var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
  1629. if (hasError) {
  1630. subscriber.error(thrownError);
  1631. } else if (isStopped) {
  1632. subscriber.complete();
  1633. }
  1634. };
  1635. Subject2.prototype.asObservable = function() {
  1636. var observable2 = new Observable();
  1637. observable2.source = this;
  1638. return observable2;
  1639. };
  1640. Subject2.create = function(destination, source) {
  1641. return new AnonymousSubject(destination, source);
  1642. };
  1643. return Subject2;
  1644. }(Observable);
  1645. var AnonymousSubject = function(_super) {
  1646. __extends(AnonymousSubject2, _super);
  1647. function AnonymousSubject2(destination, source) {
  1648. var _this = _super.call(this) || this;
  1649. _this.destination = destination;
  1650. _this.source = source;
  1651. return _this;
  1652. }
  1653. AnonymousSubject2.prototype.next = function(value) {
  1654. var _a, _b;
  1655. (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
  1656. };
  1657. AnonymousSubject2.prototype.error = function(err) {
  1658. var _a, _b;
  1659. (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
  1660. };
  1661. AnonymousSubject2.prototype.complete = function() {
  1662. var _a, _b;
  1663. (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
  1664. };
  1665. AnonymousSubject2.prototype._subscribe = function(subscriber) {
  1666. var _a, _b;
  1667. return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
  1668. };
  1669. return AnonymousSubject2;
  1670. }(Subject);
  1671. // node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js
  1672. var BehaviorSubject = function(_super) {
  1673. __extends(BehaviorSubject2, _super);
  1674. function BehaviorSubject2(_value) {
  1675. var _this = _super.call(this) || this;
  1676. _this._value = _value;
  1677. return _this;
  1678. }
  1679. Object.defineProperty(BehaviorSubject2.prototype, "value", {
  1680. get: function() {
  1681. return this.getValue();
  1682. },
  1683. enumerable: false,
  1684. configurable: true
  1685. });
  1686. BehaviorSubject2.prototype._subscribe = function(subscriber) {
  1687. var subscription = _super.prototype._subscribe.call(this, subscriber);
  1688. !subscription.closed && subscriber.next(this._value);
  1689. return subscription;
  1690. };
  1691. BehaviorSubject2.prototype.getValue = function() {
  1692. var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
  1693. if (hasError) {
  1694. throw thrownError;
  1695. }
  1696. this._throwIfClosed();
  1697. return _value;
  1698. };
  1699. BehaviorSubject2.prototype.next = function(value) {
  1700. _super.prototype.next.call(this, this._value = value);
  1701. };
  1702. return BehaviorSubject2;
  1703. }(Subject);
  1704. // node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js
  1705. var dateTimestampProvider = {
  1706. now: function() {
  1707. return (dateTimestampProvider.delegate || Date).now();
  1708. },
  1709. delegate: void 0
  1710. };
  1711. // node_modules/rxjs/dist/esm5/internal/ReplaySubject.js
  1712. var ReplaySubject = function(_super) {
  1713. __extends(ReplaySubject2, _super);
  1714. function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
  1715. if (_bufferSize === void 0) {
  1716. _bufferSize = Infinity;
  1717. }
  1718. if (_windowTime === void 0) {
  1719. _windowTime = Infinity;
  1720. }
  1721. if (_timestampProvider === void 0) {
  1722. _timestampProvider = dateTimestampProvider;
  1723. }
  1724. var _this = _super.call(this) || this;
  1725. _this._bufferSize = _bufferSize;
  1726. _this._windowTime = _windowTime;
  1727. _this._timestampProvider = _timestampProvider;
  1728. _this._buffer = [];
  1729. _this._infiniteTimeWindow = true;
  1730. _this._infiniteTimeWindow = _windowTime === Infinity;
  1731. _this._bufferSize = Math.max(1, _bufferSize);
  1732. _this._windowTime = Math.max(1, _windowTime);
  1733. return _this;
  1734. }
  1735. ReplaySubject2.prototype.next = function(value) {
  1736. var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
  1737. if (!isStopped) {
  1738. _buffer.push(value);
  1739. !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
  1740. }
  1741. this._trimBuffer();
  1742. _super.prototype.next.call(this, value);
  1743. };
  1744. ReplaySubject2.prototype._subscribe = function(subscriber) {
  1745. this._throwIfClosed();
  1746. this._trimBuffer();
  1747. var subscription = this._innerSubscribe(subscriber);
  1748. var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
  1749. var copy = _buffer.slice();
  1750. for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
  1751. subscriber.next(copy[i]);
  1752. }
  1753. this._checkFinalizedStatuses(subscriber);
  1754. return subscription;
  1755. };
  1756. ReplaySubject2.prototype._trimBuffer = function() {
  1757. var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
  1758. var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
  1759. _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
  1760. if (!_infiniteTimeWindow) {
  1761. var now = _timestampProvider.now();
  1762. var last3 = 0;
  1763. for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
  1764. last3 = i;
  1765. }
  1766. last3 && _buffer.splice(0, last3 + 1);
  1767. }
  1768. };
  1769. return ReplaySubject2;
  1770. }(Subject);
  1771. // node_modules/rxjs/dist/esm5/internal/AsyncSubject.js
  1772. var AsyncSubject = function(_super) {
  1773. __extends(AsyncSubject2, _super);
  1774. function AsyncSubject2() {
  1775. var _this = _super !== null && _super.apply(this, arguments) || this;
  1776. _this._value = null;
  1777. _this._hasValue = false;
  1778. _this._isComplete = false;
  1779. return _this;
  1780. }
  1781. AsyncSubject2.prototype._checkFinalizedStatuses = function(subscriber) {
  1782. var _a = this, hasError = _a.hasError, _hasValue = _a._hasValue, _value = _a._value, thrownError = _a.thrownError, isStopped = _a.isStopped, _isComplete = _a._isComplete;
  1783. if (hasError) {
  1784. subscriber.error(thrownError);
  1785. } else if (isStopped || _isComplete) {
  1786. _hasValue && subscriber.next(_value);
  1787. subscriber.complete();
  1788. }
  1789. };
  1790. AsyncSubject2.prototype.next = function(value) {
  1791. if (!this.isStopped) {
  1792. this._value = value;
  1793. this._hasValue = true;
  1794. }
  1795. };
  1796. AsyncSubject2.prototype.complete = function() {
  1797. var _a = this, _hasValue = _a._hasValue, _value = _a._value, _isComplete = _a._isComplete;
  1798. if (!_isComplete) {
  1799. this._isComplete = true;
  1800. _hasValue && _super.prototype.next.call(this, _value);
  1801. _super.prototype.complete.call(this);
  1802. }
  1803. };
  1804. return AsyncSubject2;
  1805. }(Subject);
  1806. // node_modules/rxjs/dist/esm5/internal/scheduler/Action.js
  1807. var Action = function(_super) {
  1808. __extends(Action2, _super);
  1809. function Action2(scheduler, work) {
  1810. return _super.call(this) || this;
  1811. }
  1812. Action2.prototype.schedule = function(state, delay2) {
  1813. if (delay2 === void 0) {
  1814. delay2 = 0;
  1815. }
  1816. return this;
  1817. };
  1818. return Action2;
  1819. }(Subscription);
  1820. // node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js
  1821. var intervalProvider = {
  1822. setInterval: function(handler, timeout2) {
  1823. var args = [];
  1824. for (var _i = 2; _i < arguments.length; _i++) {
  1825. args[_i - 2] = arguments[_i];
  1826. }
  1827. var delegate = intervalProvider.delegate;
  1828. if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
  1829. return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout2], __read(args)));
  1830. }
  1831. return setInterval.apply(void 0, __spreadArray([handler, timeout2], __read(args)));
  1832. },
  1833. clearInterval: function(handle) {
  1834. var delegate = intervalProvider.delegate;
  1835. return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
  1836. },
  1837. delegate: void 0
  1838. };
  1839. // node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js
  1840. var AsyncAction = function(_super) {
  1841. __extends(AsyncAction2, _super);
  1842. function AsyncAction2(scheduler, work) {
  1843. var _this = _super.call(this, scheduler, work) || this;
  1844. _this.scheduler = scheduler;
  1845. _this.work = work;
  1846. _this.pending = false;
  1847. return _this;
  1848. }
  1849. AsyncAction2.prototype.schedule = function(state, delay2) {
  1850. var _a;
  1851. if (delay2 === void 0) {
  1852. delay2 = 0;
  1853. }
  1854. if (this.closed) {
  1855. return this;
  1856. }
  1857. this.state = state;
  1858. var id = this.id;
  1859. var scheduler = this.scheduler;
  1860. if (id != null) {
  1861. this.id = this.recycleAsyncId(scheduler, id, delay2);
  1862. }
  1863. this.pending = true;
  1864. this.delay = delay2;
  1865. this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay2);
  1866. return this;
  1867. };
  1868. AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay2) {
  1869. if (delay2 === void 0) {
  1870. delay2 = 0;
  1871. }
  1872. return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay2);
  1873. };
  1874. AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay2) {
  1875. if (delay2 === void 0) {
  1876. delay2 = 0;
  1877. }
  1878. if (delay2 != null && this.delay === delay2 && this.pending === false) {
  1879. return id;
  1880. }
  1881. if (id != null) {
  1882. intervalProvider.clearInterval(id);
  1883. }
  1884. return void 0;
  1885. };
  1886. AsyncAction2.prototype.execute = function(state, delay2) {
  1887. if (this.closed) {
  1888. return new Error("executing a cancelled action");
  1889. }
  1890. this.pending = false;
  1891. var error = this._execute(state, delay2);
  1892. if (error) {
  1893. return error;
  1894. } else if (this.pending === false && this.id != null) {
  1895. this.id = this.recycleAsyncId(this.scheduler, this.id, null);
  1896. }
  1897. };
  1898. AsyncAction2.prototype._execute = function(state, _delay) {
  1899. var errored = false;
  1900. var errorValue;
  1901. try {
  1902. this.work(state);
  1903. } catch (e) {
  1904. errored = true;
  1905. errorValue = e ? e : new Error("Scheduled action threw falsy error");
  1906. }
  1907. if (errored) {
  1908. this.unsubscribe();
  1909. return errorValue;
  1910. }
  1911. };
  1912. AsyncAction2.prototype.unsubscribe = function() {
  1913. if (!this.closed) {
  1914. var _a = this, id = _a.id, scheduler = _a.scheduler;
  1915. var actions = scheduler.actions;
  1916. this.work = this.state = this.scheduler = null;
  1917. this.pending = false;
  1918. arrRemove(actions, this);
  1919. if (id != null) {
  1920. this.id = this.recycleAsyncId(scheduler, id, null);
  1921. }
  1922. this.delay = null;
  1923. _super.prototype.unsubscribe.call(this);
  1924. }
  1925. };
  1926. return AsyncAction2;
  1927. }(Action);
  1928. // node_modules/rxjs/dist/esm5/internal/util/Immediate.js
  1929. var nextHandle = 1;
  1930. var resolved;
  1931. var activeHandles = {};
  1932. function findAndClearHandle(handle) {
  1933. if (handle in activeHandles) {
  1934. delete activeHandles[handle];
  1935. return true;
  1936. }
  1937. return false;
  1938. }
  1939. var Immediate = {
  1940. setImmediate: function(cb) {
  1941. var handle = nextHandle++;
  1942. activeHandles[handle] = true;
  1943. if (!resolved) {
  1944. resolved = Promise.resolve();
  1945. }
  1946. resolved.then(function() {
  1947. return findAndClearHandle(handle) && cb();
  1948. });
  1949. return handle;
  1950. },
  1951. clearImmediate: function(handle) {
  1952. findAndClearHandle(handle);
  1953. }
  1954. };
  1955. // node_modules/rxjs/dist/esm5/internal/scheduler/immediateProvider.js
  1956. var setImmediate = Immediate.setImmediate;
  1957. var clearImmediate = Immediate.clearImmediate;
  1958. var immediateProvider = {
  1959. setImmediate: function() {
  1960. var args = [];
  1961. for (var _i = 0; _i < arguments.length; _i++) {
  1962. args[_i] = arguments[_i];
  1963. }
  1964. var delegate = immediateProvider.delegate;
  1965. return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate).apply(void 0, __spreadArray([], __read(args)));
  1966. },
  1967. clearImmediate: function(handle) {
  1968. var delegate = immediateProvider.delegate;
  1969. return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);
  1970. },
  1971. delegate: void 0
  1972. };
  1973. // node_modules/rxjs/dist/esm5/internal/scheduler/AsapAction.js
  1974. var AsapAction = function(_super) {
  1975. __extends(AsapAction2, _super);
  1976. function AsapAction2(scheduler, work) {
  1977. var _this = _super.call(this, scheduler, work) || this;
  1978. _this.scheduler = scheduler;
  1979. _this.work = work;
  1980. return _this;
  1981. }
  1982. AsapAction2.prototype.requestAsyncId = function(scheduler, id, delay2) {
  1983. if (delay2 === void 0) {
  1984. delay2 = 0;
  1985. }
  1986. if (delay2 !== null && delay2 > 0) {
  1987. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay2);
  1988. }
  1989. scheduler.actions.push(this);
  1990. return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, void 0)));
  1991. };
  1992. AsapAction2.prototype.recycleAsyncId = function(scheduler, id, delay2) {
  1993. var _a;
  1994. if (delay2 === void 0) {
  1995. delay2 = 0;
  1996. }
  1997. if (delay2 != null ? delay2 > 0 : this.delay > 0) {
  1998. return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay2);
  1999. }
  2000. var actions = scheduler.actions;
  2001. if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
  2002. immediateProvider.clearImmediate(id);
  2003. if (scheduler._scheduled === id) {
  2004. scheduler._scheduled = void 0;
  2005. }
  2006. }
  2007. return void 0;
  2008. };
  2009. return AsapAction2;
  2010. }(AsyncAction);
  2011. // node_modules/rxjs/dist/esm5/internal/Scheduler.js
  2012. var Scheduler = function() {
  2013. function Scheduler2(schedulerActionCtor, now) {
  2014. if (now === void 0) {
  2015. now = Scheduler2.now;
  2016. }
  2017. this.schedulerActionCtor = schedulerActionCtor;
  2018. this.now = now;
  2019. }
  2020. Scheduler2.prototype.schedule = function(work, delay2, state) {
  2021. if (delay2 === void 0) {
  2022. delay2 = 0;
  2023. }
  2024. return new this.schedulerActionCtor(this, work).schedule(state, delay2);
  2025. };
  2026. Scheduler2.now = dateTimestampProvider.now;
  2027. return Scheduler2;
  2028. }();
  2029. // node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js
  2030. var AsyncScheduler = function(_super) {
  2031. __extends(AsyncScheduler2, _super);
  2032. function AsyncScheduler2(SchedulerAction, now) {
  2033. if (now === void 0) {
  2034. now = Scheduler.now;
  2035. }
  2036. var _this = _super.call(this, SchedulerAction, now) || this;
  2037. _this.actions = [];
  2038. _this._active = false;
  2039. return _this;
  2040. }
  2041. AsyncScheduler2.prototype.flush = function(action) {
  2042. var actions = this.actions;
  2043. if (this._active) {
  2044. actions.push(action);
  2045. return;
  2046. }
  2047. var error;
  2048. this._active = true;
  2049. do {
  2050. if (error = action.execute(action.state, action.delay)) {
  2051. break;
  2052. }
  2053. } while (action = actions.shift());
  2054. this._active = false;
  2055. if (error) {
  2056. while (action = actions.shift()) {
  2057. action.unsubscribe();
  2058. }
  2059. throw error;
  2060. }
  2061. };
  2062. return AsyncScheduler2;
  2063. }(Scheduler);
  2064. // node_modules/rxjs/dist/esm5/internal/scheduler/AsapScheduler.js
  2065. var AsapScheduler = function(_super) {
  2066. __extends(AsapScheduler2, _super);
  2067. function AsapScheduler2() {
  2068. return _super !== null && _super.apply(this, arguments) || this;
  2069. }
  2070. AsapScheduler2.prototype.flush = function(action) {
  2071. this._active = true;
  2072. var flushId = this._scheduled;
  2073. this._scheduled = void 0;
  2074. var actions = this.actions;
  2075. var error;
  2076. action = action || actions.shift();
  2077. do {
  2078. if (error = action.execute(action.state, action.delay)) {
  2079. break;
  2080. }
  2081. } while ((action = actions[0]) && action.id === flushId && actions.shift());
  2082. this._active = false;
  2083. if (error) {
  2084. while ((action = actions[0]) && action.id === flushId && actions.shift()) {
  2085. action.unsubscribe();
  2086. }
  2087. throw error;
  2088. }
  2089. };
  2090. return AsapScheduler2;
  2091. }(AsyncScheduler);
  2092. // node_modules/rxjs/dist/esm5/internal/scheduler/asap.js
  2093. var asapScheduler = new AsapScheduler(AsapAction);
  2094. // node_modules/rxjs/dist/esm5/internal/scheduler/async.js
  2095. var asyncScheduler = new AsyncScheduler(AsyncAction);
  2096. // node_modules/rxjs/dist/esm5/internal/scheduler/QueueAction.js
  2097. var QueueAction = function(_super) {
  2098. __extends(QueueAction2, _super);
  2099. function QueueAction2(scheduler, work) {
  2100. var _this = _super.call(this, scheduler, work) || this;
  2101. _this.scheduler = scheduler;
  2102. _this.work = work;
  2103. return _this;
  2104. }
  2105. QueueAction2.prototype.schedule = function(state, delay2) {
  2106. if (delay2 === void 0) {
  2107. delay2 = 0;
  2108. }
  2109. if (delay2 > 0) {
  2110. return _super.prototype.schedule.call(this, state, delay2);
  2111. }
  2112. this.delay = delay2;
  2113. this.state = state;
  2114. this.scheduler.flush(this);
  2115. return this;
  2116. };
  2117. QueueAction2.prototype.execute = function(state, delay2) {
  2118. return delay2 > 0 || this.closed ? _super.prototype.execute.call(this, state, delay2) : this._execute(state, delay2);
  2119. };
  2120. QueueAction2.prototype.requestAsyncId = function(scheduler, id, delay2) {
  2121. if (delay2 === void 0) {
  2122. delay2 = 0;
  2123. }
  2124. if (delay2 != null && delay2 > 0 || delay2 == null && this.delay > 0) {
  2125. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay2);
  2126. }
  2127. scheduler.flush(this);
  2128. return 0;
  2129. };
  2130. return QueueAction2;
  2131. }(AsyncAction);
  2132. // node_modules/rxjs/dist/esm5/internal/scheduler/QueueScheduler.js
  2133. var QueueScheduler = function(_super) {
  2134. __extends(QueueScheduler2, _super);
  2135. function QueueScheduler2() {
  2136. return _super !== null && _super.apply(this, arguments) || this;
  2137. }
  2138. return QueueScheduler2;
  2139. }(AsyncScheduler);
  2140. // node_modules/rxjs/dist/esm5/internal/scheduler/queue.js
  2141. var queueScheduler = new QueueScheduler(QueueAction);
  2142. // node_modules/rxjs/dist/esm5/internal/scheduler/AnimationFrameAction.js
  2143. var AnimationFrameAction = function(_super) {
  2144. __extends(AnimationFrameAction2, _super);
  2145. function AnimationFrameAction2(scheduler, work) {
  2146. var _this = _super.call(this, scheduler, work) || this;
  2147. _this.scheduler = scheduler;
  2148. _this.work = work;
  2149. return _this;
  2150. }
  2151. AnimationFrameAction2.prototype.requestAsyncId = function(scheduler, id, delay2) {
  2152. if (delay2 === void 0) {
  2153. delay2 = 0;
  2154. }
  2155. if (delay2 !== null && delay2 > 0) {
  2156. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay2);
  2157. }
  2158. scheduler.actions.push(this);
  2159. return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(function() {
  2160. return scheduler.flush(void 0);
  2161. }));
  2162. };
  2163. AnimationFrameAction2.prototype.recycleAsyncId = function(scheduler, id, delay2) {
  2164. var _a;
  2165. if (delay2 === void 0) {
  2166. delay2 = 0;
  2167. }
  2168. if (delay2 != null ? delay2 > 0 : this.delay > 0) {
  2169. return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay2);
  2170. }
  2171. var actions = scheduler.actions;
  2172. if (id != null && id === scheduler._scheduled && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
  2173. animationFrameProvider.cancelAnimationFrame(id);
  2174. scheduler._scheduled = void 0;
  2175. }
  2176. return void 0;
  2177. };
  2178. return AnimationFrameAction2;
  2179. }(AsyncAction);
  2180. // node_modules/rxjs/dist/esm5/internal/scheduler/AnimationFrameScheduler.js
  2181. var AnimationFrameScheduler = function(_super) {
  2182. __extends(AnimationFrameScheduler2, _super);
  2183. function AnimationFrameScheduler2() {
  2184. return _super !== null && _super.apply(this, arguments) || this;
  2185. }
  2186. AnimationFrameScheduler2.prototype.flush = function(action) {
  2187. this._active = true;
  2188. var flushId;
  2189. if (action) {
  2190. flushId = action.id;
  2191. } else {
  2192. flushId = this._scheduled;
  2193. this._scheduled = void 0;
  2194. }
  2195. var actions = this.actions;
  2196. var error;
  2197. action = action || actions.shift();
  2198. do {
  2199. if (error = action.execute(action.state, action.delay)) {
  2200. break;
  2201. }
  2202. } while ((action = actions[0]) && action.id === flushId && actions.shift());
  2203. this._active = false;
  2204. if (error) {
  2205. while ((action = actions[0]) && action.id === flushId && actions.shift()) {
  2206. action.unsubscribe();
  2207. }
  2208. throw error;
  2209. }
  2210. };
  2211. return AnimationFrameScheduler2;
  2212. }(AsyncScheduler);
  2213. // node_modules/rxjs/dist/esm5/internal/scheduler/animationFrame.js
  2214. var animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);
  2215. // node_modules/rxjs/dist/esm5/internal/scheduler/VirtualTimeScheduler.js
  2216. var VirtualTimeScheduler = function(_super) {
  2217. __extends(VirtualTimeScheduler2, _super);
  2218. function VirtualTimeScheduler2(schedulerActionCtor, maxFrames) {
  2219. if (schedulerActionCtor === void 0) {
  2220. schedulerActionCtor = VirtualAction;
  2221. }
  2222. if (maxFrames === void 0) {
  2223. maxFrames = Infinity;
  2224. }
  2225. var _this = _super.call(this, schedulerActionCtor, function() {
  2226. return _this.frame;
  2227. }) || this;
  2228. _this.maxFrames = maxFrames;
  2229. _this.frame = 0;
  2230. _this.index = -1;
  2231. return _this;
  2232. }
  2233. VirtualTimeScheduler2.prototype.flush = function() {
  2234. var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;
  2235. var error;
  2236. var action;
  2237. while ((action = actions[0]) && action.delay <= maxFrames) {
  2238. actions.shift();
  2239. this.frame = action.delay;
  2240. if (error = action.execute(action.state, action.delay)) {
  2241. break;
  2242. }
  2243. }
  2244. if (error) {
  2245. while (action = actions.shift()) {
  2246. action.unsubscribe();
  2247. }
  2248. throw error;
  2249. }
  2250. };
  2251. VirtualTimeScheduler2.frameTimeFactor = 10;
  2252. return VirtualTimeScheduler2;
  2253. }(AsyncScheduler);
  2254. var VirtualAction = function(_super) {
  2255. __extends(VirtualAction2, _super);
  2256. function VirtualAction2(scheduler, work, index) {
  2257. if (index === void 0) {
  2258. index = scheduler.index += 1;
  2259. }
  2260. var _this = _super.call(this, scheduler, work) || this;
  2261. _this.scheduler = scheduler;
  2262. _this.work = work;
  2263. _this.index = index;
  2264. _this.active = true;
  2265. _this.index = scheduler.index = index;
  2266. return _this;
  2267. }
  2268. VirtualAction2.prototype.schedule = function(state, delay2) {
  2269. if (delay2 === void 0) {
  2270. delay2 = 0;
  2271. }
  2272. if (Number.isFinite(delay2)) {
  2273. if (!this.id) {
  2274. return _super.prototype.schedule.call(this, state, delay2);
  2275. }
  2276. this.active = false;
  2277. var action = new VirtualAction2(this.scheduler, this.work);
  2278. this.add(action);
  2279. return action.schedule(state, delay2);
  2280. } else {
  2281. return Subscription.EMPTY;
  2282. }
  2283. };
  2284. VirtualAction2.prototype.requestAsyncId = function(scheduler, id, delay2) {
  2285. if (delay2 === void 0) {
  2286. delay2 = 0;
  2287. }
  2288. this.delay = scheduler.frame + delay2;
  2289. var actions = scheduler.actions;
  2290. actions.push(this);
  2291. actions.sort(VirtualAction2.sortActions);
  2292. return 1;
  2293. };
  2294. VirtualAction2.prototype.recycleAsyncId = function(scheduler, id, delay2) {
  2295. if (delay2 === void 0) {
  2296. delay2 = 0;
  2297. }
  2298. return void 0;
  2299. };
  2300. VirtualAction2.prototype._execute = function(state, delay2) {
  2301. if (this.active === true) {
  2302. return _super.prototype._execute.call(this, state, delay2);
  2303. }
  2304. };
  2305. VirtualAction2.sortActions = function(a, b) {
  2306. if (a.delay === b.delay) {
  2307. if (a.index === b.index) {
  2308. return 0;
  2309. } else if (a.index > b.index) {
  2310. return 1;
  2311. } else {
  2312. return -1;
  2313. }
  2314. } else if (a.delay > b.delay) {
  2315. return 1;
  2316. } else {
  2317. return -1;
  2318. }
  2319. };
  2320. return VirtualAction2;
  2321. }(AsyncAction);
  2322. // node_modules/rxjs/dist/esm5/internal/observable/empty.js
  2323. var EMPTY = new Observable(function(subscriber) {
  2324. return subscriber.complete();
  2325. });
  2326. // node_modules/rxjs/dist/esm5/internal/util/isScheduler.js
  2327. function isScheduler(value) {
  2328. return value && isFunction(value.schedule);
  2329. }
  2330. // node_modules/rxjs/dist/esm5/internal/util/args.js
  2331. function last(arr) {
  2332. return arr[arr.length - 1];
  2333. }
  2334. function popScheduler(args) {
  2335. return isScheduler(last(args)) ? args.pop() : void 0;
  2336. }
  2337. // node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js
  2338. var isArrayLike = function(x) {
  2339. return x && typeof x.length === "number" && typeof x !== "function";
  2340. };
  2341. // node_modules/rxjs/dist/esm5/internal/util/isPromise.js
  2342. function isPromise(value) {
  2343. return isFunction(value === null || value === void 0 ? void 0 : value.then);
  2344. }
  2345. // node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js
  2346. function isInteropObservable(input2) {
  2347. return isFunction(input2[observable]);
  2348. }
  2349. // node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js
  2350. function isAsyncIterable(obj) {
  2351. return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
  2352. }
  2353. // node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js
  2354. function createInvalidObservableTypeError(input2) {
  2355. return new TypeError("You provided " + (input2 !== null && typeof input2 === "object" ? "an invalid object" : "'" + input2 + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
  2356. }
  2357. // node_modules/rxjs/dist/esm5/internal/symbol/iterator.js
  2358. function getSymbolIterator() {
  2359. if (typeof Symbol !== "function" || !Symbol.iterator) {
  2360. return "@@iterator";
  2361. }
  2362. return Symbol.iterator;
  2363. }
  2364. var iterator = getSymbolIterator();
  2365. // node_modules/rxjs/dist/esm5/internal/util/isIterable.js
  2366. function isIterable(input2) {
  2367. return isFunction(input2 === null || input2 === void 0 ? void 0 : input2[iterator]);
  2368. }
  2369. // node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js
  2370. function readableStreamLikeToAsyncGenerator(readableStream) {
  2371. return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
  2372. var reader, _a, value, done;
  2373. return __generator(this, function(_b) {
  2374. switch (_b.label) {
  2375. case 0:
  2376. reader = readableStream.getReader();
  2377. _b.label = 1;
  2378. case 1:
  2379. _b.trys.push([1, , 9, 10]);
  2380. _b.label = 2;
  2381. case 2:
  2382. if (false) return [3, 8];
  2383. return [4, __await(reader.read())];
  2384. case 3:
  2385. _a = _b.sent(), value = _a.value, done = _a.done;
  2386. if (!done) return [3, 5];
  2387. return [4, __await(void 0)];
  2388. case 4:
  2389. return [2, _b.sent()];
  2390. case 5:
  2391. return [4, __await(value)];
  2392. case 6:
  2393. return [4, _b.sent()];
  2394. case 7:
  2395. _b.sent();
  2396. return [3, 2];
  2397. case 8:
  2398. return [3, 10];
  2399. case 9:
  2400. reader.releaseLock();
  2401. return [7];
  2402. case 10:
  2403. return [2];
  2404. }
  2405. });
  2406. });
  2407. }
  2408. function isReadableStreamLike(obj) {
  2409. return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
  2410. }
  2411. // node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js
  2412. function innerFrom(input2) {
  2413. if (input2 instanceof Observable) {
  2414. return input2;
  2415. }
  2416. if (input2 != null) {
  2417. if (isInteropObservable(input2)) {
  2418. return fromInteropObservable(input2);
  2419. }
  2420. if (isArrayLike(input2)) {
  2421. return fromArrayLike(input2);
  2422. }
  2423. if (isPromise(input2)) {
  2424. return fromPromise(input2);
  2425. }
  2426. if (isAsyncIterable(input2)) {
  2427. return fromAsyncIterable(input2);
  2428. }
  2429. if (isIterable(input2)) {
  2430. return fromIterable(input2);
  2431. }
  2432. if (isReadableStreamLike(input2)) {
  2433. return fromReadableStreamLike(input2);
  2434. }
  2435. }
  2436. throw createInvalidObservableTypeError(input2);
  2437. }
  2438. function fromInteropObservable(obj) {
  2439. return new Observable(function(subscriber) {
  2440. var obs = obj[observable]();
  2441. if (isFunction(obs.subscribe)) {
  2442. return obs.subscribe(subscriber);
  2443. }
  2444. throw new TypeError("Provided object does not correctly implement Symbol.observable");
  2445. });
  2446. }
  2447. function fromArrayLike(array) {
  2448. return new Observable(function(subscriber) {
  2449. for (var i = 0; i < array.length && !subscriber.closed; i++) {
  2450. subscriber.next(array[i]);
  2451. }
  2452. subscriber.complete();
  2453. });
  2454. }
  2455. function fromPromise(promise) {
  2456. return new Observable(function(subscriber) {
  2457. promise.then(function(value) {
  2458. if (!subscriber.closed) {
  2459. subscriber.next(value);
  2460. subscriber.complete();
  2461. }
  2462. }, function(err) {
  2463. return subscriber.error(err);
  2464. }).then(null, reportUnhandledError);
  2465. });
  2466. }
  2467. function fromIterable(iterable) {
  2468. return new Observable(function(subscriber) {
  2469. var e_1, _a;
  2470. try {
  2471. for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
  2472. var value = iterable_1_1.value;
  2473. subscriber.next(value);
  2474. if (subscriber.closed) {
  2475. return;
  2476. }
  2477. }
  2478. } catch (e_1_1) {
  2479. e_1 = {
  2480. error: e_1_1
  2481. };
  2482. } finally {
  2483. try {
  2484. if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
  2485. } finally {
  2486. if (e_1) throw e_1.error;
  2487. }
  2488. }
  2489. subscriber.complete();
  2490. });
  2491. }
  2492. function fromAsyncIterable(asyncIterable) {
  2493. return new Observable(function(subscriber) {
  2494. process(asyncIterable, subscriber).catch(function(err) {
  2495. return subscriber.error(err);
  2496. });
  2497. });
  2498. }
  2499. function fromReadableStreamLike(readableStream) {
  2500. return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
  2501. }
  2502. function process(asyncIterable, subscriber) {
  2503. var asyncIterable_1, asyncIterable_1_1;
  2504. var e_2, _a;
  2505. return __awaiter(this, void 0, void 0, function() {
  2506. var value, e_2_1;
  2507. return __generator(this, function(_b) {
  2508. switch (_b.label) {
  2509. case 0:
  2510. _b.trys.push([0, 5, 6, 11]);
  2511. asyncIterable_1 = __asyncValues(asyncIterable);
  2512. _b.label = 1;
  2513. case 1:
  2514. return [4, asyncIterable_1.next()];
  2515. case 2:
  2516. if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
  2517. value = asyncIterable_1_1.value;
  2518. subscriber.next(value);
  2519. if (subscriber.closed) {
  2520. return [2];
  2521. }
  2522. _b.label = 3;
  2523. case 3:
  2524. return [3, 1];
  2525. case 4:
  2526. return [3, 11];
  2527. case 5:
  2528. e_2_1 = _b.sent();
  2529. e_2 = {
  2530. error: e_2_1
  2531. };
  2532. return [3, 11];
  2533. case 6:
  2534. _b.trys.push([6, , 9, 10]);
  2535. if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
  2536. return [4, _a.call(asyncIterable_1)];
  2537. case 7:
  2538. _b.sent();
  2539. _b.label = 8;
  2540. case 8:
  2541. return [3, 10];
  2542. case 9:
  2543. if (e_2) throw e_2.error;
  2544. return [7];
  2545. case 10:
  2546. return [7];
  2547. case 11:
  2548. subscriber.complete();
  2549. return [2];
  2550. }
  2551. });
  2552. });
  2553. }
  2554. // node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js
  2555. function executeSchedule(parentSubscription, scheduler, work, delay2, repeat2) {
  2556. if (delay2 === void 0) {
  2557. delay2 = 0;
  2558. }
  2559. if (repeat2 === void 0) {
  2560. repeat2 = false;
  2561. }
  2562. var scheduleSubscription = scheduler.schedule(function() {
  2563. work();
  2564. if (repeat2) {
  2565. parentSubscription.add(this.schedule(null, delay2));
  2566. } else {
  2567. this.unsubscribe();
  2568. }
  2569. }, delay2);
  2570. parentSubscription.add(scheduleSubscription);
  2571. if (!repeat2) {
  2572. return scheduleSubscription;
  2573. }
  2574. }
  2575. // node_modules/rxjs/dist/esm5/internal/operators/observeOn.js
  2576. function observeOn(scheduler, delay2) {
  2577. if (delay2 === void 0) {
  2578. delay2 = 0;
  2579. }
  2580. return operate(function(source, subscriber) {
  2581. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2582. return executeSchedule(subscriber, scheduler, function() {
  2583. return subscriber.next(value);
  2584. }, delay2);
  2585. }, function() {
  2586. return executeSchedule(subscriber, scheduler, function() {
  2587. return subscriber.complete();
  2588. }, delay2);
  2589. }, function(err) {
  2590. return executeSchedule(subscriber, scheduler, function() {
  2591. return subscriber.error(err);
  2592. }, delay2);
  2593. }));
  2594. });
  2595. }
  2596. // node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
  2597. function subscribeOn(scheduler, delay2) {
  2598. if (delay2 === void 0) {
  2599. delay2 = 0;
  2600. }
  2601. return operate(function(source, subscriber) {
  2602. subscriber.add(scheduler.schedule(function() {
  2603. return source.subscribe(subscriber);
  2604. }, delay2));
  2605. });
  2606. }
  2607. // node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js
  2608. function scheduleObservable(input2, scheduler) {
  2609. return innerFrom(input2).pipe(subscribeOn(scheduler), observeOn(scheduler));
  2610. }
  2611. // node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js
  2612. function schedulePromise(input2, scheduler) {
  2613. return innerFrom(input2).pipe(subscribeOn(scheduler), observeOn(scheduler));
  2614. }
  2615. // node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js
  2616. function scheduleArray(input2, scheduler) {
  2617. return new Observable(function(subscriber) {
  2618. var i = 0;
  2619. return scheduler.schedule(function() {
  2620. if (i === input2.length) {
  2621. subscriber.complete();
  2622. } else {
  2623. subscriber.next(input2[i++]);
  2624. if (!subscriber.closed) {
  2625. this.schedule();
  2626. }
  2627. }
  2628. });
  2629. });
  2630. }
  2631. // node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js
  2632. function scheduleIterable(input2, scheduler) {
  2633. return new Observable(function(subscriber) {
  2634. var iterator2;
  2635. executeSchedule(subscriber, scheduler, function() {
  2636. iterator2 = input2[iterator]();
  2637. executeSchedule(subscriber, scheduler, function() {
  2638. var _a;
  2639. var value;
  2640. var done;
  2641. try {
  2642. _a = iterator2.next(), value = _a.value, done = _a.done;
  2643. } catch (err) {
  2644. subscriber.error(err);
  2645. return;
  2646. }
  2647. if (done) {
  2648. subscriber.complete();
  2649. } else {
  2650. subscriber.next(value);
  2651. }
  2652. }, 0, true);
  2653. });
  2654. return function() {
  2655. return isFunction(iterator2 === null || iterator2 === void 0 ? void 0 : iterator2.return) && iterator2.return();
  2656. };
  2657. });
  2658. }
  2659. // node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js
  2660. function scheduleAsyncIterable(input2, scheduler) {
  2661. if (!input2) {
  2662. throw new Error("Iterable cannot be null");
  2663. }
  2664. return new Observable(function(subscriber) {
  2665. executeSchedule(subscriber, scheduler, function() {
  2666. var iterator2 = input2[Symbol.asyncIterator]();
  2667. executeSchedule(subscriber, scheduler, function() {
  2668. iterator2.next().then(function(result) {
  2669. if (result.done) {
  2670. subscriber.complete();
  2671. } else {
  2672. subscriber.next(result.value);
  2673. }
  2674. });
  2675. }, 0, true);
  2676. });
  2677. });
  2678. }
  2679. // node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js
  2680. function scheduleReadableStreamLike(input2, scheduler) {
  2681. return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input2), scheduler);
  2682. }
  2683. // node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js
  2684. function scheduled(input2, scheduler) {
  2685. if (input2 != null) {
  2686. if (isInteropObservable(input2)) {
  2687. return scheduleObservable(input2, scheduler);
  2688. }
  2689. if (isArrayLike(input2)) {
  2690. return scheduleArray(input2, scheduler);
  2691. }
  2692. if (isPromise(input2)) {
  2693. return schedulePromise(input2, scheduler);
  2694. }
  2695. if (isAsyncIterable(input2)) {
  2696. return scheduleAsyncIterable(input2, scheduler);
  2697. }
  2698. if (isIterable(input2)) {
  2699. return scheduleIterable(input2, scheduler);
  2700. }
  2701. if (isReadableStreamLike(input2)) {
  2702. return scheduleReadableStreamLike(input2, scheduler);
  2703. }
  2704. }
  2705. throw createInvalidObservableTypeError(input2);
  2706. }
  2707. // node_modules/rxjs/dist/esm5/internal/observable/from.js
  2708. function from(input2, scheduler) {
  2709. return scheduler ? scheduled(input2, scheduler) : innerFrom(input2);
  2710. }
  2711. // node_modules/rxjs/dist/esm5/internal/observable/of.js
  2712. function of() {
  2713. var args = [];
  2714. for (var _i = 0; _i < arguments.length; _i++) {
  2715. args[_i] = arguments[_i];
  2716. }
  2717. var scheduler = popScheduler(args);
  2718. return from(args, scheduler);
  2719. }
  2720. // node_modules/rxjs/dist/esm5/internal/observable/throwError.js
  2721. function throwError(errorOrErrorFactory, scheduler) {
  2722. var errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
  2723. return errorOrErrorFactory;
  2724. };
  2725. var init = function(subscriber) {
  2726. return subscriber.error(errorFactory());
  2727. };
  2728. return new Observable(scheduler ? function(subscriber) {
  2729. return scheduler.schedule(init, 0, subscriber);
  2730. } : init);
  2731. }
  2732. // node_modules/rxjs/dist/esm5/internal/Notification.js
  2733. var NotificationKind;
  2734. (function(NotificationKind2) {
  2735. NotificationKind2["NEXT"] = "N";
  2736. NotificationKind2["ERROR"] = "E";
  2737. NotificationKind2["COMPLETE"] = "C";
  2738. })(NotificationKind || (NotificationKind = {}));
  2739. var Notification = function() {
  2740. function Notification2(kind, value, error) {
  2741. this.kind = kind;
  2742. this.value = value;
  2743. this.error = error;
  2744. this.hasValue = kind === "N";
  2745. }
  2746. Notification2.prototype.observe = function(observer) {
  2747. return observeNotification(this, observer);
  2748. };
  2749. Notification2.prototype.do = function(nextHandler, errorHandler, completeHandler) {
  2750. var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
  2751. return kind === "N" ? nextHandler === null || nextHandler === void 0 ? void 0 : nextHandler(value) : kind === "E" ? errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error) : completeHandler === null || completeHandler === void 0 ? void 0 : completeHandler();
  2752. };
  2753. Notification2.prototype.accept = function(nextOrObserver, error, complete) {
  2754. var _a;
  2755. return isFunction((_a = nextOrObserver) === null || _a === void 0 ? void 0 : _a.next) ? this.observe(nextOrObserver) : this.do(nextOrObserver, error, complete);
  2756. };
  2757. Notification2.prototype.toObservable = function() {
  2758. var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
  2759. var result = kind === "N" ? of(value) : kind === "E" ? throwError(function() {
  2760. return error;
  2761. }) : kind === "C" ? EMPTY : 0;
  2762. if (!result) {
  2763. throw new TypeError("Unexpected notification kind " + kind);
  2764. }
  2765. return result;
  2766. };
  2767. Notification2.createNext = function(value) {
  2768. return new Notification2("N", value);
  2769. };
  2770. Notification2.createError = function(err) {
  2771. return new Notification2("E", void 0, err);
  2772. };
  2773. Notification2.createComplete = function() {
  2774. return Notification2.completeNotification;
  2775. };
  2776. Notification2.completeNotification = new Notification2("C");
  2777. return Notification2;
  2778. }();
  2779. function observeNotification(notification, observer) {
  2780. var _a, _b, _c;
  2781. var _d = notification, kind = _d.kind, value = _d.value, error = _d.error;
  2782. if (typeof kind !== "string") {
  2783. throw new TypeError('Invalid notification, missing "kind"');
  2784. }
  2785. kind === "N" ? (_a = observer.next) === null || _a === void 0 ? void 0 : _a.call(observer, value) : kind === "E" ? (_b = observer.error) === null || _b === void 0 ? void 0 : _b.call(observer, error) : (_c = observer.complete) === null || _c === void 0 ? void 0 : _c.call(observer);
  2786. }
  2787. // node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
  2788. var EmptyError = createErrorClass(function(_super) {
  2789. return function EmptyErrorImpl() {
  2790. _super(this);
  2791. this.name = "EmptyError";
  2792. this.message = "no elements in sequence";
  2793. };
  2794. });
  2795. // node_modules/rxjs/dist/esm5/internal/util/ArgumentOutOfRangeError.js
  2796. var ArgumentOutOfRangeError = createErrorClass(function(_super) {
  2797. return function ArgumentOutOfRangeErrorImpl() {
  2798. _super(this);
  2799. this.name = "ArgumentOutOfRangeError";
  2800. this.message = "argument out of range";
  2801. };
  2802. });
  2803. // node_modules/rxjs/dist/esm5/internal/util/NotFoundError.js
  2804. var NotFoundError = createErrorClass(function(_super) {
  2805. return function NotFoundErrorImpl(message) {
  2806. _super(this);
  2807. this.name = "NotFoundError";
  2808. this.message = message;
  2809. };
  2810. });
  2811. // node_modules/rxjs/dist/esm5/internal/util/SequenceError.js
  2812. var SequenceError = createErrorClass(function(_super) {
  2813. return function SequenceErrorImpl(message) {
  2814. _super(this);
  2815. this.name = "SequenceError";
  2816. this.message = message;
  2817. };
  2818. });
  2819. // node_modules/rxjs/dist/esm5/internal/operators/timeout.js
  2820. var TimeoutError = createErrorClass(function(_super) {
  2821. return function TimeoutErrorImpl(info) {
  2822. if (info === void 0) {
  2823. info = null;
  2824. }
  2825. _super(this);
  2826. this.message = "Timeout has occurred";
  2827. this.name = "TimeoutError";
  2828. this.info = info;
  2829. };
  2830. });
  2831. // node_modules/rxjs/dist/esm5/internal/operators/map.js
  2832. function map(project, thisArg) {
  2833. return operate(function(source, subscriber) {
  2834. var index = 0;
  2835. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2836. subscriber.next(project.call(thisArg, value, index++));
  2837. }));
  2838. });
  2839. }
  2840. // node_modules/rxjs/dist/esm5/internal/util/mapOneOrManyArgs.js
  2841. var isArray = Array.isArray;
  2842. // node_modules/rxjs/dist/esm5/internal/util/argsArgArrayOrObject.js
  2843. var isArray2 = Array.isArray;
  2844. var objectProto = Object.prototype;
  2845. // node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js
  2846. function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand2, innerSubScheduler, additionalFinalizer) {
  2847. var buffer2 = [];
  2848. var active = 0;
  2849. var index = 0;
  2850. var isComplete = false;
  2851. var checkComplete = function() {
  2852. if (isComplete && !buffer2.length && !active) {
  2853. subscriber.complete();
  2854. }
  2855. };
  2856. var outerNext = function(value) {
  2857. return active < concurrent ? doInnerSub(value) : buffer2.push(value);
  2858. };
  2859. var doInnerSub = function(value) {
  2860. expand2 && subscriber.next(value);
  2861. active++;
  2862. var innerComplete = false;
  2863. innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
  2864. onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
  2865. if (expand2) {
  2866. outerNext(innerValue);
  2867. } else {
  2868. subscriber.next(innerValue);
  2869. }
  2870. }, function() {
  2871. innerComplete = true;
  2872. }, void 0, function() {
  2873. if (innerComplete) {
  2874. try {
  2875. active--;
  2876. var _loop_1 = function() {
  2877. var bufferedValue = buffer2.shift();
  2878. if (innerSubScheduler) {
  2879. executeSchedule(subscriber, innerSubScheduler, function() {
  2880. return doInnerSub(bufferedValue);
  2881. });
  2882. } else {
  2883. doInnerSub(bufferedValue);
  2884. }
  2885. };
  2886. while (buffer2.length && active < concurrent) {
  2887. _loop_1();
  2888. }
  2889. checkComplete();
  2890. } catch (err) {
  2891. subscriber.error(err);
  2892. }
  2893. }
  2894. }));
  2895. };
  2896. source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
  2897. isComplete = true;
  2898. checkComplete();
  2899. }));
  2900. return function() {
  2901. additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
  2902. };
  2903. }
  2904. // node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js
  2905. function mergeMap(project, resultSelector, concurrent) {
  2906. if (concurrent === void 0) {
  2907. concurrent = Infinity;
  2908. }
  2909. if (isFunction(resultSelector)) {
  2910. return mergeMap(function(a, i) {
  2911. return map(function(b, ii) {
  2912. return resultSelector(a, b, i, ii);
  2913. })(innerFrom(project(a, i)));
  2914. }, concurrent);
  2915. } else if (typeof resultSelector === "number") {
  2916. concurrent = resultSelector;
  2917. }
  2918. return operate(function(source, subscriber) {
  2919. return mergeInternals(source, subscriber, project, concurrent);
  2920. });
  2921. }
  2922. // node_modules/rxjs/dist/esm5/internal/observable/never.js
  2923. var NEVER = new Observable(noop);
  2924. // node_modules/rxjs/dist/esm5/internal/util/argsOrArgArray.js
  2925. var isArray3 = Array.isArray;
  2926. // node_modules/rxjs/dist/esm5/internal/operators/filter.js
  2927. function filter(predicate, thisArg) {
  2928. return operate(function(source, subscriber) {
  2929. var index = 0;
  2930. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2931. return predicate.call(thisArg, value, index++) && subscriber.next(value);
  2932. }));
  2933. });
  2934. }
  2935. // node_modules/rxjs/dist/esm5/internal/operators/concatMap.js
  2936. function concatMap(project, resultSelector) {
  2937. return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
  2938. }
  2939. // node_modules/rxjs/dist/esm5/internal/operators/finalize.js
  2940. function finalize(callback) {
  2941. return operate(function(source, subscriber) {
  2942. try {
  2943. source.subscribe(subscriber);
  2944. } finally {
  2945. subscriber.add(callback);
  2946. }
  2947. });
  2948. }
  2949. // node_modules/rxjs/dist/esm5/internal/operators/switchMap.js
  2950. function switchMap(project, resultSelector) {
  2951. return operate(function(source, subscriber) {
  2952. var innerSubscriber = null;
  2953. var index = 0;
  2954. var isComplete = false;
  2955. var checkComplete = function() {
  2956. return isComplete && !innerSubscriber && subscriber.complete();
  2957. };
  2958. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2959. innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
  2960. var innerIndex = 0;
  2961. var outerIndex = index++;
  2962. innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, function(innerValue) {
  2963. return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue);
  2964. }, function() {
  2965. innerSubscriber = null;
  2966. checkComplete();
  2967. }));
  2968. }, function() {
  2969. isComplete = true;
  2970. checkComplete();
  2971. }));
  2972. });
  2973. }
  2974. // node_modules/rxjs/dist/esm5/internal/operators/tap.js
  2975. function tap(observerOrNext, error, complete) {
  2976. var tapObserver = isFunction(observerOrNext) || error || complete ? {
  2977. next: observerOrNext,
  2978. error,
  2979. complete
  2980. } : observerOrNext;
  2981. return tapObserver ? operate(function(source, subscriber) {
  2982. var _a;
  2983. (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
  2984. var isUnsub = true;
  2985. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2986. var _a2;
  2987. (_a2 = tapObserver.next) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, value);
  2988. subscriber.next(value);
  2989. }, function() {
  2990. var _a2;
  2991. isUnsub = false;
  2992. (_a2 = tapObserver.complete) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
  2993. subscriber.complete();
  2994. }, function(err) {
  2995. var _a2;
  2996. isUnsub = false;
  2997. (_a2 = tapObserver.error) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, err);
  2998. subscriber.error(err);
  2999. }, function() {
  3000. var _a2, _b;
  3001. if (isUnsub) {
  3002. (_a2 = tapObserver.unsubscribe) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
  3003. }
  3004. (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
  3005. }));
  3006. }) : identity;
  3007. }
  3008. // node_modules/@angular/core/fesm2022/primitives/event-dispatch.mjs
  3009. var Attribute = {
  3010. /**
  3011. * The jsaction attribute defines a mapping of a DOM event to a
  3012. * generic event (aka jsaction), to which the actual event handlers
  3013. * that implement the behavior of the application are bound. The
  3014. * value is a semicolon separated list of colon separated pairs of
  3015. * an optional DOM event name and a jsaction name. If the optional
  3016. * DOM event name is omitted, 'click' is assumed. The jsaction names
  3017. * are dot separated pairs of a namespace and a simple jsaction
  3018. * name.
  3019. *
  3020. * See grammar in README.md for expected syntax in the attribute value.
  3021. */
  3022. JSACTION: "jsaction"
  3023. };
  3024. var Property = {
  3025. /**
  3026. * The parsed value of the jsaction attribute is stored in this
  3027. * property on the DOM node. The parsed value is an Object. The
  3028. * property names of the object are the events; the values are the
  3029. * names of the actions. This property is attached even on nodes
  3030. * that don't have a jsaction attribute as an optimization, because
  3031. * property lookup is faster than attribute access.
  3032. */
  3033. JSACTION: "__jsaction",
  3034. /**
  3035. * The owner property references an a logical owner for a DOM node. JSAction
  3036. * will follow this reference instead of parentNode when traversing the DOM
  3037. * to find jsaction attributes. This allows overlaying a logical structure
  3038. * over a document where the DOM structure can't reflect that structure.
  3039. */
  3040. OWNER: "__owner"
  3041. };
  3042. var parseCache = {};
  3043. function get(element) {
  3044. return element[Property.JSACTION];
  3045. }
  3046. function set(element, actionMap) {
  3047. element[Property.JSACTION] = actionMap;
  3048. }
  3049. function getParsed(text) {
  3050. return parseCache[text];
  3051. }
  3052. function setParsed(text, parsed) {
  3053. parseCache[text] = parsed;
  3054. }
  3055. var EventType = {
  3056. /**
  3057. * The click event. In addEvent() refers to all click events, in the
  3058. * jsaction attribute it refers to the unmodified click and Enter/Space
  3059. * keypress events. In the latter case, a jsaction click will be triggered,
  3060. * for accessibility reasons. See clickmod and clickonly, below.
  3061. */
  3062. CLICK: "click",
  3063. /**
  3064. * Specifies the jsaction for a modified click event (i.e. a mouse
  3065. * click with the modifier key Cmd/Ctrl pressed). This event isn't
  3066. * separately enabled in addEvent(), because in the DOM, it's just a
  3067. * click event.
  3068. */
  3069. CLICKMOD: "clickmod",
  3070. /**
  3071. * The dblclick event.
  3072. */
  3073. DBLCLICK: "dblclick",
  3074. /**
  3075. * Focus doesn't bubble, but you can use it in addEvent() and
  3076. * jsaction anyway. EventContract does the right thing under the
  3077. * hood.
  3078. */
  3079. FOCUS: "focus",
  3080. /**
  3081. * This event only exists in IE. For addEvent() and jsaction, use
  3082. * focus instead; EventContract does the right thing even though
  3083. * focus doesn't bubble.
  3084. */
  3085. FOCUSIN: "focusin",
  3086. /**
  3087. * Analog to focus.
  3088. */
  3089. BLUR: "blur",
  3090. /**
  3091. * Analog to focusin.
  3092. */
  3093. FOCUSOUT: "focusout",
  3094. /**
  3095. * Submit doesn't bubble, so it cannot be used with event
  3096. * contract. However, the browser helpfully fires a click event on
  3097. * the submit button of a form (even if the form is not submitted by
  3098. * a click on the submit button). So you should handle click on the
  3099. * submit button instead.
  3100. */
  3101. SUBMIT: "submit",
  3102. /**
  3103. * The keydown event. In addEvent() and non-click jsaction it represents the
  3104. * regular DOM keydown event. It represents click actions in non-Gecko
  3105. * browsers.
  3106. */
  3107. KEYDOWN: "keydown",
  3108. /**
  3109. * The keypress event. In addEvent() and non-click jsaction it represents the
  3110. * regular DOM keypress event. It represents click actions in Gecko browsers.
  3111. */
  3112. KEYPRESS: "keypress",
  3113. /**
  3114. * The keyup event. In addEvent() and non-click jsaction it represents the
  3115. * regular DOM keyup event. It represents click actions in non-Gecko
  3116. * browsers.
  3117. */
  3118. KEYUP: "keyup",
  3119. /**
  3120. * The mouseover event. Can either be used directly or used implicitly to
  3121. * capture mouseenter events. In addEvent(), it represents a regular DOM
  3122. * mouseover event.
  3123. */
  3124. MOUSEOVER: "mouseover",
  3125. /**
  3126. * The mouseout event. Can either be used directly or used implicitly to
  3127. * capture mouseover events. In addEvent(), it represents a regular DOM
  3128. * mouseout event.
  3129. */
  3130. MOUSEOUT: "mouseout",
  3131. /**
  3132. * The mouseenter event. Does not bubble and fires individually on each
  3133. * element being entered within a DOM tree.
  3134. */
  3135. MOUSEENTER: "mouseenter",
  3136. /**
  3137. * The mouseleave event. Does not bubble and fires individually on each
  3138. * element being entered within a DOM tree.
  3139. */
  3140. MOUSELEAVE: "mouseleave",
  3141. /**
  3142. * The pointerover event. Can either be used directly or used implicitly to
  3143. * capture pointerenter events. In addEvent(), it represents a regular DOM
  3144. * pointerover event.
  3145. */
  3146. POINTEROVER: "pointerover",
  3147. /**
  3148. * The pointerout event. Can either be used directly or used implicitly to
  3149. * capture pointerover events. In addEvent(), it represents a regular DOM
  3150. * pointerout event.
  3151. */
  3152. POINTEROUT: "pointerout",
  3153. /**
  3154. * The pointerenter event. Does not bubble and fires individually on each
  3155. * element being entered within a DOM tree.
  3156. */
  3157. POINTERENTER: "pointerenter",
  3158. /**
  3159. * The pointerleave event. Does not bubble and fires individually on each
  3160. * element being entered within a DOM tree.
  3161. */
  3162. POINTERLEAVE: "pointerleave",
  3163. /**
  3164. * The error event. The error event doesn't bubble, but you can use it in
  3165. * addEvent() and jsaction anyway. EventContract does the right thing under
  3166. * the hood (except in IE8 which does not use error events).
  3167. */
  3168. ERROR: "error",
  3169. /**
  3170. * The load event. The load event doesn't bubble, but you can use it in
  3171. * addEvent() and jsaction anyway. EventContract does the right thing
  3172. * under the hood.
  3173. */
  3174. LOAD: "load",
  3175. /**
  3176. * The touchstart event. Bubbles, will only ever fire in browsers with
  3177. * touch support.
  3178. */
  3179. TOUCHSTART: "touchstart",
  3180. /**
  3181. * The touchend event. Bubbles, will only ever fire in browsers with
  3182. * touch support.
  3183. */
  3184. TOUCHEND: "touchend",
  3185. /**
  3186. * The touchmove event. Bubbles, will only ever fire in browsers with
  3187. * touch support.
  3188. */
  3189. TOUCHMOVE: "touchmove",
  3190. /**
  3191. * The toggle event. The toggle event doesn't bubble, but you can use it in
  3192. * addEvent() and jsaction anyway. EventContract does the right thing
  3193. * under the hood.
  3194. */
  3195. TOGGLE: "toggle"
  3196. };
  3197. var MOUSE_SPECIAL_EVENT_TYPES = [EventType.MOUSEENTER, EventType.MOUSELEAVE, "pointerenter", "pointerleave"];
  3198. var BUBBLE_EVENT_TYPES = [
  3199. EventType.CLICK,
  3200. EventType.DBLCLICK,
  3201. EventType.FOCUSIN,
  3202. EventType.FOCUSOUT,
  3203. EventType.KEYDOWN,
  3204. EventType.KEYUP,
  3205. EventType.KEYPRESS,
  3206. EventType.MOUSEOVER,
  3207. EventType.MOUSEOUT,
  3208. EventType.SUBMIT,
  3209. EventType.TOUCHSTART,
  3210. EventType.TOUCHEND,
  3211. EventType.TOUCHMOVE,
  3212. "touchcancel",
  3213. "auxclick",
  3214. "change",
  3215. "compositionstart",
  3216. "compositionupdate",
  3217. "compositionend",
  3218. "beforeinput",
  3219. "input",
  3220. "select",
  3221. "copy",
  3222. "cut",
  3223. "paste",
  3224. "mousedown",
  3225. "mouseup",
  3226. "wheel",
  3227. "contextmenu",
  3228. "dragover",
  3229. "dragenter",
  3230. "dragleave",
  3231. "drop",
  3232. "dragstart",
  3233. "dragend",
  3234. "pointerdown",
  3235. "pointermove",
  3236. "pointerup",
  3237. "pointercancel",
  3238. "pointerover",
  3239. "pointerout",
  3240. "gotpointercapture",
  3241. "lostpointercapture",
  3242. // Video events.
  3243. "ended",
  3244. "loadedmetadata",
  3245. // Page visibility events.
  3246. "pagehide",
  3247. "pageshow",
  3248. "visibilitychange",
  3249. // Content visibility events.
  3250. "beforematch"
  3251. ];
  3252. var CAPTURE_EVENT_TYPES = [EventType.FOCUS, EventType.BLUR, EventType.ERROR, EventType.LOAD, EventType.TOGGLE];
  3253. var isCaptureEventType = (eventType) => CAPTURE_EVENT_TYPES.indexOf(eventType) >= 0;
  3254. var EARLY_EVENT_TYPES = BUBBLE_EVENT_TYPES.concat(CAPTURE_EVENT_TYPES);
  3255. var isEarlyEventType = (eventType) => EARLY_EVENT_TYPES.indexOf(eventType) >= 0;
  3256. function getBrowserEventType(eventType) {
  3257. if (eventType === EventType.MOUSEENTER) {
  3258. return EventType.MOUSEOVER;
  3259. } else if (eventType === EventType.MOUSELEAVE) {
  3260. return EventType.MOUSEOUT;
  3261. } else if (eventType === EventType.POINTERENTER) {
  3262. return EventType.POINTEROVER;
  3263. } else if (eventType === EventType.POINTERLEAVE) {
  3264. return EventType.POINTEROUT;
  3265. }
  3266. return eventType;
  3267. }
  3268. function addEventListener(element, eventType, handler, passive) {
  3269. let capture = false;
  3270. if (isCaptureEventType(eventType)) {
  3271. capture = true;
  3272. }
  3273. const options = typeof passive === "boolean" ? {
  3274. capture,
  3275. passive
  3276. } : capture;
  3277. element.addEventListener(eventType, handler, options);
  3278. return {
  3279. eventType,
  3280. handler,
  3281. capture,
  3282. passive
  3283. };
  3284. }
  3285. function removeEventListener(element, info) {
  3286. if (element.removeEventListener) {
  3287. const options = typeof info.passive === "boolean" ? {
  3288. capture: info.capture
  3289. } : info.capture;
  3290. element.removeEventListener(info.eventType, info.handler, options);
  3291. } else if (element.detachEvent) {
  3292. element.detachEvent(`on${info.eventType}`, info.handler);
  3293. }
  3294. }
  3295. function preventDefault(e) {
  3296. e.preventDefault ? e.preventDefault() : e.returnValue = false;
  3297. }
  3298. var isMac = typeof navigator !== "undefined" && /Macintosh/.test(navigator.userAgent);
  3299. function isMiddleClick(e) {
  3300. return (
  3301. // `which` is an old DOM API.
  3302. e.which === 2 || // `which` is an old DOM API.
  3303. e.which == null && // `button` is an old DOM API.
  3304. e.button === 4
  3305. );
  3306. }
  3307. function isModifiedClickEvent(e) {
  3308. return (
  3309. // `metaKey` is an old DOM API.
  3310. isMac && e.metaKey || // `ctrlKey` is an old DOM API.
  3311. !isMac && e.ctrlKey || isMiddleClick(e) || // `shiftKey` is an old DOM API.
  3312. e.shiftKey
  3313. );
  3314. }
  3315. function isMouseSpecialEvent(e, type, element) {
  3316. const related = e.relatedTarget;
  3317. return (e.type === EventType.MOUSEOVER && type === EventType.MOUSEENTER || e.type === EventType.MOUSEOUT && type === EventType.MOUSELEAVE || e.type === EventType.POINTEROVER && type === EventType.POINTERENTER || e.type === EventType.POINTEROUT && type === EventType.POINTERLEAVE) && (!related || related !== element && !element.contains(related));
  3318. }
  3319. function createMouseSpecialEvent(e, target) {
  3320. const copy = {};
  3321. for (const property in e) {
  3322. if (property === "srcElement" || property === "target") {
  3323. continue;
  3324. }
  3325. const key = property;
  3326. const value = e[key];
  3327. if (typeof value === "function") {
  3328. continue;
  3329. }
  3330. copy[key] = value;
  3331. }
  3332. if (e.type === EventType.MOUSEOVER) {
  3333. copy["type"] = EventType.MOUSEENTER;
  3334. } else if (e.type === EventType.MOUSEOUT) {
  3335. copy["type"] = EventType.MOUSELEAVE;
  3336. } else if (e.type === EventType.POINTEROVER) {
  3337. copy["type"] = EventType.POINTERENTER;
  3338. } else {
  3339. copy["type"] = EventType.POINTERLEAVE;
  3340. }
  3341. copy["target"] = copy["srcElement"] = target;
  3342. copy["bubbles"] = false;
  3343. copy["_originalEvent"] = e;
  3344. return copy;
  3345. }
  3346. var isIos = typeof navigator !== "undefined" && /iPhone|iPad|iPod/.test(navigator.userAgent);
  3347. var EventContractContainer = class {
  3348. element;
  3349. /**
  3350. * Array of event handlers and their corresponding event types that are
  3351. * installed on this container.
  3352. *
  3353. */
  3354. handlerInfos = [];
  3355. /**
  3356. * @param element The container Element.
  3357. */
  3358. constructor(element) {
  3359. this.element = element;
  3360. }
  3361. /**
  3362. * Installs the provided installer on the element owned by this container,
  3363. * and maintains a reference to resulting handler in order to remove it
  3364. * later if desired.
  3365. */
  3366. addEventListener(eventType, getHandler, passive) {
  3367. if (isIos) {
  3368. this.element.style.cursor = "pointer";
  3369. }
  3370. this.handlerInfos.push(addEventListener(this.element, eventType, getHandler(this.element), passive));
  3371. }
  3372. /**
  3373. * Removes all the handlers installed on this container.
  3374. */
  3375. cleanUp() {
  3376. for (let i = 0; i < this.handlerInfos.length; i++) {
  3377. removeEventListener(this.element, this.handlerInfos[i]);
  3378. }
  3379. this.handlerInfos = [];
  3380. }
  3381. };
  3382. var Char = {
  3383. /**
  3384. * The separator between the event name and action in the jsaction
  3385. * attribute value.
  3386. */
  3387. EVENT_ACTION_SEPARATOR: ":"
  3388. };
  3389. function getEventType(eventInfo) {
  3390. return eventInfo.eventType;
  3391. }
  3392. function setEventType(eventInfo, eventType) {
  3393. eventInfo.eventType = eventType;
  3394. }
  3395. function getEvent(eventInfo) {
  3396. return eventInfo.event;
  3397. }
  3398. function setEvent(eventInfo, event) {
  3399. eventInfo.event = event;
  3400. }
  3401. function getTargetElement(eventInfo) {
  3402. return eventInfo.targetElement;
  3403. }
  3404. function setTargetElement(eventInfo, targetElement) {
  3405. eventInfo.targetElement = targetElement;
  3406. }
  3407. function getContainer(eventInfo) {
  3408. return eventInfo.eic;
  3409. }
  3410. function setContainer(eventInfo, container) {
  3411. eventInfo.eic = container;
  3412. }
  3413. function getTimestamp(eventInfo) {
  3414. return eventInfo.timeStamp;
  3415. }
  3416. function setTimestamp(eventInfo, timestamp2) {
  3417. eventInfo.timeStamp = timestamp2;
  3418. }
  3419. function getAction(eventInfo) {
  3420. return eventInfo.eia;
  3421. }
  3422. function setAction(eventInfo, actionName, actionElement) {
  3423. eventInfo.eia = [actionName, actionElement];
  3424. }
  3425. function unsetAction(eventInfo) {
  3426. eventInfo.eia = void 0;
  3427. }
  3428. function getActionElement(actionInfo) {
  3429. return actionInfo[1];
  3430. }
  3431. function getIsReplay(eventInfo) {
  3432. return eventInfo.eirp;
  3433. }
  3434. function setIsReplay(eventInfo, replay) {
  3435. eventInfo.eirp = replay;
  3436. }
  3437. function getResolved(eventInfo) {
  3438. return eventInfo.eir;
  3439. }
  3440. function setResolved(eventInfo, resolved2) {
  3441. eventInfo.eir = resolved2;
  3442. }
  3443. function cloneEventInfo(eventInfo) {
  3444. return {
  3445. eventType: eventInfo.eventType,
  3446. event: eventInfo.event,
  3447. targetElement: eventInfo.targetElement,
  3448. eic: eventInfo.eic,
  3449. eia: eventInfo.eia,
  3450. timeStamp: eventInfo.timeStamp,
  3451. eirp: eventInfo.eirp,
  3452. eiack: eventInfo.eiack,
  3453. eir: eventInfo.eir
  3454. };
  3455. }
  3456. function createEventInfoFromParameters(eventType, event, targetElement, container, timestamp2, action, isReplay, a11yClickKey) {
  3457. return {
  3458. eventType,
  3459. event,
  3460. targetElement,
  3461. eic: container,
  3462. timeStamp: timestamp2,
  3463. eia: action,
  3464. eirp: isReplay,
  3465. eiack: a11yClickKey
  3466. };
  3467. }
  3468. var EventInfoWrapper = class _EventInfoWrapper {
  3469. eventInfo;
  3470. constructor(eventInfo) {
  3471. this.eventInfo = eventInfo;
  3472. }
  3473. getEventType() {
  3474. return getEventType(this.eventInfo);
  3475. }
  3476. setEventType(eventType) {
  3477. setEventType(this.eventInfo, eventType);
  3478. }
  3479. getEvent() {
  3480. return getEvent(this.eventInfo);
  3481. }
  3482. setEvent(event) {
  3483. setEvent(this.eventInfo, event);
  3484. }
  3485. getTargetElement() {
  3486. return getTargetElement(this.eventInfo);
  3487. }
  3488. setTargetElement(targetElement) {
  3489. setTargetElement(this.eventInfo, targetElement);
  3490. }
  3491. getContainer() {
  3492. return getContainer(this.eventInfo);
  3493. }
  3494. setContainer(container) {
  3495. setContainer(this.eventInfo, container);
  3496. }
  3497. getTimestamp() {
  3498. return getTimestamp(this.eventInfo);
  3499. }
  3500. setTimestamp(timestamp2) {
  3501. setTimestamp(this.eventInfo, timestamp2);
  3502. }
  3503. getAction() {
  3504. const action = getAction(this.eventInfo);
  3505. if (!action) return void 0;
  3506. return {
  3507. name: action[0],
  3508. element: action[1]
  3509. };
  3510. }
  3511. setAction(action) {
  3512. if (!action) {
  3513. unsetAction(this.eventInfo);
  3514. return;
  3515. }
  3516. setAction(this.eventInfo, action.name, action.element);
  3517. }
  3518. getIsReplay() {
  3519. return getIsReplay(this.eventInfo);
  3520. }
  3521. setIsReplay(replay) {
  3522. setIsReplay(this.eventInfo, replay);
  3523. }
  3524. getResolved() {
  3525. return getResolved(this.eventInfo);
  3526. }
  3527. setResolved(resolved2) {
  3528. setResolved(this.eventInfo, resolved2);
  3529. }
  3530. clone() {
  3531. return new _EventInfoWrapper(cloneEventInfo(this.eventInfo));
  3532. }
  3533. };
  3534. var EMPTY_ACTION_MAP = {};
  3535. var REGEXP_SEMICOLON = /\s*;\s*/;
  3536. var DEFAULT_EVENT_TYPE = EventType.CLICK;
  3537. var ActionResolver = class {
  3538. a11yClickSupport = false;
  3539. clickModSupport = true;
  3540. syntheticMouseEventSupport;
  3541. updateEventInfoForA11yClick = void 0;
  3542. preventDefaultForA11yClick = void 0;
  3543. populateClickOnlyAction = void 0;
  3544. constructor({
  3545. syntheticMouseEventSupport = false,
  3546. clickModSupport = true
  3547. } = {}) {
  3548. this.syntheticMouseEventSupport = syntheticMouseEventSupport;
  3549. this.clickModSupport = clickModSupport;
  3550. }
  3551. resolveEventType(eventInfo) {
  3552. if (this.clickModSupport && getEventType(eventInfo) === EventType.CLICK && isModifiedClickEvent(getEvent(eventInfo))) {
  3553. setEventType(eventInfo, EventType.CLICKMOD);
  3554. } else if (this.a11yClickSupport) {
  3555. this.updateEventInfoForA11yClick(eventInfo);
  3556. }
  3557. }
  3558. resolveAction(eventInfo) {
  3559. if (getResolved(eventInfo)) {
  3560. return;
  3561. }
  3562. this.populateAction(eventInfo, getTargetElement(eventInfo));
  3563. setResolved(eventInfo, true);
  3564. }
  3565. resolveParentAction(eventInfo) {
  3566. const action = getAction(eventInfo);
  3567. const actionElement = action && getActionElement(action);
  3568. unsetAction(eventInfo);
  3569. const parentNode = actionElement && this.getParentNode(actionElement);
  3570. if (!parentNode) {
  3571. return;
  3572. }
  3573. this.populateAction(eventInfo, parentNode);
  3574. }
  3575. /**
  3576. * Searches for a jsaction that the DOM event maps to and creates an
  3577. * object containing event information used for dispatching by
  3578. * jsaction.Dispatcher. This method populates the `action` and `actionElement`
  3579. * fields of the EventInfo object passed in by finding the first
  3580. * jsaction attribute above the target Node of the event, and below
  3581. * the container Node, that specifies a jsaction for the event
  3582. * type. If no such jsaction is found, then action is undefined.
  3583. *
  3584. * @param eventInfo `EventInfo` to set `action` and `actionElement` if an
  3585. * action is found on any `Element` in the path of the `Event`.
  3586. */
  3587. populateAction(eventInfo, currentTarget) {
  3588. let actionElement = currentTarget;
  3589. while (actionElement && actionElement !== getContainer(eventInfo)) {
  3590. if (actionElement.nodeType === Node.ELEMENT_NODE) {
  3591. this.populateActionOnElement(actionElement, eventInfo);
  3592. }
  3593. if (getAction(eventInfo)) {
  3594. break;
  3595. }
  3596. actionElement = this.getParentNode(actionElement);
  3597. }
  3598. const action = getAction(eventInfo);
  3599. if (!action) {
  3600. return;
  3601. }
  3602. if (this.a11yClickSupport) {
  3603. this.preventDefaultForA11yClick(eventInfo);
  3604. }
  3605. if (this.syntheticMouseEventSupport) {
  3606. if (getEventType(eventInfo) === EventType.MOUSEENTER || getEventType(eventInfo) === EventType.MOUSELEAVE || getEventType(eventInfo) === EventType.POINTERENTER || getEventType(eventInfo) === EventType.POINTERLEAVE) {
  3607. if (isMouseSpecialEvent(getEvent(eventInfo), getEventType(eventInfo), getActionElement(action))) {
  3608. const copiedEvent = createMouseSpecialEvent(getEvent(eventInfo), getActionElement(action));
  3609. setEvent(eventInfo, copiedEvent);
  3610. setTargetElement(eventInfo, getActionElement(action));
  3611. } else {
  3612. unsetAction(eventInfo);
  3613. }
  3614. }
  3615. }
  3616. }
  3617. /**
  3618. * Walk to the parent node, unless the node has a different owner in
  3619. * which case we walk to the owner. Attempt to walk to host of a
  3620. * shadow root if needed.
  3621. */
  3622. getParentNode(element) {
  3623. const owner = element[Property.OWNER];
  3624. if (owner) {
  3625. return owner;
  3626. }
  3627. const parentNode = element.parentNode;
  3628. if (parentNode?.nodeName === "#document-fragment") {
  3629. return parentNode?.host ?? null;
  3630. }
  3631. return parentNode;
  3632. }
  3633. /**
  3634. * Accesses the jsaction map on a node and retrieves the name of the
  3635. * action the given event is mapped to, if any. It parses the
  3636. * attribute value and stores it in a property on the node for
  3637. * subsequent retrieval without re-parsing and re-accessing the
  3638. * attribute.
  3639. *
  3640. * @param actionElement The DOM node to retrieve the jsaction map from.
  3641. * @param eventInfo `EventInfo` to set `action` and `actionElement` if an
  3642. * action is found on the `actionElement`.
  3643. */
  3644. populateActionOnElement(actionElement, eventInfo) {
  3645. const actionMap = this.parseActions(actionElement);
  3646. const actionName = actionMap[getEventType(eventInfo)];
  3647. if (actionName !== void 0) {
  3648. setAction(eventInfo, actionName, actionElement);
  3649. }
  3650. if (this.a11yClickSupport) {
  3651. this.populateClickOnlyAction(actionElement, eventInfo, actionMap);
  3652. }
  3653. }
  3654. /**
  3655. * Parses and caches an element's jsaction element into a map.
  3656. *
  3657. * This is primarily for internal use.
  3658. *
  3659. * @param actionElement The DOM node to retrieve the jsaction map from.
  3660. * @return Map from event to qualified name of the jsaction bound to it.
  3661. */
  3662. parseActions(actionElement) {
  3663. let actionMap = get(actionElement);
  3664. if (!actionMap) {
  3665. const jsactionAttribute = actionElement.getAttribute(Attribute.JSACTION);
  3666. if (!jsactionAttribute) {
  3667. actionMap = EMPTY_ACTION_MAP;
  3668. set(actionElement, actionMap);
  3669. } else {
  3670. actionMap = getParsed(jsactionAttribute);
  3671. if (!actionMap) {
  3672. actionMap = {};
  3673. const values = jsactionAttribute.split(REGEXP_SEMICOLON);
  3674. for (let idx = 0; idx < values.length; idx++) {
  3675. const value = values[idx];
  3676. if (!value) {
  3677. continue;
  3678. }
  3679. const colon = value.indexOf(Char.EVENT_ACTION_SEPARATOR);
  3680. const hasColon = colon !== -1;
  3681. const type = hasColon ? value.substr(0, colon).trim() : DEFAULT_EVENT_TYPE;
  3682. const action = hasColon ? value.substr(colon + 1).trim() : value;
  3683. actionMap[type] = action;
  3684. }
  3685. setParsed(jsactionAttribute, actionMap);
  3686. }
  3687. set(actionElement, actionMap);
  3688. }
  3689. }
  3690. return actionMap;
  3691. }
  3692. addA11yClickSupport(updateEventInfoForA11yClick, preventDefaultForA11yClick, populateClickOnlyAction) {
  3693. this.a11yClickSupport = true;
  3694. this.updateEventInfoForA11yClick = updateEventInfoForA11yClick;
  3695. this.preventDefaultForA11yClick = preventDefaultForA11yClick;
  3696. this.populateClickOnlyAction = populateClickOnlyAction;
  3697. }
  3698. };
  3699. var Restriction;
  3700. (function(Restriction2) {
  3701. Restriction2[Restriction2["I_AM_THE_JSACTION_FRAMEWORK"] = 0] = "I_AM_THE_JSACTION_FRAMEWORK";
  3702. })(Restriction || (Restriction = {}));
  3703. var Dispatcher = class {
  3704. dispatchDelegate;
  3705. // The ActionResolver to use to resolve actions.
  3706. actionResolver;
  3707. /** The replayer function to be called when there are queued events. */
  3708. eventReplayer;
  3709. /** Whether the event replay is scheduled. */
  3710. eventReplayScheduled = false;
  3711. /** The queue of events. */
  3712. replayEventInfoWrappers = [];
  3713. /**
  3714. * Options are:
  3715. * - `eventReplayer`: When the event contract dispatches replay events
  3716. * to the Dispatcher, the Dispatcher collects them and in the next tick
  3717. * dispatches them to the `eventReplayer`. Defaults to dispatching to `dispatchDelegate`.
  3718. * @param dispatchDelegate A function that should handle dispatching an `EventInfoWrapper` to handlers.
  3719. */
  3720. constructor(dispatchDelegate, {
  3721. actionResolver,
  3722. eventReplayer
  3723. } = {}) {
  3724. this.dispatchDelegate = dispatchDelegate;
  3725. this.actionResolver = actionResolver;
  3726. this.eventReplayer = eventReplayer;
  3727. }
  3728. /**
  3729. * Receives an event or the event queue from the EventContract. The event
  3730. * queue is copied and it attempts to replay.
  3731. * If event info is passed in it looks for an action handler that can handle
  3732. * the given event. If there is no handler registered queues the event and
  3733. * checks if a loader is registered for the given namespace. If so, calls it.
  3734. *
  3735. * Alternatively, if in global dispatch mode, calls all registered global
  3736. * handlers for the appropriate event type.
  3737. *
  3738. * The three functionalities of this call are deliberately not split into
  3739. * three methods (and then declared as an abstract interface), because the
  3740. * interface is used by EventContract, which lives in a different jsbinary.
  3741. * Therefore the interface between the three is defined entirely in terms that
  3742. * are invariant under jscompiler processing (Function and Array, as opposed
  3743. * to a custom type with method names).
  3744. *
  3745. * @param eventInfo The info for the event that triggered this call or the
  3746. * queue of events from EventContract.
  3747. */
  3748. dispatch(eventInfo) {
  3749. const eventInfoWrapper = new EventInfoWrapper(eventInfo);
  3750. this.actionResolver?.resolveEventType(eventInfo);
  3751. this.actionResolver?.resolveAction(eventInfo);
  3752. const action = eventInfoWrapper.getAction();
  3753. if (action && shouldPreventDefaultBeforeDispatching(action.element, eventInfoWrapper)) {
  3754. preventDefault(eventInfoWrapper.getEvent());
  3755. }
  3756. if (this.eventReplayer && eventInfoWrapper.getIsReplay()) {
  3757. this.scheduleEventInfoWrapperReplay(eventInfoWrapper);
  3758. return;
  3759. }
  3760. this.dispatchDelegate(eventInfoWrapper);
  3761. }
  3762. /**
  3763. * Schedules an `EventInfoWrapper` for replay. The replaying will happen in its own
  3764. * stack once the current flow cedes control. This is done to mimic
  3765. * browser event handling.
  3766. */
  3767. scheduleEventInfoWrapperReplay(eventInfoWrapper) {
  3768. this.replayEventInfoWrappers.push(eventInfoWrapper);
  3769. if (this.eventReplayScheduled) {
  3770. return;
  3771. }
  3772. this.eventReplayScheduled = true;
  3773. Promise.resolve().then(() => {
  3774. this.eventReplayScheduled = false;
  3775. this.eventReplayer(this.replayEventInfoWrappers);
  3776. });
  3777. }
  3778. };
  3779. function shouldPreventDefaultBeforeDispatching(actionElement, eventInfoWrapper) {
  3780. return actionElement.tagName === "A" && (eventInfoWrapper.getEventType() === EventType.CLICK || eventInfoWrapper.getEventType() === EventType.CLICKMOD);
  3781. }
  3782. var PROPAGATION_STOPPED_SYMBOL = Symbol.for("propagationStopped");
  3783. var EventPhase = {
  3784. REPLAY: 101
  3785. };
  3786. var PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS = " Because event replay occurs after browser dispatch, `preventDefault` would have no effect. You can check whether an event is being replayed by accessing the event phase: `event.eventPhase === EventPhase.REPLAY`.";
  3787. var PREVENT_DEFAULT_ERROR_MESSAGE = `\`preventDefault\` called during event replay.`;
  3788. var COMPOSED_PATH_ERROR_MESSAGE_DETAILS = " Because event replay occurs after browser dispatch, `composedPath()` will be empty. Iterate parent nodes from `event.target` or `event.currentTarget` if you need to check elements in the event path.";
  3789. var COMPOSED_PATH_ERROR_MESSAGE = `\`composedPath\` called during event replay.`;
  3790. var EventDispatcher = class {
  3791. dispatchDelegate;
  3792. clickModSupport;
  3793. actionResolver;
  3794. dispatcher;
  3795. constructor(dispatchDelegate, clickModSupport = true) {
  3796. this.dispatchDelegate = dispatchDelegate;
  3797. this.clickModSupport = clickModSupport;
  3798. this.actionResolver = new ActionResolver({
  3799. clickModSupport
  3800. });
  3801. this.dispatcher = new Dispatcher((eventInfoWrapper) => {
  3802. this.dispatchToDelegate(eventInfoWrapper);
  3803. }, {
  3804. actionResolver: this.actionResolver
  3805. });
  3806. }
  3807. /**
  3808. * The entrypoint for the `EventContract` dispatch.
  3809. */
  3810. dispatch(eventInfo) {
  3811. this.dispatcher.dispatch(eventInfo);
  3812. }
  3813. /** Internal method that does basic disaptching. */
  3814. dispatchToDelegate(eventInfoWrapper) {
  3815. if (eventInfoWrapper.getIsReplay()) {
  3816. prepareEventForReplay(eventInfoWrapper);
  3817. }
  3818. prepareEventForBubbling(eventInfoWrapper);
  3819. while (eventInfoWrapper.getAction()) {
  3820. prepareEventForDispatch(eventInfoWrapper);
  3821. if (isCaptureEventType(eventInfoWrapper.getEventType()) && eventInfoWrapper.getAction().element !== eventInfoWrapper.getTargetElement()) {
  3822. return;
  3823. }
  3824. this.dispatchDelegate(eventInfoWrapper.getEvent(), eventInfoWrapper.getAction().name);
  3825. if (propagationStopped(eventInfoWrapper)) {
  3826. return;
  3827. }
  3828. this.actionResolver.resolveParentAction(eventInfoWrapper.eventInfo);
  3829. }
  3830. }
  3831. };
  3832. function prepareEventForBubbling(eventInfoWrapper) {
  3833. const event = eventInfoWrapper.getEvent();
  3834. const originalStopPropagation = eventInfoWrapper.getEvent().stopPropagation.bind(event);
  3835. const stopPropagation = () => {
  3836. event[PROPAGATION_STOPPED_SYMBOL] = true;
  3837. originalStopPropagation();
  3838. };
  3839. patchEventInstance(event, "stopPropagation", stopPropagation);
  3840. patchEventInstance(event, "stopImmediatePropagation", stopPropagation);
  3841. }
  3842. function propagationStopped(eventInfoWrapper) {
  3843. const event = eventInfoWrapper.getEvent();
  3844. return !!event[PROPAGATION_STOPPED_SYMBOL];
  3845. }
  3846. function prepareEventForReplay(eventInfoWrapper) {
  3847. const event = eventInfoWrapper.getEvent();
  3848. const target = eventInfoWrapper.getTargetElement();
  3849. const originalPreventDefault = event.preventDefault.bind(event);
  3850. patchEventInstance(event, "target", target);
  3851. patchEventInstance(event, "eventPhase", EventPhase.REPLAY);
  3852. patchEventInstance(event, "preventDefault", () => {
  3853. originalPreventDefault();
  3854. throw new Error(PREVENT_DEFAULT_ERROR_MESSAGE + (ngDevMode ? PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS : ""));
  3855. });
  3856. patchEventInstance(event, "composedPath", () => {
  3857. throw new Error(COMPOSED_PATH_ERROR_MESSAGE + (ngDevMode ? COMPOSED_PATH_ERROR_MESSAGE_DETAILS : ""));
  3858. });
  3859. }
  3860. function prepareEventForDispatch(eventInfoWrapper) {
  3861. const event = eventInfoWrapper.getEvent();
  3862. const currentTarget = eventInfoWrapper.getAction()?.element;
  3863. if (currentTarget) {
  3864. patchEventInstance(event, "currentTarget", currentTarget, {
  3865. // `currentTarget` is going to get reassigned every dispatch.
  3866. configurable: true
  3867. });
  3868. }
  3869. }
  3870. function patchEventInstance(event, property, value, {
  3871. configurable = false
  3872. } = {}) {
  3873. Object.defineProperty(event, property, {
  3874. value,
  3875. configurable
  3876. });
  3877. }
  3878. function registerDispatcher$1(eventContract, dispatcher) {
  3879. eventContract.ecrd((eventInfo) => {
  3880. dispatcher.dispatch(eventInfo);
  3881. }, Restriction.I_AM_THE_JSACTION_FRAMEWORK);
  3882. }
  3883. function getQueuedEventInfos(earlyJsactionData) {
  3884. return earlyJsactionData?.q ?? [];
  3885. }
  3886. function removeAllEventListeners(earlyJsactionData) {
  3887. if (!earlyJsactionData) {
  3888. return;
  3889. }
  3890. removeEventListeners(earlyJsactionData.c, earlyJsactionData.et, earlyJsactionData.h);
  3891. removeEventListeners(earlyJsactionData.c, earlyJsactionData.etc, earlyJsactionData.h, true);
  3892. }
  3893. function removeEventListeners(container, eventTypes, earlyEventHandler, capture) {
  3894. for (let i = 0; i < eventTypes.length; i++) {
  3895. container.removeEventListener(
  3896. eventTypes[i],
  3897. earlyEventHandler,
  3898. /* useCapture */
  3899. capture
  3900. );
  3901. }
  3902. }
  3903. var MOUSE_SPECIAL_SUPPORT = false;
  3904. var EventContract = class _EventContract {
  3905. static MOUSE_SPECIAL_SUPPORT = MOUSE_SPECIAL_SUPPORT;
  3906. containerManager;
  3907. /**
  3908. * The DOM events which this contract covers. Used to prevent double
  3909. * registration of event types. The value of the map is the
  3910. * internally created DOM event handler function that handles the
  3911. * DOM events. See addEvent().
  3912. *
  3913. */
  3914. eventHandlers = {};
  3915. browserEventTypeToExtraEventTypes = {};
  3916. /**
  3917. * The dispatcher function. Events are passed to this function for
  3918. * handling once it was set using the registerDispatcher() method. This is
  3919. * done because the function is passed from another jsbinary, so passing the
  3920. * instance and invoking the method here would require to leave the method
  3921. * unobfuscated.
  3922. */
  3923. dispatcher = null;
  3924. /**
  3925. * The list of suspended `EventInfo` that will be dispatched
  3926. * as soon as the `Dispatcher` is registered.
  3927. */
  3928. queuedEventInfos = [];
  3929. constructor(containerManager) {
  3930. this.containerManager = containerManager;
  3931. }
  3932. handleEvent(eventType, event, container) {
  3933. const eventInfo = createEventInfoFromParameters(
  3934. /* eventType= */
  3935. eventType,
  3936. /* event= */
  3937. event,
  3938. /* targetElement= */
  3939. event.target,
  3940. /* container= */
  3941. container,
  3942. /* timestamp= */
  3943. Date.now()
  3944. );
  3945. this.handleEventInfo(eventInfo);
  3946. }
  3947. /**
  3948. * Handle an `EventInfo`.
  3949. */
  3950. handleEventInfo(eventInfo) {
  3951. if (!this.dispatcher) {
  3952. setIsReplay(eventInfo, true);
  3953. this.queuedEventInfos?.push(eventInfo);
  3954. return;
  3955. }
  3956. this.dispatcher(eventInfo);
  3957. }
  3958. /**
  3959. * Enables jsaction handlers to be called for the event type given by
  3960. * name.
  3961. *
  3962. * If the event is already registered, this does nothing.
  3963. *
  3964. * @param prefixedEventType If supplied, this event is used in
  3965. * the actual browser event registration instead of the name that is
  3966. * exposed to jsaction. Use this if you e.g. want users to be able
  3967. * to subscribe to jsaction="transitionEnd:foo" while the underlying
  3968. * event is webkitTransitionEnd in one browser and mozTransitionEnd
  3969. * in another.
  3970. *
  3971. * @param passive A boolean value that, if `true`, indicates that the event
  3972. * handler will never call `preventDefault()`.
  3973. */
  3974. addEvent(eventType, prefixedEventType, passive) {
  3975. if (eventType in this.eventHandlers || !this.containerManager) {
  3976. return;
  3977. }
  3978. if (!_EventContract.MOUSE_SPECIAL_SUPPORT && MOUSE_SPECIAL_EVENT_TYPES.indexOf(eventType) >= 0) {
  3979. return;
  3980. }
  3981. const eventHandler = (eventType2, event, container) => {
  3982. this.handleEvent(eventType2, event, container);
  3983. };
  3984. this.eventHandlers[eventType] = eventHandler;
  3985. const browserEventType = getBrowserEventType(prefixedEventType || eventType);
  3986. if (browserEventType !== eventType) {
  3987. const eventTypes = this.browserEventTypeToExtraEventTypes[browserEventType] || [];
  3988. eventTypes.push(eventType);
  3989. this.browserEventTypeToExtraEventTypes[browserEventType] = eventTypes;
  3990. }
  3991. this.containerManager.addEventListener(browserEventType, (element) => {
  3992. return (event) => {
  3993. eventHandler(eventType, event, element);
  3994. };
  3995. }, passive);
  3996. }
  3997. /**
  3998. * Gets the queued early events and replay them using the appropriate handler
  3999. * in the provided event contract. Once all the events are replayed, it cleans
  4000. * up the early contract.
  4001. */
  4002. replayEarlyEvents(earlyJsactionData = window._ejsa) {
  4003. if (!earlyJsactionData) {
  4004. return;
  4005. }
  4006. this.replayEarlyEventInfos(earlyJsactionData.q);
  4007. removeAllEventListeners(earlyJsactionData);
  4008. delete window._ejsa;
  4009. }
  4010. /**
  4011. * Replays all the early `EventInfo` objects, dispatching them through the normal
  4012. * `EventContract` flow.
  4013. */
  4014. replayEarlyEventInfos(earlyEventInfos) {
  4015. for (let i = 0; i < earlyEventInfos.length; i++) {
  4016. const earlyEventInfo = earlyEventInfos[i];
  4017. const eventTypes = this.getEventTypesForBrowserEventType(earlyEventInfo.eventType);
  4018. for (let j = 0; j < eventTypes.length; j++) {
  4019. const eventInfo = cloneEventInfo(earlyEventInfo);
  4020. setEventType(eventInfo, eventTypes[j]);
  4021. this.handleEventInfo(eventInfo);
  4022. }
  4023. }
  4024. }
  4025. /**
  4026. * Returns all JSAction event types that have been registered for a given
  4027. * browser event type.
  4028. */
  4029. getEventTypesForBrowserEventType(browserEventType) {
  4030. const eventTypes = [];
  4031. if (this.eventHandlers[browserEventType]) {
  4032. eventTypes.push(browserEventType);
  4033. }
  4034. if (this.browserEventTypeToExtraEventTypes[browserEventType]) {
  4035. eventTypes.push(...this.browserEventTypeToExtraEventTypes[browserEventType]);
  4036. }
  4037. return eventTypes;
  4038. }
  4039. /**
  4040. * Returns the event handler function for a given event type.
  4041. */
  4042. handler(eventType) {
  4043. return this.eventHandlers[eventType];
  4044. }
  4045. /**
  4046. * Cleans up the event contract. This resets all of the `EventContract`'s
  4047. * internal state. Users are responsible for not using this `EventContract`
  4048. * after it has been cleaned up.
  4049. */
  4050. cleanUp() {
  4051. this.containerManager?.cleanUp();
  4052. this.containerManager = null;
  4053. this.eventHandlers = {};
  4054. this.browserEventTypeToExtraEventTypes = {};
  4055. this.dispatcher = null;
  4056. this.queuedEventInfos = [];
  4057. }
  4058. /**
  4059. * Register a dispatcher function. Event info of each event mapped to
  4060. * a jsaction is passed for handling to this callback. The queued
  4061. * events are passed as well to the dispatcher for later replaying
  4062. * once the dispatcher is registered. Clears the event queue to null.
  4063. *
  4064. * @param dispatcher The dispatcher function.
  4065. * @param restriction
  4066. */
  4067. registerDispatcher(dispatcher, restriction) {
  4068. this.ecrd(dispatcher, restriction);
  4069. }
  4070. /**
  4071. * Unrenamed alias for registerDispatcher. Necessary for any codebases that
  4072. * split the `EventContract` and `Dispatcher` code into different compilation
  4073. * units.
  4074. */
  4075. ecrd(dispatcher, restriction) {
  4076. this.dispatcher = dispatcher;
  4077. if (this.queuedEventInfos?.length) {
  4078. for (let i = 0; i < this.queuedEventInfos.length; i++) {
  4079. this.handleEventInfo(this.queuedEventInfos[i]);
  4080. }
  4081. this.queuedEventInfos = null;
  4082. }
  4083. }
  4084. };
  4085. function getAppScopedQueuedEventInfos(appId, dataContainer = window) {
  4086. return getQueuedEventInfos(dataContainer._ejsas?.[appId]);
  4087. }
  4088. function clearAppScopedEarlyEventContract(appId, dataContainer = window) {
  4089. if (!dataContainer._ejsas) {
  4090. return;
  4091. }
  4092. dataContainer._ejsas[appId] = void 0;
  4093. }
  4094. // node_modules/@angular/core/fesm2022/core.mjs
  4095. var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.dev/errors";
  4096. var XSS_SECURITY_URL = "https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss";
  4097. var RuntimeError = class extends Error {
  4098. code;
  4099. constructor(code, message) {
  4100. super(formatRuntimeError(code, message));
  4101. this.code = code;
  4102. }
  4103. };
  4104. function formatRuntimeError(code, message) {
  4105. const fullCode = `NG0${Math.abs(code)}`;
  4106. let errorMessage = `${fullCode}${message ? ": " + message : ""}`;
  4107. if (ngDevMode && code < 0) {
  4108. const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/);
  4109. const separator = addPeriodSeparator ? "." : "";
  4110. errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
  4111. }
  4112. return errorMessage;
  4113. }
  4114. var REQUIRED_UNSET_VALUE = Symbol("InputSignalNode#UNSET");
  4115. var INPUT_SIGNAL_NODE = (() => {
  4116. return __spreadProps(__spreadValues({}, SIGNAL_NODE), {
  4117. transformFn: void 0,
  4118. applyValueToInputSignal(node, value) {
  4119. signalSetFn(node, value);
  4120. }
  4121. });
  4122. })();
  4123. var ɵINPUT_SIGNAL_BRAND_WRITE_TYPE = Symbol();
  4124. function createInputSignal(initialValue, options) {
  4125. const node = Object.create(INPUT_SIGNAL_NODE);
  4126. node.value = initialValue;
  4127. node.transformFn = options?.transform;
  4128. function inputValueFn() {
  4129. producerAccessed(node);
  4130. if (node.value === REQUIRED_UNSET_VALUE) {
  4131. let message = null;
  4132. if (ngDevMode) {
  4133. const name = options?.debugName ?? options?.alias;
  4134. message = `Input${name ? ` "${name}"` : ""} is required but no value is available yet.`;
  4135. }
  4136. throw new RuntimeError(-950, message);
  4137. }
  4138. return node.value;
  4139. }
  4140. inputValueFn[SIGNAL] = node;
  4141. if (ngDevMode) {
  4142. inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;
  4143. node.debugName = options?.debugName;
  4144. }
  4145. return inputValueFn;
  4146. }
  4147. function noSideEffects(fn) {
  4148. return {
  4149. toString: fn
  4150. }.toString();
  4151. }
  4152. var ANNOTATIONS = "__annotations__";
  4153. var PARAMETERS = "__parameters__";
  4154. var PROP_METADATA = "__prop__metadata__";
  4155. function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) {
  4156. return noSideEffects(() => {
  4157. const metaCtor = makeMetadataCtor(props);
  4158. function DecoratorFactory(...args) {
  4159. if (this instanceof DecoratorFactory) {
  4160. metaCtor.call(this, ...args);
  4161. return this;
  4162. }
  4163. const annotationInstance = new DecoratorFactory(...args);
  4164. return function TypeDecorator(cls) {
  4165. if (typeFn) typeFn(cls, ...args);
  4166. const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, {
  4167. value: []
  4168. })[ANNOTATIONS];
  4169. annotations.push(annotationInstance);
  4170. return cls;
  4171. };
  4172. }
  4173. if (parentClass) {
  4174. DecoratorFactory.prototype = Object.create(parentClass.prototype);
  4175. }
  4176. DecoratorFactory.prototype.ngMetadataName = name;
  4177. DecoratorFactory.annotationCls = DecoratorFactory;
  4178. return DecoratorFactory;
  4179. });
  4180. }
  4181. function makeMetadataCtor(props) {
  4182. return function ctor(...args) {
  4183. if (props) {
  4184. const values = props(...args);
  4185. for (const propName in values) {
  4186. this[propName] = values[propName];
  4187. }
  4188. }
  4189. };
  4190. }
  4191. function makeParamDecorator(name, props, parentClass) {
  4192. return noSideEffects(() => {
  4193. const metaCtor = makeMetadataCtor(props);
  4194. function ParamDecoratorFactory(...args) {
  4195. if (this instanceof ParamDecoratorFactory) {
  4196. metaCtor.apply(this, args);
  4197. return this;
  4198. }
  4199. const annotationInstance = new ParamDecoratorFactory(...args);
  4200. ParamDecorator.annotation = annotationInstance;
  4201. return ParamDecorator;
  4202. function ParamDecorator(cls, unusedKey, index) {
  4203. const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, {
  4204. value: []
  4205. })[PARAMETERS];
  4206. while (parameters.length <= index) {
  4207. parameters.push(null);
  4208. }
  4209. (parameters[index] = parameters[index] || []).push(annotationInstance);
  4210. return cls;
  4211. }
  4212. }
  4213. ParamDecoratorFactory.prototype.ngMetadataName = name;
  4214. ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
  4215. return ParamDecoratorFactory;
  4216. });
  4217. }
  4218. function makePropDecorator(name, props, parentClass, additionalProcessing) {
  4219. return noSideEffects(() => {
  4220. const metaCtor = makeMetadataCtor(props);
  4221. function PropDecoratorFactory(...args) {
  4222. if (this instanceof PropDecoratorFactory) {
  4223. metaCtor.apply(this, args);
  4224. return this;
  4225. }
  4226. const decoratorInstance = new PropDecoratorFactory(...args);
  4227. function PropDecorator(target, name2) {
  4228. if (target === void 0) {
  4229. throw new Error("Standard Angular field decorators are not supported in JIT mode.");
  4230. }
  4231. const constructor = target.constructor;
  4232. const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, {
  4233. value: {}
  4234. })[PROP_METADATA];
  4235. meta[name2] = meta.hasOwnProperty(name2) && meta[name2] || [];
  4236. meta[name2].unshift(decoratorInstance);
  4237. }
  4238. return PropDecorator;
  4239. }
  4240. if (parentClass) {
  4241. PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
  4242. }
  4243. PropDecoratorFactory.prototype.ngMetadataName = name;
  4244. PropDecoratorFactory.annotationCls = PropDecoratorFactory;
  4245. return PropDecoratorFactory;
  4246. });
  4247. }
  4248. var _global = globalThis;
  4249. function ngDevModeResetPerfCounters() {
  4250. const locationString = typeof location !== "undefined" ? location.toString() : "";
  4251. const newCounters = {
  4252. namedConstructors: locationString.indexOf("ngDevMode=namedConstructors") != -1,
  4253. firstCreatePass: 0,
  4254. tNode: 0,
  4255. tView: 0,
  4256. rendererCreateTextNode: 0,
  4257. rendererSetText: 0,
  4258. rendererCreateElement: 0,
  4259. rendererAddEventListener: 0,
  4260. rendererSetAttribute: 0,
  4261. rendererRemoveAttribute: 0,
  4262. rendererSetProperty: 0,
  4263. rendererSetClassName: 0,
  4264. rendererAddClass: 0,
  4265. rendererRemoveClass: 0,
  4266. rendererSetStyle: 0,
  4267. rendererRemoveStyle: 0,
  4268. rendererDestroy: 0,
  4269. rendererDestroyNode: 0,
  4270. rendererMoveNode: 0,
  4271. rendererRemoveNode: 0,
  4272. rendererAppendChild: 0,
  4273. rendererInsertBefore: 0,
  4274. rendererCreateComment: 0,
  4275. hydratedNodes: 0,
  4276. hydratedComponents: 0,
  4277. dehydratedViewsRemoved: 0,
  4278. dehydratedViewsCleanupRuns: 0,
  4279. componentsSkippedHydration: 0,
  4280. deferBlocksWithIncrementalHydration: 0
  4281. };
  4282. const allowNgDevModeTrue = locationString.indexOf("ngDevMode=false") === -1;
  4283. if (!allowNgDevModeTrue) {
  4284. _global["ngDevMode"] = false;
  4285. } else {
  4286. if (typeof _global["ngDevMode"] !== "object") {
  4287. _global["ngDevMode"] = {};
  4288. }
  4289. Object.assign(_global["ngDevMode"], newCounters);
  4290. }
  4291. return newCounters;
  4292. }
  4293. function initNgDevMode() {
  4294. if (typeof ngDevMode === "undefined" || ngDevMode) {
  4295. if (typeof ngDevMode !== "object" || Object.keys(ngDevMode).length === 0) {
  4296. ngDevModeResetPerfCounters();
  4297. }
  4298. return typeof ngDevMode !== "undefined" && !!ngDevMode;
  4299. }
  4300. return false;
  4301. }
  4302. function getClosureSafeProperty(objWithPropertyToExtract) {
  4303. for (let key in objWithPropertyToExtract) {
  4304. if (objWithPropertyToExtract[key] === getClosureSafeProperty) {
  4305. return key;
  4306. }
  4307. }
  4308. throw Error("Could not find renamed property on target object.");
  4309. }
  4310. function fillProperties(target, source) {
  4311. for (const key in source) {
  4312. if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
  4313. target[key] = source[key];
  4314. }
  4315. }
  4316. }
  4317. function stringify(token) {
  4318. if (typeof token === "string") {
  4319. return token;
  4320. }
  4321. if (Array.isArray(token)) {
  4322. return `[${token.map(stringify).join(", ")}]`;
  4323. }
  4324. if (token == null) {
  4325. return "" + token;
  4326. }
  4327. const name = token.overriddenName || token.name;
  4328. if (name) {
  4329. return `${name}`;
  4330. }
  4331. const result = token.toString();
  4332. if (result == null) {
  4333. return "" + result;
  4334. }
  4335. const newLineIndex = result.indexOf("\n");
  4336. return newLineIndex >= 0 ? result.slice(0, newLineIndex) : result;
  4337. }
  4338. function concatStringsWithSpace(before, after) {
  4339. if (!before) return after || "";
  4340. if (!after) return before;
  4341. return `${before} ${after}`;
  4342. }
  4343. function truncateMiddle(str, maxLength = 100) {
  4344. if (!str || maxLength < 1 || str.length <= maxLength) return str;
  4345. if (maxLength == 1) return str.substring(0, 1) + "...";
  4346. const halfLimit = Math.round(maxLength / 2);
  4347. return str.substring(0, halfLimit) + "..." + str.substring(str.length - halfLimit);
  4348. }
  4349. var __forward_ref__ = getClosureSafeProperty({
  4350. __forward_ref__: getClosureSafeProperty
  4351. });
  4352. function forwardRef(forwardRefFn) {
  4353. forwardRefFn.__forward_ref__ = forwardRef;
  4354. forwardRefFn.toString = function() {
  4355. return stringify(this());
  4356. };
  4357. return forwardRefFn;
  4358. }
  4359. function resolveForwardRef(type) {
  4360. return isForwardRef(type) ? type() : type;
  4361. }
  4362. function isForwardRef(fn) {
  4363. return typeof fn === "function" && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef;
  4364. }
  4365. function assertNumber(actual, msg) {
  4366. if (!(typeof actual === "number")) {
  4367. throwError2(msg, typeof actual, "number", "===");
  4368. }
  4369. }
  4370. function assertNumberInRange(actual, minInclusive, maxInclusive) {
  4371. assertNumber(actual, "Expected a number");
  4372. assertLessThanOrEqual(actual, maxInclusive, "Expected number to be less than or equal to");
  4373. assertGreaterThanOrEqual(actual, minInclusive, "Expected number to be greater than or equal to");
  4374. }
  4375. function assertString(actual, msg) {
  4376. if (!(typeof actual === "string")) {
  4377. throwError2(msg, actual === null ? "null" : typeof actual, "string", "===");
  4378. }
  4379. }
  4380. function assertFunction(actual, msg) {
  4381. if (!(typeof actual === "function")) {
  4382. throwError2(msg, actual === null ? "null" : typeof actual, "function", "===");
  4383. }
  4384. }
  4385. function assertEqual(actual, expected, msg) {
  4386. if (!(actual == expected)) {
  4387. throwError2(msg, actual, expected, "==");
  4388. }
  4389. }
  4390. function assertNotEqual(actual, expected, msg) {
  4391. if (!(actual != expected)) {
  4392. throwError2(msg, actual, expected, "!=");
  4393. }
  4394. }
  4395. function assertSame(actual, expected, msg) {
  4396. if (!(actual === expected)) {
  4397. throwError2(msg, actual, expected, "===");
  4398. }
  4399. }
  4400. function assertNotSame(actual, expected, msg) {
  4401. if (!(actual !== expected)) {
  4402. throwError2(msg, actual, expected, "!==");
  4403. }
  4404. }
  4405. function assertLessThan(actual, expected, msg) {
  4406. if (!(actual < expected)) {
  4407. throwError2(msg, actual, expected, "<");
  4408. }
  4409. }
  4410. function assertLessThanOrEqual(actual, expected, msg) {
  4411. if (!(actual <= expected)) {
  4412. throwError2(msg, actual, expected, "<=");
  4413. }
  4414. }
  4415. function assertGreaterThan(actual, expected, msg) {
  4416. if (!(actual > expected)) {
  4417. throwError2(msg, actual, expected, ">");
  4418. }
  4419. }
  4420. function assertGreaterThanOrEqual(actual, expected, msg) {
  4421. if (!(actual >= expected)) {
  4422. throwError2(msg, actual, expected, ">=");
  4423. }
  4424. }
  4425. function assertDefined(actual, msg) {
  4426. if (actual == null) {
  4427. throwError2(msg, actual, null, "!=");
  4428. }
  4429. }
  4430. function throwError2(msg, actual, expected, comparison) {
  4431. throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? "" : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
  4432. }
  4433. function assertDomNode(node) {
  4434. if (!(node instanceof Node)) {
  4435. throwError2(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
  4436. }
  4437. }
  4438. function assertElement(node) {
  4439. if (!(node instanceof Element)) {
  4440. throwError2(`The provided value must be an element but got ${stringify(node)}`);
  4441. }
  4442. }
  4443. function assertIndexInRange(arr, index) {
  4444. assertDefined(arr, "Array must be defined.");
  4445. const maxLen = arr.length;
  4446. if (index < 0 || index >= maxLen) {
  4447. throwError2(`Index expected to be less than ${maxLen} but got ${index}`);
  4448. }
  4449. }
  4450. function assertOneOf(value, ...validValues) {
  4451. if (validValues.indexOf(value) !== -1) return true;
  4452. throwError2(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);
  4453. }
  4454. function assertNotReactive(fn) {
  4455. if (getActiveConsumer() !== null) {
  4456. throwError2(`${fn}() should never be called in a reactive context.`);
  4457. }
  4458. }
  4459. function ɵɵdefineInjectable(opts) {
  4460. return {
  4461. token: opts.token,
  4462. providedIn: opts.providedIn || null,
  4463. factory: opts.factory,
  4464. value: void 0
  4465. };
  4466. }
  4467. var defineInjectable = ɵɵdefineInjectable;
  4468. function ɵɵdefineInjector(options) {
  4469. return {
  4470. providers: options.providers || [],
  4471. imports: options.imports || []
  4472. };
  4473. }
  4474. function getInjectableDef(type) {
  4475. return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);
  4476. }
  4477. function isInjectable(type) {
  4478. return getInjectableDef(type) !== null;
  4479. }
  4480. function getOwnDefinition(type, field) {
  4481. return type.hasOwnProperty(field) ? type[field] : null;
  4482. }
  4483. function getInheritedInjectableDef(type) {
  4484. const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]);
  4485. if (def) {
  4486. ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself.
  4487. This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`);
  4488. return def;
  4489. } else {
  4490. return null;
  4491. }
  4492. }
  4493. function getInjectorDef(type) {
  4494. return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ? type[NG_INJ_DEF] : null;
  4495. }
  4496. var NG_PROV_DEF = getClosureSafeProperty({
  4497. ɵprov: getClosureSafeProperty
  4498. });
  4499. var NG_INJ_DEF = getClosureSafeProperty({
  4500. ɵinj: getClosureSafeProperty
  4501. });
  4502. var NG_INJECTABLE_DEF = getClosureSafeProperty({
  4503. ngInjectableDef: getClosureSafeProperty
  4504. });
  4505. var NG_INJECTOR_DEF = getClosureSafeProperty({
  4506. ngInjectorDef: getClosureSafeProperty
  4507. });
  4508. var InjectionToken = class {
  4509. _desc;
  4510. /** @internal */
  4511. ngMetadataName = "InjectionToken";
  4512. ɵprov;
  4513. /**
  4514. * @param _desc Description for the token,
  4515. * used only for debugging purposes,
  4516. * it should but does not need to be unique
  4517. * @param options Options for the token's usage, as described above
  4518. */
  4519. constructor(_desc, options) {
  4520. this._desc = _desc;
  4521. this.ɵprov = void 0;
  4522. if (typeof options == "number") {
  4523. (typeof ngDevMode === "undefined" || ngDevMode) && assertLessThan(options, 0, "Only negative numbers are supported here");
  4524. this.__NG_ELEMENT_ID__ = options;
  4525. } else if (options !== void 0) {
  4526. this.ɵprov = ɵɵdefineInjectable({
  4527. token: this,
  4528. providedIn: options.providedIn || "root",
  4529. factory: options.factory
  4530. });
  4531. }
  4532. }
  4533. /**
  4534. * @internal
  4535. */
  4536. get multi() {
  4537. return this;
  4538. }
  4539. toString() {
  4540. return `InjectionToken ${this._desc}`;
  4541. }
  4542. };
  4543. var _injectorProfilerContext;
  4544. function getInjectorProfilerContext() {
  4545. !ngDevMode && throwError2("getInjectorProfilerContext should never be called in production mode");
  4546. return _injectorProfilerContext;
  4547. }
  4548. function setInjectorProfilerContext(context2) {
  4549. !ngDevMode && throwError2("setInjectorProfilerContext should never be called in production mode");
  4550. const previous = _injectorProfilerContext;
  4551. _injectorProfilerContext = context2;
  4552. return previous;
  4553. }
  4554. var injectorProfilerCallback = null;
  4555. var setInjectorProfiler = (injectorProfiler2) => {
  4556. !ngDevMode && throwError2("setInjectorProfiler should never be called in production mode");
  4557. injectorProfilerCallback = injectorProfiler2;
  4558. };
  4559. function injectorProfiler(event) {
  4560. !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  4561. if (injectorProfilerCallback != null) {
  4562. injectorProfilerCallback(event);
  4563. }
  4564. }
  4565. function emitProviderConfiguredEvent(eventProvider, isViewProvider = false) {
  4566. !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  4567. let token;
  4568. if (typeof eventProvider === "function") {
  4569. token = eventProvider;
  4570. } else if (eventProvider instanceof InjectionToken) {
  4571. token = eventProvider;
  4572. } else {
  4573. token = resolveForwardRef(eventProvider.provide);
  4574. }
  4575. let provider = eventProvider;
  4576. if (eventProvider instanceof InjectionToken) {
  4577. provider = eventProvider.ɵprov || eventProvider;
  4578. }
  4579. injectorProfiler({
  4580. type: 2,
  4581. context: getInjectorProfilerContext(),
  4582. providerRecord: {
  4583. token,
  4584. provider,
  4585. isViewProvider
  4586. }
  4587. });
  4588. }
  4589. function emitInstanceCreatedByInjectorEvent(instance) {
  4590. !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  4591. injectorProfiler({
  4592. type: 1,
  4593. context: getInjectorProfilerContext(),
  4594. instance: {
  4595. value: instance
  4596. }
  4597. });
  4598. }
  4599. function emitInjectEvent(token, value, flags) {
  4600. !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  4601. injectorProfiler({
  4602. type: 0,
  4603. context: getInjectorProfilerContext(),
  4604. service: {
  4605. token,
  4606. value,
  4607. flags
  4608. }
  4609. });
  4610. }
  4611. function emitEffectCreatedEvent(effect2) {
  4612. !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  4613. injectorProfiler({
  4614. type: 3,
  4615. context: getInjectorProfilerContext(),
  4616. effect: effect2
  4617. });
  4618. }
  4619. function runInInjectorProfilerContext(injector, token, callback) {
  4620. !ngDevMode && throwError2("runInInjectorProfilerContext should never be called in production mode");
  4621. const prevInjectContext = setInjectorProfilerContext({
  4622. injector,
  4623. token
  4624. });
  4625. try {
  4626. callback();
  4627. } finally {
  4628. setInjectorProfilerContext(prevInjectContext);
  4629. }
  4630. }
  4631. function isEnvironmentProviders(value) {
  4632. return value && !!value.ɵproviders;
  4633. }
  4634. var NG_COMP_DEF = getClosureSafeProperty({
  4635. ɵcmp: getClosureSafeProperty
  4636. });
  4637. var NG_DIR_DEF = getClosureSafeProperty({
  4638. ɵdir: getClosureSafeProperty
  4639. });
  4640. var NG_PIPE_DEF = getClosureSafeProperty({
  4641. ɵpipe: getClosureSafeProperty
  4642. });
  4643. var NG_MOD_DEF = getClosureSafeProperty({
  4644. ɵmod: getClosureSafeProperty
  4645. });
  4646. var NG_FACTORY_DEF = getClosureSafeProperty({
  4647. ɵfac: getClosureSafeProperty
  4648. });
  4649. var NG_ELEMENT_ID = getClosureSafeProperty({
  4650. __NG_ELEMENT_ID__: getClosureSafeProperty
  4651. });
  4652. var NG_ENV_ID = getClosureSafeProperty({
  4653. __NG_ENV_ID__: getClosureSafeProperty
  4654. });
  4655. function renderStringify(value) {
  4656. if (typeof value === "string") return value;
  4657. if (value == null) return "";
  4658. return String(value);
  4659. }
  4660. function stringifyForError(value) {
  4661. if (typeof value === "function") return value.name || value.toString();
  4662. if (typeof value === "object" && value != null && typeof value.type === "function") {
  4663. return value.type.name || value.type.toString();
  4664. }
  4665. return renderStringify(value);
  4666. }
  4667. function debugStringifyTypeForError(type) {
  4668. let componentDef = type[NG_COMP_DEF] || null;
  4669. if (componentDef !== null && componentDef.debugInfo) {
  4670. return stringifyTypeFromDebugInfo(componentDef.debugInfo);
  4671. }
  4672. return stringifyForError(type);
  4673. }
  4674. function stringifyTypeFromDebugInfo(debugInfo) {
  4675. if (!debugInfo.filePath || !debugInfo.lineNumber) {
  4676. return debugInfo.className;
  4677. } else {
  4678. return `${debugInfo.className} (at ${debugInfo.filePath}:${debugInfo.lineNumber})`;
  4679. }
  4680. }
  4681. function throwCyclicDependencyError(token, path) {
  4682. throw new RuntimeError(-200, ngDevMode ? `Circular dependency in DI detected for ${token}${path ? `. Dependency path: ${path.join(" > ")} > ${token}` : ""}` : token);
  4683. }
  4684. function throwMixedMultiProviderError() {
  4685. throw new Error(`Cannot mix multi providers and regular providers`);
  4686. }
  4687. function throwInvalidProviderError(ngModuleType, providers, provider) {
  4688. if (ngModuleType && providers) {
  4689. const providerDetail = providers.map((v) => v == provider ? "?" + provider + "?" : "...");
  4690. throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(", ")}]`);
  4691. } else if (isEnvironmentProviders(provider)) {
  4692. if (provider.ɵfromNgModule) {
  4693. throw new RuntimeError(207, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);
  4694. } else {
  4695. throw new RuntimeError(207, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);
  4696. }
  4697. } else {
  4698. throw new Error("Invalid provider");
  4699. }
  4700. }
  4701. function throwProviderNotFoundError(token, injectorName) {
  4702. const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ""}`;
  4703. throw new RuntimeError(-201, errorMessage);
  4704. }
  4705. var InjectFlags;
  4706. (function(InjectFlags2) {
  4707. InjectFlags2[InjectFlags2["Default"] = 0] = "Default";
  4708. InjectFlags2[InjectFlags2["Host"] = 1] = "Host";
  4709. InjectFlags2[InjectFlags2["Self"] = 2] = "Self";
  4710. InjectFlags2[InjectFlags2["SkipSelf"] = 4] = "SkipSelf";
  4711. InjectFlags2[InjectFlags2["Optional"] = 8] = "Optional";
  4712. })(InjectFlags || (InjectFlags = {}));
  4713. var _injectImplementation;
  4714. function getInjectImplementation() {
  4715. return _injectImplementation;
  4716. }
  4717. function setInjectImplementation(impl) {
  4718. const previous = _injectImplementation;
  4719. _injectImplementation = impl;
  4720. return previous;
  4721. }
  4722. function injectRootLimpMode(token, notFoundValue, flags) {
  4723. const injectableDef = getInjectableDef(token);
  4724. if (injectableDef && injectableDef.providedIn == "root") {
  4725. return injectableDef.value === void 0 ? injectableDef.value = injectableDef.factory() : injectableDef.value;
  4726. }
  4727. if (flags & InjectFlags.Optional) return null;
  4728. if (notFoundValue !== void 0) return notFoundValue;
  4729. throwProviderNotFoundError(token, "Injector");
  4730. }
  4731. function assertInjectImplementationNotEqual(fn) {
  4732. ngDevMode && assertNotEqual(_injectImplementation, fn, "Calling ɵɵinject would cause infinite recursion");
  4733. }
  4734. var _THROW_IF_NOT_FOUND = {};
  4735. var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
  4736. var DI_DECORATOR_FLAG = "__NG_DI_FLAG__";
  4737. var RetrievingInjector = class {
  4738. injector;
  4739. constructor(injector) {
  4740. this.injector = injector;
  4741. }
  4742. retrieve(token, options) {
  4743. const ngOptions = options;
  4744. return this.injector.get(token, ngOptions.optional ? NOT_FOUND : THROW_IF_NOT_FOUND, ngOptions);
  4745. }
  4746. };
  4747. var NG_TEMP_TOKEN_PATH = "ngTempTokenPath";
  4748. var NG_TOKEN_PATH = "ngTokenPath";
  4749. var NEW_LINE = /\n/gm;
  4750. var NO_NEW_LINE = "ɵ";
  4751. var SOURCE = "__source";
  4752. function injectInjectorOnly(token, flags = InjectFlags.Default) {
  4753. if (getCurrentInjector() === void 0) {
  4754. throw new RuntimeError(-203, ngDevMode && `The \`${stringify(token)}\` token injection failed. \`inject()\` function must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`);
  4755. } else if (getCurrentInjector() === null) {
  4756. return injectRootLimpMode(token, void 0, flags);
  4757. } else {
  4758. const currentInjector = getCurrentInjector();
  4759. let injector;
  4760. if (currentInjector instanceof RetrievingInjector) {
  4761. injector = currentInjector.injector;
  4762. } else {
  4763. injector = currentInjector;
  4764. }
  4765. const value = injector.get(token, flags & InjectFlags.Optional ? null : void 0, flags);
  4766. ngDevMode && emitInjectEvent(token, value, flags);
  4767. return value;
  4768. }
  4769. }
  4770. function ɵɵinject(token, flags = InjectFlags.Default) {
  4771. return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
  4772. }
  4773. function ɵɵinvalidFactoryDep(index) {
  4774. throw new RuntimeError(202, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
  4775. This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
  4776. Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
  4777. }
  4778. function inject(token, flags = InjectFlags.Default) {
  4779. return ɵɵinject(token, convertToBitFlags(flags));
  4780. }
  4781. function convertToBitFlags(flags) {
  4782. if (typeof flags === "undefined" || typeof flags === "number") {
  4783. return flags;
  4784. }
  4785. return 0 | // comment to force a line break in the formatter
  4786. (flags.optional && 8) | (flags.host && 1) | (flags.self && 2) | (flags.skipSelf && 4);
  4787. }
  4788. function injectArgs(types) {
  4789. const args = [];
  4790. for (let i = 0; i < types.length; i++) {
  4791. const arg = resolveForwardRef(types[i]);
  4792. if (Array.isArray(arg)) {
  4793. if (arg.length === 0) {
  4794. throw new RuntimeError(900, ngDevMode && "Arguments array must have arguments.");
  4795. }
  4796. let type = void 0;
  4797. let flags = InjectFlags.Default;
  4798. for (let j = 0; j < arg.length; j++) {
  4799. const meta = arg[j];
  4800. const flag = getInjectFlag(meta);
  4801. if (typeof flag === "number") {
  4802. if (flag === -1) {
  4803. type = meta.token;
  4804. } else {
  4805. flags |= flag;
  4806. }
  4807. } else {
  4808. type = meta;
  4809. }
  4810. }
  4811. args.push(ɵɵinject(type, flags));
  4812. } else {
  4813. args.push(ɵɵinject(arg));
  4814. }
  4815. }
  4816. return args;
  4817. }
  4818. function attachInjectFlag(decorator, flag) {
  4819. decorator[DI_DECORATOR_FLAG] = flag;
  4820. decorator.prototype[DI_DECORATOR_FLAG] = flag;
  4821. return decorator;
  4822. }
  4823. function getInjectFlag(token) {
  4824. return token[DI_DECORATOR_FLAG];
  4825. }
  4826. function catchInjectorError(e, token, injectorErrorName, source) {
  4827. const tokenPath = e[NG_TEMP_TOKEN_PATH];
  4828. if (token[SOURCE]) {
  4829. tokenPath.unshift(token[SOURCE]);
  4830. }
  4831. e.message = formatError("\n" + e.message, tokenPath, injectorErrorName, source);
  4832. e[NG_TOKEN_PATH] = tokenPath;
  4833. e[NG_TEMP_TOKEN_PATH] = null;
  4834. throw e;
  4835. }
  4836. function formatError(text, obj, injectorErrorName, source = null) {
  4837. text = text && text.charAt(0) === "\n" && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;
  4838. let context2 = stringify(obj);
  4839. if (Array.isArray(obj)) {
  4840. context2 = obj.map(stringify).join(" -> ");
  4841. } else if (typeof obj === "object") {
  4842. let parts = [];
  4843. for (let key in obj) {
  4844. if (obj.hasOwnProperty(key)) {
  4845. let value = obj[key];
  4846. parts.push(key + ":" + (typeof value === "string" ? JSON.stringify(value) : stringify(value)));
  4847. }
  4848. }
  4849. context2 = `{${parts.join(", ")}}`;
  4850. }
  4851. return `${injectorErrorName}${source ? "(" + source + ")" : ""}[${context2}]: ${text.replace(NEW_LINE, "\n ")}`;
  4852. }
  4853. var Inject = attachInjectFlag(
  4854. // Disable tslint because `DecoratorFlags` is a const enum which gets inlined.
  4855. makeParamDecorator("Inject", (token) => ({
  4856. token
  4857. })),
  4858. -1
  4859. /* DecoratorFlags.Inject */
  4860. );
  4861. var Optional = (
  4862. // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  4863. // tslint:disable-next-line: no-toplevel-property-access
  4864. attachInjectFlag(
  4865. makeParamDecorator("Optional"),
  4866. 8
  4867. /* InternalInjectFlags.Optional */
  4868. )
  4869. );
  4870. var Self = (
  4871. // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  4872. // tslint:disable-next-line: no-toplevel-property-access
  4873. attachInjectFlag(
  4874. makeParamDecorator("Self"),
  4875. 2
  4876. /* InternalInjectFlags.Self */
  4877. )
  4878. );
  4879. var SkipSelf = (
  4880. // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  4881. // tslint:disable-next-line: no-toplevel-property-access
  4882. attachInjectFlag(
  4883. makeParamDecorator("SkipSelf"),
  4884. 4
  4885. /* InternalInjectFlags.SkipSelf */
  4886. )
  4887. );
  4888. var Host = (
  4889. // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  4890. // tslint:disable-next-line: no-toplevel-property-access
  4891. attachInjectFlag(
  4892. makeParamDecorator("Host"),
  4893. 1
  4894. /* InternalInjectFlags.Host */
  4895. )
  4896. );
  4897. function getFactoryDef(type, throwNotFound) {
  4898. const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
  4899. if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
  4900. throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
  4901. }
  4902. return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
  4903. }
  4904. function arrayEquals(a, b, identityAccessor) {
  4905. if (a.length !== b.length) return false;
  4906. for (let i = 0; i < a.length; i++) {
  4907. let valueA = a[i];
  4908. let valueB = b[i];
  4909. if (identityAccessor) {
  4910. valueA = identityAccessor(valueA);
  4911. valueB = identityAccessor(valueB);
  4912. }
  4913. if (valueB !== valueA) {
  4914. return false;
  4915. }
  4916. }
  4917. return true;
  4918. }
  4919. function flatten(list) {
  4920. return list.flat(Number.POSITIVE_INFINITY);
  4921. }
  4922. function deepForEach(input2, fn) {
  4923. input2.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
  4924. }
  4925. function addToArray(arr, index, value) {
  4926. if (index >= arr.length) {
  4927. arr.push(value);
  4928. } else {
  4929. arr.splice(index, 0, value);
  4930. }
  4931. }
  4932. function removeFromArray(arr, index) {
  4933. if (index >= arr.length - 1) {
  4934. return arr.pop();
  4935. } else {
  4936. return arr.splice(index, 1)[0];
  4937. }
  4938. }
  4939. function newArray(size, value) {
  4940. const list = [];
  4941. for (let i = 0; i < size; i++) {
  4942. list.push(value);
  4943. }
  4944. return list;
  4945. }
  4946. function arraySplice(array, index, count2) {
  4947. const length = array.length - count2;
  4948. while (index < length) {
  4949. array[index] = array[index + count2];
  4950. index++;
  4951. }
  4952. while (count2--) {
  4953. array.pop();
  4954. }
  4955. }
  4956. function arrayInsert2(array, index, value1, value2) {
  4957. ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end.");
  4958. let end = array.length;
  4959. if (end == index) {
  4960. array.push(value1, value2);
  4961. } else if (end === 1) {
  4962. array.push(value2, array[0]);
  4963. array[0] = value1;
  4964. } else {
  4965. end--;
  4966. array.push(array[end - 1], array[end]);
  4967. while (end > index) {
  4968. const previousEnd = end - 2;
  4969. array[end] = array[previousEnd];
  4970. end--;
  4971. }
  4972. array[index] = value1;
  4973. array[index + 1] = value2;
  4974. }
  4975. }
  4976. function keyValueArraySet(keyValueArray, key, value) {
  4977. let index = keyValueArrayIndexOf(keyValueArray, key);
  4978. if (index >= 0) {
  4979. keyValueArray[index | 1] = value;
  4980. } else {
  4981. index = ~index;
  4982. arrayInsert2(keyValueArray, index, key, value);
  4983. }
  4984. return index;
  4985. }
  4986. function keyValueArrayGet(keyValueArray, key) {
  4987. const index = keyValueArrayIndexOf(keyValueArray, key);
  4988. if (index >= 0) {
  4989. return keyValueArray[index | 1];
  4990. }
  4991. return void 0;
  4992. }
  4993. function keyValueArrayIndexOf(keyValueArray, key) {
  4994. return _arrayIndexOfSorted(keyValueArray, key, 1);
  4995. }
  4996. function _arrayIndexOfSorted(array, value, shift) {
  4997. ngDevMode && assertEqual(Array.isArray(array), true, "Expecting an array");
  4998. let start = 0;
  4999. let end = array.length >> shift;
  5000. while (end !== start) {
  5001. const middle = start + (end - start >> 1);
  5002. const current = array[middle << shift];
  5003. if (value === current) {
  5004. return middle << shift;
  5005. } else if (current > value) {
  5006. end = middle;
  5007. } else {
  5008. start = middle + 1;
  5009. }
  5010. }
  5011. return ~(end << shift);
  5012. }
  5013. var EMPTY_OBJ = {};
  5014. var EMPTY_ARRAY = [];
  5015. if ((typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode()) {
  5016. Object.freeze(EMPTY_OBJ);
  5017. Object.freeze(EMPTY_ARRAY);
  5018. }
  5019. var ENVIRONMENT_INITIALIZER = new InjectionToken(ngDevMode ? "ENVIRONMENT_INITIALIZER" : "");
  5020. var INJECTOR$1 = new InjectionToken(
  5021. ngDevMode ? "INJECTOR" : "",
  5022. // Disable tslint because this is const enum which gets inlined not top level prop access.
  5023. // tslint:disable-next-line: no-toplevel-property-access
  5024. -1
  5025. /* InjectorMarkers.Injector */
  5026. );
  5027. var INJECTOR_DEF_TYPES = new InjectionToken(ngDevMode ? "INJECTOR_DEF_TYPES" : "");
  5028. var NullInjector = class {
  5029. get(token, notFoundValue = THROW_IF_NOT_FOUND) {
  5030. if (notFoundValue === THROW_IF_NOT_FOUND) {
  5031. const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`);
  5032. error.name = "NullInjectorError";
  5033. throw error;
  5034. }
  5035. return notFoundValue;
  5036. }
  5037. };
  5038. function getNgModuleDef(type, throwNotFound) {
  5039. const ngModuleDef = type[NG_MOD_DEF] || null;
  5040. if (!ngModuleDef && throwNotFound === true) {
  5041. throw new Error(`Type ${stringify(type)} does not have 'ɵmod' property.`);
  5042. }
  5043. return ngModuleDef;
  5044. }
  5045. function getComponentDef(type) {
  5046. return type[NG_COMP_DEF] || null;
  5047. }
  5048. function getDirectiveDef(type) {
  5049. return type[NG_DIR_DEF] || null;
  5050. }
  5051. function getPipeDef$1(type) {
  5052. return type[NG_PIPE_DEF] || null;
  5053. }
  5054. function isStandalone(type) {
  5055. const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
  5056. return def !== null && def.standalone;
  5057. }
  5058. function makeEnvironmentProviders(providers) {
  5059. return {
  5060. ɵproviders: providers
  5061. };
  5062. }
  5063. function provideEnvironmentInitializer(initializerFn) {
  5064. return makeEnvironmentProviders([{
  5065. provide: ENVIRONMENT_INITIALIZER,
  5066. multi: true,
  5067. useValue: initializerFn
  5068. }]);
  5069. }
  5070. function importProvidersFrom(...sources) {
  5071. return {
  5072. ɵproviders: internalImportProvidersFrom(true, sources),
  5073. ɵfromNgModule: true
  5074. };
  5075. }
  5076. function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {
  5077. const providersOut = [];
  5078. const dedup = /* @__PURE__ */ new Set();
  5079. let injectorTypesWithProviders;
  5080. const collectProviders = (provider) => {
  5081. providersOut.push(provider);
  5082. };
  5083. deepForEach(sources, (source) => {
  5084. if ((typeof ngDevMode === "undefined" || ngDevMode) && checkForStandaloneCmp) {
  5085. const cmpDef = getComponentDef(source);
  5086. if (cmpDef?.standalone) {
  5087. throw new RuntimeError(800, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component "${stringifyForError(source)}"`);
  5088. }
  5089. }
  5090. const internalSource = source;
  5091. if (walkProviderTree(internalSource, collectProviders, [], dedup)) {
  5092. injectorTypesWithProviders ||= [];
  5093. injectorTypesWithProviders.push(internalSource);
  5094. }
  5095. });
  5096. if (injectorTypesWithProviders !== void 0) {
  5097. processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders);
  5098. }
  5099. return providersOut;
  5100. }
  5101. function processInjectorTypesWithProviders(typesWithProviders, visitor) {
  5102. for (let i = 0; i < typesWithProviders.length; i++) {
  5103. const {
  5104. ngModule,
  5105. providers
  5106. } = typesWithProviders[i];
  5107. deepForEachProvider(providers, (provider) => {
  5108. ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);
  5109. visitor(provider, ngModule);
  5110. });
  5111. }
  5112. }
  5113. function walkProviderTree(container, visitor, parents, dedup) {
  5114. container = resolveForwardRef(container);
  5115. if (!container) return false;
  5116. let defType = null;
  5117. let injDef = getInjectorDef(container);
  5118. const cmpDef = !injDef && getComponentDef(container);
  5119. if (!injDef && !cmpDef) {
  5120. const ngModule = container.ngModule;
  5121. injDef = getInjectorDef(ngModule);
  5122. if (injDef) {
  5123. defType = ngModule;
  5124. } else {
  5125. return false;
  5126. }
  5127. } else if (cmpDef && !cmpDef.standalone) {
  5128. return false;
  5129. } else {
  5130. defType = container;
  5131. }
  5132. if (ngDevMode && parents.indexOf(defType) !== -1) {
  5133. const defName = stringify(defType);
  5134. const path = parents.map(stringify);
  5135. throwCyclicDependencyError(defName, path);
  5136. }
  5137. const isDuplicate = dedup.has(defType);
  5138. if (cmpDef) {
  5139. if (isDuplicate) {
  5140. return false;
  5141. }
  5142. dedup.add(defType);
  5143. if (cmpDef.dependencies) {
  5144. const deps = typeof cmpDef.dependencies === "function" ? cmpDef.dependencies() : cmpDef.dependencies;
  5145. for (const dep of deps) {
  5146. walkProviderTree(dep, visitor, parents, dedup);
  5147. }
  5148. }
  5149. } else if (injDef) {
  5150. if (injDef.imports != null && !isDuplicate) {
  5151. ngDevMode && parents.push(defType);
  5152. dedup.add(defType);
  5153. let importTypesWithProviders;
  5154. try {
  5155. deepForEach(injDef.imports, (imported) => {
  5156. if (walkProviderTree(imported, visitor, parents, dedup)) {
  5157. importTypesWithProviders ||= [];
  5158. importTypesWithProviders.push(imported);
  5159. }
  5160. });
  5161. } finally {
  5162. ngDevMode && parents.pop();
  5163. }
  5164. if (importTypesWithProviders !== void 0) {
  5165. processInjectorTypesWithProviders(importTypesWithProviders, visitor);
  5166. }
  5167. }
  5168. if (!isDuplicate) {
  5169. const factory = getFactoryDef(defType) || (() => new defType());
  5170. visitor({
  5171. provide: defType,
  5172. useFactory: factory,
  5173. deps: EMPTY_ARRAY
  5174. }, defType);
  5175. visitor({
  5176. provide: INJECTOR_DEF_TYPES,
  5177. useValue: defType,
  5178. multi: true
  5179. }, defType);
  5180. visitor({
  5181. provide: ENVIRONMENT_INITIALIZER,
  5182. useValue: () => ɵɵinject(defType),
  5183. multi: true
  5184. }, defType);
  5185. }
  5186. const defProviders = injDef.providers;
  5187. if (defProviders != null && !isDuplicate) {
  5188. const injectorType = container;
  5189. deepForEachProvider(defProviders, (provider) => {
  5190. ngDevMode && validateProvider(provider, defProviders, injectorType);
  5191. visitor(provider, injectorType);
  5192. });
  5193. }
  5194. } else {
  5195. return false;
  5196. }
  5197. return defType !== container && container.providers !== void 0;
  5198. }
  5199. function validateProvider(provider, providers, containerType) {
  5200. if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) {
  5201. return;
  5202. }
  5203. const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
  5204. if (!classRef) {
  5205. throwInvalidProviderError(containerType, providers, provider);
  5206. }
  5207. }
  5208. function deepForEachProvider(providers, fn) {
  5209. for (let provider of providers) {
  5210. if (isEnvironmentProviders(provider)) {
  5211. provider = provider.ɵproviders;
  5212. }
  5213. if (Array.isArray(provider)) {
  5214. deepForEachProvider(provider, fn);
  5215. } else {
  5216. fn(provider);
  5217. }
  5218. }
  5219. }
  5220. var USE_VALUE$1 = getClosureSafeProperty({
  5221. provide: String,
  5222. useValue: getClosureSafeProperty
  5223. });
  5224. function isValueProvider(value) {
  5225. return value !== null && typeof value == "object" && USE_VALUE$1 in value;
  5226. }
  5227. function isExistingProvider(value) {
  5228. return !!(value && value.useExisting);
  5229. }
  5230. function isFactoryProvider(value) {
  5231. return !!(value && value.useFactory);
  5232. }
  5233. function isTypeProvider(value) {
  5234. return typeof value === "function";
  5235. }
  5236. function isClassProvider(value) {
  5237. return !!value.useClass;
  5238. }
  5239. var INJECTOR_SCOPE = new InjectionToken(ngDevMode ? "Set Injector scope." : "");
  5240. var NOT_YET = {};
  5241. var CIRCULAR = {};
  5242. var NULL_INJECTOR = void 0;
  5243. function getNullInjector() {
  5244. if (NULL_INJECTOR === void 0) {
  5245. NULL_INJECTOR = new NullInjector();
  5246. }
  5247. return NULL_INJECTOR;
  5248. }
  5249. var EnvironmentInjector = class {
  5250. };
  5251. var R3Injector = class extends EnvironmentInjector {
  5252. parent;
  5253. source;
  5254. scopes;
  5255. /**
  5256. * Map of tokens to records which contain the instances of those tokens.
  5257. * - `null` value implies that we don't have the record. Used by tree-shakable injectors
  5258. * to prevent further searches.
  5259. */
  5260. records = /* @__PURE__ */ new Map();
  5261. /**
  5262. * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks.
  5263. */
  5264. _ngOnDestroyHooks = /* @__PURE__ */ new Set();
  5265. _onDestroyHooks = [];
  5266. /**
  5267. * Flag indicating that this injector was previously destroyed.
  5268. */
  5269. get destroyed() {
  5270. return this._destroyed;
  5271. }
  5272. _destroyed = false;
  5273. injectorDefTypes;
  5274. constructor(providers, parent, source, scopes) {
  5275. super();
  5276. this.parent = parent;
  5277. this.source = source;
  5278. this.scopes = scopes;
  5279. forEachSingleProvider(providers, (provider) => this.processProvider(provider));
  5280. this.records.set(INJECTOR$1, makeRecord(void 0, this));
  5281. if (scopes.has("environment")) {
  5282. this.records.set(EnvironmentInjector, makeRecord(void 0, this));
  5283. }
  5284. const record = this.records.get(INJECTOR_SCOPE);
  5285. if (record != null && typeof record.value === "string") {
  5286. this.scopes.add(record.value);
  5287. }
  5288. this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, InjectFlags.Self));
  5289. }
  5290. retrieve(token, options) {
  5291. const ngOptions = options;
  5292. return this.get(token, ngOptions.optional ? NOT_FOUND : THROW_IF_NOT_FOUND, ngOptions);
  5293. }
  5294. /**
  5295. * Destroy the injector and release references to every instance or provider associated with it.
  5296. *
  5297. * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a
  5298. * hook was found.
  5299. */
  5300. destroy() {
  5301. assertNotDestroyed(this);
  5302. this._destroyed = true;
  5303. const prevConsumer = setActiveConsumer(null);
  5304. try {
  5305. for (const service of this._ngOnDestroyHooks) {
  5306. service.ngOnDestroy();
  5307. }
  5308. const onDestroyHooks = this._onDestroyHooks;
  5309. this._onDestroyHooks = [];
  5310. for (const hook of onDestroyHooks) {
  5311. hook();
  5312. }
  5313. } finally {
  5314. this.records.clear();
  5315. this._ngOnDestroyHooks.clear();
  5316. this.injectorDefTypes.clear();
  5317. setActiveConsumer(prevConsumer);
  5318. }
  5319. }
  5320. onDestroy(callback) {
  5321. assertNotDestroyed(this);
  5322. this._onDestroyHooks.push(callback);
  5323. return () => this.removeOnDestroy(callback);
  5324. }
  5325. runInContext(fn) {
  5326. assertNotDestroyed(this);
  5327. const previousInjector = setCurrentInjector(this);
  5328. const previousInjectImplementation = setInjectImplementation(void 0);
  5329. let prevInjectContext;
  5330. if (ngDevMode) {
  5331. prevInjectContext = setInjectorProfilerContext({
  5332. injector: this,
  5333. token: null
  5334. });
  5335. }
  5336. try {
  5337. return fn();
  5338. } finally {
  5339. setCurrentInjector(previousInjector);
  5340. setInjectImplementation(previousInjectImplementation);
  5341. ngDevMode && setInjectorProfilerContext(prevInjectContext);
  5342. }
  5343. }
  5344. get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
  5345. assertNotDestroyed(this);
  5346. if (token.hasOwnProperty(NG_ENV_ID)) {
  5347. return token[NG_ENV_ID](this);
  5348. }
  5349. flags = convertToBitFlags(flags);
  5350. let prevInjectContext;
  5351. if (ngDevMode) {
  5352. prevInjectContext = setInjectorProfilerContext({
  5353. injector: this,
  5354. token
  5355. });
  5356. }
  5357. const previousInjector = setCurrentInjector(this);
  5358. const previousInjectImplementation = setInjectImplementation(void 0);
  5359. try {
  5360. if (!(flags & InjectFlags.SkipSelf)) {
  5361. let record = this.records.get(token);
  5362. if (record === void 0) {
  5363. const def = couldBeInjectableType(token) && getInjectableDef(token);
  5364. if (def && this.injectableDefInScope(def)) {
  5365. if (ngDevMode) {
  5366. runInInjectorProfilerContext(this, token, () => {
  5367. emitProviderConfiguredEvent(token);
  5368. });
  5369. }
  5370. record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);
  5371. } else {
  5372. record = null;
  5373. }
  5374. this.records.set(token, record);
  5375. }
  5376. if (record != null) {
  5377. return this.hydrate(token, record);
  5378. }
  5379. }
  5380. const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector();
  5381. notFoundValue = flags & InjectFlags.Optional && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue;
  5382. return nextInjector.get(token, notFoundValue);
  5383. } catch (e) {
  5384. if (e.name === "NullInjectorError") {
  5385. const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
  5386. path.unshift(stringify(token));
  5387. if (previousInjector) {
  5388. throw e;
  5389. } else {
  5390. return catchInjectorError(e, token, "R3InjectorError", this.source);
  5391. }
  5392. } else {
  5393. throw e;
  5394. }
  5395. } finally {
  5396. setInjectImplementation(previousInjectImplementation);
  5397. setCurrentInjector(previousInjector);
  5398. ngDevMode && setInjectorProfilerContext(prevInjectContext);
  5399. }
  5400. }
  5401. /** @internal */
  5402. resolveInjectorInitializers() {
  5403. const prevConsumer = setActiveConsumer(null);
  5404. const previousInjector = setCurrentInjector(this);
  5405. const previousInjectImplementation = setInjectImplementation(void 0);
  5406. let prevInjectContext;
  5407. if (ngDevMode) {
  5408. prevInjectContext = setInjectorProfilerContext({
  5409. injector: this,
  5410. token: null
  5411. });
  5412. }
  5413. try {
  5414. const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, InjectFlags.Self);
  5415. if (ngDevMode && !Array.isArray(initializers)) {
  5416. throw new RuntimeError(-209, `Unexpected type of the \`ENVIRONMENT_INITIALIZER\` token value (expected an array, but got ${typeof initializers}). Please check that the \`ENVIRONMENT_INITIALIZER\` token is configured as a \`multi: true\` provider.`);
  5417. }
  5418. for (const initializer of initializers) {
  5419. initializer();
  5420. }
  5421. } finally {
  5422. setCurrentInjector(previousInjector);
  5423. setInjectImplementation(previousInjectImplementation);
  5424. ngDevMode && setInjectorProfilerContext(prevInjectContext);
  5425. setActiveConsumer(prevConsumer);
  5426. }
  5427. }
  5428. toString() {
  5429. const tokens = [];
  5430. const records = this.records;
  5431. for (const token of records.keys()) {
  5432. tokens.push(stringify(token));
  5433. }
  5434. return `R3Injector[${tokens.join(", ")}]`;
  5435. }
  5436. /**
  5437. * Process a `SingleProvider` and add it.
  5438. */
  5439. processProvider(provider) {
  5440. provider = resolveForwardRef(provider);
  5441. let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);
  5442. const record = providerToRecord(provider);
  5443. if (ngDevMode) {
  5444. runInInjectorProfilerContext(this, token, () => {
  5445. if (isValueProvider(provider)) {
  5446. emitInstanceCreatedByInjectorEvent(provider.useValue);
  5447. }
  5448. emitProviderConfiguredEvent(provider);
  5449. });
  5450. }
  5451. if (!isTypeProvider(provider) && provider.multi === true) {
  5452. let multiRecord = this.records.get(token);
  5453. if (multiRecord) {
  5454. if (ngDevMode && multiRecord.multi === void 0) {
  5455. throwMixedMultiProviderError();
  5456. }
  5457. } else {
  5458. multiRecord = makeRecord(void 0, NOT_YET, true);
  5459. multiRecord.factory = () => injectArgs(multiRecord.multi);
  5460. this.records.set(token, multiRecord);
  5461. }
  5462. token = provider;
  5463. multiRecord.multi.push(provider);
  5464. } else {
  5465. if (ngDevMode) {
  5466. const existing = this.records.get(token);
  5467. if (existing && existing.multi !== void 0) {
  5468. throwMixedMultiProviderError();
  5469. }
  5470. }
  5471. }
  5472. this.records.set(token, record);
  5473. }
  5474. hydrate(token, record) {
  5475. const prevConsumer = setActiveConsumer(null);
  5476. try {
  5477. if (record.value === CIRCULAR) {
  5478. throwCyclicDependencyError(stringify(token));
  5479. } else if (record.value === NOT_YET) {
  5480. record.value = CIRCULAR;
  5481. if (ngDevMode) {
  5482. runInInjectorProfilerContext(this, token, () => {
  5483. record.value = record.factory();
  5484. emitInstanceCreatedByInjectorEvent(record.value);
  5485. });
  5486. } else {
  5487. record.value = record.factory();
  5488. }
  5489. }
  5490. if (typeof record.value === "object" && record.value && hasOnDestroy(record.value)) {
  5491. this._ngOnDestroyHooks.add(record.value);
  5492. }
  5493. return record.value;
  5494. } finally {
  5495. setActiveConsumer(prevConsumer);
  5496. }
  5497. }
  5498. injectableDefInScope(def) {
  5499. if (!def.providedIn) {
  5500. return false;
  5501. }
  5502. const providedIn = resolveForwardRef(def.providedIn);
  5503. if (typeof providedIn === "string") {
  5504. return providedIn === "any" || this.scopes.has(providedIn);
  5505. } else {
  5506. return this.injectorDefTypes.has(providedIn);
  5507. }
  5508. }
  5509. removeOnDestroy(callback) {
  5510. const destroyCBIdx = this._onDestroyHooks.indexOf(callback);
  5511. if (destroyCBIdx !== -1) {
  5512. this._onDestroyHooks.splice(destroyCBIdx, 1);
  5513. }
  5514. }
  5515. };
  5516. function injectableDefOrInjectorDefFactory(token) {
  5517. const injectableDef = getInjectableDef(token);
  5518. const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);
  5519. if (factory !== null) {
  5520. return factory;
  5521. }
  5522. if (token instanceof InjectionToken) {
  5523. throw new RuntimeError(204, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);
  5524. }
  5525. if (token instanceof Function) {
  5526. return getUndecoratedInjectableFactory(token);
  5527. }
  5528. throw new RuntimeError(204, ngDevMode && "unreachable");
  5529. }
  5530. function getUndecoratedInjectableFactory(token) {
  5531. const paramLength = token.length;
  5532. if (paramLength > 0) {
  5533. throw new RuntimeError(204, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, "?").join(", ")}).`);
  5534. }
  5535. const inheritedInjectableDef = getInheritedInjectableDef(token);
  5536. if (inheritedInjectableDef !== null) {
  5537. return () => inheritedInjectableDef.factory(token);
  5538. } else {
  5539. return () => new token();
  5540. }
  5541. }
  5542. function providerToRecord(provider) {
  5543. if (isValueProvider(provider)) {
  5544. return makeRecord(void 0, provider.useValue);
  5545. } else {
  5546. const factory = providerToFactory(provider);
  5547. return makeRecord(factory, NOT_YET);
  5548. }
  5549. }
  5550. function providerToFactory(provider, ngModuleType, providers) {
  5551. let factory = void 0;
  5552. if (ngDevMode && isEnvironmentProviders(provider)) {
  5553. throwInvalidProviderError(void 0, providers, provider);
  5554. }
  5555. if (isTypeProvider(provider)) {
  5556. const unwrappedProvider = resolveForwardRef(provider);
  5557. return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);
  5558. } else {
  5559. if (isValueProvider(provider)) {
  5560. factory = () => resolveForwardRef(provider.useValue);
  5561. } else if (isFactoryProvider(provider)) {
  5562. factory = () => provider.useFactory(...injectArgs(provider.deps || []));
  5563. } else if (isExistingProvider(provider)) {
  5564. factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
  5565. } else {
  5566. const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
  5567. if (ngDevMode && !classRef) {
  5568. throwInvalidProviderError(ngModuleType, providers, provider);
  5569. }
  5570. if (hasDeps(provider)) {
  5571. factory = () => new classRef(...injectArgs(provider.deps));
  5572. } else {
  5573. return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);
  5574. }
  5575. }
  5576. }
  5577. return factory;
  5578. }
  5579. function assertNotDestroyed(injector) {
  5580. if (injector.destroyed) {
  5581. throw new RuntimeError(205, ngDevMode && "Injector has already been destroyed.");
  5582. }
  5583. }
  5584. function makeRecord(factory, value, multi = false) {
  5585. return {
  5586. factory,
  5587. value,
  5588. multi: multi ? [] : void 0
  5589. };
  5590. }
  5591. function hasDeps(value) {
  5592. return !!value.deps;
  5593. }
  5594. function hasOnDestroy(value) {
  5595. return value !== null && typeof value === "object" && typeof value.ngOnDestroy === "function";
  5596. }
  5597. function couldBeInjectableType(value) {
  5598. return typeof value === "function" || typeof value === "object" && value instanceof InjectionToken;
  5599. }
  5600. function forEachSingleProvider(providers, fn) {
  5601. for (const provider of providers) {
  5602. if (Array.isArray(provider)) {
  5603. forEachSingleProvider(provider, fn);
  5604. } else if (provider && isEnvironmentProviders(provider)) {
  5605. forEachSingleProvider(provider.ɵproviders, fn);
  5606. } else {
  5607. fn(provider);
  5608. }
  5609. }
  5610. }
  5611. function runInInjectionContext(injector, fn) {
  5612. let internalInjector;
  5613. if (injector instanceof R3Injector) {
  5614. assertNotDestroyed(injector);
  5615. internalInjector = injector;
  5616. } else {
  5617. internalInjector = new RetrievingInjector(injector);
  5618. }
  5619. let prevInjectorProfilerContext;
  5620. if (ngDevMode) {
  5621. prevInjectorProfilerContext = setInjectorProfilerContext({
  5622. injector,
  5623. token: null
  5624. });
  5625. }
  5626. const prevInjector = setCurrentInjector(internalInjector);
  5627. const previousInjectImplementation = setInjectImplementation(void 0);
  5628. try {
  5629. return fn();
  5630. } finally {
  5631. setCurrentInjector(prevInjector);
  5632. ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext);
  5633. setInjectImplementation(previousInjectImplementation);
  5634. }
  5635. }
  5636. function isInInjectionContext() {
  5637. return getInjectImplementation() !== void 0 || getCurrentInjector() != null;
  5638. }
  5639. function assertInInjectionContext(debugFn) {
  5640. if (!isInInjectionContext()) {
  5641. throw new RuntimeError(-203, ngDevMode && debugFn.name + "() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`");
  5642. }
  5643. }
  5644. var FactoryTarget;
  5645. (function(FactoryTarget2) {
  5646. FactoryTarget2[FactoryTarget2["Directive"] = 0] = "Directive";
  5647. FactoryTarget2[FactoryTarget2["Component"] = 1] = "Component";
  5648. FactoryTarget2[FactoryTarget2["Injectable"] = 2] = "Injectable";
  5649. FactoryTarget2[FactoryTarget2["Pipe"] = 3] = "Pipe";
  5650. FactoryTarget2[FactoryTarget2["NgModule"] = 4] = "NgModule";
  5651. })(FactoryTarget || (FactoryTarget = {}));
  5652. var R3TemplateDependencyKind;
  5653. (function(R3TemplateDependencyKind2) {
  5654. R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive";
  5655. R3TemplateDependencyKind2[R3TemplateDependencyKind2["Pipe"] = 1] = "Pipe";
  5656. R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule";
  5657. })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
  5658. var ViewEncapsulation$1;
  5659. (function(ViewEncapsulation2) {
  5660. ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated";
  5661. ViewEncapsulation2[ViewEncapsulation2["None"] = 2] = "None";
  5662. ViewEncapsulation2[ViewEncapsulation2["ShadowDom"] = 3] = "ShadowDom";
  5663. })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
  5664. function getCompilerFacade(request) {
  5665. const globalNg = _global["ng"];
  5666. if (globalNg && globalNg.ɵcompilerFacade) {
  5667. return globalNg.ɵcompilerFacade;
  5668. }
  5669. if (typeof ngDevMode === "undefined" || ngDevMode) {
  5670. console.error(`JIT compilation failed for ${request.kind}`, request.type);
  5671. let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.
  5672. `;
  5673. if (request.usage === 1) {
  5674. message += `The ${request.kind} is part of a library that has been partially compiled.
  5675. `;
  5676. message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.
  5677. `;
  5678. message += "\n";
  5679. message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
  5680. `;
  5681. } else {
  5682. message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
  5683. `;
  5684. }
  5685. message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
  5686. `;
  5687. message += `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`;
  5688. throw new Error(message);
  5689. } else {
  5690. throw new Error("JIT compiler unavailable");
  5691. }
  5692. }
  5693. var angularCoreDiEnv = {
  5694. "ɵɵdefineInjectable": ɵɵdefineInjectable,
  5695. "ɵɵdefineInjector": ɵɵdefineInjector,
  5696. "ɵɵinject": ɵɵinject,
  5697. "ɵɵinvalidFactoryDep": ɵɵinvalidFactoryDep,
  5698. "resolveForwardRef": resolveForwardRef
  5699. };
  5700. var Type = Function;
  5701. function isType(v) {
  5702. return typeof v === "function";
  5703. }
  5704. var ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\).*)\)/;
  5705. var ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/;
  5706. var ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/;
  5707. var ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/;
  5708. function isDelegateCtor(typeStr) {
  5709. return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr);
  5710. }
  5711. var ReflectionCapabilities = class {
  5712. _reflect;
  5713. constructor(reflect) {
  5714. this._reflect = reflect || _global["Reflect"];
  5715. }
  5716. factory(t) {
  5717. return (...args) => new t(...args);
  5718. }
  5719. /** @internal */
  5720. _zipTypesAndAnnotations(paramTypes, paramAnnotations) {
  5721. let result;
  5722. if (typeof paramTypes === "undefined") {
  5723. result = newArray(paramAnnotations.length);
  5724. } else {
  5725. result = newArray(paramTypes.length);
  5726. }
  5727. for (let i = 0; i < result.length; i++) {
  5728. if (typeof paramTypes === "undefined") {
  5729. result[i] = [];
  5730. } else if (paramTypes[i] && paramTypes[i] != Object) {
  5731. result[i] = [paramTypes[i]];
  5732. } else {
  5733. result[i] = [];
  5734. }
  5735. if (paramAnnotations && paramAnnotations[i] != null) {
  5736. result[i] = result[i].concat(paramAnnotations[i]);
  5737. }
  5738. }
  5739. return result;
  5740. }
  5741. _ownParameters(type, parentCtor) {
  5742. const typeStr = type.toString();
  5743. if (isDelegateCtor(typeStr)) {
  5744. return null;
  5745. }
  5746. if (type.parameters && type.parameters !== parentCtor.parameters) {
  5747. return type.parameters;
  5748. }
  5749. const tsickleCtorParams = type.ctorParameters;
  5750. if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
  5751. const ctorParameters = typeof tsickleCtorParams === "function" ? tsickleCtorParams() : tsickleCtorParams;
  5752. const paramTypes2 = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type);
  5753. const paramAnnotations2 = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
  5754. return this._zipTypesAndAnnotations(paramTypes2, paramAnnotations2);
  5755. }
  5756. const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];
  5757. const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata("design:paramtypes", type);
  5758. if (paramTypes || paramAnnotations) {
  5759. return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
  5760. }
  5761. return newArray(type.length);
  5762. }
  5763. parameters(type) {
  5764. if (!isType(type)) {
  5765. return [];
  5766. }
  5767. const parentCtor = getParentCtor(type);
  5768. let parameters = this._ownParameters(type, parentCtor);
  5769. if (!parameters && parentCtor !== Object) {
  5770. parameters = this.parameters(parentCtor);
  5771. }
  5772. return parameters || [];
  5773. }
  5774. _ownAnnotations(typeOrFunc, parentCtor) {
  5775. if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {
  5776. let annotations = typeOrFunc.annotations;
  5777. if (typeof annotations === "function" && annotations.annotations) {
  5778. annotations = annotations.annotations;
  5779. }
  5780. return annotations;
  5781. }
  5782. if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {
  5783. return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);
  5784. }
  5785. if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
  5786. return typeOrFunc[ANNOTATIONS];
  5787. }
  5788. return null;
  5789. }
  5790. annotations(typeOrFunc) {
  5791. if (!isType(typeOrFunc)) {
  5792. return [];
  5793. }
  5794. const parentCtor = getParentCtor(typeOrFunc);
  5795. const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
  5796. const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
  5797. return parentAnnotations.concat(ownAnnotations);
  5798. }
  5799. _ownPropMetadata(typeOrFunc, parentCtor) {
  5800. if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) {
  5801. let propMetadata = typeOrFunc.propMetadata;
  5802. if (typeof propMetadata === "function" && propMetadata.propMetadata) {
  5803. propMetadata = propMetadata.propMetadata;
  5804. }
  5805. return propMetadata;
  5806. }
  5807. if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) {
  5808. const propDecorators = typeOrFunc.propDecorators;
  5809. const propMetadata = {};
  5810. Object.keys(propDecorators).forEach((prop) => {
  5811. propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
  5812. });
  5813. return propMetadata;
  5814. }
  5815. if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
  5816. return typeOrFunc[PROP_METADATA];
  5817. }
  5818. return null;
  5819. }
  5820. propMetadata(typeOrFunc) {
  5821. if (!isType(typeOrFunc)) {
  5822. return {};
  5823. }
  5824. const parentCtor = getParentCtor(typeOrFunc);
  5825. const propMetadata = {};
  5826. if (parentCtor !== Object) {
  5827. const parentPropMetadata = this.propMetadata(parentCtor);
  5828. Object.keys(parentPropMetadata).forEach((propName) => {
  5829. propMetadata[propName] = parentPropMetadata[propName];
  5830. });
  5831. }
  5832. const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
  5833. if (ownPropMetadata) {
  5834. Object.keys(ownPropMetadata).forEach((propName) => {
  5835. const decorators = [];
  5836. if (propMetadata.hasOwnProperty(propName)) {
  5837. decorators.push(...propMetadata[propName]);
  5838. }
  5839. decorators.push(...ownPropMetadata[propName]);
  5840. propMetadata[propName] = decorators;
  5841. });
  5842. }
  5843. return propMetadata;
  5844. }
  5845. ownPropMetadata(typeOrFunc) {
  5846. if (!isType(typeOrFunc)) {
  5847. return {};
  5848. }
  5849. return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
  5850. }
  5851. hasLifecycleHook(type, lcProperty) {
  5852. return type instanceof Type && lcProperty in type.prototype;
  5853. }
  5854. };
  5855. function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
  5856. if (!decoratorInvocations) {
  5857. return [];
  5858. }
  5859. return decoratorInvocations.map((decoratorInvocation) => {
  5860. const decoratorType = decoratorInvocation.type;
  5861. const annotationCls = decoratorType.annotationCls;
  5862. const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
  5863. return new annotationCls(...annotationArgs);
  5864. });
  5865. }
  5866. function getParentCtor(ctor) {
  5867. const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
  5868. const parentCtor = parentProto ? parentProto.constructor : null;
  5869. return parentCtor || Object;
  5870. }
  5871. var HOST = 0;
  5872. var TVIEW = 1;
  5873. var FLAGS = 2;
  5874. var PARENT = 3;
  5875. var NEXT = 4;
  5876. var T_HOST = 5;
  5877. var HYDRATION = 6;
  5878. var CLEANUP = 7;
  5879. var CONTEXT = 8;
  5880. var INJECTOR = 9;
  5881. var ENVIRONMENT = 10;
  5882. var RENDERER = 11;
  5883. var CHILD_HEAD = 12;
  5884. var CHILD_TAIL = 13;
  5885. var DECLARATION_VIEW = 14;
  5886. var DECLARATION_COMPONENT_VIEW = 15;
  5887. var DECLARATION_LCONTAINER = 16;
  5888. var PREORDER_HOOK_FLAGS = 17;
  5889. var QUERIES = 18;
  5890. var ID = 19;
  5891. var EMBEDDED_VIEW_INJECTOR = 20;
  5892. var ON_DESTROY_HOOKS = 21;
  5893. var EFFECTS_TO_SCHEDULE = 22;
  5894. var EFFECTS = 23;
  5895. var REACTIVE_TEMPLATE_CONSUMER = 24;
  5896. var AFTER_RENDER_SEQUENCES_TO_ADD = 25;
  5897. var HEADER_OFFSET = 26;
  5898. var TYPE = 1;
  5899. var DEHYDRATED_VIEWS = 6;
  5900. var NATIVE = 7;
  5901. var VIEW_REFS = 8;
  5902. var MOVED_VIEWS = 9;
  5903. var CONTAINER_HEADER_OFFSET = 10;
  5904. function isLView(value) {
  5905. return Array.isArray(value) && typeof value[TYPE] === "object";
  5906. }
  5907. function isLContainer(value) {
  5908. return Array.isArray(value) && value[TYPE] === true;
  5909. }
  5910. function isContentQueryHost(tNode) {
  5911. return (tNode.flags & 4) !== 0;
  5912. }
  5913. function isComponentHost(tNode) {
  5914. return tNode.componentOffset > -1;
  5915. }
  5916. function isDirectiveHost(tNode) {
  5917. return (tNode.flags & 1) === 1;
  5918. }
  5919. function isComponentDef(def) {
  5920. return !!def.template;
  5921. }
  5922. function isRootView(target) {
  5923. return (target[FLAGS] & 512) !== 0;
  5924. }
  5925. function isProjectionTNode(tNode) {
  5926. return (tNode.type & 16) === 16;
  5927. }
  5928. function hasI18n(lView) {
  5929. return (lView[FLAGS] & 32) === 32;
  5930. }
  5931. function isDestroyed(lView) {
  5932. return (lView[FLAGS] & 256) === 256;
  5933. }
  5934. function assertTNodeForLView(tNode, lView) {
  5935. assertTNodeForTView(tNode, lView[TVIEW]);
  5936. }
  5937. function assertTNodeForTView(tNode, tView) {
  5938. assertTNode(tNode);
  5939. const tData = tView.data;
  5940. for (let i = HEADER_OFFSET; i < tData.length; i++) {
  5941. if (tData[i] === tNode) {
  5942. return;
  5943. }
  5944. }
  5945. throwError2("This TNode does not belong to this TView.");
  5946. }
  5947. function assertTNode(tNode) {
  5948. assertDefined(tNode, "TNode must be defined");
  5949. if (!(tNode && typeof tNode === "object" && tNode.hasOwnProperty("directiveStylingLast"))) {
  5950. throwError2("Not of type TNode, got: " + tNode);
  5951. }
  5952. }
  5953. function assertTIcu(tIcu) {
  5954. assertDefined(tIcu, "Expected TIcu to be defined");
  5955. if (!(typeof tIcu.currentCaseLViewIndex === "number")) {
  5956. throwError2("Object is not of TIcu type.");
  5957. }
  5958. }
  5959. function assertComponentType(actual, msg = "Type passed in is not ComponentType, it does not have 'ɵcmp' property.") {
  5960. if (!getComponentDef(actual)) {
  5961. throwError2(msg);
  5962. }
  5963. }
  5964. function assertNgModuleType(actual, msg = "Type passed in is not NgModuleType, it does not have 'ɵmod' property.") {
  5965. if (!getNgModuleDef(actual)) {
  5966. throwError2(msg);
  5967. }
  5968. }
  5969. function assertHasParent(tNode) {
  5970. assertDefined(tNode, "currentTNode should exist!");
  5971. assertDefined(tNode.parent, "currentTNode should have a parent");
  5972. }
  5973. function assertLContainer(value) {
  5974. assertDefined(value, "LContainer must be defined");
  5975. assertEqual(isLContainer(value), true, "Expecting LContainer");
  5976. }
  5977. function assertLViewOrUndefined(value) {
  5978. value && assertEqual(isLView(value), true, "Expecting LView or undefined or null");
  5979. }
  5980. function assertLView(value) {
  5981. assertDefined(value, "LView must be defined");
  5982. assertEqual(isLView(value), true, "Expecting LView");
  5983. }
  5984. function assertFirstCreatePass(tView, errMessage) {
  5985. assertEqual(tView.firstCreatePass, true, errMessage || "Should only be called in first create pass.");
  5986. }
  5987. function assertFirstUpdatePass(tView, errMessage) {
  5988. assertEqual(tView.firstUpdatePass, true, "Should only be called in first update pass.");
  5989. }
  5990. function assertDirectiveDef(obj) {
  5991. if (obj.type === void 0 || obj.selectors == void 0 || obj.inputs === void 0) {
  5992. throwError2(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
  5993. }
  5994. }
  5995. function assertIndexInDeclRange(tView, index) {
  5996. assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
  5997. }
  5998. function assertIndexInExpandoRange(lView, index) {
  5999. const tView = lView[1];
  6000. assertBetween(tView.expandoStartIndex, lView.length, index);
  6001. }
  6002. function assertBetween(lower, upper, index) {
  6003. if (!(lower <= index && index < upper)) {
  6004. throwError2(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
  6005. }
  6006. }
  6007. function assertProjectionSlots(lView, errMessage) {
  6008. assertDefined(lView[DECLARATION_COMPONENT_VIEW], "Component views should exist.");
  6009. assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, "Components with projection nodes (<ng-content>) must have projection slots defined.");
  6010. }
  6011. function assertParentView(lView, errMessage) {
  6012. assertDefined(lView, "Component views should always have a parent view (component's host view)");
  6013. }
  6014. function assertNodeInjector(lView, injectorIndex) {
  6015. assertIndexInExpandoRange(lView, injectorIndex);
  6016. assertIndexInExpandoRange(
  6017. lView,
  6018. injectorIndex + 8
  6019. /* NodeInjectorOffset.PARENT */
  6020. );
  6021. assertNumber(lView[injectorIndex + 0], "injectorIndex should point to a bloom filter");
  6022. assertNumber(lView[injectorIndex + 1], "injectorIndex should point to a bloom filter");
  6023. assertNumber(lView[injectorIndex + 2], "injectorIndex should point to a bloom filter");
  6024. assertNumber(lView[injectorIndex + 3], "injectorIndex should point to a bloom filter");
  6025. assertNumber(lView[injectorIndex + 4], "injectorIndex should point to a bloom filter");
  6026. assertNumber(lView[injectorIndex + 5], "injectorIndex should point to a bloom filter");
  6027. assertNumber(lView[injectorIndex + 6], "injectorIndex should point to a bloom filter");
  6028. assertNumber(lView[injectorIndex + 7], "injectorIndex should point to a bloom filter");
  6029. assertNumber(lView[
  6030. injectorIndex + 8
  6031. /* NodeInjectorOffset.PARENT */
  6032. ], "injectorIndex should point to parent injector");
  6033. }
  6034. var SimpleChange = class {
  6035. previousValue;
  6036. currentValue;
  6037. firstChange;
  6038. constructor(previousValue, currentValue, firstChange) {
  6039. this.previousValue = previousValue;
  6040. this.currentValue = currentValue;
  6041. this.firstChange = firstChange;
  6042. }
  6043. /**
  6044. * Check whether the new value is the first value assigned.
  6045. */
  6046. isFirstChange() {
  6047. return this.firstChange;
  6048. }
  6049. };
  6050. function applyValueToInputField(instance, inputSignalNode, privateName, value) {
  6051. if (inputSignalNode !== null) {
  6052. inputSignalNode.applyValueToInputSignal(inputSignalNode, value);
  6053. } else {
  6054. instance[privateName] = value;
  6055. }
  6056. }
  6057. var ɵɵNgOnChangesFeature = (() => {
  6058. const ɵɵNgOnChangesFeatureImpl = () => NgOnChangesFeatureImpl;
  6059. ɵɵNgOnChangesFeatureImpl.ngInherit = true;
  6060. return ɵɵNgOnChangesFeatureImpl;
  6061. })();
  6062. function NgOnChangesFeatureImpl(definition) {
  6063. if (definition.type.prototype.ngOnChanges) {
  6064. definition.setInput = ngOnChangesSetInput;
  6065. }
  6066. return rememberChangeHistoryAndInvokeOnChangesHook;
  6067. }
  6068. function rememberChangeHistoryAndInvokeOnChangesHook() {
  6069. const simpleChangesStore = getSimpleChangesStore(this);
  6070. const current = simpleChangesStore?.current;
  6071. if (current) {
  6072. const previous = simpleChangesStore.previous;
  6073. if (previous === EMPTY_OBJ) {
  6074. simpleChangesStore.previous = current;
  6075. } else {
  6076. for (let key in current) {
  6077. previous[key] = current[key];
  6078. }
  6079. }
  6080. simpleChangesStore.current = null;
  6081. this.ngOnChanges(current);
  6082. }
  6083. }
  6084. function ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) {
  6085. const declaredName = this.declaredInputs[publicName];
  6086. ngDevMode && assertString(declaredName, "Name of input in ngOnChanges has to be a string");
  6087. const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, {
  6088. previous: EMPTY_OBJ,
  6089. current: null
  6090. });
  6091. const current = simpleChangesStore.current || (simpleChangesStore.current = {});
  6092. const previous = simpleChangesStore.previous;
  6093. const previousChange = previous[declaredName];
  6094. current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);
  6095. applyValueToInputField(instance, inputSignalNode, privateName, value);
  6096. }
  6097. var SIMPLE_CHANGES_STORE = "__ngSimpleChanges__";
  6098. function getSimpleChangesStore(instance) {
  6099. return instance[SIMPLE_CHANGES_STORE] || null;
  6100. }
  6101. function setSimpleChangesStore(instance, store2) {
  6102. return instance[SIMPLE_CHANGES_STORE] = store2;
  6103. }
  6104. var profilerCallback = null;
  6105. var setProfiler = (profiler2) => {
  6106. profilerCallback = profiler2;
  6107. };
  6108. var profiler = function(event, instance = null, hookOrListener) {
  6109. if (profilerCallback != null) {
  6110. profilerCallback(event, instance, hookOrListener);
  6111. }
  6112. };
  6113. var SVG_NAMESPACE = "svg";
  6114. var MATH_ML_NAMESPACE = "math";
  6115. function unwrapRNode(value) {
  6116. while (Array.isArray(value)) {
  6117. value = value[HOST];
  6118. }
  6119. return value;
  6120. }
  6121. function unwrapLView(value) {
  6122. while (Array.isArray(value)) {
  6123. if (typeof value[TYPE] === "object") return value;
  6124. value = value[HOST];
  6125. }
  6126. return null;
  6127. }
  6128. function getNativeByIndex(index, lView) {
  6129. ngDevMode && assertIndexInRange(lView, index);
  6130. ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Expected to be past HEADER_OFFSET");
  6131. return unwrapRNode(lView[index]);
  6132. }
  6133. function getNativeByTNode(tNode, lView) {
  6134. ngDevMode && assertTNodeForLView(tNode, lView);
  6135. ngDevMode && assertIndexInRange(lView, tNode.index);
  6136. const node = unwrapRNode(lView[tNode.index]);
  6137. return node;
  6138. }
  6139. function getNativeByTNodeOrNull(tNode, lView) {
  6140. const index = tNode === null ? -1 : tNode.index;
  6141. if (index !== -1) {
  6142. ngDevMode && assertTNodeForLView(tNode, lView);
  6143. const node = unwrapRNode(lView[index]);
  6144. return node;
  6145. }
  6146. return null;
  6147. }
  6148. function getTNode(tView, index) {
  6149. ngDevMode && assertGreaterThan(index, -1, "wrong index for TNode");
  6150. ngDevMode && assertLessThan(index, tView.data.length, "wrong index for TNode");
  6151. const tNode = tView.data[index];
  6152. ngDevMode && tNode !== null && assertTNode(tNode);
  6153. return tNode;
  6154. }
  6155. function load(view, index) {
  6156. ngDevMode && assertIndexInRange(view, index);
  6157. return view[index];
  6158. }
  6159. function getComponentLViewByIndex(nodeIndex, hostView) {
  6160. ngDevMode && assertIndexInRange(hostView, nodeIndex);
  6161. const slotValue = hostView[nodeIndex];
  6162. const lView = isLView(slotValue) ? slotValue : slotValue[HOST];
  6163. return lView;
  6164. }
  6165. function isCreationMode(view) {
  6166. return (view[FLAGS] & 4) === 4;
  6167. }
  6168. function viewAttachedToChangeDetector(view) {
  6169. return (view[FLAGS] & 128) === 128;
  6170. }
  6171. function viewAttachedToContainer(view) {
  6172. return isLContainer(view[PARENT]);
  6173. }
  6174. function getConstant(consts, index) {
  6175. if (index === null || index === void 0) return null;
  6176. ngDevMode && assertIndexInRange(consts, index);
  6177. return consts[index];
  6178. }
  6179. function resetPreOrderHookFlags(lView) {
  6180. lView[PREORDER_HOOK_FLAGS] = 0;
  6181. }
  6182. function markViewForRefresh(lView) {
  6183. if (lView[FLAGS] & 1024) {
  6184. return;
  6185. }
  6186. lView[FLAGS] |= 1024;
  6187. if (viewAttachedToChangeDetector(lView)) {
  6188. markAncestorsForTraversal(lView);
  6189. }
  6190. }
  6191. function walkUpViews(nestingLevel, currentView) {
  6192. while (nestingLevel > 0) {
  6193. ngDevMode && assertDefined(currentView[DECLARATION_VIEW], "Declaration view should be defined if nesting level is greater than 0.");
  6194. currentView = currentView[DECLARATION_VIEW];
  6195. nestingLevel--;
  6196. }
  6197. return currentView;
  6198. }
  6199. function requiresRefreshOrTraversal(lView) {
  6200. return !!(lView[FLAGS] & (1024 | 8192) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);
  6201. }
  6202. function updateAncestorTraversalFlagsOnAttach(lView) {
  6203. lView[ENVIRONMENT].changeDetectionScheduler?.notify(
  6204. 8
  6205. /* NotificationSource.ViewAttached */
  6206. );
  6207. if (lView[FLAGS] & 64) {
  6208. lView[FLAGS] |= 1024;
  6209. }
  6210. if (requiresRefreshOrTraversal(lView)) {
  6211. markAncestorsForTraversal(lView);
  6212. }
  6213. }
  6214. function markAncestorsForTraversal(lView) {
  6215. lView[ENVIRONMENT].changeDetectionScheduler?.notify(
  6216. 0
  6217. /* NotificationSource.MarkAncestorsForTraversal */
  6218. );
  6219. let parent = getLViewParent(lView);
  6220. while (parent !== null) {
  6221. if (parent[FLAGS] & 8192) {
  6222. break;
  6223. }
  6224. parent[FLAGS] |= 8192;
  6225. if (!viewAttachedToChangeDetector(parent)) {
  6226. break;
  6227. }
  6228. parent = getLViewParent(parent);
  6229. }
  6230. }
  6231. function storeLViewOnDestroy(lView, onDestroyCallback) {
  6232. if (isDestroyed(lView)) {
  6233. throw new RuntimeError(911, ngDevMode && "View has already been destroyed.");
  6234. }
  6235. if (lView[ON_DESTROY_HOOKS] === null) {
  6236. lView[ON_DESTROY_HOOKS] = [];
  6237. }
  6238. lView[ON_DESTROY_HOOKS].push(onDestroyCallback);
  6239. }
  6240. function removeLViewOnDestroy(lView, onDestroyCallback) {
  6241. if (lView[ON_DESTROY_HOOKS] === null) return;
  6242. const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback);
  6243. if (destroyCBIdx !== -1) {
  6244. lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1);
  6245. }
  6246. }
  6247. function getLViewParent(lView) {
  6248. ngDevMode && assertLView(lView);
  6249. const parent = lView[PARENT];
  6250. return isLContainer(parent) ? parent[PARENT] : parent;
  6251. }
  6252. function getOrCreateLViewCleanup(view) {
  6253. return view[CLEANUP] ??= [];
  6254. }
  6255. function getOrCreateTViewCleanup(tView) {
  6256. return tView.cleanup ??= [];
  6257. }
  6258. function storeCleanupWithContext(tView, lView, context2, cleanupFn) {
  6259. const lCleanup = getOrCreateLViewCleanup(lView);
  6260. ngDevMode && assertDefined(context2, "Cleanup context is mandatory when registering framework-level destroy hooks");
  6261. lCleanup.push(context2);
  6262. if (tView.firstCreatePass) {
  6263. getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
  6264. } else {
  6265. if (ngDevMode) {
  6266. Object.freeze(getOrCreateTViewCleanup(tView));
  6267. }
  6268. }
  6269. }
  6270. var instructionState = {
  6271. lFrame: createLFrame(null),
  6272. bindingsEnabled: true,
  6273. skipHydrationRootTNode: null
  6274. };
  6275. var CheckNoChangesMode;
  6276. (function(CheckNoChangesMode2) {
  6277. CheckNoChangesMode2[CheckNoChangesMode2["Off"] = 0] = "Off";
  6278. CheckNoChangesMode2[CheckNoChangesMode2["Exhaustive"] = 1] = "Exhaustive";
  6279. CheckNoChangesMode2[CheckNoChangesMode2["OnlyDirtyViews"] = 2] = "OnlyDirtyViews";
  6280. })(CheckNoChangesMode || (CheckNoChangesMode = {}));
  6281. var _checkNoChangesMode = 0;
  6282. var _isRefreshingViews = false;
  6283. function getElementDepthCount() {
  6284. return instructionState.lFrame.elementDepthCount;
  6285. }
  6286. function increaseElementDepthCount() {
  6287. instructionState.lFrame.elementDepthCount++;
  6288. }
  6289. function decreaseElementDepthCount() {
  6290. instructionState.lFrame.elementDepthCount--;
  6291. }
  6292. function getBindingsEnabled() {
  6293. return instructionState.bindingsEnabled;
  6294. }
  6295. function isInSkipHydrationBlock$1() {
  6296. return instructionState.skipHydrationRootTNode !== null;
  6297. }
  6298. function isSkipHydrationRootTNode(tNode) {
  6299. return instructionState.skipHydrationRootTNode === tNode;
  6300. }
  6301. function ɵɵenableBindings() {
  6302. instructionState.bindingsEnabled = true;
  6303. }
  6304. function enterSkipHydrationBlock(tNode) {
  6305. instructionState.skipHydrationRootTNode = tNode;
  6306. }
  6307. function ɵɵdisableBindings() {
  6308. instructionState.bindingsEnabled = false;
  6309. }
  6310. function leaveSkipHydrationBlock() {
  6311. instructionState.skipHydrationRootTNode = null;
  6312. }
  6313. function getLView() {
  6314. return instructionState.lFrame.lView;
  6315. }
  6316. function getTView() {
  6317. return instructionState.lFrame.tView;
  6318. }
  6319. function ɵɵrestoreView(viewToRestore) {
  6320. instructionState.lFrame.contextLView = viewToRestore;
  6321. return viewToRestore[CONTEXT];
  6322. }
  6323. function ɵɵresetView(value) {
  6324. instructionState.lFrame.contextLView = null;
  6325. return value;
  6326. }
  6327. function getCurrentTNode() {
  6328. let currentTNode = getCurrentTNodePlaceholderOk();
  6329. while (currentTNode !== null && currentTNode.type === 64) {
  6330. currentTNode = currentTNode.parent;
  6331. }
  6332. return currentTNode;
  6333. }
  6334. function getCurrentTNodePlaceholderOk() {
  6335. return instructionState.lFrame.currentTNode;
  6336. }
  6337. function getCurrentParentTNode() {
  6338. const lFrame = instructionState.lFrame;
  6339. const currentTNode = lFrame.currentTNode;
  6340. return lFrame.isParent ? currentTNode : currentTNode.parent;
  6341. }
  6342. function setCurrentTNode(tNode, isParent) {
  6343. ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
  6344. const lFrame = instructionState.lFrame;
  6345. lFrame.currentTNode = tNode;
  6346. lFrame.isParent = isParent;
  6347. }
  6348. function isCurrentTNodeParent() {
  6349. return instructionState.lFrame.isParent;
  6350. }
  6351. function setCurrentTNodeAsNotParent() {
  6352. instructionState.lFrame.isParent = false;
  6353. }
  6354. function getContextLView() {
  6355. const contextLView = instructionState.lFrame.contextLView;
  6356. ngDevMode && assertDefined(contextLView, "contextLView must be defined.");
  6357. return contextLView;
  6358. }
  6359. function isInCheckNoChangesMode() {
  6360. !ngDevMode && throwError2("Must never be called in production mode");
  6361. return _checkNoChangesMode !== CheckNoChangesMode.Off;
  6362. }
  6363. function isExhaustiveCheckNoChanges() {
  6364. !ngDevMode && throwError2("Must never be called in production mode");
  6365. return _checkNoChangesMode === CheckNoChangesMode.Exhaustive;
  6366. }
  6367. function setIsInCheckNoChangesMode(mode) {
  6368. !ngDevMode && throwError2("Must never be called in production mode");
  6369. _checkNoChangesMode = mode;
  6370. }
  6371. function isRefreshingViews() {
  6372. return _isRefreshingViews;
  6373. }
  6374. function setIsRefreshingViews(mode) {
  6375. const prev = _isRefreshingViews;
  6376. _isRefreshingViews = mode;
  6377. return prev;
  6378. }
  6379. function getBindingRoot() {
  6380. const lFrame = instructionState.lFrame;
  6381. let index = lFrame.bindingRootIndex;
  6382. if (index === -1) {
  6383. index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;
  6384. }
  6385. return index;
  6386. }
  6387. function getBindingIndex() {
  6388. return instructionState.lFrame.bindingIndex;
  6389. }
  6390. function setBindingIndex(value) {
  6391. return instructionState.lFrame.bindingIndex = value;
  6392. }
  6393. function nextBindingIndex() {
  6394. return instructionState.lFrame.bindingIndex++;
  6395. }
  6396. function incrementBindingIndex(count2) {
  6397. const lFrame = instructionState.lFrame;
  6398. const index = lFrame.bindingIndex;
  6399. lFrame.bindingIndex = lFrame.bindingIndex + count2;
  6400. return index;
  6401. }
  6402. function isInI18nBlock() {
  6403. return instructionState.lFrame.inI18n;
  6404. }
  6405. function setInI18nBlock(isInI18nBlock2) {
  6406. instructionState.lFrame.inI18n = isInI18nBlock2;
  6407. }
  6408. function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
  6409. const lFrame = instructionState.lFrame;
  6410. lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
  6411. setCurrentDirectiveIndex(currentDirectiveIndex);
  6412. }
  6413. function getCurrentDirectiveIndex() {
  6414. return instructionState.lFrame.currentDirectiveIndex;
  6415. }
  6416. function setCurrentDirectiveIndex(currentDirectiveIndex) {
  6417. instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
  6418. }
  6419. function getCurrentDirectiveDef(tData) {
  6420. const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
  6421. return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
  6422. }
  6423. function getCurrentQueryIndex() {
  6424. return instructionState.lFrame.currentQueryIndex;
  6425. }
  6426. function setCurrentQueryIndex(value) {
  6427. instructionState.lFrame.currentQueryIndex = value;
  6428. }
  6429. function getDeclarationTNode(lView) {
  6430. const tView = lView[TVIEW];
  6431. if (tView.type === 2) {
  6432. ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents.");
  6433. return tView.declTNode;
  6434. }
  6435. if (tView.type === 1) {
  6436. return lView[T_HOST];
  6437. }
  6438. return null;
  6439. }
  6440. function enterDI(lView, tNode, flags) {
  6441. ngDevMode && assertLViewOrUndefined(lView);
  6442. if (flags & InjectFlags.SkipSelf) {
  6443. ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);
  6444. let parentTNode = tNode;
  6445. let parentLView = lView;
  6446. while (true) {
  6447. ngDevMode && assertDefined(parentTNode, "Parent TNode should be defined");
  6448. parentTNode = parentTNode.parent;
  6449. if (parentTNode === null && !(flags & InjectFlags.Host)) {
  6450. parentTNode = getDeclarationTNode(parentLView);
  6451. if (parentTNode === null) break;
  6452. ngDevMode && assertDefined(parentLView, "Parent LView should be defined");
  6453. parentLView = parentLView[DECLARATION_VIEW];
  6454. if (parentTNode.type & (2 | 8)) {
  6455. break;
  6456. }
  6457. } else {
  6458. break;
  6459. }
  6460. }
  6461. if (parentTNode === null) {
  6462. return false;
  6463. } else {
  6464. tNode = parentTNode;
  6465. lView = parentLView;
  6466. }
  6467. }
  6468. ngDevMode && assertTNodeForLView(tNode, lView);
  6469. const lFrame = instructionState.lFrame = allocLFrame();
  6470. lFrame.currentTNode = tNode;
  6471. lFrame.lView = lView;
  6472. return true;
  6473. }
  6474. function enterView(newView) {
  6475. ngDevMode && assertNotEqual(newView[0], newView[1], "????");
  6476. ngDevMode && assertLViewOrUndefined(newView);
  6477. const newLFrame = allocLFrame();
  6478. if (ngDevMode) {
  6479. assertEqual(newLFrame.isParent, true, "Expected clean LFrame");
  6480. assertEqual(newLFrame.lView, null, "Expected clean LFrame");
  6481. assertEqual(newLFrame.tView, null, "Expected clean LFrame");
  6482. assertEqual(newLFrame.selectedIndex, -1, "Expected clean LFrame");
  6483. assertEqual(newLFrame.elementDepthCount, 0, "Expected clean LFrame");
  6484. assertEqual(newLFrame.currentDirectiveIndex, -1, "Expected clean LFrame");
  6485. assertEqual(newLFrame.currentNamespace, null, "Expected clean LFrame");
  6486. assertEqual(newLFrame.bindingRootIndex, -1, "Expected clean LFrame");
  6487. assertEqual(newLFrame.currentQueryIndex, 0, "Expected clean LFrame");
  6488. }
  6489. const tView = newView[TVIEW];
  6490. instructionState.lFrame = newLFrame;
  6491. ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
  6492. newLFrame.currentTNode = tView.firstChild;
  6493. newLFrame.lView = newView;
  6494. newLFrame.tView = tView;
  6495. newLFrame.contextLView = newView;
  6496. newLFrame.bindingIndex = tView.bindingStartIndex;
  6497. newLFrame.inI18n = false;
  6498. }
  6499. function allocLFrame() {
  6500. const currentLFrame = instructionState.lFrame;
  6501. const childLFrame = currentLFrame === null ? null : currentLFrame.child;
  6502. const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;
  6503. return newLFrame;
  6504. }
  6505. function createLFrame(parent) {
  6506. const lFrame = {
  6507. currentTNode: null,
  6508. isParent: true,
  6509. lView: null,
  6510. tView: null,
  6511. selectedIndex: -1,
  6512. contextLView: null,
  6513. elementDepthCount: 0,
  6514. currentNamespace: null,
  6515. currentDirectiveIndex: -1,
  6516. bindingRootIndex: -1,
  6517. bindingIndex: -1,
  6518. currentQueryIndex: 0,
  6519. parent,
  6520. child: null,
  6521. inI18n: false
  6522. };
  6523. parent !== null && (parent.child = lFrame);
  6524. return lFrame;
  6525. }
  6526. function leaveViewLight() {
  6527. const oldLFrame = instructionState.lFrame;
  6528. instructionState.lFrame = oldLFrame.parent;
  6529. oldLFrame.currentTNode = null;
  6530. oldLFrame.lView = null;
  6531. return oldLFrame;
  6532. }
  6533. var leaveDI = leaveViewLight;
  6534. function leaveView() {
  6535. const oldLFrame = leaveViewLight();
  6536. oldLFrame.isParent = true;
  6537. oldLFrame.tView = null;
  6538. oldLFrame.selectedIndex = -1;
  6539. oldLFrame.contextLView = null;
  6540. oldLFrame.elementDepthCount = 0;
  6541. oldLFrame.currentDirectiveIndex = -1;
  6542. oldLFrame.currentNamespace = null;
  6543. oldLFrame.bindingRootIndex = -1;
  6544. oldLFrame.bindingIndex = -1;
  6545. oldLFrame.currentQueryIndex = 0;
  6546. }
  6547. function nextContextImpl(level) {
  6548. const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);
  6549. return contextLView[CONTEXT];
  6550. }
  6551. function getSelectedIndex() {
  6552. return instructionState.lFrame.selectedIndex;
  6553. }
  6554. function setSelectedIndex(index) {
  6555. ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Index must be past HEADER_OFFSET (or -1).");
  6556. ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, "Can't set index passed end of LView");
  6557. instructionState.lFrame.selectedIndex = index;
  6558. }
  6559. function getSelectedTNode() {
  6560. const lFrame = instructionState.lFrame;
  6561. return getTNode(lFrame.tView, lFrame.selectedIndex);
  6562. }
  6563. function ɵɵnamespaceSVG() {
  6564. instructionState.lFrame.currentNamespace = SVG_NAMESPACE;
  6565. }
  6566. function ɵɵnamespaceMathML() {
  6567. instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;
  6568. }
  6569. function ɵɵnamespaceHTML() {
  6570. namespaceHTMLInternal();
  6571. }
  6572. function namespaceHTMLInternal() {
  6573. instructionState.lFrame.currentNamespace = null;
  6574. }
  6575. function getNamespace() {
  6576. return instructionState.lFrame.currentNamespace;
  6577. }
  6578. var _wasLastNodeCreated = true;
  6579. function wasLastNodeCreated() {
  6580. return _wasLastNodeCreated;
  6581. }
  6582. function lastNodeWasCreated(flag) {
  6583. _wasLastNodeCreated = flag;
  6584. }
  6585. function registerPreOrderHooks(directiveIndex, directiveDef, tView) {
  6586. ngDevMode && assertFirstCreatePass(tView);
  6587. const {
  6588. ngOnChanges,
  6589. ngOnInit,
  6590. ngDoCheck
  6591. } = directiveDef.type.prototype;
  6592. if (ngOnChanges) {
  6593. const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);
  6594. (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges);
  6595. (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges);
  6596. }
  6597. if (ngOnInit) {
  6598. (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit);
  6599. }
  6600. if (ngDoCheck) {
  6601. (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck);
  6602. (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck);
  6603. }
  6604. }
  6605. function registerPostOrderHooks(tView, tNode) {
  6606. ngDevMode && assertFirstCreatePass(tView);
  6607. for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {
  6608. const directiveDef = tView.data[i];
  6609. ngDevMode && assertDefined(directiveDef, "Expecting DirectiveDef");
  6610. const lifecycleHooks = directiveDef.type.prototype;
  6611. const {
  6612. ngAfterContentInit,
  6613. ngAfterContentChecked,
  6614. ngAfterViewInit,
  6615. ngAfterViewChecked,
  6616. ngOnDestroy
  6617. } = lifecycleHooks;
  6618. if (ngAfterContentInit) {
  6619. (tView.contentHooks ??= []).push(-i, ngAfterContentInit);
  6620. }
  6621. if (ngAfterContentChecked) {
  6622. (tView.contentHooks ??= []).push(i, ngAfterContentChecked);
  6623. (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked);
  6624. }
  6625. if (ngAfterViewInit) {
  6626. (tView.viewHooks ??= []).push(-i, ngAfterViewInit);
  6627. }
  6628. if (ngAfterViewChecked) {
  6629. (tView.viewHooks ??= []).push(i, ngAfterViewChecked);
  6630. (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked);
  6631. }
  6632. if (ngOnDestroy != null) {
  6633. (tView.destroyHooks ??= []).push(i, ngOnDestroy);
  6634. }
  6635. }
  6636. }
  6637. function executeCheckHooks(lView, hooks, nodeIndex) {
  6638. callHooks(lView, hooks, 3, nodeIndex);
  6639. }
  6640. function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {
  6641. ngDevMode && assertNotEqual(initPhase, 3, "Init pre-order hooks should not be called more than once");
  6642. if ((lView[FLAGS] & 3) === initPhase) {
  6643. callHooks(lView, hooks, initPhase, nodeIndex);
  6644. }
  6645. }
  6646. function incrementInitPhaseFlags(lView, initPhase) {
  6647. ngDevMode && assertNotEqual(initPhase, 3, "Init hooks phase should not be incremented after all init hooks have been run.");
  6648. let flags = lView[FLAGS];
  6649. if ((flags & 3) === initPhase) {
  6650. flags &= 16383;
  6651. flags += 1;
  6652. lView[FLAGS] = flags;
  6653. }
  6654. }
  6655. function callHooks(currentView, arr, initPhase, currentNodeIndex) {
  6656. ngDevMode && assertEqual(isInCheckNoChangesMode(), false, "Hooks should never be run when in check no changes mode.");
  6657. const startIndex = currentNodeIndex !== void 0 ? currentView[PREORDER_HOOK_FLAGS] & 65535 : 0;
  6658. const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;
  6659. const max2 = arr.length - 1;
  6660. let lastNodeIndexFound = 0;
  6661. for (let i = startIndex; i < max2; i++) {
  6662. const hook = arr[i + 1];
  6663. if (typeof hook === "number") {
  6664. lastNodeIndexFound = arr[i];
  6665. if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {
  6666. break;
  6667. }
  6668. } else {
  6669. const isInitHook = arr[i] < 0;
  6670. if (isInitHook) {
  6671. currentView[PREORDER_HOOK_FLAGS] += 65536;
  6672. }
  6673. if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {
  6674. callHook(currentView, initPhase, arr, i);
  6675. currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760) + i + 2;
  6676. }
  6677. i++;
  6678. }
  6679. }
  6680. }
  6681. function callHookInternal(directive, hook) {
  6682. profiler(4, directive, hook);
  6683. const prevConsumer = setActiveConsumer(null);
  6684. try {
  6685. hook.call(directive);
  6686. } finally {
  6687. setActiveConsumer(prevConsumer);
  6688. profiler(5, directive, hook);
  6689. }
  6690. }
  6691. function callHook(currentView, initPhase, arr, i) {
  6692. const isInitHook = arr[i] < 0;
  6693. const hook = arr[i + 1];
  6694. const directiveIndex = isInitHook ? -arr[i] : arr[i];
  6695. const directive = currentView[directiveIndex];
  6696. if (isInitHook) {
  6697. const indexWithintInitPhase = currentView[FLAGS] >> 14;
  6698. if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 && (currentView[FLAGS] & 3) === initPhase) {
  6699. currentView[FLAGS] += 16384;
  6700. callHookInternal(directive, hook);
  6701. }
  6702. } else {
  6703. callHookInternal(directive, hook);
  6704. }
  6705. }
  6706. var NO_PARENT_INJECTOR = -1;
  6707. var NodeInjectorFactory = class {
  6708. factory;
  6709. /**
  6710. * The inject implementation to be activated when using the factory.
  6711. */
  6712. injectImpl;
  6713. /**
  6714. * Marker set to true during factory invocation to see if we get into recursive loop.
  6715. * Recursive loop causes an error to be displayed.
  6716. */
  6717. resolving = false;
  6718. /**
  6719. * Marks that the token can see other Tokens declared in `viewProviders` on the same node.
  6720. */
  6721. canSeeViewProviders;
  6722. /**
  6723. * An array of factories to use in case of `multi` provider.
  6724. */
  6725. multi;
  6726. /**
  6727. * Number of `multi`-providers which belong to the component.
  6728. *
  6729. * This is needed because when multiple components and directives declare the `multi` provider
  6730. * they have to be concatenated in the correct order.
  6731. *
  6732. * Example:
  6733. *
  6734. * If we have a component and directive active an a single element as declared here
  6735. * ```ts
  6736. * component:
  6737. * providers: [ {provide: String, useValue: 'component', multi: true} ],
  6738. * viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ],
  6739. *
  6740. * directive:
  6741. * providers: [ {provide: String, useValue: 'directive', multi: true} ],
  6742. * ```
  6743. *
  6744. * Then the expected results are:
  6745. *
  6746. * ```ts
  6747. * providers: ['component', 'directive']
  6748. * viewProviders: ['component', 'componentView', 'directive']
  6749. * ```
  6750. *
  6751. * The way to think about it is that the `viewProviders` have been inserted after the component
  6752. * but before the directives, which is why we need to know how many `multi`s have been declared by
  6753. * the component.
  6754. */
  6755. componentProviders;
  6756. /**
  6757. * Current index of the Factory in the `data`. Needed for `viewProviders` and `providers` merging.
  6758. * See `providerFactory`.
  6759. */
  6760. index;
  6761. /**
  6762. * Because the same `multi` provider can be declared in `providers` and `viewProviders` it is
  6763. * possible for `viewProviders` to shadow the `providers`. For this reason we store the
  6764. * `provideFactory` of the `providers` so that `providers` can be extended with `viewProviders`.
  6765. *
  6766. * Example:
  6767. *
  6768. * Given:
  6769. * ```ts
  6770. * providers: [ {provide: String, useValue: 'all', multi: true} ],
  6771. * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ],
  6772. * ```
  6773. *
  6774. * We have to return `['all']` in case of content injection, but `['all', 'viewOnly']` in case
  6775. * of view injection. We further have to make sure that the shared instances (in our case
  6776. * `all`) are the exact same instance in both the content as well as the view injection. (We
  6777. * have to make sure that we don't double instantiate.) For this reason the `viewProviders`
  6778. * `Factory` has a pointer to the shadowed `providers` factory so that it can instantiate the
  6779. * `providers` (`['all']`) and then extend it with `viewProviders` (`['all'] + ['viewOnly'] =
  6780. * ['all', 'viewOnly']`).
  6781. */
  6782. providerFactory;
  6783. constructor(factory, isViewProvider, injectImplementation) {
  6784. this.factory = factory;
  6785. ngDevMode && assertDefined(factory, "Factory not specified");
  6786. ngDevMode && assertEqual(typeof factory, "function", "Expected factory function.");
  6787. this.canSeeViewProviders = isViewProvider;
  6788. this.injectImpl = injectImplementation;
  6789. }
  6790. };
  6791. function toTNodeTypeAsString(tNodeType) {
  6792. let text = "";
  6793. tNodeType & 1 && (text += "|Text");
  6794. tNodeType & 2 && (text += "|Element");
  6795. tNodeType & 4 && (text += "|Container");
  6796. tNodeType & 8 && (text += "|ElementContainer");
  6797. tNodeType & 16 && (text += "|Projection");
  6798. tNodeType & 32 && (text += "|IcuContainer");
  6799. tNodeType & 64 && (text += "|Placeholder");
  6800. tNodeType & 128 && (text += "|LetDeclaration");
  6801. return text.length > 0 ? text.substring(1) : text;
  6802. }
  6803. function isTNodeShape(value) {
  6804. return value != null && typeof value === "object" && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === "number" || Array.isArray(value.insertBeforeIndex));
  6805. }
  6806. function isLetDeclaration(tNode) {
  6807. return !!(tNode.type & 128);
  6808. }
  6809. function hasClassInput(tNode) {
  6810. return (tNode.flags & 8) !== 0;
  6811. }
  6812. function hasStyleInput(tNode) {
  6813. return (tNode.flags & 16) !== 0;
  6814. }
  6815. function assertTNodeType(tNode, expectedTypes, message) {
  6816. assertDefined(tNode, "should be called with a TNode");
  6817. if ((tNode.type & expectedTypes) === 0) {
  6818. throwError2(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`);
  6819. }
  6820. }
  6821. function assertPureTNodeType(type) {
  6822. if (!(type === 2 || type === 1 || type === 4 || type === 8 || type === 32 || type === 16 || type === 64 || type === 128)) {
  6823. throwError2(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);
  6824. }
  6825. }
  6826. function setUpAttributes(renderer, native, attrs) {
  6827. let i = 0;
  6828. while (i < attrs.length) {
  6829. const value = attrs[i];
  6830. if (typeof value === "number") {
  6831. if (value !== 0) {
  6832. break;
  6833. }
  6834. i++;
  6835. const namespaceURI = attrs[i++];
  6836. const attrName = attrs[i++];
  6837. const attrVal = attrs[i++];
  6838. ngDevMode && ngDevMode.rendererSetAttribute++;
  6839. renderer.setAttribute(native, attrName, attrVal, namespaceURI);
  6840. } else {
  6841. const attrName = value;
  6842. const attrVal = attrs[++i];
  6843. ngDevMode && ngDevMode.rendererSetAttribute++;
  6844. if (isAnimationProp(attrName)) {
  6845. renderer.setProperty(native, attrName, attrVal);
  6846. } else {
  6847. renderer.setAttribute(native, attrName, attrVal);
  6848. }
  6849. i++;
  6850. }
  6851. }
  6852. return i;
  6853. }
  6854. function isNameOnlyAttributeMarker(marker) {
  6855. return marker === 3 || marker === 4 || marker === 6;
  6856. }
  6857. function isAnimationProp(name) {
  6858. return name.charCodeAt(0) === 64;
  6859. }
  6860. function mergeHostAttrs(dst, src) {
  6861. if (src === null || src.length === 0) ;
  6862. else if (dst === null || dst.length === 0) {
  6863. dst = src.slice();
  6864. } else {
  6865. let srcMarker = -1;
  6866. for (let i = 0; i < src.length; i++) {
  6867. const item = src[i];
  6868. if (typeof item === "number") {
  6869. srcMarker = item;
  6870. } else {
  6871. if (srcMarker === 0) ;
  6872. else if (srcMarker === -1 || srcMarker === 2) {
  6873. mergeHostAttribute(dst, srcMarker, item, null, src[++i]);
  6874. } else {
  6875. mergeHostAttribute(dst, srcMarker, item, null, null);
  6876. }
  6877. }
  6878. }
  6879. }
  6880. return dst;
  6881. }
  6882. function mergeHostAttribute(dst, marker, key1, key2, value) {
  6883. let i = 0;
  6884. let markerInsertPosition = dst.length;
  6885. if (marker === -1) {
  6886. markerInsertPosition = -1;
  6887. } else {
  6888. while (i < dst.length) {
  6889. const dstValue = dst[i++];
  6890. if (typeof dstValue === "number") {
  6891. if (dstValue === marker) {
  6892. markerInsertPosition = -1;
  6893. break;
  6894. } else if (dstValue > marker) {
  6895. markerInsertPosition = i - 1;
  6896. break;
  6897. }
  6898. }
  6899. }
  6900. }
  6901. while (i < dst.length) {
  6902. const item = dst[i];
  6903. if (typeof item === "number") {
  6904. break;
  6905. } else if (item === key1) {
  6906. {
  6907. if (value !== null) {
  6908. dst[i + 1] = value;
  6909. }
  6910. return;
  6911. }
  6912. }
  6913. i++;
  6914. if (value !== null) i++;
  6915. }
  6916. if (markerInsertPosition !== -1) {
  6917. dst.splice(markerInsertPosition, 0, marker);
  6918. i = markerInsertPosition + 1;
  6919. }
  6920. dst.splice(i++, 0, key1);
  6921. if (value !== null) {
  6922. dst.splice(i++, 0, value);
  6923. }
  6924. }
  6925. var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
  6926. var ChainedInjector = class {
  6927. injector;
  6928. parentInjector;
  6929. constructor(injector, parentInjector) {
  6930. this.injector = injector;
  6931. this.parentInjector = parentInjector;
  6932. }
  6933. get(token, notFoundValue, flags) {
  6934. flags = convertToBitFlags(flags);
  6935. const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
  6936. if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
  6937. return value;
  6938. }
  6939. return this.parentInjector.get(token, notFoundValue, flags);
  6940. }
  6941. };
  6942. function hasParentInjector(parentLocation) {
  6943. return parentLocation !== NO_PARENT_INJECTOR;
  6944. }
  6945. function getParentInjectorIndex(parentLocation) {
  6946. if (ngDevMode) {
  6947. assertNumber(parentLocation, "Number expected");
  6948. assertNotEqual(parentLocation, -1, "Not a valid state.");
  6949. const parentInjectorIndex = parentLocation & 32767;
  6950. assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, "Parent injector must be pointing past HEADER_OFFSET.");
  6951. }
  6952. return parentLocation & 32767;
  6953. }
  6954. function getParentInjectorViewOffset(parentLocation) {
  6955. return parentLocation >> 16;
  6956. }
  6957. function getParentInjectorView(location2, startView) {
  6958. let viewOffset = getParentInjectorViewOffset(location2);
  6959. let parentView = startView;
  6960. while (viewOffset > 0) {
  6961. parentView = parentView[DECLARATION_VIEW];
  6962. viewOffset--;
  6963. }
  6964. return parentView;
  6965. }
  6966. function isRouterOutletInjector(currentInjector) {
  6967. return currentInjector instanceof ChainedInjector && typeof currentInjector.injector.__ngOutletInjector === "function";
  6968. }
  6969. var includeViewProviders = true;
  6970. function setIncludeViewProviders(v) {
  6971. const oldValue = includeViewProviders;
  6972. includeViewProviders = v;
  6973. return oldValue;
  6974. }
  6975. var BLOOM_SIZE = 256;
  6976. var BLOOM_MASK = BLOOM_SIZE - 1;
  6977. var BLOOM_BUCKET_BITS = 5;
  6978. var nextNgElementId = 0;
  6979. var NOT_FOUND2 = {};
  6980. function bloomAdd(injectorIndex, tView, type) {
  6981. ngDevMode && assertEqual(tView.firstCreatePass, true, "expected firstCreatePass to be true");
  6982. let id;
  6983. if (typeof type === "string") {
  6984. id = type.charCodeAt(0) || 0;
  6985. } else if (type.hasOwnProperty(NG_ELEMENT_ID)) {
  6986. id = type[NG_ELEMENT_ID];
  6987. }
  6988. if (id == null) {
  6989. id = type[NG_ELEMENT_ID] = nextNgElementId++;
  6990. }
  6991. const bloomHash = id & BLOOM_MASK;
  6992. const mask = 1 << bloomHash;
  6993. tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;
  6994. }
  6995. function getOrCreateNodeInjectorForNode(tNode, lView) {
  6996. const existingInjectorIndex = getInjectorIndex(tNode, lView);
  6997. if (existingInjectorIndex !== -1) {
  6998. return existingInjectorIndex;
  6999. }
  7000. const tView = lView[TVIEW];
  7001. if (tView.firstCreatePass) {
  7002. tNode.injectorIndex = lView.length;
  7003. insertBloom(tView.data, tNode);
  7004. insertBloom(lView, null);
  7005. insertBloom(tView.blueprint, null);
  7006. }
  7007. const parentLoc = getParentInjectorLocation(tNode, lView);
  7008. const injectorIndex = tNode.injectorIndex;
  7009. if (hasParentInjector(parentLoc)) {
  7010. const parentIndex = getParentInjectorIndex(parentLoc);
  7011. const parentLView = getParentInjectorView(parentLoc, lView);
  7012. const parentData = parentLView[TVIEW].data;
  7013. for (let i = 0; i < 8; i++) {
  7014. lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];
  7015. }
  7016. }
  7017. lView[
  7018. injectorIndex + 8
  7019. /* NodeInjectorOffset.PARENT */
  7020. ] = parentLoc;
  7021. return injectorIndex;
  7022. }
  7023. function insertBloom(arr, footer) {
  7024. arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);
  7025. }
  7026. function getInjectorIndex(tNode, lView) {
  7027. if (tNode.injectorIndex === -1 || // If the injector index is the same as its parent's injector index, then the index has been
  7028. // copied down from the parent node. No injector has been created yet on this node.
  7029. tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex || // After the first template pass, the injector index might exist but the parent values
  7030. // might not have been calculated yet for this instance
  7031. lView[
  7032. tNode.injectorIndex + 8
  7033. /* NodeInjectorOffset.PARENT */
  7034. ] === null) {
  7035. return -1;
  7036. } else {
  7037. ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);
  7038. return tNode.injectorIndex;
  7039. }
  7040. }
  7041. function getParentInjectorLocation(tNode, lView) {
  7042. if (tNode.parent && tNode.parent.injectorIndex !== -1) {
  7043. return tNode.parent.injectorIndex;
  7044. }
  7045. let declarationViewOffset = 0;
  7046. let parentTNode = null;
  7047. let lViewCursor = lView;
  7048. while (lViewCursor !== null) {
  7049. parentTNode = getTNodeFromLView(lViewCursor);
  7050. if (parentTNode === null) {
  7051. return NO_PARENT_INJECTOR;
  7052. }
  7053. ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);
  7054. declarationViewOffset++;
  7055. lViewCursor = lViewCursor[DECLARATION_VIEW];
  7056. if (parentTNode.injectorIndex !== -1) {
  7057. return parentTNode.injectorIndex | declarationViewOffset << 16;
  7058. }
  7059. }
  7060. return NO_PARENT_INJECTOR;
  7061. }
  7062. function diPublicInInjector(injectorIndex, tView, token) {
  7063. bloomAdd(injectorIndex, tView, token);
  7064. }
  7065. function injectAttributeImpl(tNode, attrNameToInject) {
  7066. ngDevMode && assertTNodeType(
  7067. tNode,
  7068. 12 | 3
  7069. /* TNodeType.AnyRNode */
  7070. );
  7071. ngDevMode && assertDefined(tNode, "expecting tNode");
  7072. if (attrNameToInject === "class") {
  7073. return tNode.classes;
  7074. }
  7075. if (attrNameToInject === "style") {
  7076. return tNode.styles;
  7077. }
  7078. const attrs = tNode.attrs;
  7079. if (attrs) {
  7080. const attrsLength = attrs.length;
  7081. let i = 0;
  7082. while (i < attrsLength) {
  7083. const value = attrs[i];
  7084. if (isNameOnlyAttributeMarker(value)) break;
  7085. if (value === 0) {
  7086. i = i + 2;
  7087. } else if (typeof value === "number") {
  7088. i++;
  7089. while (i < attrsLength && typeof attrs[i] === "string") {
  7090. i++;
  7091. }
  7092. } else if (value === attrNameToInject) {
  7093. return attrs[i + 1];
  7094. } else {
  7095. i = i + 2;
  7096. }
  7097. }
  7098. }
  7099. return null;
  7100. }
  7101. function notFoundValueOrThrow(notFoundValue, token, flags) {
  7102. if (flags & InjectFlags.Optional || notFoundValue !== void 0) {
  7103. return notFoundValue;
  7104. } else {
  7105. throwProviderNotFoundError(token, "NodeInjector");
  7106. }
  7107. }
  7108. function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {
  7109. if (flags & InjectFlags.Optional && notFoundValue === void 0) {
  7110. notFoundValue = null;
  7111. }
  7112. if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {
  7113. const moduleInjector = lView[INJECTOR];
  7114. const previousInjectImplementation = setInjectImplementation(void 0);
  7115. try {
  7116. if (moduleInjector) {
  7117. return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);
  7118. } else {
  7119. return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);
  7120. }
  7121. } finally {
  7122. setInjectImplementation(previousInjectImplementation);
  7123. }
  7124. }
  7125. return notFoundValueOrThrow(notFoundValue, token, flags);
  7126. }
  7127. function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) {
  7128. if (tNode !== null) {
  7129. if (lView[FLAGS] & 2048 && // The token must be present on the current node injector when the `Self`
  7130. // flag is set, so the lookup on embedded view injector(s) can be skipped.
  7131. !(flags & InjectFlags.Self)) {
  7132. const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND2);
  7133. if (embeddedInjectorValue !== NOT_FOUND2) {
  7134. return embeddedInjectorValue;
  7135. }
  7136. }
  7137. const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND2);
  7138. if (value !== NOT_FOUND2) {
  7139. return value;
  7140. }
  7141. }
  7142. return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
  7143. }
  7144. function lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) {
  7145. const bloomHash = bloomHashBitOrFactory(token);
  7146. if (typeof bloomHash === "function") {
  7147. if (!enterDI(lView, tNode, flags)) {
  7148. return flags & InjectFlags.Host ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
  7149. }
  7150. try {
  7151. let value;
  7152. if (ngDevMode) {
  7153. runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => {
  7154. value = bloomHash(flags);
  7155. if (value != null) {
  7156. emitInstanceCreatedByInjectorEvent(value);
  7157. }
  7158. });
  7159. } else {
  7160. value = bloomHash(flags);
  7161. }
  7162. if (value == null && !(flags & InjectFlags.Optional)) {
  7163. throwProviderNotFoundError(token);
  7164. } else {
  7165. return value;
  7166. }
  7167. } finally {
  7168. leaveDI();
  7169. }
  7170. } else if (typeof bloomHash === "number") {
  7171. let previousTView = null;
  7172. let injectorIndex = getInjectorIndex(tNode, lView);
  7173. let parentLocation = NO_PARENT_INJECTOR;
  7174. let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;
  7175. if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
  7176. parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[
  7177. injectorIndex + 8
  7178. /* NodeInjectorOffset.PARENT */
  7179. ];
  7180. if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {
  7181. injectorIndex = -1;
  7182. } else {
  7183. previousTView = lView[TVIEW];
  7184. injectorIndex = getParentInjectorIndex(parentLocation);
  7185. lView = getParentInjectorView(parentLocation, lView);
  7186. }
  7187. }
  7188. while (injectorIndex !== -1) {
  7189. ngDevMode && assertNodeInjector(lView, injectorIndex);
  7190. const tView = lView[TVIEW];
  7191. ngDevMode && assertTNodeForLView(tView.data[
  7192. injectorIndex + 8
  7193. /* NodeInjectorOffset.TNODE */
  7194. ], lView);
  7195. if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
  7196. const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);
  7197. if (instance !== NOT_FOUND2) {
  7198. return instance;
  7199. }
  7200. }
  7201. parentLocation = lView[
  7202. injectorIndex + 8
  7203. /* NodeInjectorOffset.PARENT */
  7204. ];
  7205. if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[
  7206. injectorIndex + 8
  7207. /* NodeInjectorOffset.TNODE */
  7208. ] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) {
  7209. previousTView = tView;
  7210. injectorIndex = getParentInjectorIndex(parentLocation);
  7211. lView = getParentInjectorView(parentLocation, lView);
  7212. } else {
  7213. injectorIndex = -1;
  7214. }
  7215. }
  7216. }
  7217. return notFoundValue;
  7218. }
  7219. function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {
  7220. const currentTView = lView[TVIEW];
  7221. const tNode = currentTView.data[
  7222. injectorIndex + 8
  7223. /* NodeInjectorOffset.TNODE */
  7224. ];
  7225. const canAccessViewProviders = previousTView == null ? (
  7226. // 1) This is the first invocation `previousTView == null` which means that we are at the
  7227. // `TNode` of where injector is starting to look. In such a case the only time we are allowed
  7228. // to look into the ViewProviders is if:
  7229. // - we are on a component
  7230. // - AND the injector set `includeViewProviders` to true (implying that the token can see
  7231. // ViewProviders because it is the Component or a Service which itself was declared in
  7232. // ViewProviders)
  7233. isComponentHost(tNode) && includeViewProviders
  7234. ) : (
  7235. // 2) `previousTView != null` which means that we are now walking across the parent nodes.
  7236. // In such a case we are only allowed to look into the ViewProviders if:
  7237. // - We just crossed from child View to Parent View `previousTView != currentTView`
  7238. // - AND the parent TNode is an Element.
  7239. // This means that we just came from the Component's View and therefore are allowed to see
  7240. // into the ViewProviders.
  7241. previousTView != currentTView && (tNode.type & 3) !== 0
  7242. );
  7243. const isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode;
  7244. const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);
  7245. if (injectableIdx !== null) {
  7246. return getNodeInjectable(lView, currentTView, injectableIdx, tNode);
  7247. } else {
  7248. return NOT_FOUND2;
  7249. }
  7250. }
  7251. function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {
  7252. const nodeProviderIndexes = tNode.providerIndexes;
  7253. const tInjectables = tView.data;
  7254. const injectablesStart = nodeProviderIndexes & 1048575;
  7255. const directivesStart = tNode.directiveStart;
  7256. const directiveEnd = tNode.directiveEnd;
  7257. const cptViewProvidersCount = nodeProviderIndexes >> 20;
  7258. const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;
  7259. const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;
  7260. for (let i = startingIndex; i < endIndex; i++) {
  7261. const providerTokenOrDef = tInjectables[i];
  7262. if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) {
  7263. return i;
  7264. }
  7265. }
  7266. if (isHostSpecialCase) {
  7267. const dirDef = tInjectables[directivesStart];
  7268. if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {
  7269. return directivesStart;
  7270. }
  7271. }
  7272. return null;
  7273. }
  7274. function getNodeInjectable(lView, tView, index, tNode) {
  7275. let value = lView[index];
  7276. const tData = tView.data;
  7277. if (value instanceof NodeInjectorFactory) {
  7278. const factory = value;
  7279. if (factory.resolving) {
  7280. throwCyclicDependencyError(stringifyForError(tData[index]));
  7281. }
  7282. const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
  7283. factory.resolving = true;
  7284. let prevInjectContext;
  7285. if (ngDevMode) {
  7286. const token = tData[index].type || tData[index];
  7287. const injector = new NodeInjector(tNode, lView);
  7288. prevInjectContext = setInjectorProfilerContext({
  7289. injector,
  7290. token
  7291. });
  7292. }
  7293. const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;
  7294. const success = enterDI(lView, tNode, InjectFlags.Default);
  7295. ngDevMode && assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed.");
  7296. try {
  7297. value = lView[index] = factory.factory(void 0, tData, lView, tNode);
  7298. ngDevMode && emitInstanceCreatedByInjectorEvent(value);
  7299. if (tView.firstCreatePass && index >= tNode.directiveStart) {
  7300. ngDevMode && assertDirectiveDef(tData[index]);
  7301. registerPreOrderHooks(index, tData[index], tView);
  7302. }
  7303. } finally {
  7304. ngDevMode && setInjectorProfilerContext(prevInjectContext);
  7305. previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation);
  7306. setIncludeViewProviders(previousIncludeViewProviders);
  7307. factory.resolving = false;
  7308. leaveDI();
  7309. }
  7310. }
  7311. return value;
  7312. }
  7313. function bloomHashBitOrFactory(token) {
  7314. ngDevMode && assertDefined(token, "token must be defined");
  7315. if (typeof token === "string") {
  7316. return token.charCodeAt(0) || 0;
  7317. }
  7318. const tokenId = (
  7319. // First check with `hasOwnProperty` so we don't get an inherited ID.
  7320. token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : void 0
  7321. );
  7322. if (typeof tokenId === "number") {
  7323. if (tokenId >= 0) {
  7324. return tokenId & BLOOM_MASK;
  7325. } else {
  7326. ngDevMode && assertEqual(tokenId, -1, "Expecting to get Special Injector Id");
  7327. return createNodeInjector;
  7328. }
  7329. } else {
  7330. return tokenId;
  7331. }
  7332. }
  7333. function bloomHasToken(bloomHash, injectorIndex, injectorView) {
  7334. const mask = 1 << bloomHash;
  7335. const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];
  7336. return !!(value & mask);
  7337. }
  7338. function shouldSearchParent(flags, isFirstHostTNode) {
  7339. return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);
  7340. }
  7341. function getNodeInjectorLView(nodeInjector) {
  7342. return nodeInjector._lView;
  7343. }
  7344. function getNodeInjectorTNode(nodeInjector) {
  7345. return nodeInjector._tNode;
  7346. }
  7347. var NodeInjector = class {
  7348. _tNode;
  7349. _lView;
  7350. constructor(_tNode, _lView) {
  7351. this._tNode = _tNode;
  7352. this._lView = _lView;
  7353. }
  7354. get(token, notFoundValue, flags) {
  7355. return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);
  7356. }
  7357. };
  7358. function createNodeInjector() {
  7359. return new NodeInjector(getCurrentTNode(), getLView());
  7360. }
  7361. function ɵɵgetInheritedFactory(type) {
  7362. return noSideEffects(() => {
  7363. const ownConstructor = type.prototype.constructor;
  7364. const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor);
  7365. const objectPrototype = Object.prototype;
  7366. let parent = Object.getPrototypeOf(type.prototype).constructor;
  7367. while (parent && parent !== objectPrototype) {
  7368. const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent);
  7369. if (factory && factory !== ownFactory) {
  7370. return factory;
  7371. }
  7372. parent = Object.getPrototypeOf(parent);
  7373. }
  7374. return (t) => new t();
  7375. });
  7376. }
  7377. function getFactoryOf(type) {
  7378. if (isForwardRef(type)) {
  7379. return () => {
  7380. const factory = getFactoryOf(resolveForwardRef(type));
  7381. return factory && factory();
  7382. };
  7383. }
  7384. return getFactoryDef(type);
  7385. }
  7386. function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) {
  7387. let currentTNode = tNode;
  7388. let currentLView = lView;
  7389. while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 && !isRootView(currentLView)) {
  7390. ngDevMode && assertTNodeForLView(currentTNode, currentLView);
  7391. const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | InjectFlags.Self, NOT_FOUND2);
  7392. if (nodeInjectorValue !== NOT_FOUND2) {
  7393. return nodeInjectorValue;
  7394. }
  7395. let parentTNode = currentTNode.parent;
  7396. if (!parentTNode) {
  7397. const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR];
  7398. if (embeddedViewInjector) {
  7399. const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND2, flags);
  7400. if (embeddedViewInjectorValue !== NOT_FOUND2) {
  7401. return embeddedViewInjectorValue;
  7402. }
  7403. }
  7404. parentTNode = getTNodeFromLView(currentLView);
  7405. currentLView = currentLView[DECLARATION_VIEW];
  7406. }
  7407. currentTNode = parentTNode;
  7408. }
  7409. return notFoundValue;
  7410. }
  7411. function getTNodeFromLView(lView) {
  7412. const tView = lView[TVIEW];
  7413. const tViewType = tView.type;
  7414. if (tViewType === 2) {
  7415. ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents.");
  7416. return tView.declTNode;
  7417. } else if (tViewType === 1) {
  7418. return lView[T_HOST];
  7419. }
  7420. return null;
  7421. }
  7422. function ɵɵinjectAttribute(attrNameToInject) {
  7423. return injectAttributeImpl(getCurrentTNode(), attrNameToInject);
  7424. }
  7425. var Attribute2 = makeParamDecorator("Attribute", (attributeName) => ({
  7426. attributeName,
  7427. __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName)
  7428. }));
  7429. var _reflect = null;
  7430. function getReflect() {
  7431. return _reflect = _reflect || new ReflectionCapabilities();
  7432. }
  7433. function reflectDependencies(type) {
  7434. return convertDependencies(getReflect().parameters(type));
  7435. }
  7436. function convertDependencies(deps) {
  7437. return deps.map((dep) => reflectDependency(dep));
  7438. }
  7439. function reflectDependency(dep) {
  7440. const meta = {
  7441. token: null,
  7442. attribute: null,
  7443. host: false,
  7444. optional: false,
  7445. self: false,
  7446. skipSelf: false
  7447. };
  7448. if (Array.isArray(dep) && dep.length > 0) {
  7449. for (let j = 0; j < dep.length; j++) {
  7450. const param = dep[j];
  7451. if (param === void 0) {
  7452. continue;
  7453. }
  7454. const proto = Object.getPrototypeOf(param);
  7455. if (param instanceof Optional || proto.ngMetadataName === "Optional") {
  7456. meta.optional = true;
  7457. } else if (param instanceof SkipSelf || proto.ngMetadataName === "SkipSelf") {
  7458. meta.skipSelf = true;
  7459. } else if (param instanceof Self || proto.ngMetadataName === "Self") {
  7460. meta.self = true;
  7461. } else if (param instanceof Host || proto.ngMetadataName === "Host") {
  7462. meta.host = true;
  7463. } else if (param instanceof Inject) {
  7464. meta.token = param.token;
  7465. } else if (param instanceof Attribute2) {
  7466. if (param.attributeName === void 0) {
  7467. throw new RuntimeError(204, ngDevMode && `Attribute name must be defined.`);
  7468. }
  7469. meta.attribute = param.attributeName;
  7470. } else {
  7471. meta.token = param;
  7472. }
  7473. }
  7474. } else if (dep === void 0 || Array.isArray(dep) && dep.length === 0) {
  7475. meta.token = null;
  7476. } else {
  7477. meta.token = dep;
  7478. }
  7479. return meta;
  7480. }
  7481. function compileInjectable(type, meta) {
  7482. let ngInjectableDef = null;
  7483. let ngFactoryDef = null;
  7484. if (!type.hasOwnProperty(NG_PROV_DEF)) {
  7485. Object.defineProperty(type, NG_PROV_DEF, {
  7486. get: () => {
  7487. if (ngInjectableDef === null) {
  7488. const compiler = getCompilerFacade({
  7489. usage: 0,
  7490. kind: "injectable",
  7491. type
  7492. });
  7493. ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, meta));
  7494. }
  7495. return ngInjectableDef;
  7496. }
  7497. });
  7498. }
  7499. if (!type.hasOwnProperty(NG_FACTORY_DEF)) {
  7500. Object.defineProperty(type, NG_FACTORY_DEF, {
  7501. get: () => {
  7502. if (ngFactoryDef === null) {
  7503. const compiler = getCompilerFacade({
  7504. usage: 0,
  7505. kind: "injectable",
  7506. type
  7507. });
  7508. ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, {
  7509. name: type.name,
  7510. type,
  7511. typeArgumentCount: 0,
  7512. // In JIT mode types are not available nor used.
  7513. deps: reflectDependencies(type),
  7514. target: compiler.FactoryTarget.Injectable
  7515. });
  7516. }
  7517. return ngFactoryDef;
  7518. },
  7519. // Leave this configurable so that the factories from directives or pipes can take precedence.
  7520. configurable: true
  7521. });
  7522. }
  7523. }
  7524. var USE_VALUE = getClosureSafeProperty({
  7525. provide: String,
  7526. useValue: getClosureSafeProperty
  7527. });
  7528. function isUseClassProvider(meta) {
  7529. return meta.useClass !== void 0;
  7530. }
  7531. function isUseValueProvider(meta) {
  7532. return USE_VALUE in meta;
  7533. }
  7534. function isUseFactoryProvider(meta) {
  7535. return meta.useFactory !== void 0;
  7536. }
  7537. function isUseExistingProvider(meta) {
  7538. return meta.useExisting !== void 0;
  7539. }
  7540. function getInjectableMetadata(type, srcMeta) {
  7541. const meta = srcMeta || {
  7542. providedIn: null
  7543. };
  7544. const compilerMeta = {
  7545. name: type.name,
  7546. type,
  7547. typeArgumentCount: 0,
  7548. providedIn: meta.providedIn
  7549. };
  7550. if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== void 0) {
  7551. compilerMeta.deps = convertDependencies(meta.deps);
  7552. }
  7553. if (isUseClassProvider(meta)) {
  7554. compilerMeta.useClass = meta.useClass;
  7555. } else if (isUseValueProvider(meta)) {
  7556. compilerMeta.useValue = meta.useValue;
  7557. } else if (isUseFactoryProvider(meta)) {
  7558. compilerMeta.useFactory = meta.useFactory;
  7559. } else if (isUseExistingProvider(meta)) {
  7560. compilerMeta.useExisting = meta.useExisting;
  7561. }
  7562. return compilerMeta;
  7563. }
  7564. var Injectable = makeDecorator("Injectable", void 0, void 0, void 0, (type, meta) => compileInjectable(type, meta));
  7565. function createInjector(defType, parent = null, additionalProviders = null, name) {
  7566. const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);
  7567. injector.resolveInjectorInitializers();
  7568. return injector;
  7569. }
  7570. function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = /* @__PURE__ */ new Set()) {
  7571. const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)];
  7572. name = name || (typeof defType === "object" ? void 0 : stringify(defType));
  7573. return new R3Injector(providers, parent || getNullInjector(), name || null, scopes);
  7574. }
  7575. var Injector = class _Injector {
  7576. static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
  7577. static NULL = new NullInjector();
  7578. static create(options, parent) {
  7579. if (Array.isArray(options)) {
  7580. return createInjector({
  7581. name: ""
  7582. }, parent, options, "");
  7583. } else {
  7584. const name = options.name ?? "";
  7585. return createInjector({
  7586. name
  7587. }, options.parent, options.providers, name);
  7588. }
  7589. }
  7590. /** @nocollapse */
  7591. static ɵprov = (
  7592. /** @pureOrBreakMyCode */
  7593. ɵɵdefineInjectable({
  7594. token: _Injector,
  7595. providedIn: "any",
  7596. factory: () => ɵɵinject(INJECTOR$1)
  7597. })
  7598. );
  7599. /**
  7600. * @internal
  7601. * @nocollapse
  7602. */
  7603. static __NG_ELEMENT_ID__ = -1;
  7604. };
  7605. var HostAttributeToken = class {
  7606. attributeName;
  7607. constructor(attributeName) {
  7608. this.attributeName = attributeName;
  7609. }
  7610. /** @internal */
  7611. __NG_ELEMENT_ID__ = () => ɵɵinjectAttribute(this.attributeName);
  7612. toString() {
  7613. return `HostAttributeToken ${this.attributeName}`;
  7614. }
  7615. };
  7616. var HOST_TAG_NAME = new InjectionToken(ngDevMode ? "HOST_TAG_NAME" : "");
  7617. HOST_TAG_NAME.__NG_ELEMENT_ID__ = (flags) => {
  7618. const tNode = getCurrentTNode();
  7619. if (tNode === null) {
  7620. throw new RuntimeError(204, ngDevMode && "HOST_TAG_NAME can only be injected in directives and components during construction time (in a class constructor or as a class field initializer)");
  7621. }
  7622. if (tNode.type & 2) {
  7623. return tNode.value;
  7624. }
  7625. if (flags & InjectFlags.Optional) {
  7626. return null;
  7627. }
  7628. throw new RuntimeError(204, ngDevMode && `HOST_TAG_NAME was used on ${getDevModeNodeName(tNode)} which doesn't have an underlying element in the DOM. This is invalid, and so the dependency should be marked as optional.`);
  7629. };
  7630. function getDevModeNodeName(tNode) {
  7631. if (tNode.type & 8) {
  7632. return "an <ng-container>";
  7633. } else if (tNode.type & 4) {
  7634. return "an <ng-template>";
  7635. } else if (tNode.type & 128) {
  7636. return "an @let declaration";
  7637. } else {
  7638. return "a node";
  7639. }
  7640. }
  7641. var SCHEDULE_IN_ROOT_ZONE_DEFAULT = false;
  7642. var DestroyRef = class {
  7643. /**
  7644. * @internal
  7645. * @nocollapse
  7646. */
  7647. static __NG_ELEMENT_ID__ = injectDestroyRef;
  7648. /**
  7649. * @internal
  7650. * @nocollapse
  7651. */
  7652. static __NG_ENV_ID__ = (injector) => injector;
  7653. };
  7654. var NodeInjectorDestroyRef = class extends DestroyRef {
  7655. _lView;
  7656. constructor(_lView) {
  7657. super();
  7658. this._lView = _lView;
  7659. }
  7660. onDestroy(callback) {
  7661. storeLViewOnDestroy(this._lView, callback);
  7662. return () => removeLViewOnDestroy(this._lView, callback);
  7663. }
  7664. };
  7665. function injectDestroyRef() {
  7666. return new NodeInjectorDestroyRef(getLView());
  7667. }
  7668. var ChangeDetectionScheduler = class {
  7669. };
  7670. var ZONELESS_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless enabled" : "", {
  7671. providedIn: "root",
  7672. factory: () => false
  7673. });
  7674. var PROVIDED_ZONELESS = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless provided" : "", {
  7675. providedIn: "root",
  7676. factory: () => false
  7677. });
  7678. var ZONELESS_SCHEDULER_DISABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "scheduler disabled" : "");
  7679. var SCHEDULE_IN_ROOT_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "run changes outside zone in root" : "");
  7680. var PendingTasksInternal = class _PendingTasksInternal {
  7681. taskId = 0;
  7682. pendingTasks = /* @__PURE__ */ new Set();
  7683. get _hasPendingTasks() {
  7684. return this.hasPendingTasks.value;
  7685. }
  7686. hasPendingTasks = new BehaviorSubject(false);
  7687. add() {
  7688. if (!this._hasPendingTasks) {
  7689. this.hasPendingTasks.next(true);
  7690. }
  7691. const taskId = this.taskId++;
  7692. this.pendingTasks.add(taskId);
  7693. return taskId;
  7694. }
  7695. has(taskId) {
  7696. return this.pendingTasks.has(taskId);
  7697. }
  7698. remove(taskId) {
  7699. this.pendingTasks.delete(taskId);
  7700. if (this.pendingTasks.size === 0 && this._hasPendingTasks) {
  7701. this.hasPendingTasks.next(false);
  7702. }
  7703. }
  7704. ngOnDestroy() {
  7705. this.pendingTasks.clear();
  7706. if (this._hasPendingTasks) {
  7707. this.hasPendingTasks.next(false);
  7708. }
  7709. }
  7710. /** @nocollapse */
  7711. static ɵprov = (
  7712. /** @pureOrBreakMyCode */
  7713. ɵɵdefineInjectable({
  7714. token: _PendingTasksInternal,
  7715. providedIn: "root",
  7716. factory: () => new _PendingTasksInternal()
  7717. })
  7718. );
  7719. };
  7720. var PendingTasks = class _PendingTasks {
  7721. internalPendingTasks = inject(PendingTasksInternal);
  7722. scheduler = inject(ChangeDetectionScheduler);
  7723. /**
  7724. * Adds a new task that should block application's stability.
  7725. * @returns A cleanup function that removes a task when called.
  7726. */
  7727. add() {
  7728. const taskId = this.internalPendingTasks.add();
  7729. return () => {
  7730. if (!this.internalPendingTasks.has(taskId)) {
  7731. return;
  7732. }
  7733. this.scheduler.notify(
  7734. 11
  7735. /* NotificationSource.PendingTaskRemoved */
  7736. );
  7737. this.internalPendingTasks.remove(taskId);
  7738. };
  7739. }
  7740. /**
  7741. * Runs an asynchronous function and blocks the application's stability until the function completes.
  7742. *
  7743. * ```ts
  7744. * pendingTasks.run(async () => {
  7745. * const userData = await fetch('/api/user');
  7746. * this.userData.set(userData);
  7747. * });
  7748. * ```
  7749. *
  7750. * Application stability is at least delayed until the next tick after the `run` method resolves
  7751. * so it is safe to make additional updates to application state that would require UI synchronization:
  7752. *
  7753. * ```ts
  7754. * const userData = await pendingTasks.run(() => fetch('/api/user'));
  7755. * this.userData.set(userData);
  7756. * ```
  7757. *
  7758. * @param fn The asynchronous function to execute
  7759. */
  7760. run(fn) {
  7761. return __async(this, null, function* () {
  7762. const removeTask = this.add();
  7763. try {
  7764. return yield fn();
  7765. } finally {
  7766. removeTask();
  7767. }
  7768. });
  7769. }
  7770. /** @nocollapse */
  7771. static ɵprov = (
  7772. /** @pureOrBreakMyCode */
  7773. ɵɵdefineInjectable({
  7774. token: _PendingTasks,
  7775. providedIn: "root",
  7776. factory: () => new _PendingTasks()
  7777. })
  7778. );
  7779. };
  7780. var EventEmitter_ = class extends Subject {
  7781. // tslint:disable-next-line:require-internal-with-underscore
  7782. __isAsync;
  7783. destroyRef = void 0;
  7784. pendingTasks = void 0;
  7785. constructor(isAsync = false) {
  7786. super();
  7787. this.__isAsync = isAsync;
  7788. if (isInInjectionContext()) {
  7789. this.destroyRef = inject(DestroyRef, {
  7790. optional: true
  7791. }) ?? void 0;
  7792. this.pendingTasks = inject(PendingTasksInternal, {
  7793. optional: true
  7794. }) ?? void 0;
  7795. }
  7796. }
  7797. emit(value) {
  7798. const prevConsumer = setActiveConsumer(null);
  7799. try {
  7800. super.next(value);
  7801. } finally {
  7802. setActiveConsumer(prevConsumer);
  7803. }
  7804. }
  7805. subscribe(observerOrNext, error, complete) {
  7806. let nextFn = observerOrNext;
  7807. let errorFn = error || (() => null);
  7808. let completeFn = complete;
  7809. if (observerOrNext && typeof observerOrNext === "object") {
  7810. const observer = observerOrNext;
  7811. nextFn = observer.next?.bind(observer);
  7812. errorFn = observer.error?.bind(observer);
  7813. completeFn = observer.complete?.bind(observer);
  7814. }
  7815. if (this.__isAsync) {
  7816. errorFn = this.wrapInTimeout(errorFn);
  7817. if (nextFn) {
  7818. nextFn = this.wrapInTimeout(nextFn);
  7819. }
  7820. if (completeFn) {
  7821. completeFn = this.wrapInTimeout(completeFn);
  7822. }
  7823. }
  7824. const sink = super.subscribe({
  7825. next: nextFn,
  7826. error: errorFn,
  7827. complete: completeFn
  7828. });
  7829. if (observerOrNext instanceof Subscription) {
  7830. observerOrNext.add(sink);
  7831. }
  7832. return sink;
  7833. }
  7834. wrapInTimeout(fn) {
  7835. return (value) => {
  7836. const taskId = this.pendingTasks?.add();
  7837. setTimeout(() => {
  7838. fn(value);
  7839. if (taskId !== void 0) {
  7840. this.pendingTasks?.remove(taskId);
  7841. }
  7842. });
  7843. };
  7844. }
  7845. };
  7846. var EventEmitter = EventEmitter_;
  7847. function noop2(...args) {
  7848. }
  7849. function scheduleCallbackWithRafRace(callback) {
  7850. let timeoutId;
  7851. let animationFrameId;
  7852. function cleanup() {
  7853. callback = noop2;
  7854. try {
  7855. if (animationFrameId !== void 0 && typeof cancelAnimationFrame === "function") {
  7856. cancelAnimationFrame(animationFrameId);
  7857. }
  7858. if (timeoutId !== void 0) {
  7859. clearTimeout(timeoutId);
  7860. }
  7861. } catch {
  7862. }
  7863. }
  7864. timeoutId = setTimeout(() => {
  7865. callback();
  7866. cleanup();
  7867. });
  7868. if (typeof requestAnimationFrame === "function") {
  7869. animationFrameId = requestAnimationFrame(() => {
  7870. callback();
  7871. cleanup();
  7872. });
  7873. }
  7874. return () => cleanup();
  7875. }
  7876. function scheduleCallbackWithMicrotask(callback) {
  7877. queueMicrotask(() => callback());
  7878. return () => {
  7879. callback = noop2;
  7880. };
  7881. }
  7882. var AsyncStackTaggingZoneSpec = class {
  7883. createTask;
  7884. constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
  7885. this.name = "asyncStackTagging for " + namePrefix;
  7886. this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);
  7887. }
  7888. // ZoneSpec implementation below.
  7889. name;
  7890. onScheduleTask(delegate, _current, target, task) {
  7891. task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
  7892. return delegate.scheduleTask(target, task);
  7893. }
  7894. onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
  7895. let ret;
  7896. if (task.consoleTask) {
  7897. ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
  7898. } else {
  7899. ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
  7900. }
  7901. return ret;
  7902. }
  7903. };
  7904. var isAngularZoneProperty = "isAngularZone";
  7905. var angularZoneInstanceIdProperty = isAngularZoneProperty + "_ID";
  7906. var ngZoneInstanceId = 0;
  7907. var NgZone = class _NgZone {
  7908. hasPendingMacrotasks = false;
  7909. hasPendingMicrotasks = false;
  7910. /**
  7911. * Whether there are no outstanding microtasks or macrotasks.
  7912. */
  7913. isStable = true;
  7914. /**
  7915. * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
  7916. */
  7917. onUnstable = new EventEmitter(false);
  7918. /**
  7919. * Notifies when there is no more microtasks enqueued in the current VM Turn.
  7920. * This is a hint for Angular to do change detection, which may enqueue more microtasks.
  7921. * For this reason this event can fire multiple times per VM Turn.
  7922. */
  7923. onMicrotaskEmpty = new EventEmitter(false);
  7924. /**
  7925. * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
  7926. * implies we are about to relinquish VM turn.
  7927. * This event gets called just once.
  7928. */
  7929. onStable = new EventEmitter(false);
  7930. /**
  7931. * Notifies that an error has been delivered.
  7932. */
  7933. onError = new EventEmitter(false);
  7934. constructor(options) {
  7935. const {
  7936. enableLongStackTrace = false,
  7937. shouldCoalesceEventChangeDetection = false,
  7938. shouldCoalesceRunChangeDetection = false,
  7939. scheduleInRootZone = SCHEDULE_IN_ROOT_ZONE_DEFAULT
  7940. } = options;
  7941. if (typeof Zone == "undefined") {
  7942. throw new RuntimeError(908, ngDevMode && `In this configuration Angular requires Zone.js`);
  7943. }
  7944. Zone.assertZonePatched();
  7945. const self = this;
  7946. self._nesting = 0;
  7947. self._outer = self._inner = Zone.current;
  7948. if (ngDevMode) {
  7949. self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec("Angular"));
  7950. }
  7951. if (Zone["TaskTrackingZoneSpec"]) {
  7952. self._inner = self._inner.fork(new Zone["TaskTrackingZoneSpec"]());
  7953. }
  7954. if (enableLongStackTrace && Zone["longStackTraceZoneSpec"]) {
  7955. self._inner = self._inner.fork(Zone["longStackTraceZoneSpec"]);
  7956. }
  7957. self.shouldCoalesceEventChangeDetection = !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection;
  7958. self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection;
  7959. self.callbackScheduled = false;
  7960. self.scheduleInRootZone = scheduleInRootZone;
  7961. forkInnerZoneWithAngularBehavior(self);
  7962. }
  7963. /**
  7964. This method checks whether the method call happens within an Angular Zone instance.
  7965. */
  7966. static isInAngularZone() {
  7967. return typeof Zone !== "undefined" && Zone.current.get(isAngularZoneProperty) === true;
  7968. }
  7969. /**
  7970. Assures that the method is called within the Angular Zone, otherwise throws an error.
  7971. */
  7972. static assertInAngularZone() {
  7973. if (!_NgZone.isInAngularZone()) {
  7974. throw new RuntimeError(909, ngDevMode && "Expected to be in Angular Zone, but it is not!");
  7975. }
  7976. }
  7977. /**
  7978. Assures that the method is called outside of the Angular Zone, otherwise throws an error.
  7979. */
  7980. static assertNotInAngularZone() {
  7981. if (_NgZone.isInAngularZone()) {
  7982. throw new RuntimeError(909, ngDevMode && "Expected to not be in Angular Zone, but it is!");
  7983. }
  7984. }
  7985. /**
  7986. * Executes the `fn` function synchronously within the Angular zone and returns value returned by
  7987. * the function.
  7988. *
  7989. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  7990. * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
  7991. *
  7992. * Any future tasks or microtasks scheduled from within this function will continue executing from
  7993. * within the Angular zone.
  7994. *
  7995. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  7996. */
  7997. run(fn, applyThis, applyArgs) {
  7998. return this._inner.run(fn, applyThis, applyArgs);
  7999. }
  8000. /**
  8001. * Executes the `fn` function synchronously within the Angular zone as a task and returns value
  8002. * returned by the function.
  8003. *
  8004. * Running functions via `runTask` allows you to reenter Angular zone from a task that was executed
  8005. * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
  8006. *
  8007. * Any future tasks or microtasks scheduled from within this function will continue executing from
  8008. * within the Angular zone.
  8009. *
  8010. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  8011. */
  8012. runTask(fn, applyThis, applyArgs, name) {
  8013. const zone = this._inner;
  8014. const task = zone.scheduleEventTask("NgZoneEvent: " + name, fn, EMPTY_PAYLOAD, noop2, noop2);
  8015. try {
  8016. return zone.runTask(task, applyThis, applyArgs);
  8017. } finally {
  8018. zone.cancelTask(task);
  8019. }
  8020. }
  8021. /**
  8022. * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
  8023. * rethrown.
  8024. */
  8025. runGuarded(fn, applyThis, applyArgs) {
  8026. return this._inner.runGuarded(fn, applyThis, applyArgs);
  8027. }
  8028. /**
  8029. * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
  8030. * the function.
  8031. *
  8032. * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
  8033. * work that
  8034. * doesn't trigger Angular change-detection or is subject to Angular's error handling.
  8035. *
  8036. * Any future tasks or microtasks scheduled from within this function will continue executing from
  8037. * outside of the Angular zone.
  8038. *
  8039. * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
  8040. */
  8041. runOutsideAngular(fn) {
  8042. return this._outer.run(fn);
  8043. }
  8044. };
  8045. var EMPTY_PAYLOAD = {};
  8046. function checkStable(zone) {
  8047. if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
  8048. try {
  8049. zone._nesting++;
  8050. zone.onMicrotaskEmpty.emit(null);
  8051. } finally {
  8052. zone._nesting--;
  8053. if (!zone.hasPendingMicrotasks) {
  8054. try {
  8055. zone.runOutsideAngular(() => zone.onStable.emit(null));
  8056. } finally {
  8057. zone.isStable = true;
  8058. }
  8059. }
  8060. }
  8061. }
  8062. }
  8063. function delayChangeDetectionForEvents(zone) {
  8064. if (zone.isCheckStableRunning || zone.callbackScheduled) {
  8065. return;
  8066. }
  8067. zone.callbackScheduled = true;
  8068. function scheduleCheckStable() {
  8069. scheduleCallbackWithRafRace(() => {
  8070. zone.callbackScheduled = false;
  8071. updateMicroTaskStatus(zone);
  8072. zone.isCheckStableRunning = true;
  8073. checkStable(zone);
  8074. zone.isCheckStableRunning = false;
  8075. });
  8076. }
  8077. if (zone.scheduleInRootZone) {
  8078. Zone.root.run(() => {
  8079. scheduleCheckStable();
  8080. });
  8081. } else {
  8082. zone._outer.run(() => {
  8083. scheduleCheckStable();
  8084. });
  8085. }
  8086. updateMicroTaskStatus(zone);
  8087. }
  8088. function forkInnerZoneWithAngularBehavior(zone) {
  8089. const delayChangeDetectionForEventsDelegate = () => {
  8090. delayChangeDetectionForEvents(zone);
  8091. };
  8092. const instanceId = ngZoneInstanceId++;
  8093. zone._inner = zone._inner.fork({
  8094. name: "angular",
  8095. properties: {
  8096. [isAngularZoneProperty]: true,
  8097. [angularZoneInstanceIdProperty]: instanceId,
  8098. [angularZoneInstanceIdProperty + instanceId]: true
  8099. },
  8100. onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
  8101. if (shouldBeIgnoredByZone(applyArgs)) {
  8102. return delegate.invokeTask(target, task, applyThis, applyArgs);
  8103. }
  8104. try {
  8105. onEnter(zone);
  8106. return delegate.invokeTask(target, task, applyThis, applyArgs);
  8107. } finally {
  8108. if (zone.shouldCoalesceEventChangeDetection && task.type === "eventTask" || zone.shouldCoalesceRunChangeDetection) {
  8109. delayChangeDetectionForEventsDelegate();
  8110. }
  8111. onLeave(zone);
  8112. }
  8113. },
  8114. onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
  8115. try {
  8116. onEnter(zone);
  8117. return delegate.invoke(target, callback, applyThis, applyArgs, source);
  8118. } finally {
  8119. if (zone.shouldCoalesceRunChangeDetection && // Do not delay change detection when the task is the scheduler's tick.
  8120. // We need to synchronously trigger the stability logic so that the
  8121. // zone-based scheduler can prevent a duplicate ApplicationRef.tick
  8122. // by first checking if the scheduler tick is running. This does seem a bit roundabout,
  8123. // but we _do_ still want to trigger all the correct events when we exit the zone.run
  8124. // (`onMicrotaskEmpty` and `onStable` _should_ emit; developers can have code which
  8125. // relies on these events happening after change detection runs).
  8126. // Note: `zone.callbackScheduled` is already in delayChangeDetectionForEventsDelegate
  8127. // but is added here as well to prevent reads of applyArgs when not necessary
  8128. !zone.callbackScheduled && !isSchedulerTick(applyArgs)) {
  8129. delayChangeDetectionForEventsDelegate();
  8130. }
  8131. onLeave(zone);
  8132. }
  8133. },
  8134. onHasTask: (delegate, current, target, hasTaskState) => {
  8135. delegate.hasTask(target, hasTaskState);
  8136. if (current === target) {
  8137. if (hasTaskState.change == "microTask") {
  8138. zone._hasPendingMicrotasks = hasTaskState.microTask;
  8139. updateMicroTaskStatus(zone);
  8140. checkStable(zone);
  8141. } else if (hasTaskState.change == "macroTask") {
  8142. zone.hasPendingMacrotasks = hasTaskState.macroTask;
  8143. }
  8144. }
  8145. },
  8146. onHandleError: (delegate, current, target, error) => {
  8147. delegate.handleError(target, error);
  8148. zone.runOutsideAngular(() => zone.onError.emit(error));
  8149. return false;
  8150. }
  8151. });
  8152. }
  8153. function updateMicroTaskStatus(zone) {
  8154. if (zone._hasPendingMicrotasks || (zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) && zone.callbackScheduled === true) {
  8155. zone.hasPendingMicrotasks = true;
  8156. } else {
  8157. zone.hasPendingMicrotasks = false;
  8158. }
  8159. }
  8160. function onEnter(zone) {
  8161. zone._nesting++;
  8162. if (zone.isStable) {
  8163. zone.isStable = false;
  8164. zone.onUnstable.emit(null);
  8165. }
  8166. }
  8167. function onLeave(zone) {
  8168. zone._nesting--;
  8169. checkStable(zone);
  8170. }
  8171. var NoopNgZone = class {
  8172. hasPendingMicrotasks = false;
  8173. hasPendingMacrotasks = false;
  8174. isStable = true;
  8175. onUnstable = new EventEmitter();
  8176. onMicrotaskEmpty = new EventEmitter();
  8177. onStable = new EventEmitter();
  8178. onError = new EventEmitter();
  8179. run(fn, applyThis, applyArgs) {
  8180. return fn.apply(applyThis, applyArgs);
  8181. }
  8182. runGuarded(fn, applyThis, applyArgs) {
  8183. return fn.apply(applyThis, applyArgs);
  8184. }
  8185. runOutsideAngular(fn) {
  8186. return fn();
  8187. }
  8188. runTask(fn, applyThis, applyArgs, name) {
  8189. return fn.apply(applyThis, applyArgs);
  8190. }
  8191. };
  8192. function shouldBeIgnoredByZone(applyArgs) {
  8193. return hasApplyArgsData(applyArgs, "__ignore_ng_zone__");
  8194. }
  8195. function isSchedulerTick(applyArgs) {
  8196. return hasApplyArgsData(applyArgs, "__scheduler_tick__");
  8197. }
  8198. function hasApplyArgsData(applyArgs, key) {
  8199. if (!Array.isArray(applyArgs)) {
  8200. return false;
  8201. }
  8202. if (applyArgs.length !== 1) {
  8203. return false;
  8204. }
  8205. return applyArgs[0]?.data?.[key] === true;
  8206. }
  8207. function getNgZone(ngZoneToUse = "zone.js", options) {
  8208. if (ngZoneToUse === "noop") {
  8209. return new NoopNgZone();
  8210. }
  8211. if (ngZoneToUse === "zone.js") {
  8212. return new NgZone(options);
  8213. }
  8214. return ngZoneToUse;
  8215. }
  8216. var ErrorHandler = class {
  8217. /**
  8218. * @internal
  8219. */
  8220. _console = console;
  8221. handleError(error) {
  8222. this._console.error("ERROR", error);
  8223. }
  8224. };
  8225. var INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "internal error handler" : "", {
  8226. providedIn: "root",
  8227. factory: () => {
  8228. const zone = inject(NgZone);
  8229. const userErrorHandler = inject(ErrorHandler);
  8230. return (e) => zone.runOutsideAngular(() => userErrorHandler.handleError(e));
  8231. }
  8232. });
  8233. var OutputEmitterRef = class {
  8234. destroyed = false;
  8235. listeners = null;
  8236. errorHandler = inject(ErrorHandler, {
  8237. optional: true
  8238. });
  8239. /** @internal */
  8240. destroyRef = inject(DestroyRef);
  8241. constructor() {
  8242. this.destroyRef.onDestroy(() => {
  8243. this.destroyed = true;
  8244. this.listeners = null;
  8245. });
  8246. }
  8247. subscribe(callback) {
  8248. if (this.destroyed) {
  8249. throw new RuntimeError(953, ngDevMode && "Unexpected subscription to destroyed `OutputRef`. The owning directive/component is destroyed.");
  8250. }
  8251. (this.listeners ??= []).push(callback);
  8252. return {
  8253. unsubscribe: () => {
  8254. const idx = this.listeners?.indexOf(callback);
  8255. if (idx !== void 0 && idx !== -1) {
  8256. this.listeners?.splice(idx, 1);
  8257. }
  8258. }
  8259. };
  8260. }
  8261. /** Emits a new value to the output. */
  8262. emit(value) {
  8263. if (this.destroyed) {
  8264. console.warn(formatRuntimeError(953, ngDevMode && "Unexpected emit for destroyed `OutputRef`. The owning directive/component is destroyed."));
  8265. return;
  8266. }
  8267. if (this.listeners === null) {
  8268. return;
  8269. }
  8270. const previousConsumer = setActiveConsumer(null);
  8271. try {
  8272. for (const listenerFn of this.listeners) {
  8273. try {
  8274. listenerFn(value);
  8275. } catch (err) {
  8276. this.errorHandler?.handleError(err);
  8277. }
  8278. }
  8279. } finally {
  8280. setActiveConsumer(previousConsumer);
  8281. }
  8282. }
  8283. };
  8284. function getOutputDestroyRef(ref) {
  8285. return ref.destroyRef;
  8286. }
  8287. function output(opts) {
  8288. ngDevMode && assertInInjectionContext(output);
  8289. return new OutputEmitterRef();
  8290. }
  8291. function inputFunction(initialValue, opts) {
  8292. ngDevMode && assertInInjectionContext(input);
  8293. return createInputSignal(initialValue, opts);
  8294. }
  8295. function inputRequiredFunction(opts) {
  8296. ngDevMode && assertInInjectionContext(input);
  8297. return createInputSignal(REQUIRED_UNSET_VALUE, opts);
  8298. }
  8299. var input = (() => {
  8300. inputFunction.required = inputRequiredFunction;
  8301. return inputFunction;
  8302. })();
  8303. function injectElementRef() {
  8304. return createElementRef(getCurrentTNode(), getLView());
  8305. }
  8306. function createElementRef(tNode, lView) {
  8307. return new ElementRef(getNativeByTNode(tNode, lView));
  8308. }
  8309. var ElementRef = class {
  8310. /**
  8311. * <div class="callout is-critical">
  8312. * <header>Use with caution</header>
  8313. * <p>
  8314. * Use this API as the last resort when direct access to DOM is needed. Use templating and
  8315. * data-binding provided by Angular instead. Alternatively you can take a look at
  8316. * {@link Renderer2} which provides an API that can be safely used.
  8317. * </p>
  8318. * </div>
  8319. */
  8320. nativeElement;
  8321. constructor(nativeElement) {
  8322. this.nativeElement = nativeElement;
  8323. }
  8324. /**
  8325. * @internal
  8326. * @nocollapse
  8327. */
  8328. static __NG_ELEMENT_ID__ = injectElementRef;
  8329. };
  8330. function unwrapElementRef(value) {
  8331. return value instanceof ElementRef ? value.nativeElement : value;
  8332. }
  8333. function isSignal(value) {
  8334. return typeof value === "function" && value[SIGNAL] !== void 0;
  8335. }
  8336. function ɵunwrapWritableSignal(value) {
  8337. return null;
  8338. }
  8339. function signal(initialValue, options) {
  8340. const signalFn = createSignal(initialValue, options?.equal);
  8341. const node = signalFn[SIGNAL];
  8342. signalFn.set = (newValue) => signalSetFn(node, newValue);
  8343. signalFn.update = (updateFn) => signalUpdateFn(node, updateFn);
  8344. signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn);
  8345. if (ngDevMode) {
  8346. signalFn.toString = () => `[Signal: ${signalFn()}]`;
  8347. node.debugName = options?.debugName;
  8348. }
  8349. return signalFn;
  8350. }
  8351. function signalAsReadonlyFn() {
  8352. const node = this[SIGNAL];
  8353. if (node.readonlyFn === void 0) {
  8354. const readonlyFn = () => this();
  8355. readonlyFn[SIGNAL] = node;
  8356. node.readonlyFn = readonlyFn;
  8357. }
  8358. return node.readonlyFn;
  8359. }
  8360. function isWritableSignal(value) {
  8361. return isSignal(value) && typeof value.set === "function";
  8362. }
  8363. function symbolIterator() {
  8364. return this._results[Symbol.iterator]();
  8365. }
  8366. var QueryList = class {
  8367. _emitDistinctChangesOnly;
  8368. dirty = true;
  8369. _onDirty = void 0;
  8370. _results = [];
  8371. _changesDetected = false;
  8372. _changes = void 0;
  8373. length = 0;
  8374. first = void 0;
  8375. last = void 0;
  8376. /**
  8377. * Returns `Observable` of `QueryList` notifying the subscriber of changes.
  8378. */
  8379. get changes() {
  8380. return this._changes ??= new Subject();
  8381. }
  8382. /**
  8383. * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change
  8384. * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in
  8385. * the same result)
  8386. */
  8387. constructor(_emitDistinctChangesOnly = false) {
  8388. this._emitDistinctChangesOnly = _emitDistinctChangesOnly;
  8389. }
  8390. /**
  8391. * Returns the QueryList entry at `index`.
  8392. */
  8393. get(index) {
  8394. return this._results[index];
  8395. }
  8396. /**
  8397. * See
  8398. * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
  8399. */
  8400. map(fn) {
  8401. return this._results.map(fn);
  8402. }
  8403. filter(fn) {
  8404. return this._results.filter(fn);
  8405. }
  8406. /**
  8407. * See
  8408. * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
  8409. */
  8410. find(fn) {
  8411. return this._results.find(fn);
  8412. }
  8413. /**
  8414. * See
  8415. * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
  8416. */
  8417. reduce(fn, init) {
  8418. return this._results.reduce(fn, init);
  8419. }
  8420. /**
  8421. * See
  8422. * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
  8423. */
  8424. forEach(fn) {
  8425. this._results.forEach(fn);
  8426. }
  8427. /**
  8428. * See
  8429. * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
  8430. */
  8431. some(fn) {
  8432. return this._results.some(fn);
  8433. }
  8434. /**
  8435. * Returns a copy of the internal results list as an Array.
  8436. */
  8437. toArray() {
  8438. return this._results.slice();
  8439. }
  8440. toString() {
  8441. return this._results.toString();
  8442. }
  8443. /**
  8444. * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that
  8445. * on change detection, it will not notify of changes to the queries, unless a new change
  8446. * occurs.
  8447. *
  8448. * @param resultsTree The query results to store
  8449. * @param identityAccessor Optional function for extracting stable object identity from a value
  8450. * in the array. This function is executed for each element of the query result list while
  8451. * comparing current query list with the new one (provided as a first argument of the `reset`
  8452. * function) to detect if the lists are different. If the function is not provided, elements
  8453. * are compared as is (without any pre-processing).
  8454. */
  8455. reset(resultsTree, identityAccessor) {
  8456. this.dirty = false;
  8457. const newResultFlat = flatten(resultsTree);
  8458. if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) {
  8459. this._results = newResultFlat;
  8460. this.length = newResultFlat.length;
  8461. this.last = newResultFlat[this.length - 1];
  8462. this.first = newResultFlat[0];
  8463. }
  8464. }
  8465. /**
  8466. * Triggers a change event by emitting on the `changes` {@link EventEmitter}.
  8467. */
  8468. notifyOnChanges() {
  8469. if (this._changes !== void 0 && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.next(this);
  8470. }
  8471. /** @internal */
  8472. onDirty(cb) {
  8473. this._onDirty = cb;
  8474. }
  8475. /** internal */
  8476. setDirty() {
  8477. this.dirty = true;
  8478. this._onDirty?.();
  8479. }
  8480. /** internal */
  8481. destroy() {
  8482. if (this._changes !== void 0) {
  8483. this._changes.complete();
  8484. this._changes.unsubscribe();
  8485. }
  8486. }
  8487. [Symbol.iterator] = /* @__PURE__ */ (() => symbolIterator)();
  8488. };
  8489. var SKIP_HYDRATION_ATTR_NAME = "ngSkipHydration";
  8490. var SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = "ngskiphydration";
  8491. function hasSkipHydrationAttrOnTNode(tNode) {
  8492. const attrs = tNode.mergedAttrs;
  8493. if (attrs === null) return false;
  8494. for (let i = 0; i < attrs.length; i += 2) {
  8495. const value = attrs[i];
  8496. if (typeof value === "number") return false;
  8497. if (typeof value === "string" && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {
  8498. return true;
  8499. }
  8500. }
  8501. return false;
  8502. }
  8503. function hasSkipHydrationAttrOnRElement(rNode) {
  8504. return rNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME);
  8505. }
  8506. function hasInSkipHydrationBlockFlag(tNode) {
  8507. return (tNode.flags & 128) === 128;
  8508. }
  8509. function isInSkipHydrationBlock(tNode) {
  8510. if (hasInSkipHydrationBlockFlag(tNode)) {
  8511. return true;
  8512. }
  8513. let currentTNode = tNode.parent;
  8514. while (currentTNode) {
  8515. if (hasInSkipHydrationBlockFlag(tNode) || hasSkipHydrationAttrOnTNode(currentTNode)) {
  8516. return true;
  8517. }
  8518. currentTNode = currentTNode.parent;
  8519. }
  8520. return false;
  8521. }
  8522. function isI18nInSkipHydrationBlock(parentTNode) {
  8523. return hasInSkipHydrationBlockFlag(parentTNode) || hasSkipHydrationAttrOnTNode(parentTNode) || isInSkipHydrationBlock(parentTNode);
  8524. }
  8525. var ChangeDetectionStrategy;
  8526. (function(ChangeDetectionStrategy2) {
  8527. ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush";
  8528. ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default";
  8529. })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
  8530. var TRACKED_LVIEWS = /* @__PURE__ */ new Map();
  8531. var uniqueIdCounter = 0;
  8532. function getUniqueLViewId() {
  8533. return uniqueIdCounter++;
  8534. }
  8535. function registerLView(lView) {
  8536. ngDevMode && assertNumber(lView[ID], "LView must have an ID in order to be registered");
  8537. TRACKED_LVIEWS.set(lView[ID], lView);
  8538. }
  8539. function getLViewById(id) {
  8540. ngDevMode && assertNumber(id, "ID used for LView lookup must be a number");
  8541. return TRACKED_LVIEWS.get(id) || null;
  8542. }
  8543. function unregisterLView(lView) {
  8544. ngDevMode && assertNumber(lView[ID], "Cannot stop tracking an LView that does not have an ID");
  8545. TRACKED_LVIEWS.delete(lView[ID]);
  8546. }
  8547. function getTrackedLViews() {
  8548. return TRACKED_LVIEWS;
  8549. }
  8550. var LContext = class {
  8551. lViewId;
  8552. nodeIndex;
  8553. native;
  8554. /**
  8555. * The instance of the Component node.
  8556. */
  8557. component;
  8558. /**
  8559. * The list of active directives that exist on this element.
  8560. */
  8561. directives;
  8562. /**
  8563. * The map of local references (local reference name => element or directive instance) that
  8564. * exist on this element.
  8565. */
  8566. localRefs;
  8567. /** Component's parent view data. */
  8568. get lView() {
  8569. return getLViewById(this.lViewId);
  8570. }
  8571. constructor(lViewId, nodeIndex, native) {
  8572. this.lViewId = lViewId;
  8573. this.nodeIndex = nodeIndex;
  8574. this.native = native;
  8575. }
  8576. };
  8577. function getLContext(target) {
  8578. let mpValue = readPatchedData(target);
  8579. if (mpValue) {
  8580. if (isLView(mpValue)) {
  8581. const lView = mpValue;
  8582. let nodeIndex;
  8583. let component = void 0;
  8584. let directives = void 0;
  8585. if (isComponentInstance(target)) {
  8586. nodeIndex = findViaComponent(lView, target);
  8587. if (nodeIndex == -1) {
  8588. throw new Error("The provided component was not found in the application");
  8589. }
  8590. component = target;
  8591. } else if (isDirectiveInstance(target)) {
  8592. nodeIndex = findViaDirective(lView, target);
  8593. if (nodeIndex == -1) {
  8594. throw new Error("The provided directive was not found in the application");
  8595. }
  8596. directives = getDirectivesAtNodeIndex(nodeIndex, lView);
  8597. } else {
  8598. nodeIndex = findViaNativeElement(lView, target);
  8599. if (nodeIndex == -1) {
  8600. return null;
  8601. }
  8602. }
  8603. const native = unwrapRNode(lView[nodeIndex]);
  8604. const existingCtx = readPatchedData(native);
  8605. const context2 = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native);
  8606. if (component && context2.component === void 0) {
  8607. context2.component = component;
  8608. attachPatchData(context2.component, context2);
  8609. }
  8610. if (directives && context2.directives === void 0) {
  8611. context2.directives = directives;
  8612. for (let i = 0; i < directives.length; i++) {
  8613. attachPatchData(directives[i], context2);
  8614. }
  8615. }
  8616. attachPatchData(context2.native, context2);
  8617. mpValue = context2;
  8618. }
  8619. } else {
  8620. const rElement = target;
  8621. ngDevMode && assertDomNode(rElement);
  8622. let parent = rElement;
  8623. while (parent = parent.parentNode) {
  8624. const parentContext = readPatchedData(parent);
  8625. if (parentContext) {
  8626. const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
  8627. if (!lView) {
  8628. return null;
  8629. }
  8630. const index = findViaNativeElement(lView, rElement);
  8631. if (index >= 0) {
  8632. const native = unwrapRNode(lView[index]);
  8633. const context2 = createLContext(lView, index, native);
  8634. attachPatchData(native, context2);
  8635. mpValue = context2;
  8636. break;
  8637. }
  8638. }
  8639. }
  8640. }
  8641. return mpValue || null;
  8642. }
  8643. function createLContext(lView, nodeIndex, native) {
  8644. return new LContext(lView[ID], nodeIndex, native);
  8645. }
  8646. function getComponentViewByInstance(componentInstance) {
  8647. let patchedData = readPatchedData(componentInstance);
  8648. let lView;
  8649. if (isLView(patchedData)) {
  8650. const contextLView = patchedData;
  8651. const nodeIndex = findViaComponent(contextLView, componentInstance);
  8652. lView = getComponentLViewByIndex(nodeIndex, contextLView);
  8653. const context2 = createLContext(contextLView, nodeIndex, lView[HOST]);
  8654. context2.component = componentInstance;
  8655. attachPatchData(componentInstance, context2);
  8656. attachPatchData(context2.native, context2);
  8657. } else {
  8658. const context2 = patchedData;
  8659. const contextLView = context2.lView;
  8660. ngDevMode && assertLView(contextLView);
  8661. lView = getComponentLViewByIndex(context2.nodeIndex, contextLView);
  8662. }
  8663. return lView;
  8664. }
  8665. var MONKEY_PATCH_KEY_NAME = "__ngContext__";
  8666. function attachPatchData(target, data) {
  8667. ngDevMode && assertDefined(target, "Target expected");
  8668. if (isLView(data)) {
  8669. target[MONKEY_PATCH_KEY_NAME] = data[ID];
  8670. registerLView(data);
  8671. } else {
  8672. target[MONKEY_PATCH_KEY_NAME] = data;
  8673. }
  8674. }
  8675. function readPatchedData(target) {
  8676. ngDevMode && assertDefined(target, "Target expected");
  8677. const data = target[MONKEY_PATCH_KEY_NAME];
  8678. return typeof data === "number" ? getLViewById(data) : data || null;
  8679. }
  8680. function readPatchedLView(target) {
  8681. const value = readPatchedData(target);
  8682. if (value) {
  8683. return isLView(value) ? value : value.lView;
  8684. }
  8685. return null;
  8686. }
  8687. function isComponentInstance(instance) {
  8688. return instance && instance.constructor && instance.constructor.ɵcmp;
  8689. }
  8690. function isDirectiveInstance(instance) {
  8691. return instance && instance.constructor && instance.constructor.ɵdir;
  8692. }
  8693. function findViaNativeElement(lView, target) {
  8694. const tView = lView[TVIEW];
  8695. for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
  8696. if (unwrapRNode(lView[i]) === target) {
  8697. return i;
  8698. }
  8699. }
  8700. return -1;
  8701. }
  8702. function traverseNextElement(tNode) {
  8703. if (tNode.child) {
  8704. return tNode.child;
  8705. } else if (tNode.next) {
  8706. return tNode.next;
  8707. } else {
  8708. while (tNode.parent && !tNode.parent.next) {
  8709. tNode = tNode.parent;
  8710. }
  8711. return tNode.parent && tNode.parent.next;
  8712. }
  8713. }
  8714. function findViaComponent(lView, componentInstance) {
  8715. const componentIndices = lView[TVIEW].components;
  8716. if (componentIndices) {
  8717. for (let i = 0; i < componentIndices.length; i++) {
  8718. const elementComponentIndex = componentIndices[i];
  8719. const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
  8720. if (componentView[CONTEXT] === componentInstance) {
  8721. return elementComponentIndex;
  8722. }
  8723. }
  8724. } else {
  8725. const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
  8726. const rootComponent = rootComponentView[CONTEXT];
  8727. if (rootComponent === componentInstance) {
  8728. return HEADER_OFFSET;
  8729. }
  8730. }
  8731. return -1;
  8732. }
  8733. function findViaDirective(lView, directiveInstance) {
  8734. let tNode = lView[TVIEW].firstChild;
  8735. while (tNode) {
  8736. const directiveIndexStart = tNode.directiveStart;
  8737. const directiveIndexEnd = tNode.directiveEnd;
  8738. for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
  8739. if (lView[i] === directiveInstance) {
  8740. return tNode.index;
  8741. }
  8742. }
  8743. tNode = traverseNextElement(tNode);
  8744. }
  8745. return -1;
  8746. }
  8747. function getDirectivesAtNodeIndex(nodeIndex, lView) {
  8748. const tNode = lView[TVIEW].data[nodeIndex];
  8749. if (tNode.directiveStart === 0) return EMPTY_ARRAY;
  8750. const results = [];
  8751. for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
  8752. const directiveInstance = lView[i];
  8753. if (!isComponentInstance(directiveInstance)) {
  8754. results.push(directiveInstance);
  8755. }
  8756. }
  8757. return results;
  8758. }
  8759. function getComponentAtNodeIndex(nodeIndex, lView) {
  8760. const tNode = lView[TVIEW].data[nodeIndex];
  8761. return isComponentHost(tNode) ? lView[tNode.directiveStart + tNode.componentOffset] : null;
  8762. }
  8763. function discoverLocalRefs(lView, nodeIndex) {
  8764. const tNode = lView[TVIEW].data[nodeIndex];
  8765. if (tNode && tNode.localNames) {
  8766. const result = {};
  8767. let localIndex = tNode.index + 1;
  8768. for (let i = 0; i < tNode.localNames.length; i += 2) {
  8769. result[tNode.localNames[i]] = lView[localIndex];
  8770. localIndex++;
  8771. }
  8772. return result;
  8773. }
  8774. return null;
  8775. }
  8776. function getRootView(componentOrLView) {
  8777. ngDevMode && assertDefined(componentOrLView, "component");
  8778. let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
  8779. while (lView && !isRootView(lView)) {
  8780. lView = getLViewParent(lView);
  8781. }
  8782. ngDevMode && assertLView(lView);
  8783. return lView;
  8784. }
  8785. function getRootContext(viewOrComponent) {
  8786. const rootView = getRootView(viewOrComponent);
  8787. ngDevMode && assertDefined(rootView[CONTEXT], "Root view has no context. Perhaps it is disconnected?");
  8788. return rootView[CONTEXT];
  8789. }
  8790. function getFirstLContainer(lView) {
  8791. return getNearestLContainer(lView[CHILD_HEAD]);
  8792. }
  8793. function getNextLContainer(container) {
  8794. return getNearestLContainer(container[NEXT]);
  8795. }
  8796. function getNearestLContainer(viewOrContainer) {
  8797. while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {
  8798. viewOrContainer = viewOrContainer[NEXT];
  8799. }
  8800. return viewOrContainer;
  8801. }
  8802. function getComponent(element) {
  8803. ngDevMode && assertDomElement(element);
  8804. const context2 = getLContext(element);
  8805. if (context2 === null) return null;
  8806. if (context2.component === void 0) {
  8807. const lView = context2.lView;
  8808. if (lView === null) {
  8809. return null;
  8810. }
  8811. context2.component = getComponentAtNodeIndex(context2.nodeIndex, lView);
  8812. }
  8813. return context2.component;
  8814. }
  8815. function getContext(element) {
  8816. assertDomElement(element);
  8817. const context2 = getLContext(element);
  8818. const lView = context2 ? context2.lView : null;
  8819. return lView === null ? null : lView[CONTEXT];
  8820. }
  8821. function getOwningComponent(elementOrDir) {
  8822. const context2 = getLContext(elementOrDir);
  8823. let lView = context2 ? context2.lView : null;
  8824. if (lView === null) return null;
  8825. let parent;
  8826. while (lView[TVIEW].type === 2 && (parent = getLViewParent(lView))) {
  8827. lView = parent;
  8828. }
  8829. return isRootView(lView) ? null : lView[CONTEXT];
  8830. }
  8831. function getRootComponents(elementOrDir) {
  8832. const lView = readPatchedLView(elementOrDir);
  8833. return lView !== null ? [getRootContext(lView)] : [];
  8834. }
  8835. function getInjector(elementOrDir) {
  8836. const context2 = getLContext(elementOrDir);
  8837. const lView = context2 ? context2.lView : null;
  8838. if (lView === null) return Injector.NULL;
  8839. const tNode = lView[TVIEW].data[context2.nodeIndex];
  8840. return new NodeInjector(tNode, lView);
  8841. }
  8842. function getInjectionTokens(element) {
  8843. const context2 = getLContext(element);
  8844. const lView = context2 ? context2.lView : null;
  8845. if (lView === null) return [];
  8846. const tView = lView[TVIEW];
  8847. const tNode = tView.data[context2.nodeIndex];
  8848. const providerTokens = [];
  8849. const startIndex = tNode.providerIndexes & 1048575;
  8850. const endIndex = tNode.directiveEnd;
  8851. for (let i = startIndex; i < endIndex; i++) {
  8852. let value = tView.data[i];
  8853. if (isDirectiveDefHack(value)) {
  8854. value = value.type;
  8855. }
  8856. providerTokens.push(value);
  8857. }
  8858. return providerTokens;
  8859. }
  8860. function getDirectives(node) {
  8861. if (node instanceof Text) {
  8862. return [];
  8863. }
  8864. const context2 = getLContext(node);
  8865. const lView = context2 ? context2.lView : null;
  8866. if (lView === null) {
  8867. return [];
  8868. }
  8869. const tView = lView[TVIEW];
  8870. const nodeIndex = context2.nodeIndex;
  8871. if (!tView?.data[nodeIndex]) {
  8872. return [];
  8873. }
  8874. if (context2.directives === void 0) {
  8875. context2.directives = getDirectivesAtNodeIndex(nodeIndex, lView);
  8876. }
  8877. return context2.directives === null ? [] : [...context2.directives];
  8878. }
  8879. function getDirectiveMetadata$1(directiveOrComponentInstance) {
  8880. const {
  8881. constructor
  8882. } = directiveOrComponentInstance;
  8883. if (!constructor) {
  8884. throw new Error("Unable to find the instance constructor");
  8885. }
  8886. const componentDef = getComponentDef(constructor);
  8887. if (componentDef) {
  8888. const inputs = extractInputDebugMetadata(componentDef.inputs);
  8889. return {
  8890. inputs,
  8891. outputs: componentDef.outputs,
  8892. encapsulation: componentDef.encapsulation,
  8893. changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush : ChangeDetectionStrategy.Default
  8894. };
  8895. }
  8896. const directiveDef = getDirectiveDef(constructor);
  8897. if (directiveDef) {
  8898. const inputs = extractInputDebugMetadata(directiveDef.inputs);
  8899. return {
  8900. inputs,
  8901. outputs: directiveDef.outputs
  8902. };
  8903. }
  8904. return null;
  8905. }
  8906. function getLocalRefs(target) {
  8907. const context2 = getLContext(target);
  8908. if (context2 === null) return {};
  8909. if (context2.localRefs === void 0) {
  8910. const lView = context2.lView;
  8911. if (lView === null) {
  8912. return {};
  8913. }
  8914. context2.localRefs = discoverLocalRefs(lView, context2.nodeIndex);
  8915. }
  8916. return context2.localRefs || {};
  8917. }
  8918. function getHostElement(componentOrDirective) {
  8919. return getLContext(componentOrDirective).native;
  8920. }
  8921. function getListeners(element) {
  8922. ngDevMode && assertDomElement(element);
  8923. const lContext = getLContext(element);
  8924. const lView = lContext === null ? null : lContext.lView;
  8925. if (lView === null) return [];
  8926. const tView = lView[TVIEW];
  8927. const lCleanup = lView[CLEANUP];
  8928. const tCleanup = tView.cleanup;
  8929. const listeners = [];
  8930. if (tCleanup && lCleanup) {
  8931. for (let i = 0; i < tCleanup.length; ) {
  8932. const firstParam = tCleanup[i++];
  8933. const secondParam = tCleanup[i++];
  8934. if (typeof firstParam === "string") {
  8935. const name = firstParam;
  8936. const listenerElement = unwrapRNode(lView[secondParam]);
  8937. const callback = lCleanup[tCleanup[i++]];
  8938. const useCaptureOrIndx = tCleanup[i++];
  8939. const type = typeof useCaptureOrIndx === "boolean" || useCaptureOrIndx >= 0 ? "dom" : "output";
  8940. const useCapture = typeof useCaptureOrIndx === "boolean" ? useCaptureOrIndx : false;
  8941. if (element == listenerElement) {
  8942. listeners.push({
  8943. element,
  8944. name,
  8945. callback,
  8946. useCapture,
  8947. type
  8948. });
  8949. }
  8950. }
  8951. }
  8952. }
  8953. listeners.sort(sortListeners);
  8954. return listeners;
  8955. }
  8956. function sortListeners(a, b) {
  8957. if (a.name == b.name) return 0;
  8958. return a.name < b.name ? -1 : 1;
  8959. }
  8960. function isDirectiveDefHack(obj) {
  8961. return obj.type !== void 0 && obj.declaredInputs !== void 0 && obj.findHostDirectiveDefs !== void 0;
  8962. }
  8963. function assertDomElement(value) {
  8964. if (typeof Element !== "undefined" && !(value instanceof Element)) {
  8965. throw new Error("Expecting instance of DOM Element");
  8966. }
  8967. }
  8968. function extractInputDebugMetadata(inputs) {
  8969. const res = {};
  8970. for (const key in inputs) {
  8971. if (inputs.hasOwnProperty(key)) {
  8972. const value = inputs[key];
  8973. if (value !== void 0) {
  8974. res[key] = value[0];
  8975. }
  8976. }
  8977. }
  8978. return res;
  8979. }
  8980. var DOCUMENT = void 0;
  8981. function setDocument(document2) {
  8982. DOCUMENT = document2;
  8983. }
  8984. function getDocument() {
  8985. if (DOCUMENT !== void 0) {
  8986. return DOCUMENT;
  8987. } else if (typeof document !== "undefined") {
  8988. return document;
  8989. }
  8990. throw new RuntimeError(210, (typeof ngDevMode === "undefined" || ngDevMode) && `The document object is not available in this context. Make sure the DOCUMENT injection token is provided.`);
  8991. }
  8992. var APP_ID = new InjectionToken(ngDevMode ? "AppId" : "", {
  8993. providedIn: "root",
  8994. factory: () => DEFAULT_APP_ID
  8995. });
  8996. var DEFAULT_APP_ID = "ng";
  8997. var PLATFORM_INITIALIZER = new InjectionToken(ngDevMode ? "Platform Initializer" : "");
  8998. var PLATFORM_ID = new InjectionToken(ngDevMode ? "Platform ID" : "", {
  8999. providedIn: "platform",
  9000. factory: () => "unknown"
  9001. // set a default platform name, when none set explicitly
  9002. });
  9003. var PACKAGE_ROOT_URL = new InjectionToken(ngDevMode ? "Application Packages Root URL" : "");
  9004. var ANIMATION_MODULE_TYPE = new InjectionToken(ngDevMode ? "AnimationModuleType" : "");
  9005. var CSP_NONCE = new InjectionToken(ngDevMode ? "CSP nonce" : "", {
  9006. providedIn: "root",
  9007. factory: () => {
  9008. return getDocument().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce") || null;
  9009. }
  9010. });
  9011. var IMAGE_CONFIG_DEFAULTS = {
  9012. breakpoints: [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840],
  9013. placeholderResolution: 30,
  9014. disableImageSizeWarning: false,
  9015. disableImageLazyLoadWarning: false
  9016. };
  9017. var IMAGE_CONFIG = new InjectionToken(ngDevMode ? "ImageConfig" : "", {
  9018. providedIn: "root",
  9019. factory: () => IMAGE_CONFIG_DEFAULTS
  9020. });
  9021. function makeStateKey(key) {
  9022. return key;
  9023. }
  9024. function initTransferState() {
  9025. const transferState = new TransferState();
  9026. if (true) {
  9027. transferState.store = retrieveTransferredState(getDocument(), inject(APP_ID));
  9028. }
  9029. return transferState;
  9030. }
  9031. var TransferState = class _TransferState {
  9032. /** @nocollapse */
  9033. static ɵprov = (
  9034. /** @pureOrBreakMyCode */
  9035. ɵɵdefineInjectable({
  9036. token: _TransferState,
  9037. providedIn: "root",
  9038. factory: initTransferState
  9039. })
  9040. );
  9041. /** @internal */
  9042. store = {};
  9043. onSerializeCallbacks = {};
  9044. /**
  9045. * Get the value corresponding to a key. Return `defaultValue` if key is not found.
  9046. */
  9047. get(key, defaultValue) {
  9048. return this.store[key] !== void 0 ? this.store[key] : defaultValue;
  9049. }
  9050. /**
  9051. * Set the value corresponding to a key.
  9052. */
  9053. set(key, value) {
  9054. this.store[key] = value;
  9055. }
  9056. /**
  9057. * Remove a key from the store.
  9058. */
  9059. remove(key) {
  9060. delete this.store[key];
  9061. }
  9062. /**
  9063. * Test whether a key exists in the store.
  9064. */
  9065. hasKey(key) {
  9066. return this.store.hasOwnProperty(key);
  9067. }
  9068. /**
  9069. * Indicates whether the state is empty.
  9070. */
  9071. get isEmpty() {
  9072. return Object.keys(this.store).length === 0;
  9073. }
  9074. /**
  9075. * Register a callback to provide the value for a key when `toJson` is called.
  9076. */
  9077. onSerialize(key, callback) {
  9078. this.onSerializeCallbacks[key] = callback;
  9079. }
  9080. /**
  9081. * Serialize the current state of the store to JSON.
  9082. */
  9083. toJson() {
  9084. for (const key in this.onSerializeCallbacks) {
  9085. if (this.onSerializeCallbacks.hasOwnProperty(key)) {
  9086. try {
  9087. this.store[key] = this.onSerializeCallbacks[key]();
  9088. } catch (e) {
  9089. console.warn("Exception in onSerialize callback: ", e);
  9090. }
  9091. }
  9092. }
  9093. return JSON.stringify(this.store).replace(/</g, "\\u003C");
  9094. }
  9095. };
  9096. function retrieveTransferredState(doc, appId) {
  9097. const script = doc.getElementById(appId + "-state");
  9098. if (script?.textContent) {
  9099. try {
  9100. return JSON.parse(script.textContent);
  9101. } catch (e) {
  9102. console.warn("Exception while restoring TransferState for app " + appId, e);
  9103. }
  9104. }
  9105. return {};
  9106. }
  9107. var REFERENCE_NODE_HOST = "h";
  9108. var REFERENCE_NODE_BODY = "b";
  9109. var NODE_NAVIGATION_STEP_FIRST_CHILD = "f";
  9110. var NODE_NAVIGATION_STEP_NEXT_SIBLING = "n";
  9111. var ELEMENT_CONTAINERS = "e";
  9112. var TEMPLATES = "t";
  9113. var CONTAINERS = "c";
  9114. var MULTIPLIER = "x";
  9115. var NUM_ROOT_NODES = "r";
  9116. var TEMPLATE_ID = "i";
  9117. var NODES = "n";
  9118. var DISCONNECTED_NODES = "d";
  9119. var I18N_DATA = "l";
  9120. var DEFER_BLOCK_ID = "di";
  9121. var DEFER_BLOCK_STATE$1 = "s";
  9122. var DEFER_PARENT_BLOCK_ID = "p";
  9123. var DEFER_HYDRATE_TRIGGERS = "t";
  9124. var IS_HYDRATION_DOM_REUSE_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_HYDRATION_DOM_REUSE_ENABLED" : "");
  9125. var PRESERVE_HOST_CONTENT_DEFAULT = false;
  9126. var PRESERVE_HOST_CONTENT = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "PRESERVE_HOST_CONTENT" : "", {
  9127. providedIn: "root",
  9128. factory: () => PRESERVE_HOST_CONTENT_DEFAULT
  9129. });
  9130. var IS_I18N_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_I18N_HYDRATION_ENABLED" : "");
  9131. var IS_EVENT_REPLAY_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_EVENT_REPLAY_ENABLED" : "");
  9132. var EVENT_REPLAY_ENABLED_DEFAULT = false;
  9133. var IS_INCREMENTAL_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_INCREMENTAL_HYDRATION_ENABLED" : "");
  9134. var JSACTION_BLOCK_ELEMENT_MAP = new InjectionToken(ngDevMode ? "JSACTION_BLOCK_ELEMENT_MAP" : "", {
  9135. providedIn: "root",
  9136. factory: () => /* @__PURE__ */ new Map()
  9137. });
  9138. var TracingAction;
  9139. (function(TracingAction2) {
  9140. TracingAction2[TracingAction2["CHANGE_DETECTION"] = 0] = "CHANGE_DETECTION";
  9141. TracingAction2[TracingAction2["AFTER_NEXT_RENDER"] = 1] = "AFTER_NEXT_RENDER";
  9142. })(TracingAction || (TracingAction = {}));
  9143. var TracingService = new InjectionToken(ngDevMode ? "TracingService" : "");
  9144. var markedFeatures = /* @__PURE__ */ new Set();
  9145. function performanceMarkFeature(feature) {
  9146. if (markedFeatures.has(feature)) {
  9147. return;
  9148. }
  9149. markedFeatures.add(feature);
  9150. performance?.mark?.("mark_feature_usage", {
  9151. detail: {
  9152. feature
  9153. }
  9154. });
  9155. }
  9156. function assertNotInReactiveContext(debugFn, extraContext) {
  9157. if (getActiveConsumer() !== null) {
  9158. throw new RuntimeError(-602, ngDevMode && `${debugFn.name}() cannot be called from within a reactive context.${extraContext ? ` ${extraContext}` : ""}`);
  9159. }
  9160. }
  9161. var ViewContext = class {
  9162. view;
  9163. node;
  9164. constructor(view, node) {
  9165. this.view = view;
  9166. this.node = node;
  9167. }
  9168. /**
  9169. * @internal
  9170. * @nocollapse
  9171. */
  9172. static __NG_ELEMENT_ID__ = injectViewContext;
  9173. };
  9174. function injectViewContext() {
  9175. return new ViewContext(getLView(), getCurrentTNode());
  9176. }
  9177. var AfterRenderPhase;
  9178. (function(AfterRenderPhase2) {
  9179. AfterRenderPhase2[AfterRenderPhase2["EarlyRead"] = 0] = "EarlyRead";
  9180. AfterRenderPhase2[AfterRenderPhase2["Write"] = 1] = "Write";
  9181. AfterRenderPhase2[AfterRenderPhase2["MixedReadWrite"] = 2] = "MixedReadWrite";
  9182. AfterRenderPhase2[AfterRenderPhase2["Read"] = 3] = "Read";
  9183. })(AfterRenderPhase || (AfterRenderPhase = {}));
  9184. var AfterRenderManager = class _AfterRenderManager {
  9185. impl = null;
  9186. execute() {
  9187. this.impl?.execute();
  9188. }
  9189. /** @nocollapse */
  9190. static ɵprov = (
  9191. /** @pureOrBreakMyCode */
  9192. ɵɵdefineInjectable({
  9193. token: _AfterRenderManager,
  9194. providedIn: "root",
  9195. factory: () => new _AfterRenderManager()
  9196. })
  9197. );
  9198. };
  9199. var AFTER_RENDER_PHASES = (() => [AfterRenderPhase.EarlyRead, AfterRenderPhase.Write, AfterRenderPhase.MixedReadWrite, AfterRenderPhase.Read])();
  9200. var AfterRenderImpl = class _AfterRenderImpl {
  9201. ngZone = inject(NgZone);
  9202. scheduler = inject(ChangeDetectionScheduler);
  9203. errorHandler = inject(ErrorHandler, {
  9204. optional: true
  9205. });
  9206. /** Current set of active sequences. */
  9207. sequences = /* @__PURE__ */ new Set();
  9208. /** Tracks registrations made during the current set of executions. */
  9209. deferredRegistrations = /* @__PURE__ */ new Set();
  9210. /** Whether the `AfterRenderManager` is currently executing hooks. */
  9211. executing = false;
  9212. constructor() {
  9213. inject(TracingService, {
  9214. optional: true
  9215. });
  9216. }
  9217. /**
  9218. * Run the sequence of phases of hooks, once through. As a result of executing some hooks, more
  9219. * might be scheduled.
  9220. */
  9221. execute() {
  9222. const hasSequencesToExecute = this.sequences.size > 0;
  9223. if (hasSequencesToExecute) {
  9224. profiler(
  9225. 16
  9226. /* ProfilerEvent.AfterRenderHooksStart */
  9227. );
  9228. }
  9229. this.executing = true;
  9230. for (const phase of AFTER_RENDER_PHASES) {
  9231. for (const sequence of this.sequences) {
  9232. if (sequence.erroredOrDestroyed || !sequence.hooks[phase]) {
  9233. continue;
  9234. }
  9235. try {
  9236. sequence.pipelinedValue = this.ngZone.runOutsideAngular(() => this.maybeTrace(() => {
  9237. const hookFn = sequence.hooks[phase];
  9238. const value = hookFn(sequence.pipelinedValue);
  9239. return value;
  9240. }, sequence.snapshot));
  9241. } catch (err) {
  9242. sequence.erroredOrDestroyed = true;
  9243. this.errorHandler?.handleError(err);
  9244. }
  9245. }
  9246. }
  9247. this.executing = false;
  9248. for (const sequence of this.sequences) {
  9249. sequence.afterRun();
  9250. if (sequence.once) {
  9251. this.sequences.delete(sequence);
  9252. sequence.destroy();
  9253. }
  9254. }
  9255. for (const sequence of this.deferredRegistrations) {
  9256. this.sequences.add(sequence);
  9257. }
  9258. if (this.deferredRegistrations.size > 0) {
  9259. this.scheduler.notify(
  9260. 7
  9261. /* NotificationSource.RenderHook */
  9262. );
  9263. }
  9264. this.deferredRegistrations.clear();
  9265. if (hasSequencesToExecute) {
  9266. profiler(
  9267. 17
  9268. /* ProfilerEvent.AfterRenderHooksEnd */
  9269. );
  9270. }
  9271. }
  9272. register(sequence) {
  9273. const {
  9274. view
  9275. } = sequence;
  9276. if (view !== void 0) {
  9277. (view[AFTER_RENDER_SEQUENCES_TO_ADD] ??= []).push(sequence);
  9278. markAncestorsForTraversal(view);
  9279. view[FLAGS] |= 8192;
  9280. } else if (!this.executing) {
  9281. this.addSequence(sequence);
  9282. } else {
  9283. this.deferredRegistrations.add(sequence);
  9284. }
  9285. }
  9286. addSequence(sequence) {
  9287. this.sequences.add(sequence);
  9288. this.scheduler.notify(
  9289. 7
  9290. /* NotificationSource.RenderHook */
  9291. );
  9292. }
  9293. unregister(sequence) {
  9294. if (this.executing && this.sequences.has(sequence)) {
  9295. sequence.erroredOrDestroyed = true;
  9296. sequence.pipelinedValue = void 0;
  9297. sequence.once = true;
  9298. } else {
  9299. this.sequences.delete(sequence);
  9300. this.deferredRegistrations.delete(sequence);
  9301. }
  9302. }
  9303. maybeTrace(fn, snapshot) {
  9304. return snapshot ? snapshot.run(TracingAction.AFTER_NEXT_RENDER, fn) : fn();
  9305. }
  9306. /** @nocollapse */
  9307. static ɵprov = (
  9308. /** @pureOrBreakMyCode */
  9309. ɵɵdefineInjectable({
  9310. token: _AfterRenderImpl,
  9311. providedIn: "root",
  9312. factory: () => new _AfterRenderImpl()
  9313. })
  9314. );
  9315. };
  9316. var AfterRenderSequence = class {
  9317. impl;
  9318. hooks;
  9319. view;
  9320. once;
  9321. snapshot;
  9322. /**
  9323. * Whether this sequence errored or was destroyed during this execution, and hooks should no
  9324. * longer run for it.
  9325. */
  9326. erroredOrDestroyed = false;
  9327. /**
  9328. * The value returned by the last hook execution (if any), ready to be pipelined into the next
  9329. * one.
  9330. */
  9331. pipelinedValue = void 0;
  9332. unregisterOnDestroy;
  9333. constructor(impl, hooks, view, once, destroyRef, snapshot = null) {
  9334. this.impl = impl;
  9335. this.hooks = hooks;
  9336. this.view = view;
  9337. this.once = once;
  9338. this.snapshot = snapshot;
  9339. this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
  9340. }
  9341. afterRun() {
  9342. this.erroredOrDestroyed = false;
  9343. this.pipelinedValue = void 0;
  9344. this.snapshot?.dispose();
  9345. this.snapshot = null;
  9346. }
  9347. destroy() {
  9348. this.impl.unregister(this);
  9349. this.unregisterOnDestroy?.();
  9350. const scheduled2 = this.view?.[AFTER_RENDER_SEQUENCES_TO_ADD];
  9351. if (scheduled2) {
  9352. this.view[AFTER_RENDER_SEQUENCES_TO_ADD] = scheduled2.filter((s) => s !== this);
  9353. }
  9354. }
  9355. };
  9356. function afterRender(callbackOrSpec, options) {
  9357. ngDevMode && assertNotInReactiveContext(afterRender, "Call `afterRender` outside of a reactive context. For example, schedule the render callback inside the component constructor`.");
  9358. !options?.injector && assertInInjectionContext(afterRender);
  9359. const injector = options?.injector ?? inject(Injector);
  9360. if (false) {
  9361. return NOOP_AFTER_RENDER_REF;
  9362. }
  9363. performanceMarkFeature("NgAfterRender");
  9364. return afterRenderImpl(
  9365. callbackOrSpec,
  9366. injector,
  9367. options,
  9368. /* once */
  9369. false
  9370. );
  9371. }
  9372. function afterNextRender(callbackOrSpec, options) {
  9373. !options?.injector && assertInInjectionContext(afterNextRender);
  9374. const injector = options?.injector ?? inject(Injector);
  9375. if (false) {
  9376. return NOOP_AFTER_RENDER_REF;
  9377. }
  9378. performanceMarkFeature("NgAfterNextRender");
  9379. return afterRenderImpl(
  9380. callbackOrSpec,
  9381. injector,
  9382. options,
  9383. /* once */
  9384. true
  9385. );
  9386. }
  9387. function getHooks(callbackOrSpec, phase) {
  9388. if (callbackOrSpec instanceof Function) {
  9389. const hooks = [void 0, void 0, void 0, void 0];
  9390. hooks[phase] = callbackOrSpec;
  9391. return hooks;
  9392. } else {
  9393. return [callbackOrSpec.earlyRead, callbackOrSpec.write, callbackOrSpec.mixedReadWrite, callbackOrSpec.read];
  9394. }
  9395. }
  9396. function afterRenderImpl(callbackOrSpec, injector, options, once) {
  9397. const manager = injector.get(AfterRenderManager);
  9398. manager.impl ??= injector.get(AfterRenderImpl);
  9399. const tracing = injector.get(TracingService, null, {
  9400. optional: true
  9401. });
  9402. const hooks = options?.phase ?? AfterRenderPhase.MixedReadWrite;
  9403. const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
  9404. const viewContext = injector.get(ViewContext, null, {
  9405. optional: true
  9406. });
  9407. const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec, hooks), viewContext?.view, once, destroyRef, tracing?.snapshot(null));
  9408. manager.impl.register(sequence);
  9409. return sequence;
  9410. }
  9411. var DeferDependenciesLoadingState;
  9412. (function(DeferDependenciesLoadingState2) {
  9413. DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["NOT_STARTED"] = 0] = "NOT_STARTED";
  9414. DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["IN_PROGRESS"] = 1] = "IN_PROGRESS";
  9415. DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["COMPLETE"] = 2] = "COMPLETE";
  9416. DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["FAILED"] = 3] = "FAILED";
  9417. })(DeferDependenciesLoadingState || (DeferDependenciesLoadingState = {}));
  9418. var MINIMUM_SLOT = 0;
  9419. var LOADING_AFTER_SLOT = 1;
  9420. var DeferBlockState;
  9421. (function(DeferBlockState2) {
  9422. DeferBlockState2[DeferBlockState2["Placeholder"] = 0] = "Placeholder";
  9423. DeferBlockState2[DeferBlockState2["Loading"] = 1] = "Loading";
  9424. DeferBlockState2[DeferBlockState2["Complete"] = 2] = "Complete";
  9425. DeferBlockState2[DeferBlockState2["Error"] = 3] = "Error";
  9426. })(DeferBlockState || (DeferBlockState = {}));
  9427. var DeferBlockInternalState;
  9428. (function(DeferBlockInternalState2) {
  9429. DeferBlockInternalState2[DeferBlockInternalState2["Initial"] = -1] = "Initial";
  9430. })(DeferBlockInternalState || (DeferBlockInternalState = {}));
  9431. var NEXT_DEFER_BLOCK_STATE = 0;
  9432. var DEFER_BLOCK_STATE = 1;
  9433. var STATE_IS_FROZEN_UNTIL = 2;
  9434. var LOADING_AFTER_CLEANUP_FN = 3;
  9435. var TRIGGER_CLEANUP_FNS = 4;
  9436. var PREFETCH_TRIGGER_CLEANUP_FNS = 5;
  9437. var SSR_UNIQUE_ID = 6;
  9438. var SSR_BLOCK_STATE = 7;
  9439. var ON_COMPLETE_FNS = 8;
  9440. var HYDRATE_TRIGGER_CLEANUP_FNS = 9;
  9441. var DeferBlockBehavior;
  9442. (function(DeferBlockBehavior2) {
  9443. DeferBlockBehavior2[DeferBlockBehavior2["Manual"] = 0] = "Manual";
  9444. DeferBlockBehavior2[DeferBlockBehavior2["Playthrough"] = 1] = "Playthrough";
  9445. })(DeferBlockBehavior || (DeferBlockBehavior = {}));
  9446. function storeTriggerCleanupFn(type, lDetails, cleanupFn) {
  9447. const key = getCleanupFnKeyByType(type);
  9448. if (lDetails[key] === null) {
  9449. lDetails[key] = [];
  9450. }
  9451. lDetails[key].push(cleanupFn);
  9452. }
  9453. function invokeTriggerCleanupFns(type, lDetails) {
  9454. const key = getCleanupFnKeyByType(type);
  9455. const cleanupFns = lDetails[key];
  9456. if (cleanupFns !== null) {
  9457. for (const cleanupFn of cleanupFns) {
  9458. cleanupFn();
  9459. }
  9460. lDetails[key] = null;
  9461. }
  9462. }
  9463. function invokeAllTriggerCleanupFns(lDetails) {
  9464. invokeTriggerCleanupFns(1, lDetails);
  9465. invokeTriggerCleanupFns(0, lDetails);
  9466. invokeTriggerCleanupFns(2, lDetails);
  9467. }
  9468. function getCleanupFnKeyByType(type) {
  9469. let key = TRIGGER_CLEANUP_FNS;
  9470. if (type === 1) {
  9471. key = PREFETCH_TRIGGER_CLEANUP_FNS;
  9472. } else if (type === 2) {
  9473. key = HYDRATE_TRIGGER_CLEANUP_FNS;
  9474. }
  9475. return key;
  9476. }
  9477. function getDeferBlockDataIndex(deferBlockIndex) {
  9478. return deferBlockIndex + 1;
  9479. }
  9480. function getLDeferBlockDetails(lView, tNode) {
  9481. const tView = lView[TVIEW];
  9482. const slotIndex = getDeferBlockDataIndex(tNode.index);
  9483. ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  9484. return lView[slotIndex];
  9485. }
  9486. function setLDeferBlockDetails(lView, deferBlockIndex, lDetails) {
  9487. const tView = lView[TVIEW];
  9488. const slotIndex = getDeferBlockDataIndex(deferBlockIndex);
  9489. ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  9490. lView[slotIndex] = lDetails;
  9491. }
  9492. function getTDeferBlockDetails(tView, tNode) {
  9493. const slotIndex = getDeferBlockDataIndex(tNode.index);
  9494. ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  9495. return tView.data[slotIndex];
  9496. }
  9497. function setTDeferBlockDetails(tView, deferBlockIndex, deferBlockConfig) {
  9498. const slotIndex = getDeferBlockDataIndex(deferBlockIndex);
  9499. ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  9500. tView.data[slotIndex] = deferBlockConfig;
  9501. }
  9502. function getTemplateIndexForState(newState, hostLView, tNode) {
  9503. const tView = hostLView[TVIEW];
  9504. const tDetails = getTDeferBlockDetails(tView, tNode);
  9505. switch (newState) {
  9506. case DeferBlockState.Complete:
  9507. return tDetails.primaryTmplIndex;
  9508. case DeferBlockState.Loading:
  9509. return tDetails.loadingTmplIndex;
  9510. case DeferBlockState.Error:
  9511. return tDetails.errorTmplIndex;
  9512. case DeferBlockState.Placeholder:
  9513. return tDetails.placeholderTmplIndex;
  9514. default:
  9515. ngDevMode && throwError2(`Unexpected defer block state: ${newState}`);
  9516. return null;
  9517. }
  9518. }
  9519. function getMinimumDurationForState(tDetails, currentState) {
  9520. if (currentState === DeferBlockState.Placeholder) {
  9521. return tDetails.placeholderBlockConfig?.[MINIMUM_SLOT] ?? null;
  9522. } else if (currentState === DeferBlockState.Loading) {
  9523. return tDetails.loadingBlockConfig?.[MINIMUM_SLOT] ?? null;
  9524. }
  9525. return null;
  9526. }
  9527. function getLoadingBlockAfter(tDetails) {
  9528. return tDetails.loadingBlockConfig?.[LOADING_AFTER_SLOT] ?? null;
  9529. }
  9530. function addDepsToRegistry(currentDeps, newDeps) {
  9531. if (!currentDeps || currentDeps.length === 0) {
  9532. return newDeps;
  9533. }
  9534. const currentDepSet = new Set(currentDeps);
  9535. for (const dep of newDeps) {
  9536. currentDepSet.add(dep);
  9537. }
  9538. return currentDeps.length === currentDepSet.size ? currentDeps : Array.from(currentDepSet);
  9539. }
  9540. function getPrimaryBlockTNode(tView, tDetails) {
  9541. const adjustedIndex = tDetails.primaryTmplIndex + HEADER_OFFSET;
  9542. return getTNode(tView, adjustedIndex);
  9543. }
  9544. function assertDeferredDependenciesLoaded(tDetails) {
  9545. assertEqual(tDetails.loadingState, DeferDependenciesLoadingState.COMPLETE, "Expecting all deferred dependencies to be loaded.");
  9546. }
  9547. function isTDeferBlockDetails(value) {
  9548. return value !== null && typeof value === "object" && typeof value.primaryTmplIndex === "number";
  9549. }
  9550. function isDeferBlock(tView, tNode) {
  9551. let tDetails = null;
  9552. const slotIndex = getDeferBlockDataIndex(tNode.index);
  9553. if (HEADER_OFFSET < slotIndex && slotIndex < tView.bindingStartIndex) {
  9554. tDetails = getTDeferBlockDetails(tView, tNode);
  9555. }
  9556. return !!tDetails && isTDeferBlockDetails(tDetails);
  9557. }
  9558. function trackTriggerForDebugging(tView, tNode, textRepresentation) {
  9559. const tDetails = getTDeferBlockDetails(tView, tNode);
  9560. tDetails.debug ??= {};
  9561. tDetails.debug.triggers ??= /* @__PURE__ */ new Set();
  9562. tDetails.debug.triggers.add(textRepresentation);
  9563. }
  9564. var eventListenerOptions = {
  9565. passive: true,
  9566. capture: true
  9567. };
  9568. var hoverTriggers = /* @__PURE__ */ new WeakMap();
  9569. var interactionTriggers = /* @__PURE__ */ new WeakMap();
  9570. var viewportTriggers = /* @__PURE__ */ new WeakMap();
  9571. var interactionEventNames = ["click", "keydown"];
  9572. var hoverEventNames = ["mouseenter", "mouseover", "focusin"];
  9573. var intersectionObserver = null;
  9574. var observedViewportElements = 0;
  9575. var DeferEventEntry = class {
  9576. callbacks = /* @__PURE__ */ new Set();
  9577. listener = () => {
  9578. for (const callback of this.callbacks) {
  9579. callback();
  9580. }
  9581. };
  9582. };
  9583. function onInteraction(trigger, callback) {
  9584. let entry = interactionTriggers.get(trigger);
  9585. if (!entry) {
  9586. entry = new DeferEventEntry();
  9587. interactionTriggers.set(trigger, entry);
  9588. for (const name of interactionEventNames) {
  9589. trigger.addEventListener(name, entry.listener, eventListenerOptions);
  9590. }
  9591. }
  9592. entry.callbacks.add(callback);
  9593. return () => {
  9594. const {
  9595. callbacks,
  9596. listener
  9597. } = entry;
  9598. callbacks.delete(callback);
  9599. if (callbacks.size === 0) {
  9600. interactionTriggers.delete(trigger);
  9601. for (const name of interactionEventNames) {
  9602. trigger.removeEventListener(name, listener, eventListenerOptions);
  9603. }
  9604. }
  9605. };
  9606. }
  9607. function onHover(trigger, callback) {
  9608. let entry = hoverTriggers.get(trigger);
  9609. if (!entry) {
  9610. entry = new DeferEventEntry();
  9611. hoverTriggers.set(trigger, entry);
  9612. for (const name of hoverEventNames) {
  9613. trigger.addEventListener(name, entry.listener, eventListenerOptions);
  9614. }
  9615. }
  9616. entry.callbacks.add(callback);
  9617. return () => {
  9618. const {
  9619. callbacks,
  9620. listener
  9621. } = entry;
  9622. callbacks.delete(callback);
  9623. if (callbacks.size === 0) {
  9624. for (const name of hoverEventNames) {
  9625. trigger.removeEventListener(name, listener, eventListenerOptions);
  9626. }
  9627. hoverTriggers.delete(trigger);
  9628. }
  9629. };
  9630. }
  9631. function onViewport(trigger, callback, injector) {
  9632. const ngZone = injector.get(NgZone);
  9633. let entry = viewportTriggers.get(trigger);
  9634. intersectionObserver = intersectionObserver || ngZone.runOutsideAngular(() => {
  9635. return new IntersectionObserver((entries) => {
  9636. for (const current of entries) {
  9637. if (current.isIntersecting && viewportTriggers.has(current.target)) {
  9638. ngZone.run(viewportTriggers.get(current.target).listener);
  9639. }
  9640. }
  9641. });
  9642. });
  9643. if (!entry) {
  9644. entry = new DeferEventEntry();
  9645. ngZone.runOutsideAngular(() => intersectionObserver.observe(trigger));
  9646. viewportTriggers.set(trigger, entry);
  9647. observedViewportElements++;
  9648. }
  9649. entry.callbacks.add(callback);
  9650. return () => {
  9651. if (!viewportTriggers.has(trigger)) {
  9652. return;
  9653. }
  9654. entry.callbacks.delete(callback);
  9655. if (entry.callbacks.size === 0) {
  9656. intersectionObserver?.unobserve(trigger);
  9657. viewportTriggers.delete(trigger);
  9658. observedViewportElements--;
  9659. }
  9660. if (observedViewportElements === 0) {
  9661. intersectionObserver?.disconnect();
  9662. intersectionObserver = null;
  9663. }
  9664. };
  9665. }
  9666. function getTriggerLView(deferredHostLView, deferredTNode, walkUpTimes) {
  9667. if (walkUpTimes == null) {
  9668. return deferredHostLView;
  9669. }
  9670. if (walkUpTimes >= 0) {
  9671. return walkUpViews(walkUpTimes, deferredHostLView);
  9672. }
  9673. const deferredContainer = deferredHostLView[deferredTNode.index];
  9674. ngDevMode && assertLContainer(deferredContainer);
  9675. const triggerLView = deferredContainer[CONTAINER_HEADER_OFFSET] ?? null;
  9676. if (ngDevMode && triggerLView !== null) {
  9677. const lDetails = getLDeferBlockDetails(deferredHostLView, deferredTNode);
  9678. const renderedState = lDetails[DEFER_BLOCK_STATE];
  9679. assertEqual(renderedState, DeferBlockState.Placeholder, "Expected a placeholder to be rendered in this defer block.");
  9680. assertLView(triggerLView);
  9681. }
  9682. return triggerLView;
  9683. }
  9684. function getTriggerElement(triggerLView, triggerIndex) {
  9685. const element = getNativeByIndex(HEADER_OFFSET + triggerIndex, triggerLView);
  9686. ngDevMode && assertElement(element);
  9687. return element;
  9688. }
  9689. function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, registerFn, callback, type) {
  9690. const injector = initialLView[INJECTOR];
  9691. const zone = injector.get(NgZone);
  9692. let poll;
  9693. function pollDomTrigger() {
  9694. if (isDestroyed(initialLView)) {
  9695. poll.destroy();
  9696. return;
  9697. }
  9698. const lDetails = getLDeferBlockDetails(initialLView, tNode);
  9699. const renderedState = lDetails[DEFER_BLOCK_STATE];
  9700. if (renderedState !== DeferBlockInternalState.Initial && renderedState !== DeferBlockState.Placeholder) {
  9701. poll.destroy();
  9702. return;
  9703. }
  9704. const triggerLView = getTriggerLView(initialLView, tNode, walkUpTimes);
  9705. if (!triggerLView) {
  9706. return;
  9707. }
  9708. poll.destroy();
  9709. if (isDestroyed(triggerLView)) {
  9710. return;
  9711. }
  9712. const element = getTriggerElement(triggerLView, triggerIndex);
  9713. const cleanup = registerFn(element, () => {
  9714. zone.run(() => {
  9715. if (initialLView !== triggerLView) {
  9716. removeLViewOnDestroy(triggerLView, cleanup);
  9717. }
  9718. callback();
  9719. });
  9720. }, injector);
  9721. if (initialLView !== triggerLView) {
  9722. storeLViewOnDestroy(triggerLView, cleanup);
  9723. }
  9724. storeTriggerCleanupFn(type, lDetails, cleanup);
  9725. }
  9726. poll = afterRender({
  9727. read: pollDomTrigger
  9728. }, {
  9729. injector
  9730. });
  9731. }
  9732. var DEFER_BLOCK_SSR_ID_ATTRIBUTE = "ngb";
  9733. function setJSActionAttributes(nativeElement, eventTypes, parentDeferBlockId = null) {
  9734. if (eventTypes.length === 0 || nativeElement.nodeType !== Node.ELEMENT_NODE) {
  9735. return;
  9736. }
  9737. const existingAttr = nativeElement.getAttribute(Attribute.JSACTION);
  9738. const parts = eventTypes.reduce((prev, curr) => {
  9739. return (existingAttr?.indexOf(curr) ?? -1) === -1 ? prev + curr + ":;" : prev;
  9740. }, "");
  9741. nativeElement.setAttribute(Attribute.JSACTION, `${existingAttr ?? ""}${parts}`);
  9742. const blockName = parentDeferBlockId ?? "";
  9743. if (blockName !== "" && parts.length > 0) {
  9744. nativeElement.setAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE, blockName);
  9745. }
  9746. }
  9747. var sharedStashFunction = (rEl, eventType, listenerFn) => {
  9748. const el = rEl;
  9749. const eventListenerMap = el.__jsaction_fns ?? /* @__PURE__ */ new Map();
  9750. const eventListeners = eventListenerMap.get(eventType) ?? [];
  9751. eventListeners.push(listenerFn);
  9752. eventListenerMap.set(eventType, eventListeners);
  9753. el.__jsaction_fns = eventListenerMap;
  9754. };
  9755. var sharedMapFunction = (rEl, jsActionMap) => {
  9756. const el = rEl;
  9757. let blockName = el.getAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE) ?? "";
  9758. const blockSet = jsActionMap.get(blockName) ?? /* @__PURE__ */ new Set();
  9759. if (!blockSet.has(el)) {
  9760. blockSet.add(el);
  9761. }
  9762. jsActionMap.set(blockName, blockSet);
  9763. };
  9764. function removeListenersFromBlocks(blockNames, jsActionMap) {
  9765. if (blockNames.length > 0) {
  9766. let blockList = [];
  9767. for (let blockName of blockNames) {
  9768. if (jsActionMap.has(blockName)) {
  9769. blockList = [...blockList, ...jsActionMap.get(blockName)];
  9770. }
  9771. }
  9772. const replayList = new Set(blockList);
  9773. replayList.forEach(removeListeners);
  9774. }
  9775. }
  9776. var removeListeners = (el) => {
  9777. el.removeAttribute(Attribute.JSACTION);
  9778. el.removeAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE);
  9779. el.__jsaction_fns = void 0;
  9780. };
  9781. var JSACTION_EVENT_CONTRACT = new InjectionToken(ngDevMode ? "EVENT_CONTRACT_DETAILS" : "", {
  9782. providedIn: "root",
  9783. factory: () => ({})
  9784. });
  9785. function invokeListeners(event, currentTarget) {
  9786. const handlerFns = currentTarget?.__jsaction_fns?.get(event.type);
  9787. if (!handlerFns || !currentTarget?.isConnected) {
  9788. return;
  9789. }
  9790. for (const handler of handlerFns) {
  9791. handler(event);
  9792. }
  9793. }
  9794. var DEHYDRATED_BLOCK_REGISTRY = new InjectionToken(ngDevMode ? "DEHYDRATED_BLOCK_REGISTRY" : "");
  9795. var DehydratedBlockRegistry = class _DehydratedBlockRegistry {
  9796. registry = /* @__PURE__ */ new Map();
  9797. cleanupFns = /* @__PURE__ */ new Map();
  9798. jsActionMap = inject(JSACTION_BLOCK_ELEMENT_MAP);
  9799. contract = inject(JSACTION_EVENT_CONTRACT);
  9800. add(blockId, info) {
  9801. this.registry.set(blockId, info);
  9802. if (this.awaitingCallbacks.has(blockId)) {
  9803. const awaitingCallbacks = this.awaitingCallbacks.get(blockId);
  9804. for (const cb of awaitingCallbacks) {
  9805. cb();
  9806. }
  9807. }
  9808. }
  9809. get(blockId) {
  9810. return this.registry.get(blockId) ?? null;
  9811. }
  9812. has(blockId) {
  9813. return this.registry.has(blockId);
  9814. }
  9815. cleanup(hydratedBlocks) {
  9816. removeListenersFromBlocks(hydratedBlocks, this.jsActionMap);
  9817. for (let blockId of hydratedBlocks) {
  9818. this.registry.delete(blockId);
  9819. this.jsActionMap.delete(blockId);
  9820. this.invokeTriggerCleanupFns(blockId);
  9821. this.hydrating.delete(blockId);
  9822. this.awaitingCallbacks.delete(blockId);
  9823. }
  9824. if (this.size === 0) {
  9825. this.contract.instance?.cleanUp();
  9826. }
  9827. }
  9828. get size() {
  9829. return this.registry.size;
  9830. }
  9831. // we have to leave the lowest block Id in the registry
  9832. // unless that block has no children
  9833. addCleanupFn(blockId, fn) {
  9834. let cleanupFunctions = [];
  9835. if (this.cleanupFns.has(blockId)) {
  9836. cleanupFunctions = this.cleanupFns.get(blockId);
  9837. }
  9838. cleanupFunctions.push(fn);
  9839. this.cleanupFns.set(blockId, cleanupFunctions);
  9840. }
  9841. invokeTriggerCleanupFns(blockId) {
  9842. const fns = this.cleanupFns.get(blockId) ?? [];
  9843. for (let fn of fns) {
  9844. fn();
  9845. }
  9846. this.cleanupFns.delete(blockId);
  9847. }
  9848. // Blocks that are being hydrated.
  9849. hydrating = /* @__PURE__ */ new Map();
  9850. // Blocks that are awaiting a defer instruction finish.
  9851. awaitingCallbacks = /* @__PURE__ */ new Map();
  9852. awaitParentBlock(topmostParentBlock, callback) {
  9853. const parentBlockAwaitCallbacks = this.awaitingCallbacks.get(topmostParentBlock) ?? [];
  9854. parentBlockAwaitCallbacks.push(callback);
  9855. this.awaitingCallbacks.set(topmostParentBlock, parentBlockAwaitCallbacks);
  9856. }
  9857. /** @nocollapse */
  9858. static ɵprov = (
  9859. /** @pureOrBreakMyCode */
  9860. ɵɵdefineInjectable({
  9861. token: _DehydratedBlockRegistry,
  9862. providedIn: null,
  9863. factory: () => new _DehydratedBlockRegistry()
  9864. })
  9865. );
  9866. };
  9867. var TRANSFER_STATE_TOKEN_ID = "__nghData__";
  9868. var NGH_DATA_KEY = makeStateKey(TRANSFER_STATE_TOKEN_ID);
  9869. var TRANSFER_STATE_DEFER_BLOCKS_INFO = "__nghDeferData__";
  9870. var NGH_DEFER_BLOCKS_KEY = makeStateKey(TRANSFER_STATE_DEFER_BLOCKS_INFO);
  9871. var NGH_ATTR_NAME = "ngh";
  9872. var SSR_CONTENT_INTEGRITY_MARKER = "nghm";
  9873. var _retrieveHydrationInfoImpl = () => null;
  9874. function retrieveHydrationInfoImpl(rNode, injector, isRootView2 = false) {
  9875. let nghAttrValue = rNode.getAttribute(NGH_ATTR_NAME);
  9876. if (nghAttrValue == null) return null;
  9877. const [componentViewNgh, rootViewNgh] = nghAttrValue.split("|");
  9878. nghAttrValue = isRootView2 ? rootViewNgh : componentViewNgh;
  9879. if (!nghAttrValue) return null;
  9880. const rootNgh = rootViewNgh ? `|${rootViewNgh}` : "";
  9881. const remainingNgh = isRootView2 ? componentViewNgh : rootNgh;
  9882. let data = {};
  9883. if (nghAttrValue !== "") {
  9884. const transferState = injector.get(TransferState, null, {
  9885. optional: true
  9886. });
  9887. if (transferState !== null) {
  9888. const nghData = transferState.get(NGH_DATA_KEY, []);
  9889. data = nghData[Number(nghAttrValue)];
  9890. ngDevMode && assertDefined(data, "Unable to retrieve hydration info from the TransferState.");
  9891. }
  9892. }
  9893. const dehydratedView = {
  9894. data,
  9895. firstChild: rNode.firstChild ?? null
  9896. };
  9897. if (isRootView2) {
  9898. dehydratedView.firstChild = rNode;
  9899. setSegmentHead(dehydratedView, 0, rNode.nextSibling);
  9900. }
  9901. if (remainingNgh) {
  9902. rNode.setAttribute(NGH_ATTR_NAME, remainingNgh);
  9903. } else {
  9904. rNode.removeAttribute(NGH_ATTR_NAME);
  9905. }
  9906. ngDevMode && markRNodeAsClaimedByHydration(
  9907. rNode,
  9908. /* checkIfAlreadyClaimed */
  9909. false
  9910. );
  9911. ngDevMode && ngDevMode.hydratedComponents++;
  9912. return dehydratedView;
  9913. }
  9914. function enableRetrieveHydrationInfoImpl() {
  9915. _retrieveHydrationInfoImpl = retrieveHydrationInfoImpl;
  9916. }
  9917. function retrieveHydrationInfo(rNode, injector, isRootView2 = false) {
  9918. return _retrieveHydrationInfoImpl(rNode, injector, isRootView2);
  9919. }
  9920. function getLNodeForHydration(viewRef) {
  9921. let lView = viewRef._lView;
  9922. const tView = lView[TVIEW];
  9923. if (tView.type === 2) {
  9924. return null;
  9925. }
  9926. if (isRootView(lView)) {
  9927. lView = lView[HEADER_OFFSET];
  9928. }
  9929. return lView;
  9930. }
  9931. function getTextNodeContent(node) {
  9932. return node.textContent?.replace(/\s/gm, "");
  9933. }
  9934. function processTextNodeMarkersBeforeHydration(node) {
  9935. const doc = getDocument();
  9936. const commentNodesIterator = doc.createNodeIterator(node, NodeFilter.SHOW_COMMENT, {
  9937. acceptNode(node2) {
  9938. const content = getTextNodeContent(node2);
  9939. const isTextNodeMarker = content === "ngetn" || content === "ngtns";
  9940. return isTextNodeMarker ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
  9941. }
  9942. });
  9943. let currentNode;
  9944. const nodes = [];
  9945. while (currentNode = commentNodesIterator.nextNode()) {
  9946. nodes.push(currentNode);
  9947. }
  9948. for (const node2 of nodes) {
  9949. if (node2.textContent === "ngetn") {
  9950. node2.replaceWith(doc.createTextNode(""));
  9951. } else {
  9952. node2.remove();
  9953. }
  9954. }
  9955. }
  9956. var HydrationStatus;
  9957. (function(HydrationStatus2) {
  9958. HydrationStatus2["Hydrated"] = "hydrated";
  9959. HydrationStatus2["Skipped"] = "skipped";
  9960. HydrationStatus2["Mismatched"] = "mismatched";
  9961. })(HydrationStatus || (HydrationStatus = {}));
  9962. var HYDRATION_INFO_KEY = "__ngDebugHydrationInfo__";
  9963. function patchHydrationInfo(node, info) {
  9964. node[HYDRATION_INFO_KEY] = info;
  9965. }
  9966. function readHydrationInfo(node) {
  9967. return node[HYDRATION_INFO_KEY] ?? null;
  9968. }
  9969. function markRNodeAsClaimedByHydration(node, checkIfAlreadyClaimed = true) {
  9970. if (!ngDevMode) {
  9971. throw new Error("Calling `markRNodeAsClaimedByHydration` in prod mode is not supported and likely a mistake.");
  9972. }
  9973. if (checkIfAlreadyClaimed && isRNodeClaimedForHydration(node)) {
  9974. throw new Error("Trying to claim a node, which was claimed already.");
  9975. }
  9976. patchHydrationInfo(node, {
  9977. status: HydrationStatus.Hydrated
  9978. });
  9979. ngDevMode.hydratedNodes++;
  9980. }
  9981. function markRNodeAsSkippedByHydration(node) {
  9982. if (!ngDevMode) {
  9983. throw new Error("Calling `markRNodeAsSkippedByHydration` in prod mode is not supported and likely a mistake.");
  9984. }
  9985. patchHydrationInfo(node, {
  9986. status: HydrationStatus.Skipped
  9987. });
  9988. ngDevMode.componentsSkippedHydration++;
  9989. }
  9990. function countBlocksSkippedByHydration(injector) {
  9991. const transferState = injector.get(TransferState);
  9992. const nghDeferData = transferState.get(NGH_DEFER_BLOCKS_KEY, {});
  9993. if (ngDevMode) {
  9994. ngDevMode.deferBlocksWithIncrementalHydration = Object.keys(nghDeferData).length;
  9995. }
  9996. }
  9997. function markRNodeAsHavingHydrationMismatch(node, expectedNodeDetails = null, actualNodeDetails = null) {
  9998. if (!ngDevMode) {
  9999. throw new Error("Calling `markRNodeAsMismatchedByHydration` in prod mode is not supported and likely a mistake.");
  10000. }
  10001. while (node && !getComponent(node)) {
  10002. node = node?.parentNode;
  10003. }
  10004. if (node) {
  10005. patchHydrationInfo(node, {
  10006. status: HydrationStatus.Mismatched,
  10007. expectedNodeDetails,
  10008. actualNodeDetails
  10009. });
  10010. }
  10011. }
  10012. function isRNodeClaimedForHydration(node) {
  10013. return readHydrationInfo(node)?.status === HydrationStatus.Hydrated;
  10014. }
  10015. function setSegmentHead(hydrationInfo, index, node) {
  10016. hydrationInfo.segmentHeads ??= {};
  10017. hydrationInfo.segmentHeads[index] = node;
  10018. }
  10019. function getSegmentHead(hydrationInfo, index) {
  10020. return hydrationInfo.segmentHeads?.[index] ?? null;
  10021. }
  10022. function isIncrementalHydrationEnabled(injector) {
  10023. return injector.get(IS_INCREMENTAL_HYDRATION_ENABLED, false, {
  10024. optional: true
  10025. });
  10026. }
  10027. function assertIncrementalHydrationIsConfigured(injector) {
  10028. if (!isIncrementalHydrationEnabled(injector)) {
  10029. throw new RuntimeError(508, "Angular has detected that some `@defer` blocks use `hydrate` triggers, but incremental hydration was not enabled. Please ensure that the `withIncrementalHydration()` call is added as an argument for the `provideClientHydration()` function call in your application config.");
  10030. }
  10031. }
  10032. function assertSsrIdDefined(ssrUniqueId) {
  10033. assertDefined(ssrUniqueId, "Internal error: expecting an SSR id for a defer block that should be hydrated, but the id is not present");
  10034. }
  10035. function getNgContainerSize(hydrationInfo, index) {
  10036. const data = hydrationInfo.data;
  10037. let size = data[ELEMENT_CONTAINERS]?.[index] ?? null;
  10038. if (size === null && data[CONTAINERS]?.[index]) {
  10039. size = calcSerializedContainerSize(hydrationInfo, index);
  10040. }
  10041. return size;
  10042. }
  10043. function isSerializedElementContainer(hydrationInfo, index) {
  10044. return hydrationInfo.data[ELEMENT_CONTAINERS]?.[index] !== void 0;
  10045. }
  10046. function getSerializedContainerViews(hydrationInfo, index) {
  10047. return hydrationInfo.data[CONTAINERS]?.[index] ?? null;
  10048. }
  10049. function calcSerializedContainerSize(hydrationInfo, index) {
  10050. const views = getSerializedContainerViews(hydrationInfo, index) ?? [];
  10051. let numNodes = 0;
  10052. for (let view of views) {
  10053. numNodes += view[NUM_ROOT_NODES] * (view[MULTIPLIER] ?? 1);
  10054. }
  10055. return numNodes;
  10056. }
  10057. function initDisconnectedNodes(hydrationInfo) {
  10058. if (typeof hydrationInfo.disconnectedNodes === "undefined") {
  10059. const nodeIds = hydrationInfo.data[DISCONNECTED_NODES];
  10060. hydrationInfo.disconnectedNodes = nodeIds ? new Set(nodeIds) : null;
  10061. }
  10062. return hydrationInfo.disconnectedNodes;
  10063. }
  10064. function isDisconnectedNode$1(hydrationInfo, index) {
  10065. if (typeof hydrationInfo.disconnectedNodes === "undefined") {
  10066. const nodeIds = hydrationInfo.data[DISCONNECTED_NODES];
  10067. hydrationInfo.disconnectedNodes = nodeIds ? new Set(nodeIds) : null;
  10068. }
  10069. return !!initDisconnectedNodes(hydrationInfo)?.has(index);
  10070. }
  10071. function processTextNodeBeforeSerialization(context2, node) {
  10072. const el = node;
  10073. const corruptedTextNodes = context2.corruptedTextNodes;
  10074. if (el.textContent === "") {
  10075. corruptedTextNodes.set(
  10076. el,
  10077. "ngetn"
  10078. /* TextNodeMarker.EmptyNode */
  10079. );
  10080. } else if (el.nextSibling?.nodeType === Node.TEXT_NODE) {
  10081. corruptedTextNodes.set(
  10082. el,
  10083. "ngtns"
  10084. /* TextNodeMarker.Separator */
  10085. );
  10086. }
  10087. }
  10088. function convertHydrateTriggersToJsAction(triggers) {
  10089. let actionList = [];
  10090. if (triggers !== null) {
  10091. if (triggers.has(
  10092. 4
  10093. /* DeferBlockTrigger.Hover */
  10094. )) {
  10095. actionList.push(...hoverEventNames);
  10096. }
  10097. if (triggers.has(
  10098. 3
  10099. /* DeferBlockTrigger.Interaction */
  10100. )) {
  10101. actionList.push(...interactionEventNames);
  10102. }
  10103. }
  10104. return actionList;
  10105. }
  10106. function getParentBlockHydrationQueue(deferBlockId, injector) {
  10107. const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  10108. const transferState = injector.get(TransferState);
  10109. const deferBlockParents = transferState.get(NGH_DEFER_BLOCKS_KEY, {});
  10110. let isTopMostDeferBlock = false;
  10111. let currentBlockId = deferBlockId;
  10112. let parentBlockPromise = null;
  10113. const hydrationQueue = [];
  10114. while (!isTopMostDeferBlock && currentBlockId) {
  10115. ngDevMode && assertEqual(hydrationQueue.indexOf(currentBlockId), -1, "Internal error: defer block hierarchy has a cycle.");
  10116. isTopMostDeferBlock = dehydratedBlockRegistry.has(currentBlockId);
  10117. const hydratingParentBlock = dehydratedBlockRegistry.hydrating.get(currentBlockId);
  10118. if (parentBlockPromise === null && hydratingParentBlock != null) {
  10119. parentBlockPromise = hydratingParentBlock.promise;
  10120. break;
  10121. }
  10122. hydrationQueue.unshift(currentBlockId);
  10123. currentBlockId = deferBlockParents[currentBlockId][DEFER_PARENT_BLOCK_ID];
  10124. }
  10125. return {
  10126. parentBlockPromise,
  10127. hydrationQueue
  10128. };
  10129. }
  10130. function gatherDeferBlocksByJSActionAttribute(doc) {
  10131. const jsactionNodes = doc.body.querySelectorAll("[jsaction]");
  10132. const blockMap = /* @__PURE__ */ new Set();
  10133. for (let node of jsactionNodes) {
  10134. const attr = node.getAttribute("jsaction");
  10135. const blockId = node.getAttribute("ngb");
  10136. const eventTypes = [...hoverEventNames.join(":;"), ...interactionEventNames.join(":;")].join("|");
  10137. if (attr?.match(eventTypes) && blockId !== null) {
  10138. blockMap.add(node);
  10139. }
  10140. }
  10141. return blockMap;
  10142. }
  10143. function appendDeferBlocksToJSActionMap(doc, injector) {
  10144. const blockMap = gatherDeferBlocksByJSActionAttribute(doc);
  10145. for (let rNode of blockMap) {
  10146. const jsActionMap = injector.get(JSACTION_BLOCK_ELEMENT_MAP);
  10147. sharedMapFunction(rNode, jsActionMap);
  10148. }
  10149. }
  10150. var _retrieveDeferBlockDataImpl = () => {
  10151. return {};
  10152. };
  10153. function retrieveDeferBlockDataImpl(injector) {
  10154. const transferState = injector.get(TransferState, null, {
  10155. optional: true
  10156. });
  10157. if (transferState !== null) {
  10158. const nghDeferData = transferState.get(NGH_DEFER_BLOCKS_KEY, {});
  10159. ngDevMode && assertDefined(nghDeferData, "Unable to retrieve defer block info from the TransferState.");
  10160. return nghDeferData;
  10161. }
  10162. return {};
  10163. }
  10164. function enableRetrieveDeferBlockDataImpl() {
  10165. _retrieveDeferBlockDataImpl = retrieveDeferBlockDataImpl;
  10166. }
  10167. function retrieveDeferBlockData(injector) {
  10168. return _retrieveDeferBlockDataImpl(injector);
  10169. }
  10170. function isTimerTrigger(triggerInfo) {
  10171. return typeof triggerInfo === "object" && triggerInfo.trigger === 5;
  10172. }
  10173. function getHydrateTimerTrigger(blockData) {
  10174. const trigger = blockData[DEFER_HYDRATE_TRIGGERS]?.find((t) => isTimerTrigger(t));
  10175. return trigger?.delay ?? null;
  10176. }
  10177. function hasHydrateTrigger(blockData, trigger) {
  10178. return blockData[DEFER_HYDRATE_TRIGGERS]?.includes(trigger) ?? false;
  10179. }
  10180. function createBlockSummary(blockInfo) {
  10181. return {
  10182. data: blockInfo,
  10183. hydrate: {
  10184. idle: hasHydrateTrigger(
  10185. blockInfo,
  10186. 0
  10187. /* DeferBlockTrigger.Idle */
  10188. ),
  10189. immediate: hasHydrateTrigger(
  10190. blockInfo,
  10191. 1
  10192. /* DeferBlockTrigger.Immediate */
  10193. ),
  10194. timer: getHydrateTimerTrigger(blockInfo),
  10195. viewport: hasHydrateTrigger(
  10196. blockInfo,
  10197. 2
  10198. /* DeferBlockTrigger.Viewport */
  10199. )
  10200. }
  10201. };
  10202. }
  10203. function processBlockData(injector) {
  10204. const blockData = retrieveDeferBlockData(injector);
  10205. let blockDetails = /* @__PURE__ */ new Map();
  10206. for (let blockId in blockData) {
  10207. blockDetails.set(blockId, createBlockSummary(blockData[blockId]));
  10208. }
  10209. return blockDetails;
  10210. }
  10211. function isSsrContentsIntegrity(node) {
  10212. return !!node && node.nodeType === Node.COMMENT_NODE && node.textContent?.trim() === SSR_CONTENT_INTEGRITY_MARKER;
  10213. }
  10214. function skipTextNodes(node) {
  10215. while (node && node.nodeType === Node.TEXT_NODE) {
  10216. node = node.previousSibling;
  10217. }
  10218. return node;
  10219. }
  10220. function verifySsrContentsIntegrity(doc) {
  10221. for (const node of doc.body.childNodes) {
  10222. if (isSsrContentsIntegrity(node)) {
  10223. return;
  10224. }
  10225. }
  10226. const beforeBody = skipTextNodes(doc.body.previousSibling);
  10227. if (isSsrContentsIntegrity(beforeBody)) {
  10228. return;
  10229. }
  10230. let endOfHead = skipTextNodes(doc.head.lastChild);
  10231. if (isSsrContentsIntegrity(endOfHead)) {
  10232. return;
  10233. }
  10234. throw new RuntimeError(-507, typeof ngDevMode !== "undefined" && ngDevMode && "Angular hydration logic detected that HTML content of this page was modified after it was produced during server side rendering. Make sure that there are no optimizations that remove comment nodes from HTML enabled on your CDN. Angular hydration relies on HTML produced by the server, including whitespaces and comment nodes.");
  10235. }
  10236. function refreshContentQueries(tView, lView) {
  10237. const contentQueries = tView.contentQueries;
  10238. if (contentQueries !== null) {
  10239. const prevConsumer = setActiveConsumer(null);
  10240. try {
  10241. for (let i = 0; i < contentQueries.length; i += 2) {
  10242. const queryStartIdx = contentQueries[i];
  10243. const directiveDefIdx = contentQueries[i + 1];
  10244. if (directiveDefIdx !== -1) {
  10245. const directiveDef = tView.data[directiveDefIdx];
  10246. ngDevMode && assertDefined(directiveDef, "DirectiveDef not found.");
  10247. ngDevMode && assertDefined(directiveDef.contentQueries, "contentQueries function should be defined");
  10248. setCurrentQueryIndex(queryStartIdx);
  10249. directiveDef.contentQueries(2, lView[directiveDefIdx], directiveDefIdx);
  10250. }
  10251. }
  10252. } finally {
  10253. setActiveConsumer(prevConsumer);
  10254. }
  10255. }
  10256. }
  10257. function executeViewQueryFn(flags, viewQueryFn, component) {
  10258. ngDevMode && assertDefined(viewQueryFn, "View queries function to execute must be defined.");
  10259. setCurrentQueryIndex(0);
  10260. const prevConsumer = setActiveConsumer(null);
  10261. try {
  10262. viewQueryFn(flags, component);
  10263. } finally {
  10264. setActiveConsumer(prevConsumer);
  10265. }
  10266. }
  10267. function executeContentQueries(tView, tNode, lView) {
  10268. if (isContentQueryHost(tNode)) {
  10269. const prevConsumer = setActiveConsumer(null);
  10270. try {
  10271. const start = tNode.directiveStart;
  10272. const end = tNode.directiveEnd;
  10273. for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
  10274. const def = tView.data[directiveIndex];
  10275. if (def.contentQueries) {
  10276. const directiveInstance = lView[directiveIndex];
  10277. ngDevMode && assertDefined(directiveIndex, "Incorrect reference to a directive defining a content query");
  10278. def.contentQueries(1, directiveInstance, directiveIndex);
  10279. }
  10280. }
  10281. } finally {
  10282. setActiveConsumer(prevConsumer);
  10283. }
  10284. }
  10285. }
  10286. var ViewEncapsulation;
  10287. (function(ViewEncapsulation2) {
  10288. ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated";
  10289. ViewEncapsulation2[ViewEncapsulation2["None"] = 2] = "None";
  10290. ViewEncapsulation2[ViewEncapsulation2["ShadowDom"] = 3] = "ShadowDom";
  10291. })(ViewEncapsulation || (ViewEncapsulation = {}));
  10292. var policy$1;
  10293. function getPolicy$1() {
  10294. if (policy$1 === void 0) {
  10295. policy$1 = null;
  10296. if (_global.trustedTypes) {
  10297. try {
  10298. policy$1 = _global.trustedTypes.createPolicy("angular", {
  10299. createHTML: (s) => s,
  10300. createScript: (s) => s,
  10301. createScriptURL: (s) => s
  10302. });
  10303. } catch {
  10304. }
  10305. }
  10306. }
  10307. return policy$1;
  10308. }
  10309. function trustedHTMLFromString(html) {
  10310. return getPolicy$1()?.createHTML(html) || html;
  10311. }
  10312. function trustedScriptURLFromString(url) {
  10313. return getPolicy$1()?.createScriptURL(url) || url;
  10314. }
  10315. var policy;
  10316. function getPolicy() {
  10317. if (policy === void 0) {
  10318. policy = null;
  10319. if (_global.trustedTypes) {
  10320. try {
  10321. policy = _global.trustedTypes.createPolicy("angular#unsafe-bypass", {
  10322. createHTML: (s) => s,
  10323. createScript: (s) => s,
  10324. createScriptURL: (s) => s
  10325. });
  10326. } catch {
  10327. }
  10328. }
  10329. }
  10330. return policy;
  10331. }
  10332. function trustedHTMLFromStringBypass(html) {
  10333. return getPolicy()?.createHTML(html) || html;
  10334. }
  10335. function trustedScriptFromStringBypass(script) {
  10336. return getPolicy()?.createScript(script) || script;
  10337. }
  10338. function trustedScriptURLFromStringBypass(url) {
  10339. return getPolicy()?.createScriptURL(url) || url;
  10340. }
  10341. var SafeValueImpl = class {
  10342. changingThisBreaksApplicationSecurity;
  10343. constructor(changingThisBreaksApplicationSecurity) {
  10344. this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
  10345. }
  10346. toString() {
  10347. return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${XSS_SECURITY_URL})`;
  10348. }
  10349. };
  10350. var SafeHtmlImpl = class extends SafeValueImpl {
  10351. getTypeName() {
  10352. return "HTML";
  10353. }
  10354. };
  10355. var SafeStyleImpl = class extends SafeValueImpl {
  10356. getTypeName() {
  10357. return "Style";
  10358. }
  10359. };
  10360. var SafeScriptImpl = class extends SafeValueImpl {
  10361. getTypeName() {
  10362. return "Script";
  10363. }
  10364. };
  10365. var SafeUrlImpl = class extends SafeValueImpl {
  10366. getTypeName() {
  10367. return "URL";
  10368. }
  10369. };
  10370. var SafeResourceUrlImpl = class extends SafeValueImpl {
  10371. getTypeName() {
  10372. return "ResourceURL";
  10373. }
  10374. };
  10375. function unwrapSafeValue(value) {
  10376. return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity : value;
  10377. }
  10378. function allowSanitizationBypassAndThrow(value, type) {
  10379. const actualType = getSanitizationBypassType(value);
  10380. if (actualType != null && actualType !== type) {
  10381. if (actualType === "ResourceURL" && type === "URL") return true;
  10382. throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`);
  10383. }
  10384. return actualType === type;
  10385. }
  10386. function getSanitizationBypassType(value) {
  10387. return value instanceof SafeValueImpl && value.getTypeName() || null;
  10388. }
  10389. function bypassSanitizationTrustHtml(trustedHtml) {
  10390. return new SafeHtmlImpl(trustedHtml);
  10391. }
  10392. function bypassSanitizationTrustStyle(trustedStyle) {
  10393. return new SafeStyleImpl(trustedStyle);
  10394. }
  10395. function bypassSanitizationTrustScript(trustedScript) {
  10396. return new SafeScriptImpl(trustedScript);
  10397. }
  10398. function bypassSanitizationTrustUrl(trustedUrl) {
  10399. return new SafeUrlImpl(trustedUrl);
  10400. }
  10401. function bypassSanitizationTrustResourceUrl(trustedResourceUrl) {
  10402. return new SafeResourceUrlImpl(trustedResourceUrl);
  10403. }
  10404. function getInertBodyHelper(defaultDoc) {
  10405. const inertDocumentHelper = new InertDocumentHelper(defaultDoc);
  10406. return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper;
  10407. }
  10408. var DOMParserHelper = class {
  10409. inertDocumentHelper;
  10410. constructor(inertDocumentHelper) {
  10411. this.inertDocumentHelper = inertDocumentHelper;
  10412. }
  10413. getInertBodyElement(html) {
  10414. html = "<body><remove></remove>" + html;
  10415. try {
  10416. const body = new window.DOMParser().parseFromString(trustedHTMLFromString(html), "text/html").body;
  10417. if (body === null) {
  10418. return this.inertDocumentHelper.getInertBodyElement(html);
  10419. }
  10420. body.firstChild?.remove();
  10421. return body;
  10422. } catch {
  10423. return null;
  10424. }
  10425. }
  10426. };
  10427. var InertDocumentHelper = class {
  10428. defaultDoc;
  10429. inertDocument;
  10430. constructor(defaultDoc) {
  10431. this.defaultDoc = defaultDoc;
  10432. this.inertDocument = this.defaultDoc.implementation.createHTMLDocument("sanitization-inert");
  10433. }
  10434. getInertBodyElement(html) {
  10435. const templateEl = this.inertDocument.createElement("template");
  10436. templateEl.innerHTML = trustedHTMLFromString(html);
  10437. return templateEl;
  10438. }
  10439. };
  10440. function isDOMParserAvailable() {
  10441. try {
  10442. return !!new window.DOMParser().parseFromString(trustedHTMLFromString(""), "text/html");
  10443. } catch {
  10444. return false;
  10445. }
  10446. }
  10447. var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;
  10448. function _sanitizeUrl(url) {
  10449. url = String(url);
  10450. if (url.match(SAFE_URL_PATTERN)) return url;
  10451. if (typeof ngDevMode === "undefined" || ngDevMode) {
  10452. console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`);
  10453. }
  10454. return "unsafe:" + url;
  10455. }
  10456. function tagSet(tags) {
  10457. const res = {};
  10458. for (const t of tags.split(",")) res[t] = true;
  10459. return res;
  10460. }
  10461. function merge3(...sets) {
  10462. const res = {};
  10463. for (const s of sets) {
  10464. for (const v in s) {
  10465. if (s.hasOwnProperty(v)) res[v] = true;
  10466. }
  10467. }
  10468. return res;
  10469. }
  10470. var VOID_ELEMENTS = tagSet("area,br,col,hr,img,wbr");
  10471. var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr");
  10472. var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet("rp,rt");
  10473. var OPTIONAL_END_TAG_ELEMENTS = merge3(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
  10474. var BLOCK_ELEMENTS = merge3(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul"));
  10475. var INLINE_ELEMENTS = merge3(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video"));
  10476. var VALID_ELEMENTS = merge3(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
  10477. var URI_ATTRS = tagSet("background,cite,href,itemtype,longdesc,poster,src,xlink:href");
  10478. var HTML_ATTRS = tagSet("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width");
  10479. var ARIA_ATTRS = tagSet("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext");
  10480. var VALID_ATTRS = merge3(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS);
  10481. var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet("script,style,template");
  10482. var SanitizingHtmlSerializer = class {
  10483. // Explicitly track if something was stripped, to avoid accidentally warning of sanitization just
  10484. // because characters were re-encoded.
  10485. sanitizedSomething = false;
  10486. buf = [];
  10487. sanitizeChildren(el) {
  10488. let current = el.firstChild;
  10489. let traverseContent = true;
  10490. let parentNodes = [];
  10491. while (current) {
  10492. if (current.nodeType === Node.ELEMENT_NODE) {
  10493. traverseContent = this.startElement(current);
  10494. } else if (current.nodeType === Node.TEXT_NODE) {
  10495. this.chars(current.nodeValue);
  10496. } else {
  10497. this.sanitizedSomething = true;
  10498. }
  10499. if (traverseContent && current.firstChild) {
  10500. parentNodes.push(current);
  10501. current = getFirstChild(current);
  10502. continue;
  10503. }
  10504. while (current) {
  10505. if (current.nodeType === Node.ELEMENT_NODE) {
  10506. this.endElement(current);
  10507. }
  10508. let next = getNextSibling(current);
  10509. if (next) {
  10510. current = next;
  10511. break;
  10512. }
  10513. current = parentNodes.pop();
  10514. }
  10515. }
  10516. return this.buf.join("");
  10517. }
  10518. /**
  10519. * Sanitizes an opening element tag (if valid) and returns whether the element's contents should
  10520. * be traversed. Element content must always be traversed (even if the element itself is not
  10521. * valid/safe), unless the element is one of `SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS`.
  10522. *
  10523. * @param element The element to sanitize.
  10524. * @return True if the element's contents should be traversed.
  10525. */
  10526. startElement(element) {
  10527. const tagName = getNodeName(element).toLowerCase();
  10528. if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
  10529. this.sanitizedSomething = true;
  10530. return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName);
  10531. }
  10532. this.buf.push("<");
  10533. this.buf.push(tagName);
  10534. const elAttrs = element.attributes;
  10535. for (let i = 0; i < elAttrs.length; i++) {
  10536. const elAttr = elAttrs.item(i);
  10537. const attrName = elAttr.name;
  10538. const lower = attrName.toLowerCase();
  10539. if (!VALID_ATTRS.hasOwnProperty(lower)) {
  10540. this.sanitizedSomething = true;
  10541. continue;
  10542. }
  10543. let value = elAttr.value;
  10544. if (URI_ATTRS[lower]) value = _sanitizeUrl(value);
  10545. this.buf.push(" ", attrName, '="', encodeEntities(value), '"');
  10546. }
  10547. this.buf.push(">");
  10548. return true;
  10549. }
  10550. endElement(current) {
  10551. const tagName = getNodeName(current).toLowerCase();
  10552. if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
  10553. this.buf.push("</");
  10554. this.buf.push(tagName);
  10555. this.buf.push(">");
  10556. }
  10557. }
  10558. chars(chars) {
  10559. this.buf.push(encodeEntities(chars));
  10560. }
  10561. };
  10562. function isClobberedElement(parentNode, childNode) {
  10563. return (parentNode.compareDocumentPosition(childNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) !== Node.DOCUMENT_POSITION_CONTAINED_BY;
  10564. }
  10565. function getNextSibling(node) {
  10566. const nextSibling = node.nextSibling;
  10567. if (nextSibling && node !== nextSibling.previousSibling) {
  10568. throw clobberedElementError(nextSibling);
  10569. }
  10570. return nextSibling;
  10571. }
  10572. function getFirstChild(node) {
  10573. const firstChild = node.firstChild;
  10574. if (firstChild && isClobberedElement(node, firstChild)) {
  10575. throw clobberedElementError(firstChild);
  10576. }
  10577. return firstChild;
  10578. }
  10579. function getNodeName(node) {
  10580. const nodeName = node.nodeName;
  10581. return typeof nodeName === "string" ? nodeName : "FORM";
  10582. }
  10583. function clobberedElementError(node) {
  10584. return new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`);
  10585. }
  10586. var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  10587. var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
  10588. function encodeEntities(value) {
  10589. return value.replace(/&/g, "&amp;").replace(SURROGATE_PAIR_REGEXP, function(match) {
  10590. const hi = match.charCodeAt(0);
  10591. const low = match.charCodeAt(1);
  10592. return "&#" + ((hi - 55296) * 1024 + (low - 56320) + 65536) + ";";
  10593. }).replace(NON_ALPHANUMERIC_REGEXP, function(match) {
  10594. return "&#" + match.charCodeAt(0) + ";";
  10595. }).replace(/</g, "&lt;").replace(/>/g, "&gt;");
  10596. }
  10597. var inertBodyHelper;
  10598. function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
  10599. let inertBodyElement = null;
  10600. try {
  10601. inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc);
  10602. let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : "";
  10603. inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
  10604. let mXSSAttempts = 5;
  10605. let parsedHtml = unsafeHtml;
  10606. do {
  10607. if (mXSSAttempts === 0) {
  10608. throw new Error("Failed to sanitize html because the input is unstable");
  10609. }
  10610. mXSSAttempts--;
  10611. unsafeHtml = parsedHtml;
  10612. parsedHtml = inertBodyElement.innerHTML;
  10613. inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
  10614. } while (unsafeHtml !== parsedHtml);
  10615. const sanitizer = new SanitizingHtmlSerializer();
  10616. const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
  10617. if ((typeof ngDevMode === "undefined" || ngDevMode) && sanitizer.sanitizedSomething) {
  10618. console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`);
  10619. }
  10620. return trustedHTMLFromString(safeHtml);
  10621. } finally {
  10622. if (inertBodyElement) {
  10623. const parent = getTemplateContent(inertBodyElement) || inertBodyElement;
  10624. while (parent.firstChild) {
  10625. parent.firstChild.remove();
  10626. }
  10627. }
  10628. }
  10629. }
  10630. function getTemplateContent(el) {
  10631. return "content" in el && isTemplateElement(el) ? el.content : null;
  10632. }
  10633. function isTemplateElement(el) {
  10634. return el.nodeType === Node.ELEMENT_NODE && el.nodeName === "TEMPLATE";
  10635. }
  10636. var SecurityContext;
  10637. (function(SecurityContext2) {
  10638. SecurityContext2[SecurityContext2["NONE"] = 0] = "NONE";
  10639. SecurityContext2[SecurityContext2["HTML"] = 1] = "HTML";
  10640. SecurityContext2[SecurityContext2["STYLE"] = 2] = "STYLE";
  10641. SecurityContext2[SecurityContext2["SCRIPT"] = 3] = "SCRIPT";
  10642. SecurityContext2[SecurityContext2["URL"] = 4] = "URL";
  10643. SecurityContext2[SecurityContext2["RESOURCE_URL"] = 5] = "RESOURCE_URL";
  10644. })(SecurityContext || (SecurityContext = {}));
  10645. function ɵɵsanitizeHtml(unsafeHtml) {
  10646. const sanitizer = getSanitizer();
  10647. if (sanitizer) {
  10648. return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || "");
  10649. }
  10650. if (allowSanitizationBypassAndThrow(
  10651. unsafeHtml,
  10652. "HTML"
  10653. /* BypassType.Html */
  10654. )) {
  10655. return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml));
  10656. }
  10657. return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml));
  10658. }
  10659. function ɵɵsanitizeStyle(unsafeStyle) {
  10660. const sanitizer = getSanitizer();
  10661. if (sanitizer) {
  10662. return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || "";
  10663. }
  10664. if (allowSanitizationBypassAndThrow(
  10665. unsafeStyle,
  10666. "Style"
  10667. /* BypassType.Style */
  10668. )) {
  10669. return unwrapSafeValue(unsafeStyle);
  10670. }
  10671. return renderStringify(unsafeStyle);
  10672. }
  10673. function ɵɵsanitizeUrl(unsafeUrl) {
  10674. const sanitizer = getSanitizer();
  10675. if (sanitizer) {
  10676. return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || "";
  10677. }
  10678. if (allowSanitizationBypassAndThrow(
  10679. unsafeUrl,
  10680. "URL"
  10681. /* BypassType.Url */
  10682. )) {
  10683. return unwrapSafeValue(unsafeUrl);
  10684. }
  10685. return _sanitizeUrl(renderStringify(unsafeUrl));
  10686. }
  10687. function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
  10688. const sanitizer = getSanitizer();
  10689. if (sanitizer) {
  10690. return trustedScriptURLFromStringBypass(sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || "");
  10691. }
  10692. if (allowSanitizationBypassAndThrow(
  10693. unsafeResourceUrl,
  10694. "ResourceURL"
  10695. /* BypassType.ResourceUrl */
  10696. )) {
  10697. return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
  10698. }
  10699. throw new RuntimeError(904, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
  10700. }
  10701. function ɵɵsanitizeScript(unsafeScript) {
  10702. const sanitizer = getSanitizer();
  10703. if (sanitizer) {
  10704. return trustedScriptFromStringBypass(sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || "");
  10705. }
  10706. if (allowSanitizationBypassAndThrow(
  10707. unsafeScript,
  10708. "Script"
  10709. /* BypassType.Script */
  10710. )) {
  10711. return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
  10712. }
  10713. throw new RuntimeError(905, ngDevMode && "unsafe value used in a script context");
  10714. }
  10715. function ɵɵtrustConstantHtml(html) {
  10716. if (ngDevMode && (!Array.isArray(html) || !Array.isArray(html.raw) || html.length !== 1)) {
  10717. throw new Error(`Unexpected interpolation in trusted HTML constant: ${html.join("?")}`);
  10718. }
  10719. return trustedHTMLFromString(html[0]);
  10720. }
  10721. function ɵɵtrustConstantResourceUrl(url) {
  10722. if (ngDevMode && (!Array.isArray(url) || !Array.isArray(url.raw) || url.length !== 1)) {
  10723. throw new Error(`Unexpected interpolation in trusted URL constant: ${url.join("?")}`);
  10724. }
  10725. return trustedScriptURLFromString(url[0]);
  10726. }
  10727. function getUrlSanitizer(tag, prop) {
  10728. if (prop === "src" && (tag === "embed" || tag === "frame" || tag === "iframe" || tag === "media" || tag === "script") || prop === "href" && (tag === "base" || tag === "link")) {
  10729. return ɵɵsanitizeResourceUrl;
  10730. }
  10731. return ɵɵsanitizeUrl;
  10732. }
  10733. function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
  10734. return getUrlSanitizer(tag, prop)(unsafeUrl);
  10735. }
  10736. function validateAgainstEventProperties(name) {
  10737. if (name.toLowerCase().startsWith("on")) {
  10738. const errorMessage = `Binding to event property '${name}' is disallowed for security reasons, please use (${name.slice(2)})=...
  10739. If '${name}' is a directive input, make sure the directive is imported by the current module.`;
  10740. throw new RuntimeError(306, errorMessage);
  10741. }
  10742. }
  10743. function validateAgainstEventAttributes(name) {
  10744. if (name.toLowerCase().startsWith("on")) {
  10745. const errorMessage = `Binding to event attribute '${name}' is disallowed for security reasons, please use (${name.slice(2)})=...`;
  10746. throw new RuntimeError(306, errorMessage);
  10747. }
  10748. }
  10749. function getSanitizer() {
  10750. const lView = getLView();
  10751. return lView && lView[ENVIRONMENT].sanitizer;
  10752. }
  10753. var COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
  10754. var COMMENT_DELIMITER = /(<|>)/g;
  10755. var COMMENT_DELIMITER_ESCAPED = "​$1​";
  10756. function escapeCommentText(value) {
  10757. return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
  10758. }
  10759. function normalizeDebugBindingName(name) {
  10760. name = camelCaseToDashCase(name.replace(/[$@]/g, "_"));
  10761. return `ng-reflect-${name}`;
  10762. }
  10763. var CAMEL_CASE_REGEXP = /([A-Z])/g;
  10764. function camelCaseToDashCase(input2) {
  10765. return input2.replace(CAMEL_CASE_REGEXP, (...m) => "-" + m[1].toLowerCase());
  10766. }
  10767. function normalizeDebugBindingValue(value) {
  10768. try {
  10769. return value != null ? value.toString().slice(0, 30) : value;
  10770. } catch (e) {
  10771. return "[ERROR] Exception while trying to serialize the value";
  10772. }
  10773. }
  10774. var CUSTOM_ELEMENTS_SCHEMA = {
  10775. name: "custom-elements"
  10776. };
  10777. var NO_ERRORS_SCHEMA = {
  10778. name: "no-errors-schema"
  10779. };
  10780. var shouldThrowErrorOnUnknownElement = false;
  10781. function ɵsetUnknownElementStrictMode(shouldThrow) {
  10782. shouldThrowErrorOnUnknownElement = shouldThrow;
  10783. }
  10784. function ɵgetUnknownElementStrictMode() {
  10785. return shouldThrowErrorOnUnknownElement;
  10786. }
  10787. var shouldThrowErrorOnUnknownProperty = false;
  10788. function ɵsetUnknownPropertyStrictMode(shouldThrow) {
  10789. shouldThrowErrorOnUnknownProperty = shouldThrow;
  10790. }
  10791. function ɵgetUnknownPropertyStrictMode() {
  10792. return shouldThrowErrorOnUnknownProperty;
  10793. }
  10794. function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
  10795. if (schemas === null) return;
  10796. if (!hasDirectives && tagName !== null) {
  10797. const isUnknown = (
  10798. // Note that we can't check for `typeof HTMLUnknownElement === 'function'` because
  10799. // Domino doesn't expose HTMLUnknownElement globally.
  10800. typeof HTMLUnknownElement !== "undefined" && HTMLUnknownElement && element instanceof HTMLUnknownElement || typeof customElements !== "undefined" && tagName.indexOf("-") > -1 && !customElements.get(tagName)
  10801. );
  10802. if (isUnknown && !matchingSchemas(schemas, tagName)) {
  10803. const isHostStandalone = isHostComponentStandalone(lView);
  10804. const templateLocation = getTemplateLocationDetails(lView);
  10805. const schemas2 = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`;
  10806. let message = `'${tagName}' is not a known element${templateLocation}:
  10807. `;
  10808. message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"}.
  10809. `;
  10810. if (tagName && tagName.indexOf("-") > -1) {
  10811. message += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`;
  10812. } else {
  10813. message += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
  10814. }
  10815. if (shouldThrowErrorOnUnknownElement) {
  10816. throw new RuntimeError(304, message);
  10817. } else {
  10818. console.error(formatRuntimeError(304, message));
  10819. }
  10820. }
  10821. }
  10822. }
  10823. function isPropertyValid(element, propName, tagName, schemas) {
  10824. if (schemas === null) return true;
  10825. if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
  10826. return true;
  10827. }
  10828. return typeof Node === "undefined" || Node === null || !(element instanceof Node);
  10829. }
  10830. function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
  10831. if (!tagName && nodeType === 4) {
  10832. tagName = "ng-template";
  10833. }
  10834. const isHostStandalone = isHostComponentStandalone(lView);
  10835. const templateLocation = getTemplateLocationDetails(lView);
  10836. let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
  10837. const schemas = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`;
  10838. const importLocation = isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared";
  10839. if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
  10840. const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
  10841. message += `
  10842. If the '${propName}' is an Angular control flow directive, please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
  10843. } else {
  10844. message += `
  10845. 1. If '${tagName}' is an Angular component and it has the '${propName}' input, then verify that it is ${importLocation}.`;
  10846. if (tagName && tagName.indexOf("-") > -1) {
  10847. message += `
  10848. 2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
  10849. message += `
  10850. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
  10851. } else {
  10852. message += `
  10853. 2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
  10854. }
  10855. }
  10856. reportUnknownPropertyError(message);
  10857. }
  10858. function reportUnknownPropertyError(message) {
  10859. if (shouldThrowErrorOnUnknownProperty) {
  10860. throw new RuntimeError(303, message);
  10861. } else {
  10862. console.error(formatRuntimeError(303, message));
  10863. }
  10864. }
  10865. function getDeclarationComponentDef(lView) {
  10866. !ngDevMode && throwError2("Must never be called in production mode");
  10867. const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
  10868. const context2 = declarationLView[CONTEXT];
  10869. if (!context2) return null;
  10870. return context2.constructor ? getComponentDef(context2.constructor) : null;
  10871. }
  10872. function isHostComponentStandalone(lView) {
  10873. !ngDevMode && throwError2("Must never be called in production mode");
  10874. const componentDef = getDeclarationComponentDef(lView);
  10875. return !!componentDef?.standalone;
  10876. }
  10877. function getTemplateLocationDetails(lView) {
  10878. !ngDevMode && throwError2("Must never be called in production mode");
  10879. const hostComponentDef = getDeclarationComponentDef(lView);
  10880. const componentClassName = hostComponentDef?.type?.name;
  10881. return componentClassName ? ` (used in the '${componentClassName}' component template)` : "";
  10882. }
  10883. var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([["ngIf", "NgIf"], ["ngFor", "NgFor"], ["ngSwitchCase", "NgSwitchCase"], ["ngSwitchDefault", "NgSwitchDefault"]]);
  10884. function matchingSchemas(schemas, tagName) {
  10885. if (schemas !== null) {
  10886. for (let i = 0; i < schemas.length; i++) {
  10887. const schema = schemas[i];
  10888. if (schema === NO_ERRORS_SCHEMA || schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf("-") > -1) {
  10889. return true;
  10890. }
  10891. }
  10892. }
  10893. return false;
  10894. }
  10895. function ɵɵresolveWindow(element) {
  10896. return element.ownerDocument.defaultView;
  10897. }
  10898. function ɵɵresolveDocument(element) {
  10899. return element.ownerDocument;
  10900. }
  10901. function ɵɵresolveBody(element) {
  10902. return element.ownerDocument.body;
  10903. }
  10904. var INTERPOLATION_DELIMITER = `�`;
  10905. function maybeUnwrapFn(value) {
  10906. if (value instanceof Function) {
  10907. return value();
  10908. } else {
  10909. return value;
  10910. }
  10911. }
  10912. var VALUE_STRING_LENGTH_LIMIT = 200;
  10913. function assertStandaloneComponentType(type) {
  10914. assertComponentDef(type);
  10915. const componentDef = getComponentDef(type);
  10916. if (!componentDef.standalone) {
  10917. throw new RuntimeError(907, `The ${stringifyForError(type)} component is not marked as standalone, but Angular expects to have a standalone component here. Please make sure the ${stringifyForError(type)} component has the \`standalone: true\` flag in the decorator.`);
  10918. }
  10919. }
  10920. function assertComponentDef(type) {
  10921. if (!getComponentDef(type)) {
  10922. throw new RuntimeError(906, `The ${stringifyForError(type)} is not an Angular component, make sure it has the \`@Component\` decorator.`);
  10923. }
  10924. }
  10925. function throwMultipleComponentError(tNode, first2, second) {
  10926. throw new RuntimeError(-300, `Multiple components match node with tagname ${tNode.value}: ${stringifyForError(first2)} and ${stringifyForError(second)}`);
  10927. }
  10928. function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName, lView) {
  10929. const hostComponentDef = getDeclarationComponentDef(lView);
  10930. const componentClassName = hostComponentDef?.type?.name;
  10931. const field = propName ? ` for '${propName}'` : "";
  10932. let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${formatValue(oldValue)}'. Current value: '${formatValue(currValue)}'.${componentClassName ? ` Expression location: ${componentClassName} component` : ""}`;
  10933. if (creationMode) {
  10934. msg += ` It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook?`;
  10935. }
  10936. throw new RuntimeError(-100, msg);
  10937. }
  10938. function formatValue(value) {
  10939. let strValue = String(value);
  10940. try {
  10941. if (Array.isArray(value) || strValue === "[object Object]") {
  10942. strValue = JSON.stringify(value);
  10943. }
  10944. } catch (error) {
  10945. }
  10946. return strValue.length > VALUE_STRING_LENGTH_LIMIT ? strValue.substring(0, VALUE_STRING_LENGTH_LIMIT) + "…" : strValue;
  10947. }
  10948. function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
  10949. const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
  10950. let oldValue = prefix, newValue = prefix;
  10951. for (let i = 0; i < chunks.length; i++) {
  10952. const slotIdx = rootIndex + i;
  10953. oldValue += `${lView[slotIdx]}${chunks[i]}`;
  10954. newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`;
  10955. }
  10956. return {
  10957. propName,
  10958. oldValue,
  10959. newValue
  10960. };
  10961. }
  10962. function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) {
  10963. const tData = lView[TVIEW].data;
  10964. const metadata = tData[bindingIndex];
  10965. if (typeof metadata === "string") {
  10966. if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) {
  10967. return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue);
  10968. }
  10969. return {
  10970. propName: metadata,
  10971. oldValue,
  10972. newValue
  10973. };
  10974. }
  10975. if (metadata === null) {
  10976. let idx = bindingIndex - 1;
  10977. while (typeof tData[idx] !== "string" && tData[idx + 1] === null) {
  10978. idx--;
  10979. }
  10980. const meta = tData[idx];
  10981. if (typeof meta === "string") {
  10982. const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, "g"));
  10983. if (matches && matches.length - 1 > bindingIndex - idx) {
  10984. return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue);
  10985. }
  10986. }
  10987. }
  10988. return {
  10989. propName: void 0,
  10990. oldValue,
  10991. newValue
  10992. };
  10993. }
  10994. function classIndexOf(className, classToSearch, startingIndex) {
  10995. ngDevMode && assertNotEqual(classToSearch, "", 'can not look for "" string.');
  10996. let end = className.length;
  10997. while (true) {
  10998. const foundIndex = className.indexOf(classToSearch, startingIndex);
  10999. if (foundIndex === -1) return foundIndex;
  11000. if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32) {
  11001. const length = classToSearch.length;
  11002. if (foundIndex + length === end || className.charCodeAt(foundIndex + length) <= 32) {
  11003. return foundIndex;
  11004. }
  11005. }
  11006. startingIndex = foundIndex + 1;
  11007. }
  11008. }
  11009. var NG_TEMPLATE_SELECTOR = "ng-template";
  11010. function isCssClassMatching(tNode, attrs, cssClassToMatch, isProjectionMode) {
  11011. ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), "Class name expected to be lowercase.");
  11012. let i = 0;
  11013. if (isProjectionMode) {
  11014. for (; i < attrs.length && typeof attrs[i] === "string"; i += 2) {
  11015. if (attrs[i] === "class" && classIndexOf(attrs[i + 1].toLowerCase(), cssClassToMatch, 0) !== -1) {
  11016. return true;
  11017. }
  11018. }
  11019. } else if (isInlineTemplate(tNode)) {
  11020. return false;
  11021. }
  11022. i = attrs.indexOf(1, i);
  11023. if (i > -1) {
  11024. let item;
  11025. while (++i < attrs.length && typeof (item = attrs[i]) === "string") {
  11026. if (item.toLowerCase() === cssClassToMatch) {
  11027. return true;
  11028. }
  11029. }
  11030. }
  11031. return false;
  11032. }
  11033. function isInlineTemplate(tNode) {
  11034. return tNode.type === 4 && tNode.value !== NG_TEMPLATE_SELECTOR;
  11035. }
  11036. function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) {
  11037. const tagNameToCompare = tNode.type === 4 && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value;
  11038. return currentSelector === tagNameToCompare;
  11039. }
  11040. function isNodeMatchingSelector(tNode, selector, isProjectionMode) {
  11041. ngDevMode && assertDefined(selector[0], "Selector should have a tag name");
  11042. let mode = 4;
  11043. const nodeAttrs = tNode.attrs;
  11044. const nameOnlyMarkerIdx = nodeAttrs !== null ? getNameOnlyMarkerIndex(nodeAttrs) : 0;
  11045. let skipToNextSelector = false;
  11046. for (let i = 0; i < selector.length; i++) {
  11047. const current = selector[i];
  11048. if (typeof current === "number") {
  11049. if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) {
  11050. return false;
  11051. }
  11052. if (skipToNextSelector && isPositive(current)) continue;
  11053. skipToNextSelector = false;
  11054. mode = current | mode & 1;
  11055. continue;
  11056. }
  11057. if (skipToNextSelector) continue;
  11058. if (mode & 4) {
  11059. mode = 2 | mode & 1;
  11060. if (current !== "" && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === "" && selector.length === 1) {
  11061. if (isPositive(mode)) return false;
  11062. skipToNextSelector = true;
  11063. }
  11064. } else if (mode & 8) {
  11065. if (nodeAttrs === null || !isCssClassMatching(tNode, nodeAttrs, current, isProjectionMode)) {
  11066. if (isPositive(mode)) return false;
  11067. skipToNextSelector = true;
  11068. }
  11069. } else {
  11070. const selectorAttrValue = selector[++i];
  11071. const attrIndexInNode = findAttrIndexInNode(current, nodeAttrs, isInlineTemplate(tNode), isProjectionMode);
  11072. if (attrIndexInNode === -1) {
  11073. if (isPositive(mode)) return false;
  11074. skipToNextSelector = true;
  11075. continue;
  11076. }
  11077. if (selectorAttrValue !== "") {
  11078. let nodeAttrValue;
  11079. if (attrIndexInNode > nameOnlyMarkerIdx) {
  11080. nodeAttrValue = "";
  11081. } else {
  11082. ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0, "We do not match directives on namespaced attributes");
  11083. nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase();
  11084. }
  11085. if (mode & 2 && selectorAttrValue !== nodeAttrValue) {
  11086. if (isPositive(mode)) return false;
  11087. skipToNextSelector = true;
  11088. }
  11089. }
  11090. }
  11091. }
  11092. return isPositive(mode) || skipToNextSelector;
  11093. }
  11094. function isPositive(mode) {
  11095. return (mode & 1) === 0;
  11096. }
  11097. function findAttrIndexInNode(name, attrs, isInlineTemplate2, isProjectionMode) {
  11098. if (attrs === null) return -1;
  11099. let i = 0;
  11100. if (isProjectionMode || !isInlineTemplate2) {
  11101. let bindingsMode = false;
  11102. while (i < attrs.length) {
  11103. const maybeAttrName = attrs[i];
  11104. if (maybeAttrName === name) {
  11105. return i;
  11106. } else if (maybeAttrName === 3 || maybeAttrName === 6) {
  11107. bindingsMode = true;
  11108. } else if (maybeAttrName === 1 || maybeAttrName === 2) {
  11109. let value = attrs[++i];
  11110. while (typeof value === "string") {
  11111. value = attrs[++i];
  11112. }
  11113. continue;
  11114. } else if (maybeAttrName === 4) {
  11115. break;
  11116. } else if (maybeAttrName === 0) {
  11117. i += 4;
  11118. continue;
  11119. }
  11120. i += bindingsMode ? 1 : 2;
  11121. }
  11122. return -1;
  11123. } else {
  11124. return matchTemplateAttribute(attrs, name);
  11125. }
  11126. }
  11127. function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) {
  11128. for (let i = 0; i < selector.length; i++) {
  11129. if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) {
  11130. return true;
  11131. }
  11132. }
  11133. return false;
  11134. }
  11135. function getProjectAsAttrValue(tNode) {
  11136. const nodeAttrs = tNode.attrs;
  11137. if (nodeAttrs != null) {
  11138. const ngProjectAsAttrIdx = nodeAttrs.indexOf(
  11139. 5
  11140. /* AttributeMarker.ProjectAs */
  11141. );
  11142. if ((ngProjectAsAttrIdx & 1) === 0) {
  11143. return nodeAttrs[ngProjectAsAttrIdx + 1];
  11144. }
  11145. }
  11146. return null;
  11147. }
  11148. function getNameOnlyMarkerIndex(nodeAttrs) {
  11149. for (let i = 0; i < nodeAttrs.length; i++) {
  11150. const nodeAttr = nodeAttrs[i];
  11151. if (isNameOnlyAttributeMarker(nodeAttr)) {
  11152. return i;
  11153. }
  11154. }
  11155. return nodeAttrs.length;
  11156. }
  11157. function matchTemplateAttribute(attrs, name) {
  11158. let i = attrs.indexOf(
  11159. 4
  11160. /* AttributeMarker.Template */
  11161. );
  11162. if (i > -1) {
  11163. i++;
  11164. while (i < attrs.length) {
  11165. const attr = attrs[i];
  11166. if (typeof attr === "number") return -1;
  11167. if (attr === name) return i;
  11168. i++;
  11169. }
  11170. }
  11171. return -1;
  11172. }
  11173. function isSelectorInSelectorList(selector, list) {
  11174. selectorListLoop: for (let i = 0; i < list.length; i++) {
  11175. const currentSelectorInList = list[i];
  11176. if (selector.length !== currentSelectorInList.length) {
  11177. continue;
  11178. }
  11179. for (let j = 0; j < selector.length; j++) {
  11180. if (selector[j] !== currentSelectorInList[j]) {
  11181. continue selectorListLoop;
  11182. }
  11183. }
  11184. return true;
  11185. }
  11186. return false;
  11187. }
  11188. function maybeWrapInNotSelector(isNegativeMode, chunk) {
  11189. return isNegativeMode ? ":not(" + chunk.trim() + ")" : chunk;
  11190. }
  11191. function stringifyCSSSelector(selector) {
  11192. let result = selector[0];
  11193. let i = 1;
  11194. let mode = 2;
  11195. let currentChunk = "";
  11196. let isNegativeMode = false;
  11197. while (i < selector.length) {
  11198. let valueOrMarker = selector[i];
  11199. if (typeof valueOrMarker === "string") {
  11200. if (mode & 2) {
  11201. const attrValue = selector[++i];
  11202. currentChunk += "[" + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : "") + "]";
  11203. } else if (mode & 8) {
  11204. currentChunk += "." + valueOrMarker;
  11205. } else if (mode & 4) {
  11206. currentChunk += " " + valueOrMarker;
  11207. }
  11208. } else {
  11209. if (currentChunk !== "" && !isPositive(valueOrMarker)) {
  11210. result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
  11211. currentChunk = "";
  11212. }
  11213. mode = valueOrMarker;
  11214. isNegativeMode = isNegativeMode || !isPositive(mode);
  11215. }
  11216. i++;
  11217. }
  11218. if (currentChunk !== "") {
  11219. result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
  11220. }
  11221. return result;
  11222. }
  11223. function stringifyCSSSelectorList(selectorList) {
  11224. return selectorList.map(stringifyCSSSelector).join(",");
  11225. }
  11226. function extractAttrsAndClassesFromSelector(selector) {
  11227. const attrs = [];
  11228. const classes = [];
  11229. let i = 1;
  11230. let mode = 2;
  11231. while (i < selector.length) {
  11232. let valueOrMarker = selector[i];
  11233. if (typeof valueOrMarker === "string") {
  11234. if (mode === 2) {
  11235. if (valueOrMarker !== "") {
  11236. attrs.push(valueOrMarker, selector[++i]);
  11237. }
  11238. } else if (mode === 8) {
  11239. classes.push(valueOrMarker);
  11240. }
  11241. } else {
  11242. if (!isPositive(mode)) break;
  11243. mode = valueOrMarker;
  11244. }
  11245. i++;
  11246. }
  11247. if (classes.length) {
  11248. attrs.push(1, ...classes);
  11249. }
  11250. return attrs;
  11251. }
  11252. var NO_CHANGE = typeof ngDevMode === "undefined" || ngDevMode ? {
  11253. __brand__: "NO_CHANGE"
  11254. } : {};
  11255. function createTextNode(renderer, value) {
  11256. ngDevMode && ngDevMode.rendererCreateTextNode++;
  11257. ngDevMode && ngDevMode.rendererSetText++;
  11258. return renderer.createText(value);
  11259. }
  11260. function updateTextNode(renderer, rNode, value) {
  11261. ngDevMode && ngDevMode.rendererSetText++;
  11262. renderer.setValue(rNode, value);
  11263. }
  11264. function createCommentNode(renderer, value) {
  11265. ngDevMode && ngDevMode.rendererCreateComment++;
  11266. return renderer.createComment(escapeCommentText(value));
  11267. }
  11268. function createElementNode(renderer, name, namespace) {
  11269. ngDevMode && ngDevMode.rendererCreateElement++;
  11270. return renderer.createElement(name, namespace);
  11271. }
  11272. function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
  11273. ngDevMode && ngDevMode.rendererInsertBefore++;
  11274. renderer.insertBefore(parent, child, beforeNode, isMove);
  11275. }
  11276. function nativeAppendChild(renderer, parent, child) {
  11277. ngDevMode && ngDevMode.rendererAppendChild++;
  11278. ngDevMode && assertDefined(parent, "parent node must be defined");
  11279. renderer.appendChild(parent, child);
  11280. }
  11281. function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
  11282. if (beforeNode !== null) {
  11283. nativeInsertBefore(renderer, parent, child, beforeNode, isMove);
  11284. } else {
  11285. nativeAppendChild(renderer, parent, child);
  11286. }
  11287. }
  11288. function nativeRemoveNode(renderer, rNode, isHostElement) {
  11289. ngDevMode && ngDevMode.rendererRemoveNode++;
  11290. renderer.removeChild(null, rNode, isHostElement);
  11291. }
  11292. function clearElementContents(rElement) {
  11293. rElement.textContent = "";
  11294. }
  11295. function writeDirectStyle(renderer, element, newValue) {
  11296. ngDevMode && assertString(newValue, "'newValue' should be a string");
  11297. renderer.setAttribute(element, "style", newValue);
  11298. ngDevMode && ngDevMode.rendererSetStyle++;
  11299. }
  11300. function writeDirectClass(renderer, element, newValue) {
  11301. ngDevMode && assertString(newValue, "'newValue' should be a string");
  11302. if (newValue === "") {
  11303. renderer.removeAttribute(element, "class");
  11304. } else {
  11305. renderer.setAttribute(element, "class", newValue);
  11306. }
  11307. ngDevMode && ngDevMode.rendererSetClassName++;
  11308. }
  11309. function setupStaticAttributes(renderer, element, tNode) {
  11310. const {
  11311. mergedAttrs,
  11312. classes,
  11313. styles
  11314. } = tNode;
  11315. if (mergedAttrs !== null) {
  11316. setUpAttributes(renderer, element, mergedAttrs);
  11317. }
  11318. if (classes !== null) {
  11319. writeDirectClass(renderer, element, classes);
  11320. }
  11321. if (styles !== null) {
  11322. writeDirectStyle(renderer, element, styles);
  11323. }
  11324. }
  11325. function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory, ssrId) {
  11326. ngDevMode && ngDevMode.tView++;
  11327. const bindingStartIndex = HEADER_OFFSET + decls;
  11328. const initialViewLength = bindingStartIndex + vars;
  11329. const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
  11330. const consts = typeof constsOrFactory === "function" ? constsOrFactory() : constsOrFactory;
  11331. const tView = blueprint[TVIEW] = {
  11332. type,
  11333. blueprint,
  11334. template: templateFn,
  11335. queries: null,
  11336. viewQuery,
  11337. declTNode,
  11338. data: blueprint.slice().fill(null, bindingStartIndex),
  11339. bindingStartIndex,
  11340. expandoStartIndex: initialViewLength,
  11341. hostBindingOpCodes: null,
  11342. firstCreatePass: true,
  11343. firstUpdatePass: true,
  11344. staticViewQueries: false,
  11345. staticContentQueries: false,
  11346. preOrderHooks: null,
  11347. preOrderCheckHooks: null,
  11348. contentHooks: null,
  11349. contentCheckHooks: null,
  11350. viewHooks: null,
  11351. viewCheckHooks: null,
  11352. destroyHooks: null,
  11353. cleanup: null,
  11354. contentQueries: null,
  11355. components: null,
  11356. directiveRegistry: typeof directives === "function" ? directives() : directives,
  11357. pipeRegistry: typeof pipes === "function" ? pipes() : pipes,
  11358. firstChild: null,
  11359. schemas,
  11360. consts,
  11361. incompleteFirstPass: false,
  11362. ssrId
  11363. };
  11364. if (ngDevMode) {
  11365. Object.seal(tView);
  11366. }
  11367. return tView;
  11368. }
  11369. function createViewBlueprint(bindingStartIndex, initialViewLength) {
  11370. const blueprint = [];
  11371. for (let i = 0; i < initialViewLength; i++) {
  11372. blueprint.push(i < bindingStartIndex ? null : NO_CHANGE);
  11373. }
  11374. return blueprint;
  11375. }
  11376. function getOrCreateComponentTView(def) {
  11377. const tView = def.tView;
  11378. if (tView === null || tView.incompleteFirstPass) {
  11379. const declTNode = null;
  11380. return def.tView = createTView(1, declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts, def.id);
  11381. }
  11382. return tView;
  11383. }
  11384. function createLView(parentLView, tView, context2, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
  11385. const lView = tView.blueprint.slice();
  11386. lView[HOST] = host;
  11387. lView[FLAGS] = flags | 4 | 128 | 8 | 64 | 1024;
  11388. if (embeddedViewInjector !== null || parentLView && parentLView[FLAGS] & 2048) {
  11389. lView[FLAGS] |= 2048;
  11390. }
  11391. resetPreOrderHookFlags(lView);
  11392. ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
  11393. lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
  11394. lView[CONTEXT] = context2;
  11395. lView[ENVIRONMENT] = environment || parentLView && parentLView[ENVIRONMENT];
  11396. ngDevMode && assertDefined(lView[ENVIRONMENT], "LViewEnvironment is required");
  11397. lView[RENDERER] = renderer || parentLView && parentLView[RENDERER];
  11398. ngDevMode && assertDefined(lView[RENDERER], "Renderer is required");
  11399. lView[INJECTOR] = injector || parentLView && parentLView[INJECTOR] || null;
  11400. lView[T_HOST] = tHostNode;
  11401. lView[ID] = getUniqueLViewId();
  11402. lView[HYDRATION] = hydrationInfo;
  11403. lView[EMBEDDED_VIEW_INJECTOR] = embeddedViewInjector;
  11404. ngDevMode && assertEqual(tView.type == 2 ? parentLView !== null : true, true, "Embedded views must have parentLView");
  11405. lView[DECLARATION_COMPONENT_VIEW] = tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
  11406. return lView;
  11407. }
  11408. function createComponentLView(lView, hostTNode, def) {
  11409. const native = getNativeByTNode(hostTNode, lView);
  11410. const tView = getOrCreateComponentTView(def);
  11411. const rendererFactory = lView[ENVIRONMENT].rendererFactory;
  11412. const componentView = addToEndOfViewTree(lView, createLView(lView, tView, null, getInitialLViewFlagsFromDef(def), native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
  11413. return lView[hostTNode.index] = componentView;
  11414. }
  11415. function getInitialLViewFlagsFromDef(def) {
  11416. let flags = 16;
  11417. if (def.signals) {
  11418. flags = 4096;
  11419. } else if (def.onPush) {
  11420. flags = 64;
  11421. }
  11422. return flags;
  11423. }
  11424. function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
  11425. if (numSlotsToAlloc === 0) return -1;
  11426. if (ngDevMode) {
  11427. assertFirstCreatePass(tView);
  11428. assertSame(tView, lView[TVIEW], "`LView` must be associated with `TView`!");
  11429. assertEqual(tView.data.length, lView.length, "Expecting LView to be same size as TView");
  11430. assertEqual(tView.data.length, tView.blueprint.length, "Expecting Blueprint to be same size as TView");
  11431. assertFirstUpdatePass(tView);
  11432. }
  11433. const allocIdx = lView.length;
  11434. for (let i = 0; i < numSlotsToAlloc; i++) {
  11435. lView.push(initialValue);
  11436. tView.blueprint.push(initialValue);
  11437. tView.data.push(null);
  11438. }
  11439. return allocIdx;
  11440. }
  11441. function addToEndOfViewTree(lView, lViewOrLContainer) {
  11442. if (lView[CHILD_HEAD]) {
  11443. lView[CHILD_TAIL][NEXT] = lViewOrLContainer;
  11444. } else {
  11445. lView[CHILD_HEAD] = lViewOrLContainer;
  11446. }
  11447. lView[CHILD_TAIL] = lViewOrLContainer;
  11448. return lViewOrLContainer;
  11449. }
  11450. function ɵɵadvance(delta = 1) {
  11451. ngDevMode && assertGreaterThan(delta, 0, "Can only advance forward");
  11452. selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode());
  11453. }
  11454. function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
  11455. ngDevMode && assertIndexInDeclRange(lView[TVIEW], index);
  11456. if (!checkNoChangesMode) {
  11457. const hooksInitPhaseCompleted = (lView[FLAGS] & 3) === 3;
  11458. if (hooksInitPhaseCompleted) {
  11459. const preOrderCheckHooks = tView.preOrderCheckHooks;
  11460. if (preOrderCheckHooks !== null) {
  11461. executeCheckHooks(lView, preOrderCheckHooks, index);
  11462. }
  11463. } else {
  11464. const preOrderHooks = tView.preOrderHooks;
  11465. if (preOrderHooks !== null) {
  11466. executeInitAndCheckHooks(lView, preOrderHooks, 0, index);
  11467. }
  11468. }
  11469. }
  11470. setSelectedIndex(index);
  11471. }
  11472. var InputFlags;
  11473. (function(InputFlags2) {
  11474. InputFlags2[InputFlags2["None"] = 0] = "None";
  11475. InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased";
  11476. InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
  11477. })(InputFlags || (InputFlags = {}));
  11478. function writeToDirectiveInput(def, instance, publicName, value) {
  11479. const prevConsumer = setActiveConsumer(null);
  11480. try {
  11481. if (ngDevMode) {
  11482. if (!def.inputs.hasOwnProperty(publicName)) {
  11483. throw new Error(`ASSERTION ERROR: Directive ${def.type.name} does not have an input with a public name of "${publicName}"`);
  11484. }
  11485. if (instance instanceof NodeInjectorFactory) {
  11486. throw new Error(`ASSERTION ERROR: Cannot write input to factory for type ${def.type.name}. Directive has not been created yet.`);
  11487. }
  11488. }
  11489. const [privateName, flags, transform] = def.inputs[publicName];
  11490. let inputSignalNode = null;
  11491. if ((flags & InputFlags.SignalBased) !== 0) {
  11492. const field = instance[privateName];
  11493. inputSignalNode = field[SIGNAL];
  11494. }
  11495. if (inputSignalNode !== null && inputSignalNode.transformFn !== void 0) {
  11496. value = inputSignalNode.transformFn(value);
  11497. } else if (transform !== null) {
  11498. value = transform.call(instance, value);
  11499. }
  11500. if (def.setInput !== null) {
  11501. def.setInput(instance, inputSignalNode, value, publicName, privateName);
  11502. } else {
  11503. applyValueToInputField(instance, inputSignalNode, privateName, value);
  11504. }
  11505. } finally {
  11506. setActiveConsumer(prevConsumer);
  11507. }
  11508. }
  11509. function executeTemplate(tView, lView, templateFn, rf, context2) {
  11510. const prevSelectedIndex = getSelectedIndex();
  11511. const isUpdatePhase = rf & 2;
  11512. try {
  11513. setSelectedIndex(-1);
  11514. if (isUpdatePhase && lView.length > HEADER_OFFSET) {
  11515. selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode());
  11516. }
  11517. const preHookType = isUpdatePhase ? 2 : 0;
  11518. profiler(preHookType, context2);
  11519. templateFn(rf, context2);
  11520. } finally {
  11521. setSelectedIndex(prevSelectedIndex);
  11522. const postHookType = isUpdatePhase ? 3 : 1;
  11523. profiler(postHookType, context2);
  11524. }
  11525. }
  11526. function createDirectivesInstances(tView, lView, tNode) {
  11527. instantiateAllDirectives(tView, lView, tNode);
  11528. if ((tNode.flags & 64) === 64) {
  11529. invokeDirectivesHostBindings(tView, lView, tNode);
  11530. }
  11531. }
  11532. function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) {
  11533. const localNames = tNode.localNames;
  11534. if (localNames !== null) {
  11535. let localIndex = tNode.index + 1;
  11536. for (let i = 0; i < localNames.length; i += 2) {
  11537. const index = localNames[i + 1];
  11538. const value = index === -1 ? localRefExtractor(tNode, viewData) : viewData[index];
  11539. viewData[localIndex++] = value;
  11540. }
  11541. }
  11542. }
  11543. function locateHostElement(renderer, elementOrSelector, encapsulation, injector) {
  11544. const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT);
  11545. const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation.ShadowDom;
  11546. const rootElement = renderer.selectRootElement(elementOrSelector, preserveContent);
  11547. applyRootElementTransform(rootElement);
  11548. return rootElement;
  11549. }
  11550. function applyRootElementTransform(rootElement) {
  11551. _applyRootElementTransformImpl(rootElement);
  11552. }
  11553. var _applyRootElementTransformImpl = () => null;
  11554. function applyRootElementTransformImpl(rootElement) {
  11555. if (hasSkipHydrationAttrOnRElement(rootElement)) {
  11556. clearElementContents(rootElement);
  11557. } else {
  11558. processTextNodeMarkersBeforeHydration(rootElement);
  11559. }
  11560. }
  11561. function enableApplyRootElementTransformImpl() {
  11562. _applyRootElementTransformImpl = applyRootElementTransformImpl;
  11563. }
  11564. function mapPropName(name) {
  11565. if (name === "class") return "className";
  11566. if (name === "for") return "htmlFor";
  11567. if (name === "formaction") return "formAction";
  11568. if (name === "innerHtml") return "innerHTML";
  11569. if (name === "readonly") return "readOnly";
  11570. if (name === "tabindex") return "tabIndex";
  11571. return name;
  11572. }
  11573. function elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, nativeOnly) {
  11574. ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
  11575. if (!nativeOnly) {
  11576. const hasSetInput = setAllInputsForProperty(tNode, tView, lView, propName, value);
  11577. if (hasSetInput) {
  11578. isComponentHost(tNode) && markDirtyIfOnPush(lView, tNode.index);
  11579. ngDevMode && setNgReflectProperties(lView, tView, tNode, propName, value);
  11580. return;
  11581. }
  11582. }
  11583. if (tNode.type & 3) {
  11584. const element = getNativeByTNode(tNode, lView);
  11585. propName = mapPropName(propName);
  11586. if (ngDevMode) {
  11587. validateAgainstEventProperties(propName);
  11588. if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
  11589. handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
  11590. }
  11591. ngDevMode.rendererSetProperty++;
  11592. }
  11593. value = sanitizer != null ? sanitizer(value, tNode.value || "", propName) : value;
  11594. renderer.setProperty(element, propName, value);
  11595. } else if (tNode.type & 12) {
  11596. if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
  11597. handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
  11598. }
  11599. }
  11600. }
  11601. function markDirtyIfOnPush(lView, viewIndex) {
  11602. ngDevMode && assertLView(lView);
  11603. const childComponentLView = getComponentLViewByIndex(viewIndex, lView);
  11604. if (!(childComponentLView[FLAGS] & 16)) {
  11605. childComponentLView[FLAGS] |= 64;
  11606. }
  11607. }
  11608. function setNgReflectProperty(lView, tNode, attrName, value) {
  11609. const element = getNativeByTNode(tNode, lView);
  11610. const renderer = lView[RENDERER];
  11611. attrName = normalizeDebugBindingName(attrName);
  11612. const debugValue = normalizeDebugBindingValue(value);
  11613. if (tNode.type & 3) {
  11614. if (value == null) {
  11615. renderer.removeAttribute(element, attrName);
  11616. } else {
  11617. renderer.setAttribute(element, attrName, debugValue);
  11618. }
  11619. } else {
  11620. const textContent = escapeCommentText(`bindings=${JSON.stringify({
  11621. [attrName]: debugValue
  11622. }, null, 2)}`);
  11623. renderer.setValue(element, textContent);
  11624. }
  11625. }
  11626. function setNgReflectProperties(lView, tView, tNode, publicName, value) {
  11627. if (!(tNode.type & (3 | 4))) {
  11628. return;
  11629. }
  11630. const inputConfig = tNode.inputs?.[publicName];
  11631. const hostInputConfig = tNode.hostDirectiveInputs?.[publicName];
  11632. if (hostInputConfig) {
  11633. for (let i = 0; i < hostInputConfig.length; i += 2) {
  11634. const index = hostInputConfig[i];
  11635. const publicName2 = hostInputConfig[i + 1];
  11636. const def = tView.data[index];
  11637. setNgReflectProperty(lView, tNode, def.inputs[publicName2][0], value);
  11638. }
  11639. }
  11640. if (inputConfig) {
  11641. for (const index of inputConfig) {
  11642. const def = tView.data[index];
  11643. setNgReflectProperty(lView, tNode, def.inputs[publicName][0], value);
  11644. }
  11645. }
  11646. }
  11647. function instantiateAllDirectives(tView, lView, tNode) {
  11648. const start = tNode.directiveStart;
  11649. const end = tNode.directiveEnd;
  11650. if (isComponentHost(tNode)) {
  11651. ngDevMode && assertTNodeType(
  11652. tNode,
  11653. 3
  11654. /* TNodeType.AnyRNode */
  11655. );
  11656. createComponentLView(lView, tNode, tView.data[start + tNode.componentOffset]);
  11657. }
  11658. if (!tView.firstCreatePass) {
  11659. getOrCreateNodeInjectorForNode(tNode, lView);
  11660. }
  11661. const initialInputs = tNode.initialInputs;
  11662. for (let i = start; i < end; i++) {
  11663. const def = tView.data[i];
  11664. const directive = getNodeInjectable(lView, tView, i, tNode);
  11665. attachPatchData(directive, lView);
  11666. if (initialInputs !== null) {
  11667. setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs);
  11668. }
  11669. if (isComponentDef(def)) {
  11670. const componentView = getComponentLViewByIndex(tNode.index, lView);
  11671. componentView[CONTEXT] = getNodeInjectable(lView, tView, i, tNode);
  11672. }
  11673. }
  11674. }
  11675. function invokeDirectivesHostBindings(tView, lView, tNode) {
  11676. const start = tNode.directiveStart;
  11677. const end = tNode.directiveEnd;
  11678. const elementIndex = tNode.index;
  11679. const currentDirectiveIndex = getCurrentDirectiveIndex();
  11680. try {
  11681. setSelectedIndex(elementIndex);
  11682. for (let dirIndex = start; dirIndex < end; dirIndex++) {
  11683. const def = tView.data[dirIndex];
  11684. const directive = lView[dirIndex];
  11685. setCurrentDirectiveIndex(dirIndex);
  11686. if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) {
  11687. invokeHostBindingsInCreationMode(def, directive);
  11688. }
  11689. }
  11690. } finally {
  11691. setSelectedIndex(-1);
  11692. setCurrentDirectiveIndex(currentDirectiveIndex);
  11693. }
  11694. }
  11695. function invokeHostBindingsInCreationMode(def, directive) {
  11696. if (def.hostBindings !== null) {
  11697. def.hostBindings(1, directive);
  11698. }
  11699. }
  11700. function findDirectiveDefMatches(tView, tNode) {
  11701. ngDevMode && assertFirstCreatePass(tView);
  11702. ngDevMode && assertTNodeType(
  11703. tNode,
  11704. 3 | 12
  11705. /* TNodeType.AnyContainer */
  11706. );
  11707. const registry = tView.directiveRegistry;
  11708. let matches = null;
  11709. if (registry) {
  11710. for (let i = 0; i < registry.length; i++) {
  11711. const def = registry[i];
  11712. if (isNodeMatchingSelectorList(
  11713. tNode,
  11714. def.selectors,
  11715. /* isProjectionMode */
  11716. false
  11717. )) {
  11718. matches ??= [];
  11719. if (isComponentDef(def)) {
  11720. if (ngDevMode) {
  11721. assertTNodeType(tNode, 2, `"${tNode.value}" tags cannot be used as component hosts. Please use a different tag to activate the ${stringify(def.type)} component.`);
  11722. if (matches.length && isComponentDef(matches[0])) {
  11723. throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
  11724. }
  11725. }
  11726. matches.unshift(def);
  11727. } else {
  11728. matches.push(def);
  11729. }
  11730. }
  11731. }
  11732. }
  11733. return matches;
  11734. }
  11735. function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) {
  11736. if (ngDevMode) {
  11737. assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
  11738. validateAgainstEventAttributes(name);
  11739. assertTNodeType(tNode, 2, `Attempted to set attribute \`${name}\` on a container node. Host bindings are not valid on ng-container or ng-template.`);
  11740. }
  11741. const element = getNativeByTNode(tNode, lView);
  11742. setElementAttribute(lView[RENDERER], element, namespace, tNode.value, name, value, sanitizer);
  11743. }
  11744. function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) {
  11745. if (value == null) {
  11746. ngDevMode && ngDevMode.rendererRemoveAttribute++;
  11747. renderer.removeAttribute(element, name, namespace);
  11748. } else {
  11749. ngDevMode && ngDevMode.rendererSetAttribute++;
  11750. const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || "", name);
  11751. renderer.setAttribute(element, name, strValue, namespace);
  11752. }
  11753. }
  11754. function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) {
  11755. const initialInputs = initialInputData[directiveIndex];
  11756. if (initialInputs !== null) {
  11757. for (let i = 0; i < initialInputs.length; i += 2) {
  11758. const lookupName = initialInputs[i];
  11759. const value = initialInputs[i + 1];
  11760. writeToDirectiveInput(def, instance, lookupName, value);
  11761. if (ngDevMode) {
  11762. setNgReflectProperty(lView, tNode, def.inputs[lookupName][0], value);
  11763. }
  11764. }
  11765. }
  11766. }
  11767. function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) {
  11768. if (tData[bindingIndex] === null) {
  11769. if (!tNode.inputs?.[propertyName] && !tNode.hostDirectiveInputs?.[propertyName]) {
  11770. const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []);
  11771. propBindingIdxs.push(bindingIndex);
  11772. let bindingMetadata = propertyName;
  11773. if (interpolationParts.length > 0) {
  11774. bindingMetadata += INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER);
  11775. }
  11776. tData[bindingIndex] = bindingMetadata;
  11777. }
  11778. }
  11779. }
  11780. function loadComponentRenderer(currentDef, tNode, lView) {
  11781. if (currentDef === null || isComponentDef(currentDef)) {
  11782. lView = unwrapLView(lView[tNode.index]);
  11783. }
  11784. return lView[RENDERER];
  11785. }
  11786. function handleError$1(lView, error) {
  11787. const injector = lView[INJECTOR];
  11788. const errorHandler = injector ? injector.get(ErrorHandler, null) : null;
  11789. errorHandler && errorHandler.handleError(error);
  11790. }
  11791. function setAllInputsForProperty(tNode, tView, lView, publicName, value) {
  11792. const inputs = tNode.inputs?.[publicName];
  11793. const hostDirectiveInputs = tNode.hostDirectiveInputs?.[publicName];
  11794. let hasMatch = false;
  11795. if (hostDirectiveInputs) {
  11796. for (let i = 0; i < hostDirectiveInputs.length; i += 2) {
  11797. const index = hostDirectiveInputs[i];
  11798. ngDevMode && assertIndexInRange(lView, index);
  11799. const publicName2 = hostDirectiveInputs[i + 1];
  11800. const def = tView.data[index];
  11801. writeToDirectiveInput(def, lView[index], publicName2, value);
  11802. hasMatch = true;
  11803. }
  11804. }
  11805. if (inputs) {
  11806. for (const index of inputs) {
  11807. ngDevMode && assertIndexInRange(lView, index);
  11808. const instance = lView[index];
  11809. const def = tView.data[index];
  11810. writeToDirectiveInput(def, instance, publicName, value);
  11811. hasMatch = true;
  11812. }
  11813. }
  11814. return hasMatch;
  11815. }
  11816. function renderComponent(hostLView, componentHostIdx) {
  11817. ngDevMode && assertEqual(isCreationMode(hostLView), true, "Should be run in creation mode");
  11818. const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
  11819. const componentTView = componentView[TVIEW];
  11820. syncViewWithBlueprint(componentTView, componentView);
  11821. const hostRNode = componentView[HOST];
  11822. if (hostRNode !== null && componentView[HYDRATION] === null) {
  11823. componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]);
  11824. }
  11825. profiler(
  11826. 18
  11827. /* ProfilerEvent.ComponentStart */
  11828. );
  11829. renderView(componentTView, componentView, componentView[CONTEXT]);
  11830. profiler(19, componentView[CONTEXT]);
  11831. }
  11832. function syncViewWithBlueprint(tView, lView) {
  11833. for (let i = lView.length; i < tView.blueprint.length; i++) {
  11834. lView.push(tView.blueprint[i]);
  11835. }
  11836. }
  11837. function renderView(tView, lView, context2) {
  11838. ngDevMode && assertEqual(isCreationMode(lView), true, "Should be run in creation mode");
  11839. ngDevMode && assertNotReactive(renderView.name);
  11840. enterView(lView);
  11841. try {
  11842. const viewQuery = tView.viewQuery;
  11843. if (viewQuery !== null) {
  11844. executeViewQueryFn(1, viewQuery, context2);
  11845. }
  11846. const templateFn = tView.template;
  11847. if (templateFn !== null) {
  11848. executeTemplate(tView, lView, templateFn, 1, context2);
  11849. }
  11850. if (tView.firstCreatePass) {
  11851. tView.firstCreatePass = false;
  11852. }
  11853. lView[QUERIES]?.finishViewCreation(tView);
  11854. if (tView.staticContentQueries) {
  11855. refreshContentQueries(tView, lView);
  11856. }
  11857. if (tView.staticViewQueries) {
  11858. executeViewQueryFn(2, tView.viewQuery, context2);
  11859. }
  11860. const components = tView.components;
  11861. if (components !== null) {
  11862. renderChildComponents(lView, components);
  11863. }
  11864. } catch (error) {
  11865. if (tView.firstCreatePass) {
  11866. tView.incompleteFirstPass = true;
  11867. tView.firstCreatePass = false;
  11868. }
  11869. throw error;
  11870. } finally {
  11871. lView[FLAGS] &= -5;
  11872. leaveView();
  11873. }
  11874. }
  11875. function renderChildComponents(hostLView, components) {
  11876. for (let i = 0; i < components.length; i++) {
  11877. renderComponent(hostLView, components[i]);
  11878. }
  11879. }
  11880. function createAndRenderEmbeddedLView(declarationLView, templateTNode, context2, options) {
  11881. const prevConsumer = setActiveConsumer(null);
  11882. try {
  11883. const embeddedTView = templateTNode.tView;
  11884. ngDevMode && assertDefined(embeddedTView, "TView must be defined for a template node.");
  11885. ngDevMode && assertTNodeForLView(templateTNode, declarationLView);
  11886. const isSignalView = declarationLView[FLAGS] & 4096;
  11887. const viewFlags = isSignalView ? 4096 : 16;
  11888. const embeddedLView = createLView(declarationLView, embeddedTView, context2, viewFlags, null, templateTNode, null, null, options?.injector ?? null, options?.embeddedViewInjector ?? null, options?.dehydratedView ?? null);
  11889. const declarationLContainer = declarationLView[templateTNode.index];
  11890. ngDevMode && assertLContainer(declarationLContainer);
  11891. embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
  11892. const declarationViewLQueries = declarationLView[QUERIES];
  11893. if (declarationViewLQueries !== null) {
  11894. embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
  11895. }
  11896. renderView(embeddedTView, embeddedLView, context2);
  11897. return embeddedLView;
  11898. } finally {
  11899. setActiveConsumer(prevConsumer);
  11900. }
  11901. }
  11902. function shouldAddViewToDom(tNode, dehydratedView) {
  11903. return !dehydratedView || dehydratedView.firstChild === null || hasInSkipHydrationBlockFlag(tNode);
  11904. }
  11905. var _icuContainerIterate;
  11906. function icuContainerIterate(tIcuContainerNode, lView) {
  11907. return _icuContainerIterate(tIcuContainerNode, lView);
  11908. }
  11909. function ensureIcuContainerVisitorLoaded(loader) {
  11910. if (_icuContainerIterate === void 0) {
  11911. _icuContainerIterate = loader();
  11912. }
  11913. }
  11914. var RendererStyleFlags2;
  11915. (function(RendererStyleFlags22) {
  11916. RendererStyleFlags22[RendererStyleFlags22["Important"] = 1] = "Important";
  11917. RendererStyleFlags22[RendererStyleFlags22["DashCase"] = 2] = "DashCase";
  11918. })(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
  11919. function isDetachedByI18n(tNode) {
  11920. return (tNode.flags & 32) === 32;
  11921. }
  11922. function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) {
  11923. if (lNodeToHandle != null) {
  11924. let lContainer;
  11925. let isComponent2 = false;
  11926. if (isLContainer(lNodeToHandle)) {
  11927. lContainer = lNodeToHandle;
  11928. } else if (isLView(lNodeToHandle)) {
  11929. isComponent2 = true;
  11930. ngDevMode && assertDefined(lNodeToHandle[HOST], "HOST must be defined for a component LView");
  11931. lNodeToHandle = lNodeToHandle[HOST];
  11932. }
  11933. const rNode = unwrapRNode(lNodeToHandle);
  11934. if (action === 0 && parent !== null) {
  11935. if (beforeNode == null) {
  11936. nativeAppendChild(renderer, parent, rNode);
  11937. } else {
  11938. nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true);
  11939. }
  11940. } else if (action === 1 && parent !== null) {
  11941. nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true);
  11942. } else if (action === 2) {
  11943. nativeRemoveNode(renderer, rNode, isComponent2);
  11944. } else if (action === 3) {
  11945. ngDevMode && ngDevMode.rendererDestroyNode++;
  11946. renderer.destroyNode(rNode);
  11947. }
  11948. if (lContainer != null) {
  11949. applyContainer(renderer, action, lContainer, parent, beforeNode);
  11950. }
  11951. }
  11952. }
  11953. function removeViewFromDOM(tView, lView) {
  11954. detachViewFromDOM(tView, lView);
  11955. lView[HOST] = null;
  11956. lView[T_HOST] = null;
  11957. }
  11958. function addViewToDOM(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) {
  11959. lView[HOST] = parentNativeNode;
  11960. lView[T_HOST] = parentTNode;
  11961. applyView(tView, lView, renderer, 1, parentNativeNode, beforeNode);
  11962. }
  11963. function detachViewFromDOM(tView, lView) {
  11964. lView[ENVIRONMENT].changeDetectionScheduler?.notify(
  11965. 9
  11966. /* NotificationSource.ViewDetachedFromDOM */
  11967. );
  11968. applyView(tView, lView, lView[RENDERER], 2, null, null);
  11969. }
  11970. function destroyViewTree(rootView) {
  11971. let lViewOrLContainer = rootView[CHILD_HEAD];
  11972. if (!lViewOrLContainer) {
  11973. return cleanUpView(rootView[TVIEW], rootView);
  11974. }
  11975. while (lViewOrLContainer) {
  11976. let next = null;
  11977. if (isLView(lViewOrLContainer)) {
  11978. next = lViewOrLContainer[CHILD_HEAD];
  11979. } else {
  11980. ngDevMode && assertLContainer(lViewOrLContainer);
  11981. const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET];
  11982. if (firstView) next = firstView;
  11983. }
  11984. if (!next) {
  11985. while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) {
  11986. if (isLView(lViewOrLContainer)) {
  11987. cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
  11988. }
  11989. lViewOrLContainer = lViewOrLContainer[PARENT];
  11990. }
  11991. if (lViewOrLContainer === null) lViewOrLContainer = rootView;
  11992. if (isLView(lViewOrLContainer)) {
  11993. cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
  11994. }
  11995. next = lViewOrLContainer && lViewOrLContainer[NEXT];
  11996. }
  11997. lViewOrLContainer = next;
  11998. }
  11999. }
  12000. function detachMovedView(declarationContainer, lView) {
  12001. ngDevMode && assertLContainer(declarationContainer);
  12002. ngDevMode && assertDefined(declarationContainer[MOVED_VIEWS], "A projected view should belong to a non-empty projected views collection");
  12003. const movedViews = declarationContainer[MOVED_VIEWS];
  12004. const declarationViewIndex = movedViews.indexOf(lView);
  12005. movedViews.splice(declarationViewIndex, 1);
  12006. }
  12007. function destroyLView(tView, lView) {
  12008. if (isDestroyed(lView)) {
  12009. return;
  12010. }
  12011. const renderer = lView[RENDERER];
  12012. if (renderer.destroyNode) {
  12013. applyView(tView, lView, renderer, 3, null, null);
  12014. }
  12015. destroyViewTree(lView);
  12016. }
  12017. function cleanUpView(tView, lView) {
  12018. if (isDestroyed(lView)) {
  12019. return;
  12020. }
  12021. const prevConsumer = setActiveConsumer(null);
  12022. try {
  12023. lView[FLAGS] &= ~128;
  12024. lView[FLAGS] |= 256;
  12025. lView[REACTIVE_TEMPLATE_CONSUMER] && consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]);
  12026. executeOnDestroys(tView, lView);
  12027. processCleanups(tView, lView);
  12028. if (lView[TVIEW].type === 1) {
  12029. ngDevMode && ngDevMode.rendererDestroy++;
  12030. lView[RENDERER].destroy();
  12031. }
  12032. const declarationContainer = lView[DECLARATION_LCONTAINER];
  12033. if (declarationContainer !== null && isLContainer(lView[PARENT])) {
  12034. if (declarationContainer !== lView[PARENT]) {
  12035. detachMovedView(declarationContainer, lView);
  12036. }
  12037. const lQueries = lView[QUERIES];
  12038. if (lQueries !== null) {
  12039. lQueries.detachView(tView);
  12040. }
  12041. }
  12042. unregisterLView(lView);
  12043. } finally {
  12044. setActiveConsumer(prevConsumer);
  12045. }
  12046. }
  12047. function processCleanups(tView, lView) {
  12048. ngDevMode && assertNotReactive(processCleanups.name);
  12049. const tCleanup = tView.cleanup;
  12050. const lCleanup = lView[CLEANUP];
  12051. if (tCleanup !== null) {
  12052. for (let i = 0; i < tCleanup.length - 1; i += 2) {
  12053. if (typeof tCleanup[i] === "string") {
  12054. const targetIdx = tCleanup[i + 3];
  12055. ngDevMode && assertNumber(targetIdx, "cleanup target must be a number");
  12056. if (targetIdx >= 0) {
  12057. lCleanup[targetIdx]();
  12058. } else {
  12059. lCleanup[-targetIdx].unsubscribe();
  12060. }
  12061. i += 2;
  12062. } else {
  12063. const context2 = lCleanup[tCleanup[i + 1]];
  12064. tCleanup[i].call(context2);
  12065. }
  12066. }
  12067. }
  12068. if (lCleanup !== null) {
  12069. lView[CLEANUP] = null;
  12070. }
  12071. const destroyHooks = lView[ON_DESTROY_HOOKS];
  12072. if (destroyHooks !== null) {
  12073. lView[ON_DESTROY_HOOKS] = null;
  12074. for (let i = 0; i < destroyHooks.length; i++) {
  12075. const destroyHooksFn = destroyHooks[i];
  12076. ngDevMode && assertFunction(destroyHooksFn, "Expecting destroy hook to be a function.");
  12077. destroyHooksFn();
  12078. }
  12079. }
  12080. const effects = lView[EFFECTS];
  12081. if (effects !== null) {
  12082. lView[EFFECTS] = null;
  12083. for (const effect2 of effects) {
  12084. effect2.destroy();
  12085. }
  12086. }
  12087. }
  12088. function executeOnDestroys(tView, lView) {
  12089. ngDevMode && assertNotReactive(executeOnDestroys.name);
  12090. let destroyHooks;
  12091. if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
  12092. for (let i = 0; i < destroyHooks.length; i += 2) {
  12093. const context2 = lView[destroyHooks[i]];
  12094. if (!(context2 instanceof NodeInjectorFactory)) {
  12095. const toCall = destroyHooks[i + 1];
  12096. if (Array.isArray(toCall)) {
  12097. for (let j = 0; j < toCall.length; j += 2) {
  12098. const callContext = context2[toCall[j]];
  12099. const hook = toCall[j + 1];
  12100. profiler(4, callContext, hook);
  12101. try {
  12102. hook.call(callContext);
  12103. } finally {
  12104. profiler(5, callContext, hook);
  12105. }
  12106. }
  12107. } else {
  12108. profiler(4, context2, toCall);
  12109. try {
  12110. toCall.call(context2);
  12111. } finally {
  12112. profiler(5, context2, toCall);
  12113. }
  12114. }
  12115. }
  12116. }
  12117. }
  12118. }
  12119. function getParentRElement(tView, tNode, lView) {
  12120. return getClosestRElement(tView, tNode.parent, lView);
  12121. }
  12122. function getClosestRElement(tView, tNode, lView) {
  12123. let parentTNode = tNode;
  12124. while (parentTNode !== null && parentTNode.type & (8 | 32 | 128)) {
  12125. tNode = parentTNode;
  12126. parentTNode = tNode.parent;
  12127. }
  12128. if (parentTNode === null) {
  12129. return lView[HOST];
  12130. } else {
  12131. ngDevMode && assertTNodeType(
  12132. parentTNode,
  12133. 3 | 4
  12134. /* TNodeType.Container */
  12135. );
  12136. if (isComponentHost(parentTNode)) {
  12137. ngDevMode && assertTNodeForLView(parentTNode, lView);
  12138. const {
  12139. encapsulation
  12140. } = tView.data[parentTNode.directiveStart + parentTNode.componentOffset];
  12141. if (encapsulation === ViewEncapsulation.None || encapsulation === ViewEncapsulation.Emulated) {
  12142. return null;
  12143. }
  12144. }
  12145. return getNativeByTNode(parentTNode, lView);
  12146. }
  12147. }
  12148. function getInsertInFrontOfRNode(parentTNode, currentTNode, lView) {
  12149. return _getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView);
  12150. }
  12151. function getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView) {
  12152. if (parentTNode.type & (8 | 32)) {
  12153. return getNativeByTNode(parentTNode, lView);
  12154. }
  12155. return null;
  12156. }
  12157. var _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithNoI18n;
  12158. var _processI18nInsertBefore;
  12159. function setI18nHandling(getInsertInFrontOfRNodeWithI18n2, processI18nInsertBefore2) {
  12160. _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithI18n2;
  12161. _processI18nInsertBefore = processI18nInsertBefore2;
  12162. }
  12163. function appendChild(tView, lView, childRNode, childTNode) {
  12164. const parentRNode = getParentRElement(tView, childTNode, lView);
  12165. const renderer = lView[RENDERER];
  12166. const parentTNode = childTNode.parent || lView[T_HOST];
  12167. const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView);
  12168. if (parentRNode != null) {
  12169. if (Array.isArray(childRNode)) {
  12170. for (let i = 0; i < childRNode.length; i++) {
  12171. nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false);
  12172. }
  12173. } else {
  12174. nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false);
  12175. }
  12176. }
  12177. _processI18nInsertBefore !== void 0 && _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode);
  12178. }
  12179. function getFirstNativeNode(lView, tNode) {
  12180. if (tNode !== null) {
  12181. ngDevMode && assertTNodeType(
  12182. tNode,
  12183. 3 | 12 | 32 | 16 | 128
  12184. /* TNodeType.LetDeclaration */
  12185. );
  12186. const tNodeType = tNode.type;
  12187. if (tNodeType & 3) {
  12188. return getNativeByTNode(tNode, lView);
  12189. } else if (tNodeType & 4) {
  12190. return getBeforeNodeForView(-1, lView[tNode.index]);
  12191. } else if (tNodeType & 8) {
  12192. const elIcuContainerChild = tNode.child;
  12193. if (elIcuContainerChild !== null) {
  12194. return getFirstNativeNode(lView, elIcuContainerChild);
  12195. } else {
  12196. const rNodeOrLContainer = lView[tNode.index];
  12197. if (isLContainer(rNodeOrLContainer)) {
  12198. return getBeforeNodeForView(-1, rNodeOrLContainer);
  12199. } else {
  12200. return unwrapRNode(rNodeOrLContainer);
  12201. }
  12202. }
  12203. } else if (tNodeType & 128) {
  12204. return getFirstNativeNode(lView, tNode.next);
  12205. } else if (tNodeType & 32) {
  12206. let nextRNode = icuContainerIterate(tNode, lView);
  12207. let rNode = nextRNode();
  12208. return rNode || unwrapRNode(lView[tNode.index]);
  12209. } else {
  12210. const projectionNodes = getProjectionNodes(lView, tNode);
  12211. if (projectionNodes !== null) {
  12212. if (Array.isArray(projectionNodes)) {
  12213. return projectionNodes[0];
  12214. }
  12215. const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
  12216. ngDevMode && assertParentView(parentView);
  12217. return getFirstNativeNode(parentView, projectionNodes);
  12218. } else {
  12219. return getFirstNativeNode(lView, tNode.next);
  12220. }
  12221. }
  12222. }
  12223. return null;
  12224. }
  12225. function getProjectionNodes(lView, tNode) {
  12226. if (tNode !== null) {
  12227. const componentView = lView[DECLARATION_COMPONENT_VIEW];
  12228. const componentHost = componentView[T_HOST];
  12229. const slotIdx = tNode.projection;
  12230. ngDevMode && assertProjectionSlots(lView);
  12231. return componentHost.projection[slotIdx];
  12232. }
  12233. return null;
  12234. }
  12235. function getBeforeNodeForView(viewIndexInContainer, lContainer) {
  12236. const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1;
  12237. if (nextViewIndex < lContainer.length) {
  12238. const lView = lContainer[nextViewIndex];
  12239. const firstTNodeOfView = lView[TVIEW].firstChild;
  12240. if (firstTNodeOfView !== null) {
  12241. return getFirstNativeNode(lView, firstTNodeOfView);
  12242. }
  12243. }
  12244. return lContainer[NATIVE];
  12245. }
  12246. function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) {
  12247. while (tNode != null) {
  12248. ngDevMode && assertTNodeForLView(tNode, lView);
  12249. if (tNode.type === 128) {
  12250. tNode = tNode.next;
  12251. continue;
  12252. }
  12253. ngDevMode && assertTNodeType(
  12254. tNode,
  12255. 3 | 12 | 16 | 32
  12256. /* TNodeType.Icu */
  12257. );
  12258. const rawSlotValue = lView[tNode.index];
  12259. const tNodeType = tNode.type;
  12260. if (isProjection) {
  12261. if (action === 0) {
  12262. rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
  12263. tNode.flags |= 2;
  12264. }
  12265. }
  12266. if (!isDetachedByI18n(tNode)) {
  12267. if (tNodeType & 8) {
  12268. applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
  12269. applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
  12270. } else if (tNodeType & 32) {
  12271. const nextRNode = icuContainerIterate(tNode, lView);
  12272. let rNode;
  12273. while (rNode = nextRNode()) {
  12274. applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode);
  12275. }
  12276. applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
  12277. } else if (tNodeType & 16) {
  12278. applyProjectionRecursive(renderer, action, lView, tNode, parentRElement, beforeNode);
  12279. } else {
  12280. ngDevMode && assertTNodeType(
  12281. tNode,
  12282. 3 | 4
  12283. /* TNodeType.Container */
  12284. );
  12285. applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
  12286. }
  12287. }
  12288. tNode = isProjection ? tNode.projectionNext : tNode.next;
  12289. }
  12290. }
  12291. function applyView(tView, lView, renderer, action, parentRElement, beforeNode) {
  12292. applyNodes(renderer, action, tView.firstChild, lView, parentRElement, beforeNode, false);
  12293. }
  12294. function applyProjection(tView, lView, tProjectionNode) {
  12295. const renderer = lView[RENDERER];
  12296. const parentRNode = getParentRElement(tView, tProjectionNode, lView);
  12297. const parentTNode = tProjectionNode.parent || lView[T_HOST];
  12298. let beforeNode = getInsertInFrontOfRNode(parentTNode, tProjectionNode, lView);
  12299. applyProjectionRecursive(renderer, 0, lView, tProjectionNode, parentRNode, beforeNode);
  12300. }
  12301. function applyProjectionRecursive(renderer, action, lView, tProjectionNode, parentRElement, beforeNode) {
  12302. const componentLView = lView[DECLARATION_COMPONENT_VIEW];
  12303. const componentNode = componentLView[T_HOST];
  12304. ngDevMode && assertEqual(typeof tProjectionNode.projection, "number", "expecting projection index");
  12305. const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection];
  12306. if (Array.isArray(nodeToProjectOrRNodes)) {
  12307. for (let i = 0; i < nodeToProjectOrRNodes.length; i++) {
  12308. const rNode = nodeToProjectOrRNodes[i];
  12309. applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode);
  12310. }
  12311. } else {
  12312. let nodeToProject = nodeToProjectOrRNodes;
  12313. const projectedComponentLView = componentLView[PARENT];
  12314. if (hasInSkipHydrationBlockFlag(tProjectionNode)) {
  12315. nodeToProject.flags |= 128;
  12316. }
  12317. applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true);
  12318. }
  12319. }
  12320. function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) {
  12321. ngDevMode && assertLContainer(lContainer);
  12322. const anchor = lContainer[NATIVE];
  12323. const native = unwrapRNode(lContainer);
  12324. if (anchor !== native) {
  12325. applyToElementOrContainer(action, renderer, parentRElement, anchor, beforeNode);
  12326. }
  12327. for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
  12328. const lView = lContainer[i];
  12329. applyView(lView[TVIEW], lView, renderer, action, parentRElement, anchor);
  12330. }
  12331. }
  12332. function applyStyling(renderer, isClassBased, rNode, prop, value) {
  12333. if (isClassBased) {
  12334. if (!value) {
  12335. ngDevMode && ngDevMode.rendererRemoveClass++;
  12336. renderer.removeClass(rNode, prop);
  12337. } else {
  12338. ngDevMode && ngDevMode.rendererAddClass++;
  12339. renderer.addClass(rNode, prop);
  12340. }
  12341. } else {
  12342. let flags = prop.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase;
  12343. if (value == null) {
  12344. ngDevMode && ngDevMode.rendererRemoveStyle++;
  12345. renderer.removeStyle(rNode, prop, flags);
  12346. } else {
  12347. const isImportant = typeof value === "string" ? value.endsWith("!important") : false;
  12348. if (isImportant) {
  12349. value = value.slice(0, -10);
  12350. flags |= RendererStyleFlags2.Important;
  12351. }
  12352. ngDevMode && ngDevMode.rendererSetStyle++;
  12353. renderer.setStyle(rNode, prop, value, flags);
  12354. }
  12355. }
  12356. }
  12357. function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
  12358. while (tNode !== null) {
  12359. if (tNode.type === 128) {
  12360. tNode = isProjection ? tNode.projectionNext : tNode.next;
  12361. continue;
  12362. }
  12363. ngDevMode && assertTNodeType(
  12364. tNode,
  12365. 3 | 12 | 16 | 32
  12366. /* TNodeType.Icu */
  12367. );
  12368. const lNode = lView[tNode.index];
  12369. if (lNode !== null) {
  12370. result.push(unwrapRNode(lNode));
  12371. }
  12372. if (isLContainer(lNode)) {
  12373. collectNativeNodesInLContainer(lNode, result);
  12374. }
  12375. const tNodeType = tNode.type;
  12376. if (tNodeType & 8) {
  12377. collectNativeNodes(tView, lView, tNode.child, result);
  12378. } else if (tNodeType & 32) {
  12379. const nextRNode = icuContainerIterate(tNode, lView);
  12380. let rNode;
  12381. while (rNode = nextRNode()) {
  12382. result.push(rNode);
  12383. }
  12384. } else if (tNodeType & 16) {
  12385. const nodesInSlot = getProjectionNodes(lView, tNode);
  12386. if (Array.isArray(nodesInSlot)) {
  12387. result.push(...nodesInSlot);
  12388. } else {
  12389. const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
  12390. ngDevMode && assertParentView(parentView);
  12391. collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
  12392. }
  12393. }
  12394. tNode = isProjection ? tNode.projectionNext : tNode.next;
  12395. }
  12396. return result;
  12397. }
  12398. function collectNativeNodesInLContainer(lContainer, result) {
  12399. for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
  12400. const lViewInAContainer = lContainer[i];
  12401. const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild;
  12402. if (lViewFirstChildTNode !== null) {
  12403. collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result);
  12404. }
  12405. }
  12406. if (lContainer[NATIVE] !== lContainer[HOST]) {
  12407. result.push(lContainer[NATIVE]);
  12408. }
  12409. }
  12410. function addAfterRenderSequencesForView(lView) {
  12411. if (lView[AFTER_RENDER_SEQUENCES_TO_ADD] !== null) {
  12412. for (const sequence of lView[AFTER_RENDER_SEQUENCES_TO_ADD]) {
  12413. sequence.impl.addSequence(sequence);
  12414. }
  12415. lView[AFTER_RENDER_SEQUENCES_TO_ADD].length = 0;
  12416. }
  12417. }
  12418. var freeConsumers = [];
  12419. function getOrBorrowReactiveLViewConsumer(lView) {
  12420. return lView[REACTIVE_TEMPLATE_CONSUMER] ?? borrowReactiveLViewConsumer(lView);
  12421. }
  12422. function borrowReactiveLViewConsumer(lView) {
  12423. const consumer = freeConsumers.pop() ?? Object.create(REACTIVE_LVIEW_CONSUMER_NODE);
  12424. consumer.lView = lView;
  12425. return consumer;
  12426. }
  12427. function maybeReturnReactiveLViewConsumer(consumer) {
  12428. if (consumer.lView[REACTIVE_TEMPLATE_CONSUMER] === consumer) {
  12429. return;
  12430. }
  12431. consumer.lView = null;
  12432. freeConsumers.push(consumer);
  12433. }
  12434. var REACTIVE_LVIEW_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  12435. consumerIsAlwaysLive: true,
  12436. kind: "template",
  12437. consumerMarkedDirty: (node) => {
  12438. markAncestorsForTraversal(node.lView);
  12439. },
  12440. consumerOnSignalRead() {
  12441. this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
  12442. }
  12443. });
  12444. function getOrCreateTemporaryConsumer(lView) {
  12445. const consumer = lView[REACTIVE_TEMPLATE_CONSUMER] ?? Object.create(TEMPORARY_CONSUMER_NODE);
  12446. consumer.lView = lView;
  12447. return consumer;
  12448. }
  12449. var TEMPORARY_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  12450. consumerIsAlwaysLive: true,
  12451. kind: "template",
  12452. consumerMarkedDirty: (node) => {
  12453. let parent = getLViewParent(node.lView);
  12454. while (parent && !viewShouldHaveReactiveConsumer(parent[TVIEW])) {
  12455. parent = getLViewParent(parent);
  12456. }
  12457. if (!parent) {
  12458. return;
  12459. }
  12460. markViewForRefresh(parent);
  12461. },
  12462. consumerOnSignalRead() {
  12463. this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
  12464. }
  12465. });
  12466. function viewShouldHaveReactiveConsumer(tView) {
  12467. return tView.type !== 2;
  12468. }
  12469. function runEffectsInView(view) {
  12470. if (view[EFFECTS] === null) {
  12471. return;
  12472. }
  12473. let tryFlushEffects = true;
  12474. while (tryFlushEffects) {
  12475. let foundDirtyEffect = false;
  12476. for (const effect2 of view[EFFECTS]) {
  12477. if (!effect2.dirty) {
  12478. continue;
  12479. }
  12480. foundDirtyEffect = true;
  12481. if (effect2.zone === null || Zone.current === effect2.zone) {
  12482. effect2.run();
  12483. } else {
  12484. effect2.zone.run(() => effect2.run());
  12485. }
  12486. }
  12487. tryFlushEffects = foundDirtyEffect && !!(view[FLAGS] & 8192);
  12488. }
  12489. }
  12490. var MAXIMUM_REFRESH_RERUNS$1 = 100;
  12491. function detectChangesInternal(lView, notifyErrorHandler = true, mode = 0) {
  12492. const environment = lView[ENVIRONMENT];
  12493. const rendererFactory = environment.rendererFactory;
  12494. const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
  12495. if (!checkNoChangesMode) {
  12496. rendererFactory.begin?.();
  12497. }
  12498. try {
  12499. detectChangesInViewWhileDirty(lView, mode);
  12500. } catch (error) {
  12501. if (notifyErrorHandler) {
  12502. handleError$1(lView, error);
  12503. }
  12504. throw error;
  12505. } finally {
  12506. if (!checkNoChangesMode) {
  12507. rendererFactory.end?.();
  12508. }
  12509. }
  12510. }
  12511. function detectChangesInViewWhileDirty(lView, mode) {
  12512. const lastIsRefreshingViewsValue = isRefreshingViews();
  12513. try {
  12514. setIsRefreshingViews(true);
  12515. detectChangesInView(lView, mode);
  12516. if (ngDevMode && isExhaustiveCheckNoChanges()) {
  12517. return;
  12518. }
  12519. let retries = 0;
  12520. while (requiresRefreshOrTraversal(lView)) {
  12521. if (retries === MAXIMUM_REFRESH_RERUNS$1) {
  12522. throw new RuntimeError(103, ngDevMode && "Infinite change detection while trying to refresh views. There may be components which each cause the other to require a refresh, causing an infinite loop.");
  12523. }
  12524. retries++;
  12525. detectChangesInView(
  12526. lView,
  12527. 1
  12528. /* ChangeDetectionMode.Targeted */
  12529. );
  12530. }
  12531. } finally {
  12532. setIsRefreshingViews(lastIsRefreshingViewsValue);
  12533. }
  12534. }
  12535. function checkNoChangesInternal(lView, mode, notifyErrorHandler = true) {
  12536. setIsInCheckNoChangesMode(mode);
  12537. try {
  12538. detectChangesInternal(lView, notifyErrorHandler);
  12539. } finally {
  12540. setIsInCheckNoChangesMode(CheckNoChangesMode.Off);
  12541. }
  12542. }
  12543. function refreshView(tView, lView, templateFn, context2) {
  12544. ngDevMode && assertEqual(isCreationMode(lView), false, "Should be run in update mode");
  12545. if (isDestroyed(lView)) return;
  12546. const flags = lView[FLAGS];
  12547. const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
  12548. const isInExhaustiveCheckNoChangesPass = ngDevMode && isExhaustiveCheckNoChanges();
  12549. enterView(lView);
  12550. let returnConsumerToPool = true;
  12551. let prevConsumer = null;
  12552. let currentConsumer = null;
  12553. if (!isInCheckNoChangesPass) {
  12554. if (viewShouldHaveReactiveConsumer(tView)) {
  12555. currentConsumer = getOrBorrowReactiveLViewConsumer(lView);
  12556. prevConsumer = consumerBeforeComputation(currentConsumer);
  12557. } else if (getActiveConsumer() === null) {
  12558. returnConsumerToPool = false;
  12559. currentConsumer = getOrCreateTemporaryConsumer(lView);
  12560. prevConsumer = consumerBeforeComputation(currentConsumer);
  12561. } else if (lView[REACTIVE_TEMPLATE_CONSUMER]) {
  12562. consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]);
  12563. lView[REACTIVE_TEMPLATE_CONSUMER] = null;
  12564. }
  12565. }
  12566. try {
  12567. resetPreOrderHookFlags(lView);
  12568. setBindingIndex(tView.bindingStartIndex);
  12569. if (templateFn !== null) {
  12570. executeTemplate(tView, lView, templateFn, 2, context2);
  12571. }
  12572. const hooksInitPhaseCompleted = (flags & 3) === 3;
  12573. if (!isInCheckNoChangesPass) {
  12574. if (hooksInitPhaseCompleted) {
  12575. const preOrderCheckHooks = tView.preOrderCheckHooks;
  12576. if (preOrderCheckHooks !== null) {
  12577. executeCheckHooks(lView, preOrderCheckHooks, null);
  12578. }
  12579. } else {
  12580. const preOrderHooks = tView.preOrderHooks;
  12581. if (preOrderHooks !== null) {
  12582. executeInitAndCheckHooks(lView, preOrderHooks, 0, null);
  12583. }
  12584. incrementInitPhaseFlags(
  12585. lView,
  12586. 0
  12587. /* InitPhaseState.OnInitHooksToBeRun */
  12588. );
  12589. }
  12590. }
  12591. if (!isInExhaustiveCheckNoChangesPass) {
  12592. markTransplantedViewsForRefresh(lView);
  12593. }
  12594. runEffectsInView(lView);
  12595. detectChangesInEmbeddedViews(
  12596. lView,
  12597. 0
  12598. /* ChangeDetectionMode.Global */
  12599. );
  12600. if (tView.contentQueries !== null) {
  12601. refreshContentQueries(tView, lView);
  12602. }
  12603. if (!isInCheckNoChangesPass) {
  12604. if (hooksInitPhaseCompleted) {
  12605. const contentCheckHooks = tView.contentCheckHooks;
  12606. if (contentCheckHooks !== null) {
  12607. executeCheckHooks(lView, contentCheckHooks);
  12608. }
  12609. } else {
  12610. const contentHooks = tView.contentHooks;
  12611. if (contentHooks !== null) {
  12612. executeInitAndCheckHooks(
  12613. lView,
  12614. contentHooks,
  12615. 1
  12616. /* InitPhaseState.AfterContentInitHooksToBeRun */
  12617. );
  12618. }
  12619. incrementInitPhaseFlags(
  12620. lView,
  12621. 1
  12622. /* InitPhaseState.AfterContentInitHooksToBeRun */
  12623. );
  12624. }
  12625. }
  12626. processHostBindingOpCodes(tView, lView);
  12627. const components = tView.components;
  12628. if (components !== null) {
  12629. detectChangesInChildComponents(
  12630. lView,
  12631. components,
  12632. 0
  12633. /* ChangeDetectionMode.Global */
  12634. );
  12635. }
  12636. const viewQuery = tView.viewQuery;
  12637. if (viewQuery !== null) {
  12638. executeViewQueryFn(2, viewQuery, context2);
  12639. }
  12640. if (!isInCheckNoChangesPass) {
  12641. if (hooksInitPhaseCompleted) {
  12642. const viewCheckHooks = tView.viewCheckHooks;
  12643. if (viewCheckHooks !== null) {
  12644. executeCheckHooks(lView, viewCheckHooks);
  12645. }
  12646. } else {
  12647. const viewHooks = tView.viewHooks;
  12648. if (viewHooks !== null) {
  12649. executeInitAndCheckHooks(
  12650. lView,
  12651. viewHooks,
  12652. 2
  12653. /* InitPhaseState.AfterViewInitHooksToBeRun */
  12654. );
  12655. }
  12656. incrementInitPhaseFlags(
  12657. lView,
  12658. 2
  12659. /* InitPhaseState.AfterViewInitHooksToBeRun */
  12660. );
  12661. }
  12662. }
  12663. if (tView.firstUpdatePass === true) {
  12664. tView.firstUpdatePass = false;
  12665. }
  12666. if (lView[EFFECTS_TO_SCHEDULE]) {
  12667. for (const notifyEffect of lView[EFFECTS_TO_SCHEDULE]) {
  12668. notifyEffect();
  12669. }
  12670. lView[EFFECTS_TO_SCHEDULE] = null;
  12671. }
  12672. if (!isInCheckNoChangesPass) {
  12673. addAfterRenderSequencesForView(lView);
  12674. lView[FLAGS] &= ~(64 | 8);
  12675. }
  12676. } catch (e) {
  12677. if (!isInCheckNoChangesPass) {
  12678. markAncestorsForTraversal(lView);
  12679. }
  12680. throw e;
  12681. } finally {
  12682. if (currentConsumer !== null) {
  12683. consumerAfterComputation(currentConsumer, prevConsumer);
  12684. if (returnConsumerToPool) {
  12685. maybeReturnReactiveLViewConsumer(currentConsumer);
  12686. }
  12687. }
  12688. leaveView();
  12689. }
  12690. }
  12691. function detectChangesInEmbeddedViews(lView, mode) {
  12692. for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
  12693. for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
  12694. const embeddedLView = lContainer[i];
  12695. detectChangesInViewIfAttached(embeddedLView, mode);
  12696. }
  12697. }
  12698. }
  12699. function markTransplantedViewsForRefresh(lView) {
  12700. for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
  12701. if (!(lContainer[FLAGS] & 2)) continue;
  12702. const movedViews = lContainer[MOVED_VIEWS];
  12703. ngDevMode && assertDefined(movedViews, "Transplanted View flags set but missing MOVED_VIEWS");
  12704. for (let i = 0; i < movedViews.length; i++) {
  12705. const movedLView = movedViews[i];
  12706. markViewForRefresh(movedLView);
  12707. }
  12708. }
  12709. }
  12710. function detectChangesInComponent(hostLView, componentHostIdx, mode) {
  12711. ngDevMode && assertEqual(isCreationMode(hostLView), false, "Should be run in update mode");
  12712. profiler(
  12713. 18
  12714. /* ProfilerEvent.ComponentStart */
  12715. );
  12716. const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
  12717. detectChangesInViewIfAttached(componentView, mode);
  12718. profiler(19, componentView[CONTEXT]);
  12719. }
  12720. function detectChangesInViewIfAttached(lView, mode) {
  12721. if (!viewAttachedToChangeDetector(lView)) {
  12722. return;
  12723. }
  12724. detectChangesInView(lView, mode);
  12725. }
  12726. function detectChangesInView(lView, mode) {
  12727. const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
  12728. const tView = lView[TVIEW];
  12729. const flags = lView[FLAGS];
  12730. const consumer = lView[REACTIVE_TEMPLATE_CONSUMER];
  12731. let shouldRefreshView = !!(mode === 0 && flags & 16);
  12732. shouldRefreshView ||= !!(flags & 64 && mode === 0 && !isInCheckNoChangesPass);
  12733. shouldRefreshView ||= !!(flags & 1024);
  12734. shouldRefreshView ||= !!(consumer?.dirty && consumerPollProducersForChange(consumer));
  12735. shouldRefreshView ||= !!(ngDevMode && isExhaustiveCheckNoChanges());
  12736. if (consumer) {
  12737. consumer.dirty = false;
  12738. }
  12739. lView[FLAGS] &= -9217;
  12740. if (shouldRefreshView) {
  12741. refreshView(tView, lView, tView.template, lView[CONTEXT]);
  12742. } else if (flags & 8192) {
  12743. if (!isInCheckNoChangesPass) {
  12744. runEffectsInView(lView);
  12745. }
  12746. detectChangesInEmbeddedViews(
  12747. lView,
  12748. 1
  12749. /* ChangeDetectionMode.Targeted */
  12750. );
  12751. const components = tView.components;
  12752. if (components !== null) {
  12753. detectChangesInChildComponents(
  12754. lView,
  12755. components,
  12756. 1
  12757. /* ChangeDetectionMode.Targeted */
  12758. );
  12759. }
  12760. if (!isInCheckNoChangesPass) {
  12761. addAfterRenderSequencesForView(lView);
  12762. }
  12763. }
  12764. }
  12765. function detectChangesInChildComponents(hostLView, components, mode) {
  12766. for (let i = 0; i < components.length; i++) {
  12767. detectChangesInComponent(hostLView, components[i], mode);
  12768. }
  12769. }
  12770. function processHostBindingOpCodes(tView, lView) {
  12771. const hostBindingOpCodes = tView.hostBindingOpCodes;
  12772. if (hostBindingOpCodes === null) return;
  12773. try {
  12774. for (let i = 0; i < hostBindingOpCodes.length; i++) {
  12775. const opCode = hostBindingOpCodes[i];
  12776. if (opCode < 0) {
  12777. setSelectedIndex(~opCode);
  12778. } else {
  12779. const directiveIdx = opCode;
  12780. const bindingRootIndx = hostBindingOpCodes[++i];
  12781. const hostBindingFn = hostBindingOpCodes[++i];
  12782. setBindingRootForHostBindings(bindingRootIndx, directiveIdx);
  12783. const context2 = lView[directiveIdx];
  12784. profiler(24, context2);
  12785. hostBindingFn(2, context2);
  12786. profiler(25, context2);
  12787. }
  12788. }
  12789. } finally {
  12790. setSelectedIndex(-1);
  12791. }
  12792. }
  12793. function markViewDirty(lView, source) {
  12794. const dirtyBitsToUse = isRefreshingViews() ? (
  12795. // When we are actively refreshing views, we only use the `Dirty` bit to mark a view
  12796. 64
  12797. ) : (
  12798. // When we are not actively refreshing a view tree, it is absolutely
  12799. // valid to update state and mark views dirty. We use the `RefreshView` flag in this
  12800. // case to allow synchronously rerunning change detection. This applies today to
  12801. // afterRender hooks as well as animation listeners which execute after detecting
  12802. // changes in a view when the render factory flushes.
  12803. 1024 | 64
  12804. );
  12805. lView[ENVIRONMENT].changeDetectionScheduler?.notify(source);
  12806. while (lView) {
  12807. lView[FLAGS] |= dirtyBitsToUse;
  12808. const parent = getLViewParent(lView);
  12809. if (isRootView(lView) && !parent) {
  12810. return lView;
  12811. }
  12812. lView = parent;
  12813. }
  12814. return null;
  12815. }
  12816. function createLContainer(hostNative, currentView, native, tNode) {
  12817. ngDevMode && assertLView(currentView);
  12818. const lContainer = [
  12819. hostNative,
  12820. // host native
  12821. true,
  12822. // Boolean `true` in this position signifies that this is an `LContainer`
  12823. 0,
  12824. // flags
  12825. currentView,
  12826. // parent
  12827. null,
  12828. // next
  12829. tNode,
  12830. // t_host
  12831. null,
  12832. // dehydrated views
  12833. native,
  12834. // native,
  12835. null,
  12836. // view refs
  12837. null
  12838. // moved views
  12839. ];
  12840. ngDevMode && assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, "Should allocate correct number of slots for LContainer header.");
  12841. return lContainer;
  12842. }
  12843. function getLViewFromLContainer(lContainer, index) {
  12844. const adjustedIndex = CONTAINER_HEADER_OFFSET + index;
  12845. if (adjustedIndex < lContainer.length) {
  12846. const lView = lContainer[adjustedIndex];
  12847. ngDevMode && assertLView(lView);
  12848. return lView;
  12849. }
  12850. return void 0;
  12851. }
  12852. function addLViewToLContainer(lContainer, lView, index, addToDOM = true) {
  12853. const tView = lView[TVIEW];
  12854. insertView(tView, lView, lContainer, index);
  12855. if (addToDOM) {
  12856. const beforeNode = getBeforeNodeForView(index, lContainer);
  12857. const renderer = lView[RENDERER];
  12858. const parentRNode = renderer.parentNode(lContainer[NATIVE]);
  12859. if (parentRNode !== null) {
  12860. addViewToDOM(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
  12861. }
  12862. }
  12863. const hydrationInfo = lView[HYDRATION];
  12864. if (hydrationInfo !== null && hydrationInfo.firstChild !== null) {
  12865. hydrationInfo.firstChild = null;
  12866. }
  12867. }
  12868. function removeLViewFromLContainer(lContainer, index) {
  12869. const lView = detachView(lContainer, index);
  12870. if (lView !== void 0) {
  12871. destroyLView(lView[TVIEW], lView);
  12872. }
  12873. return lView;
  12874. }
  12875. function detachView(lContainer, removeIndex) {
  12876. if (lContainer.length <= CONTAINER_HEADER_OFFSET) return;
  12877. const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex;
  12878. const viewToDetach = lContainer[indexInContainer];
  12879. if (viewToDetach) {
  12880. const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER];
  12881. if (declarationLContainer !== null && declarationLContainer !== lContainer) {
  12882. detachMovedView(declarationLContainer, viewToDetach);
  12883. }
  12884. if (removeIndex > 0) {
  12885. lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT];
  12886. }
  12887. const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex);
  12888. removeViewFromDOM(viewToDetach[TVIEW], viewToDetach);
  12889. const lQueries = removedLView[QUERIES];
  12890. if (lQueries !== null) {
  12891. lQueries.detachView(removedLView[TVIEW]);
  12892. }
  12893. viewToDetach[PARENT] = null;
  12894. viewToDetach[NEXT] = null;
  12895. viewToDetach[FLAGS] &= -129;
  12896. }
  12897. return viewToDetach;
  12898. }
  12899. function insertView(tView, lView, lContainer, index) {
  12900. ngDevMode && assertLView(lView);
  12901. ngDevMode && assertLContainer(lContainer);
  12902. const indexInContainer = CONTAINER_HEADER_OFFSET + index;
  12903. const containerLength = lContainer.length;
  12904. if (index > 0) {
  12905. lContainer[indexInContainer - 1][NEXT] = lView;
  12906. }
  12907. if (index < containerLength - CONTAINER_HEADER_OFFSET) {
  12908. lView[NEXT] = lContainer[indexInContainer];
  12909. addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView);
  12910. } else {
  12911. lContainer.push(lView);
  12912. lView[NEXT] = null;
  12913. }
  12914. lView[PARENT] = lContainer;
  12915. const declarationLContainer = lView[DECLARATION_LCONTAINER];
  12916. if (declarationLContainer !== null && lContainer !== declarationLContainer) {
  12917. trackMovedView(declarationLContainer, lView);
  12918. }
  12919. const lQueries = lView[QUERIES];
  12920. if (lQueries !== null) {
  12921. lQueries.insertView(tView);
  12922. }
  12923. updateAncestorTraversalFlagsOnAttach(lView);
  12924. lView[FLAGS] |= 128;
  12925. }
  12926. function trackMovedView(declarationContainer, lView) {
  12927. ngDevMode && assertDefined(lView, "LView required");
  12928. ngDevMode && assertLContainer(declarationContainer);
  12929. const movedViews = declarationContainer[MOVED_VIEWS];
  12930. const parent = lView[PARENT];
  12931. ngDevMode && assertDefined(parent, "missing parent");
  12932. if (isLView(parent)) {
  12933. declarationContainer[FLAGS] |= 2;
  12934. } else {
  12935. const insertedComponentLView = parent[PARENT][DECLARATION_COMPONENT_VIEW];
  12936. ngDevMode && assertDefined(insertedComponentLView, "Missing insertedComponentLView");
  12937. const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW];
  12938. ngDevMode && assertDefined(declaredComponentLView, "Missing declaredComponentLView");
  12939. if (declaredComponentLView !== insertedComponentLView) {
  12940. declarationContainer[FLAGS] |= 2;
  12941. }
  12942. }
  12943. if (movedViews === null) {
  12944. declarationContainer[MOVED_VIEWS] = [lView];
  12945. } else {
  12946. movedViews.push(lView);
  12947. }
  12948. }
  12949. var ViewRef$1 = class ViewRef {
  12950. _lView;
  12951. _cdRefInjectingView;
  12952. notifyErrorHandler;
  12953. _appRef = null;
  12954. _attachedToViewContainer = false;
  12955. get rootNodes() {
  12956. const lView = this._lView;
  12957. const tView = lView[TVIEW];
  12958. return collectNativeNodes(tView, lView, tView.firstChild, []);
  12959. }
  12960. constructor(_lView, _cdRefInjectingView, notifyErrorHandler = true) {
  12961. this._lView = _lView;
  12962. this._cdRefInjectingView = _cdRefInjectingView;
  12963. this.notifyErrorHandler = notifyErrorHandler;
  12964. }
  12965. get context() {
  12966. return this._lView[CONTEXT];
  12967. }
  12968. /**
  12969. * @deprecated Replacing the full context object is not supported. Modify the context
  12970. * directly, or consider using a `Proxy` if you need to replace the full object.
  12971. * // TODO(devversion): Remove this.
  12972. */
  12973. set context(value) {
  12974. if (ngDevMode) {
  12975. console.warn("Angular: Replacing the `context` object of an `EmbeddedViewRef` is deprecated.");
  12976. }
  12977. this._lView[CONTEXT] = value;
  12978. }
  12979. get destroyed() {
  12980. return isDestroyed(this._lView);
  12981. }
  12982. destroy() {
  12983. if (this._appRef) {
  12984. this._appRef.detachView(this);
  12985. } else if (this._attachedToViewContainer) {
  12986. const parent = this._lView[PARENT];
  12987. if (isLContainer(parent)) {
  12988. const viewRefs = parent[VIEW_REFS];
  12989. const index = viewRefs ? viewRefs.indexOf(this) : -1;
  12990. if (index > -1) {
  12991. ngDevMode && assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, "An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.");
  12992. detachView(parent, index);
  12993. removeFromArray(viewRefs, index);
  12994. }
  12995. }
  12996. this._attachedToViewContainer = false;
  12997. }
  12998. destroyLView(this._lView[TVIEW], this._lView);
  12999. }
  13000. onDestroy(callback) {
  13001. storeLViewOnDestroy(this._lView, callback);
  13002. }
  13003. /**
  13004. * Marks a view and all of its ancestors dirty.
  13005. *
  13006. * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush} component is
  13007. * checked when it needs to be re-rendered but the two normal triggers haven't marked it
  13008. * dirty (i.e. inputs haven't changed and events haven't fired in the view).
  13009. *
  13010. * <!-- TODO: Add a link to a chapter on OnPush components -->
  13011. *
  13012. * @usageNotes
  13013. * ### Example
  13014. *
  13015. * ```ts
  13016. * @Component({
  13017. * selector: 'app-root',
  13018. * template: `Number of ticks: {{numberOfTicks}}`
  13019. * changeDetection: ChangeDetectionStrategy.OnPush,
  13020. * })
  13021. * class AppComponent {
  13022. * numberOfTicks = 0;
  13023. *
  13024. * constructor(private ref: ChangeDetectorRef) {
  13025. * setInterval(() => {
  13026. * this.numberOfTicks++;
  13027. * // the following is required, otherwise the view will not be updated
  13028. * this.ref.markForCheck();
  13029. * }, 1000);
  13030. * }
  13031. * }
  13032. * ```
  13033. */
  13034. markForCheck() {
  13035. markViewDirty(
  13036. this._cdRefInjectingView || this._lView,
  13037. 4
  13038. /* NotificationSource.MarkForCheck */
  13039. );
  13040. }
  13041. /**
  13042. * Detaches the view from the change detection tree.
  13043. *
  13044. * Detached views will not be checked during change detection runs until they are
  13045. * re-attached, even if they are dirty. `detach` can be used in combination with
  13046. * {@link ChangeDetectorRef#detectChanges} to implement local change
  13047. * detection checks.
  13048. *
  13049. * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
  13050. * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
  13051. *
  13052. * @usageNotes
  13053. * ### Example
  13054. *
  13055. * The following example defines a component with a large list of readonly data.
  13056. * Imagine the data changes constantly, many times per second. For performance reasons,
  13057. * we want to check and update the list every five seconds. We can do that by detaching
  13058. * the component's change detector and doing a local check every five seconds.
  13059. *
  13060. * ```ts
  13061. * class DataProvider {
  13062. * // in a real application the returned data will be different every time
  13063. * get data() {
  13064. * return [1,2,3,4,5];
  13065. * }
  13066. * }
  13067. *
  13068. * @Component({
  13069. * selector: 'giant-list',
  13070. * template: `
  13071. * <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
  13072. * `,
  13073. * })
  13074. * class GiantList {
  13075. * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
  13076. * ref.detach();
  13077. * setInterval(() => {
  13078. * this.ref.detectChanges();
  13079. * }, 5000);
  13080. * }
  13081. * }
  13082. *
  13083. * @Component({
  13084. * selector: 'app',
  13085. * providers: [DataProvider],
  13086. * template: `
  13087. * <giant-list><giant-list>
  13088. * `,
  13089. * })
  13090. * class App {
  13091. * }
  13092. * ```
  13093. */
  13094. detach() {
  13095. this._lView[FLAGS] &= -129;
  13096. }
  13097. /**
  13098. * Re-attaches a view to the change detection tree.
  13099. *
  13100. * This can be used to re-attach views that were previously detached from the tree
  13101. * using {@link ChangeDetectorRef#detach}. Views are attached to the tree by default.
  13102. *
  13103. * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
  13104. *
  13105. * @usageNotes
  13106. * ### Example
  13107. *
  13108. * The following example creates a component displaying `live` data. The component will detach
  13109. * its change detector from the main change detector tree when the component's live property
  13110. * is set to false.
  13111. *
  13112. * ```ts
  13113. * class DataProvider {
  13114. * data = 1;
  13115. *
  13116. * constructor() {
  13117. * setInterval(() => {
  13118. * this.data = this.data * 2;
  13119. * }, 500);
  13120. * }
  13121. * }
  13122. *
  13123. * @Component({
  13124. * selector: 'live-data',
  13125. * inputs: ['live'],
  13126. * template: 'Data: {{dataProvider.data}}'
  13127. * })
  13128. * class LiveData {
  13129. * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {}
  13130. *
  13131. * set live(value) {
  13132. * if (value) {
  13133. * this.ref.reattach();
  13134. * } else {
  13135. * this.ref.detach();
  13136. * }
  13137. * }
  13138. * }
  13139. *
  13140. * @Component({
  13141. * selector: 'app-root',
  13142. * providers: [DataProvider],
  13143. * template: `
  13144. * Live Update: <input type="checkbox" [(ngModel)]="live">
  13145. * <live-data [live]="live"><live-data>
  13146. * `,
  13147. * })
  13148. * class AppComponent {
  13149. * live = true;
  13150. * }
  13151. * ```
  13152. */
  13153. reattach() {
  13154. updateAncestorTraversalFlagsOnAttach(this._lView);
  13155. this._lView[FLAGS] |= 128;
  13156. }
  13157. /**
  13158. * Checks the view and its children.
  13159. *
  13160. * This can also be used in combination with {@link ChangeDetectorRef#detach} to implement
  13161. * local change detection checks.
  13162. *
  13163. * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
  13164. * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
  13165. *
  13166. * @usageNotes
  13167. * ### Example
  13168. *
  13169. * The following example defines a component with a large list of readonly data.
  13170. * Imagine, the data changes constantly, many times per second. For performance reasons,
  13171. * we want to check and update the list every five seconds.
  13172. *
  13173. * We can do that by detaching the component's change detector and doing a local change detection
  13174. * check every five seconds.
  13175. *
  13176. * See {@link ChangeDetectorRef#detach} for more information.
  13177. */
  13178. detectChanges() {
  13179. this._lView[FLAGS] |= 1024;
  13180. detectChangesInternal(this._lView, this.notifyErrorHandler);
  13181. }
  13182. /**
  13183. * Checks the change detector and its children, and throws if any changes are detected.
  13184. *
  13185. * This is used in development mode to verify that running change detection doesn't
  13186. * introduce other changes.
  13187. */
  13188. checkNoChanges() {
  13189. if (ngDevMode) {
  13190. checkNoChangesInternal(this._lView, CheckNoChangesMode.OnlyDirtyViews, this.notifyErrorHandler);
  13191. }
  13192. }
  13193. attachToViewContainerRef() {
  13194. if (this._appRef) {
  13195. throw new RuntimeError(902, ngDevMode && "This view is already attached directly to the ApplicationRef!");
  13196. }
  13197. this._attachedToViewContainer = true;
  13198. }
  13199. detachFromAppRef() {
  13200. this._appRef = null;
  13201. const isRoot = isRootView(this._lView);
  13202. const declarationContainer = this._lView[DECLARATION_LCONTAINER];
  13203. if (declarationContainer !== null && !isRoot) {
  13204. detachMovedView(declarationContainer, this._lView);
  13205. }
  13206. detachViewFromDOM(this._lView[TVIEW], this._lView);
  13207. }
  13208. attachToAppRef(appRef) {
  13209. if (this._attachedToViewContainer) {
  13210. throw new RuntimeError(902, ngDevMode && "This view is already attached to a ViewContainer!");
  13211. }
  13212. this._appRef = appRef;
  13213. const isRoot = isRootView(this._lView);
  13214. const declarationContainer = this._lView[DECLARATION_LCONTAINER];
  13215. if (declarationContainer !== null && !isRoot) {
  13216. trackMovedView(declarationContainer, this._lView);
  13217. }
  13218. updateAncestorTraversalFlagsOnAttach(this._lView);
  13219. }
  13220. };
  13221. function isViewDirty(view) {
  13222. return requiresRefreshOrTraversal(view._lView) || !!(view._lView[FLAGS] & 64);
  13223. }
  13224. function markForRefresh(view) {
  13225. markViewForRefresh(view["_cdRefInjectingView"] || view._lView);
  13226. }
  13227. var TemplateRef = class {
  13228. /**
  13229. * @internal
  13230. * @nocollapse
  13231. */
  13232. static __NG_ELEMENT_ID__ = injectTemplateRef;
  13233. };
  13234. var ViewEngineTemplateRef = TemplateRef;
  13235. var R3TemplateRef = class TemplateRef2 extends ViewEngineTemplateRef {
  13236. _declarationLView;
  13237. _declarationTContainer;
  13238. elementRef;
  13239. constructor(_declarationLView, _declarationTContainer, elementRef) {
  13240. super();
  13241. this._declarationLView = _declarationLView;
  13242. this._declarationTContainer = _declarationTContainer;
  13243. this.elementRef = elementRef;
  13244. }
  13245. /**
  13246. * Returns an `ssrId` associated with a TView, which was used to
  13247. * create this instance of the `TemplateRef`.
  13248. *
  13249. * @internal
  13250. */
  13251. get ssrId() {
  13252. return this._declarationTContainer.tView?.ssrId || null;
  13253. }
  13254. createEmbeddedView(context2, injector) {
  13255. return this.createEmbeddedViewImpl(context2, injector);
  13256. }
  13257. /**
  13258. * @internal
  13259. */
  13260. createEmbeddedViewImpl(context2, injector, dehydratedView) {
  13261. const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context2, {
  13262. embeddedViewInjector: injector,
  13263. dehydratedView
  13264. });
  13265. return new ViewRef$1(embeddedLView);
  13266. }
  13267. };
  13268. function injectTemplateRef() {
  13269. return createTemplateRef(getCurrentTNode(), getLView());
  13270. }
  13271. function createTemplateRef(hostTNode, hostLView) {
  13272. if (hostTNode.type & 4) {
  13273. ngDevMode && assertDefined(hostTNode.tView, "TView must be allocated");
  13274. return new R3TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView));
  13275. }
  13276. return null;
  13277. }
  13278. var AT_THIS_LOCATION = "<-- AT THIS LOCATION";
  13279. function getFriendlyStringFromTNodeType(tNodeType) {
  13280. switch (tNodeType) {
  13281. case 4:
  13282. return "view container";
  13283. case 2:
  13284. return "element";
  13285. case 8:
  13286. return "ng-container";
  13287. case 32:
  13288. return "icu";
  13289. case 64:
  13290. return "i18n";
  13291. case 16:
  13292. return "projection";
  13293. case 1:
  13294. return "text";
  13295. case 128:
  13296. return "@let";
  13297. default:
  13298. return "<unknown>";
  13299. }
  13300. }
  13301. function validateMatchingNode(node, nodeType, tagName, lView, tNode, isViewContainerAnchor = false) {
  13302. if (!node || node.nodeType !== nodeType || node.nodeType === Node.ELEMENT_NODE && node.tagName.toLowerCase() !== tagName?.toLowerCase()) {
  13303. const expectedNode = shortRNodeDescription(nodeType, tagName, null);
  13304. let header = `During hydration Angular expected ${expectedNode} but `;
  13305. const hostComponentDef = getDeclarationComponentDef(lView);
  13306. const componentClassName = hostComponentDef?.type?.name;
  13307. const expectedDom = describeExpectedDom(lView, tNode, isViewContainerAnchor);
  13308. const expected = `Angular expected this DOM:
  13309. ${expectedDom}
  13310. `;
  13311. let actual = "";
  13312. const componentHostElement = unwrapRNode(lView[HOST]);
  13313. if (!node) {
  13314. header += `the node was not found.
  13315. `;
  13316. markRNodeAsHavingHydrationMismatch(componentHostElement, expectedDom);
  13317. } else {
  13318. const actualNode = shortRNodeDescription(node.nodeType, node.tagName ?? null, node.textContent ?? null);
  13319. header += `found ${actualNode}.
  13320. `;
  13321. const actualDom = describeDomFromNode(node);
  13322. actual = `Actual DOM is:
  13323. ${actualDom}
  13324. `;
  13325. markRNodeAsHavingHydrationMismatch(componentHostElement, expectedDom, actualDom);
  13326. }
  13327. const footer = getHydrationErrorFooter(componentClassName);
  13328. const message = header + expected + actual + getHydrationAttributeNote() + footer;
  13329. throw new RuntimeError(-500, message);
  13330. }
  13331. }
  13332. function validateSiblingNodeExists(node) {
  13333. validateNodeExists(node);
  13334. if (!node.nextSibling) {
  13335. const header = "During hydration Angular expected more sibling nodes to be present.\n\n";
  13336. const actual = `Actual DOM is:
  13337. ${describeDomFromNode(node)}
  13338. `;
  13339. const footer = getHydrationErrorFooter();
  13340. const message = header + actual + footer;
  13341. markRNodeAsHavingHydrationMismatch(node, "", actual);
  13342. throw new RuntimeError(-501, message);
  13343. }
  13344. }
  13345. function validateNodeExists(node, lView = null, tNode = null) {
  13346. if (!node) {
  13347. const header = "During hydration, Angular expected an element to be present at this location.\n\n";
  13348. let expected = "";
  13349. let footer = "";
  13350. if (lView !== null && tNode !== null) {
  13351. expected = describeExpectedDom(lView, tNode, false);
  13352. footer = getHydrationErrorFooter();
  13353. markRNodeAsHavingHydrationMismatch(unwrapRNode(lView[HOST]), expected, "");
  13354. }
  13355. throw new RuntimeError(-502, `${header}${expected}
  13356. ${footer}`);
  13357. }
  13358. }
  13359. function nodeNotFoundError(lView, tNode) {
  13360. const header = "During serialization, Angular was unable to find an element in the DOM:\n\n";
  13361. const expected = `${describeExpectedDom(lView, tNode, false)}
  13362. `;
  13363. const footer = getHydrationErrorFooter();
  13364. throw new RuntimeError(-502, header + expected + footer);
  13365. }
  13366. function nodeNotFoundAtPathError(host, path) {
  13367. const header = `During hydration Angular was unable to locate a node using the "${path}" path, starting from the ${describeRNode(host)} node.
  13368. `;
  13369. const footer = getHydrationErrorFooter();
  13370. markRNodeAsHavingHydrationMismatch(host);
  13371. throw new RuntimeError(-502, header + footer);
  13372. }
  13373. function unsupportedProjectionOfDomNodes(rNode) {
  13374. const header = "During serialization, Angular detected DOM nodes that were created outside of Angular context and provided as projectable nodes (likely via `ViewContainerRef.createComponent` or `createComponent` APIs). Hydration is not supported for such cases, consider refactoring the code to avoid this pattern or using `ngSkipHydration` on the host element of the component.\n\n";
  13375. const actual = `${describeDomFromNode(rNode)}
  13376. `;
  13377. const message = header + actual + getHydrationAttributeNote();
  13378. return new RuntimeError(-503, message);
  13379. }
  13380. function invalidSkipHydrationHost(rNode) {
  13381. const header = "The `ngSkipHydration` flag is applied on a node that doesn't act as a component host. Hydration can be skipped only on per-component basis.\n\n";
  13382. const actual = `${describeDomFromNode(rNode)}
  13383. `;
  13384. const footer = "Please move the `ngSkipHydration` attribute to the component host element.\n\n";
  13385. const message = header + actual + footer;
  13386. return new RuntimeError(-504, message);
  13387. }
  13388. function stringifyTNodeAttrs(tNode) {
  13389. const results = [];
  13390. if (tNode.attrs) {
  13391. for (let i = 0; i < tNode.attrs.length; ) {
  13392. const attrName = tNode.attrs[i++];
  13393. if (typeof attrName == "number") {
  13394. break;
  13395. }
  13396. const attrValue = tNode.attrs[i++];
  13397. results.push(`${attrName}="${shorten(attrValue)}"`);
  13398. }
  13399. }
  13400. return results.join(" ");
  13401. }
  13402. var internalAttrs = /* @__PURE__ */ new Set(["ngh", "ng-version", "ng-server-context"]);
  13403. function stringifyRNodeAttrs(rNode) {
  13404. const results = [];
  13405. for (let i = 0; i < rNode.attributes.length; i++) {
  13406. const attr = rNode.attributes[i];
  13407. if (internalAttrs.has(attr.name)) continue;
  13408. results.push(`${attr.name}="${shorten(attr.value)}"`);
  13409. }
  13410. return results.join(" ");
  13411. }
  13412. function describeTNode(tNode, innerContent = "…") {
  13413. switch (tNode.type) {
  13414. case 1:
  13415. const content = tNode.value ? `(${tNode.value})` : "";
  13416. return `#text${content}`;
  13417. case 2:
  13418. const attrs = stringifyTNodeAttrs(tNode);
  13419. const tag = tNode.value.toLowerCase();
  13420. return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}</${tag}>`;
  13421. case 8:
  13422. return "<!-- ng-container -->";
  13423. case 4:
  13424. return "<!-- container -->";
  13425. default:
  13426. const typeAsString = getFriendlyStringFromTNodeType(tNode.type);
  13427. return `#node(${typeAsString})`;
  13428. }
  13429. }
  13430. function describeRNode(rNode, innerContent = "…") {
  13431. const node = rNode;
  13432. switch (node.nodeType) {
  13433. case Node.ELEMENT_NODE:
  13434. const tag = node.tagName.toLowerCase();
  13435. const attrs = stringifyRNodeAttrs(node);
  13436. return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}</${tag}>`;
  13437. case Node.TEXT_NODE:
  13438. const content = node.textContent ? shorten(node.textContent) : "";
  13439. return `#text${content ? `(${content})` : ""}`;
  13440. case Node.COMMENT_NODE:
  13441. return `<!-- ${shorten(node.textContent ?? "")} -->`;
  13442. default:
  13443. return `#node(${node.nodeType})`;
  13444. }
  13445. }
  13446. function describeExpectedDom(lView, tNode, isViewContainerAnchor) {
  13447. const spacer = " ";
  13448. let content = "";
  13449. if (tNode.prev) {
  13450. content += spacer + "…\n";
  13451. content += spacer + describeTNode(tNode.prev) + "\n";
  13452. } else if (tNode.type && tNode.type & 12) {
  13453. content += spacer + "…\n";
  13454. }
  13455. if (isViewContainerAnchor) {
  13456. content += spacer + describeTNode(tNode) + "\n";
  13457. content += spacer + `<!-- container --> ${AT_THIS_LOCATION}
  13458. `;
  13459. } else {
  13460. content += spacer + describeTNode(tNode) + ` ${AT_THIS_LOCATION}
  13461. `;
  13462. }
  13463. content += spacer + "…\n";
  13464. const parentRNode = tNode.type ? getParentRElement(lView[TVIEW], tNode, lView) : null;
  13465. if (parentRNode) {
  13466. content = describeRNode(parentRNode, "\n" + content);
  13467. }
  13468. return content;
  13469. }
  13470. function describeDomFromNode(node) {
  13471. const spacer = " ";
  13472. let content = "";
  13473. const currentNode = node;
  13474. if (currentNode.previousSibling) {
  13475. content += spacer + "…\n";
  13476. content += spacer + describeRNode(currentNode.previousSibling) + "\n";
  13477. }
  13478. content += spacer + describeRNode(currentNode) + ` ${AT_THIS_LOCATION}
  13479. `;
  13480. if (node.nextSibling) {
  13481. content += spacer + "…\n";
  13482. }
  13483. if (node.parentNode) {
  13484. content = describeRNode(currentNode.parentNode, "\n" + content);
  13485. }
  13486. return content;
  13487. }
  13488. function shortRNodeDescription(nodeType, tagName, textContent) {
  13489. switch (nodeType) {
  13490. case Node.ELEMENT_NODE:
  13491. return `<${tagName.toLowerCase()}>`;
  13492. case Node.TEXT_NODE:
  13493. const content = textContent ? ` (with the "${shorten(textContent)}" content)` : "";
  13494. return `a text node${content}`;
  13495. case Node.COMMENT_NODE:
  13496. return "a comment node";
  13497. default:
  13498. return `#node(nodeType=${nodeType})`;
  13499. }
  13500. }
  13501. function getHydrationErrorFooter(componentClassName) {
  13502. const componentInfo = componentClassName ? `the "${componentClassName}"` : "corresponding";
  13503. return `To fix this problem:
  13504. * check ${componentInfo} component for hydration-related issues
  13505. * check to see if your template has valid HTML structure
  13506. * or skip hydration by adding the \`ngSkipHydration\` attribute to its host node in a template
  13507. `;
  13508. }
  13509. function getHydrationAttributeNote() {
  13510. return "Note: attributes are only displayed to better represent the DOM but have no effect on hydration mismatches.\n\n";
  13511. }
  13512. function stripNewlines(input2) {
  13513. return input2.replace(/\s+/gm, "");
  13514. }
  13515. function shorten(input2, maxLength = 50) {
  13516. if (!input2) {
  13517. return "";
  13518. }
  13519. input2 = stripNewlines(input2);
  13520. return input2.length > maxLength ? `${input2.substring(0, maxLength - 1)}…` : input2;
  13521. }
  13522. function getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView) {
  13523. const tNodeInsertBeforeIndex = currentTNode.insertBeforeIndex;
  13524. const insertBeforeIndex = Array.isArray(tNodeInsertBeforeIndex) ? tNodeInsertBeforeIndex[0] : tNodeInsertBeforeIndex;
  13525. if (insertBeforeIndex === null) {
  13526. return getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView);
  13527. } else {
  13528. ngDevMode && assertIndexInRange(lView, insertBeforeIndex);
  13529. return unwrapRNode(lView[insertBeforeIndex]);
  13530. }
  13531. }
  13532. function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRElement) {
  13533. const tNodeInsertBeforeIndex = childTNode.insertBeforeIndex;
  13534. if (Array.isArray(tNodeInsertBeforeIndex)) {
  13535. ngDevMode && assertDomNode(childRNode);
  13536. let i18nParent = childRNode;
  13537. let anchorRNode = null;
  13538. if (!(childTNode.type & 3)) {
  13539. anchorRNode = i18nParent;
  13540. i18nParent = parentRElement;
  13541. }
  13542. if (i18nParent !== null && childTNode.componentOffset === -1) {
  13543. for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
  13544. const i18nChild = lView[tNodeInsertBeforeIndex[i]];
  13545. nativeInsertBefore(renderer, i18nParent, i18nChild, anchorRNode, false);
  13546. }
  13547. }
  13548. }
  13549. }
  13550. function getOrCreateTNode(tView, index, type, name, attrs) {
  13551. ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
  13552. // `view_engine_compatibility` for additional context.
  13553. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
  13554. ngDevMode && assertPureTNodeType(type);
  13555. let tNode = tView.data[index];
  13556. if (tNode === null) {
  13557. tNode = createTNodeAtIndex(tView, index, type, name, attrs);
  13558. if (isInI18nBlock()) {
  13559. tNode.flags |= 32;
  13560. }
  13561. } else if (tNode.type & 64) {
  13562. tNode.type = type;
  13563. tNode.value = name;
  13564. tNode.attrs = attrs;
  13565. const parent = getCurrentParentTNode();
  13566. tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex;
  13567. ngDevMode && assertTNodeForTView(tNode, tView);
  13568. ngDevMode && assertEqual(index, tNode.index, "Expecting same index");
  13569. }
  13570. setCurrentTNode(tNode, true);
  13571. return tNode;
  13572. }
  13573. function createTNodeAtIndex(tView, index, type, name, attrs) {
  13574. const currentTNode = getCurrentTNodePlaceholderOk();
  13575. const isParent = isCurrentTNodeParent();
  13576. const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
  13577. const tNode = tView.data[index] = createTNode(tView, parent, type, index, name, attrs);
  13578. linkTNodeInTView(tView, tNode, currentTNode, isParent);
  13579. return tNode;
  13580. }
  13581. function linkTNodeInTView(tView, tNode, currentTNode, isParent) {
  13582. if (tView.firstChild === null) {
  13583. tView.firstChild = tNode;
  13584. }
  13585. if (currentTNode !== null) {
  13586. if (isParent) {
  13587. if (currentTNode.child == null && tNode.parent !== null) {
  13588. currentTNode.child = tNode;
  13589. }
  13590. } else {
  13591. if (currentTNode.next === null) {
  13592. currentTNode.next = tNode;
  13593. tNode.prev = currentTNode;
  13594. }
  13595. }
  13596. }
  13597. }
  13598. function createTNode(tView, tParent, type, index, value, attrs) {
  13599. ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
  13600. // `view_engine_compatibility` for additional context.
  13601. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
  13602. ngDevMode && assertNotSame(attrs, void 0, "'undefined' is not valid value for 'attrs'");
  13603. ngDevMode && ngDevMode.tNode++;
  13604. ngDevMode && tParent && assertTNodeForTView(tParent, tView);
  13605. let injectorIndex = tParent ? tParent.injectorIndex : -1;
  13606. let flags = 0;
  13607. if (isInSkipHydrationBlock$1()) {
  13608. flags |= 128;
  13609. }
  13610. const tNode = {
  13611. type,
  13612. index,
  13613. insertBeforeIndex: null,
  13614. injectorIndex,
  13615. directiveStart: -1,
  13616. directiveEnd: -1,
  13617. directiveStylingLast: -1,
  13618. componentOffset: -1,
  13619. propertyBindings: null,
  13620. flags,
  13621. providerIndexes: 0,
  13622. value,
  13623. attrs,
  13624. mergedAttrs: null,
  13625. localNames: null,
  13626. initialInputs: null,
  13627. inputs: null,
  13628. hostDirectiveInputs: null,
  13629. outputs: null,
  13630. hostDirectiveOutputs: null,
  13631. directiveToIndex: null,
  13632. tView: null,
  13633. next: null,
  13634. prev: null,
  13635. projectionNext: null,
  13636. child: null,
  13637. parent: tParent,
  13638. projection: null,
  13639. styles: null,
  13640. stylesWithoutHost: null,
  13641. residualStyles: void 0,
  13642. classes: null,
  13643. classesWithoutHost: null,
  13644. residualClasses: void 0,
  13645. classBindings: 0,
  13646. styleBindings: 0
  13647. };
  13648. if (ngDevMode) {
  13649. Object.seal(tNode);
  13650. }
  13651. return tNode;
  13652. }
  13653. function addTNodeAndUpdateInsertBeforeIndex(previousTNodes, newTNode) {
  13654. ngDevMode && assertEqual(newTNode.insertBeforeIndex, null, "We expect that insertBeforeIndex is not set");
  13655. previousTNodes.push(newTNode);
  13656. if (previousTNodes.length > 1) {
  13657. for (let i = previousTNodes.length - 2; i >= 0; i--) {
  13658. const existingTNode = previousTNodes[i];
  13659. if (!isI18nText(existingTNode)) {
  13660. if (isNewTNodeCreatedBefore(existingTNode, newTNode) && getInsertBeforeIndex(existingTNode) === null) {
  13661. setInsertBeforeIndex(existingTNode, newTNode.index);
  13662. }
  13663. }
  13664. }
  13665. }
  13666. }
  13667. function isI18nText(tNode) {
  13668. return !(tNode.type & 64);
  13669. }
  13670. function isNewTNodeCreatedBefore(existingTNode, newTNode) {
  13671. return isI18nText(newTNode) || existingTNode.index > newTNode.index;
  13672. }
  13673. function getInsertBeforeIndex(tNode) {
  13674. const index = tNode.insertBeforeIndex;
  13675. return Array.isArray(index) ? index[0] : index;
  13676. }
  13677. function setInsertBeforeIndex(tNode, value) {
  13678. const index = tNode.insertBeforeIndex;
  13679. if (Array.isArray(index)) {
  13680. index[0] = value;
  13681. } else {
  13682. setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore);
  13683. tNode.insertBeforeIndex = value;
  13684. }
  13685. }
  13686. function getTIcu(tView, index) {
  13687. const value = tView.data[index];
  13688. if (value === null || typeof value === "string") return null;
  13689. if (ngDevMode && !(value.hasOwnProperty("tView") || value.hasOwnProperty("currentCaseLViewIndex"))) {
  13690. throwError2("We expect to get 'null'|'TIcu'|'TIcuContainer', but got: " + value);
  13691. }
  13692. const tIcu = value.hasOwnProperty("currentCaseLViewIndex") ? value : value.value;
  13693. ngDevMode && assertTIcu(tIcu);
  13694. return tIcu;
  13695. }
  13696. function setTIcu(tView, index, tIcu) {
  13697. const tNode = tView.data[index];
  13698. ngDevMode && assertEqual(tNode === null || tNode.hasOwnProperty("tView"), true, "We expect to get 'null'|'TIcuContainer'");
  13699. if (tNode === null) {
  13700. tView.data[index] = tIcu;
  13701. } else {
  13702. ngDevMode && assertTNodeType(
  13703. tNode,
  13704. 32
  13705. /* TNodeType.Icu */
  13706. );
  13707. tNode.value = tIcu;
  13708. }
  13709. }
  13710. function setTNodeInsertBeforeIndex(tNode, index) {
  13711. ngDevMode && assertTNode(tNode);
  13712. let insertBeforeIndex = tNode.insertBeforeIndex;
  13713. if (insertBeforeIndex === null) {
  13714. setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore);
  13715. insertBeforeIndex = tNode.insertBeforeIndex = [null, index];
  13716. } else {
  13717. assertEqual(Array.isArray(insertBeforeIndex), true, "Expecting array here");
  13718. insertBeforeIndex.push(index);
  13719. }
  13720. }
  13721. function createTNodePlaceholder(tView, previousTNodes, index) {
  13722. const tNode = createTNodeAtIndex(tView, index, 64, null, null);
  13723. addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode);
  13724. return tNode;
  13725. }
  13726. function getCurrentICUCaseIndex(tIcu, lView) {
  13727. const currentCase = lView[tIcu.currentCaseLViewIndex];
  13728. return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase;
  13729. }
  13730. function getParentFromIcuCreateOpCode(mergedCode) {
  13731. return mergedCode >>> 17;
  13732. }
  13733. function getRefFromIcuCreateOpCode(mergedCode) {
  13734. return (mergedCode & 131070) >>> 1;
  13735. }
  13736. function getInstructionFromIcuCreateOpCode(mergedCode) {
  13737. return mergedCode & 1;
  13738. }
  13739. function icuCreateOpCode(opCode, parentIdx, refIdx) {
  13740. ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, "Missing parent index");
  13741. ngDevMode && assertGreaterThan(refIdx, 0, "Missing ref index");
  13742. return opCode | parentIdx << 17 | refIdx << 1;
  13743. }
  13744. function isRootTemplateMessage(subTemplateIndex) {
  13745. return subTemplateIndex === -1;
  13746. }
  13747. function enterIcu(state, tIcu, lView) {
  13748. state.index = 0;
  13749. const currentCase = getCurrentICUCaseIndex(tIcu, lView);
  13750. if (currentCase !== null) {
  13751. ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1);
  13752. state.removes = tIcu.remove[currentCase];
  13753. } else {
  13754. state.removes = EMPTY_ARRAY;
  13755. }
  13756. }
  13757. function icuContainerIteratorNext(state) {
  13758. if (state.index < state.removes.length) {
  13759. const removeOpCode = state.removes[state.index++];
  13760. ngDevMode && assertNumber(removeOpCode, "Expecting OpCode number");
  13761. if (removeOpCode > 0) {
  13762. const rNode = state.lView[removeOpCode];
  13763. ngDevMode && assertDomNode(rNode);
  13764. return rNode;
  13765. } else {
  13766. state.stack.push(state.index, state.removes);
  13767. const tIcuIndex = ~removeOpCode;
  13768. const tIcu = state.lView[TVIEW].data[tIcuIndex];
  13769. ngDevMode && assertTIcu(tIcu);
  13770. enterIcu(state, tIcu, state.lView);
  13771. return icuContainerIteratorNext(state);
  13772. }
  13773. } else {
  13774. if (state.stack.length === 0) {
  13775. return null;
  13776. } else {
  13777. state.removes = state.stack.pop();
  13778. state.index = state.stack.pop();
  13779. return icuContainerIteratorNext(state);
  13780. }
  13781. }
  13782. }
  13783. function loadIcuContainerVisitor() {
  13784. const _state = {
  13785. stack: [],
  13786. index: -1
  13787. };
  13788. function icuContainerIteratorStart(tIcuContainerNode, lView) {
  13789. _state.lView = lView;
  13790. while (_state.stack.length) _state.stack.pop();
  13791. ngDevMode && assertTNodeForLView(tIcuContainerNode, lView);
  13792. enterIcu(_state, tIcuContainerNode.value, lView);
  13793. return icuContainerIteratorNext.bind(null, _state);
  13794. }
  13795. return icuContainerIteratorStart;
  13796. }
  13797. function createIcuIterator(tIcu, lView) {
  13798. const state = {
  13799. stack: [],
  13800. index: -1,
  13801. lView
  13802. };
  13803. ngDevMode && assertTIcu(tIcu);
  13804. enterIcu(state, tIcu, lView);
  13805. return icuContainerIteratorNext.bind(null, state);
  13806. }
  13807. var REF_EXTRACTOR_REGEXP = new RegExp(`^(\\d+)*(${REFERENCE_NODE_BODY}|${REFERENCE_NODE_HOST})*(.*)`);
  13808. function compressNodeLocation(referenceNode, path) {
  13809. const result = [referenceNode];
  13810. for (const segment of path) {
  13811. const lastIdx = result.length - 1;
  13812. if (lastIdx > 0 && result[lastIdx - 1] === segment) {
  13813. const value = result[lastIdx] || 1;
  13814. result[lastIdx] = value + 1;
  13815. } else {
  13816. result.push(segment, "");
  13817. }
  13818. }
  13819. return result.join("");
  13820. }
  13821. function decompressNodeLocation(path) {
  13822. const matches = path.match(REF_EXTRACTOR_REGEXP);
  13823. const [_, refNodeId, refNodeName, rest] = matches;
  13824. const ref = refNodeId ? parseInt(refNodeId, 10) : refNodeName;
  13825. const steps = [];
  13826. for (const [_2, step, count2] of rest.matchAll(/(f|n)(\d*)/g)) {
  13827. const repeat2 = parseInt(count2, 10) || 1;
  13828. steps.push(step, repeat2);
  13829. }
  13830. return [ref, ...steps];
  13831. }
  13832. function isFirstElementInNgContainer(tNode) {
  13833. return !tNode.prev && tNode.parent?.type === 8;
  13834. }
  13835. function getNoOffsetIndex(tNode) {
  13836. return tNode.index - HEADER_OFFSET;
  13837. }
  13838. function isDisconnectedNode(tNode, lView) {
  13839. return !(tNode.type & (16 | 128)) && !!lView[tNode.index] && isDisconnectedRNode(unwrapRNode(lView[tNode.index]));
  13840. }
  13841. function isDisconnectedRNode(rNode) {
  13842. return !!rNode && !rNode.isConnected;
  13843. }
  13844. function locateI18nRNodeByIndex(hydrationInfo, noOffsetIndex) {
  13845. const i18nNodes = hydrationInfo.i18nNodes;
  13846. if (i18nNodes) {
  13847. return i18nNodes.get(noOffsetIndex);
  13848. }
  13849. return void 0;
  13850. }
  13851. function tryLocateRNodeByPath(hydrationInfo, lView, noOffsetIndex) {
  13852. const nodes = hydrationInfo.data[NODES];
  13853. const path = nodes?.[noOffsetIndex];
  13854. return path ? locateRNodeByPath(path, lView) : null;
  13855. }
  13856. function locateNextRNode(hydrationInfo, tView, lView, tNode) {
  13857. const noOffsetIndex = getNoOffsetIndex(tNode);
  13858. let native = locateI18nRNodeByIndex(hydrationInfo, noOffsetIndex);
  13859. if (native === void 0) {
  13860. const nodes = hydrationInfo.data[NODES];
  13861. if (nodes?.[noOffsetIndex]) {
  13862. native = locateRNodeByPath(nodes[noOffsetIndex], lView);
  13863. } else if (tView.firstChild === tNode) {
  13864. native = hydrationInfo.firstChild;
  13865. } else {
  13866. const previousTNodeParent = tNode.prev === null;
  13867. const previousTNode = tNode.prev ?? tNode.parent;
  13868. ngDevMode && assertDefined(previousTNode, "Unexpected state: current TNode does not have a connection to the previous node or a parent node.");
  13869. if (isFirstElementInNgContainer(tNode)) {
  13870. const noOffsetParentIndex = getNoOffsetIndex(tNode.parent);
  13871. native = getSegmentHead(hydrationInfo, noOffsetParentIndex);
  13872. } else {
  13873. let previousRElement = getNativeByTNode(previousTNode, lView);
  13874. if (previousTNodeParent) {
  13875. native = previousRElement.firstChild;
  13876. } else {
  13877. const noOffsetPrevSiblingIndex = getNoOffsetIndex(previousTNode);
  13878. const segmentHead = getSegmentHead(hydrationInfo, noOffsetPrevSiblingIndex);
  13879. if (previousTNode.type === 2 && segmentHead) {
  13880. const numRootNodesToSkip = calcSerializedContainerSize(hydrationInfo, noOffsetPrevSiblingIndex);
  13881. const nodesToSkip = numRootNodesToSkip + 1;
  13882. native = siblingAfter(nodesToSkip, segmentHead);
  13883. } else {
  13884. native = previousRElement.nextSibling;
  13885. }
  13886. }
  13887. }
  13888. }
  13889. }
  13890. return native;
  13891. }
  13892. function siblingAfter(skip2, from2) {
  13893. let currentNode = from2;
  13894. for (let i = 0; i < skip2; i++) {
  13895. ngDevMode && validateSiblingNodeExists(currentNode);
  13896. currentNode = currentNode.nextSibling;
  13897. }
  13898. return currentNode;
  13899. }
  13900. function stringifyNavigationInstructions(instructions) {
  13901. const container = [];
  13902. for (let i = 0; i < instructions.length; i += 2) {
  13903. const step = instructions[i];
  13904. const repeat2 = instructions[i + 1];
  13905. for (let r = 0; r < repeat2; r++) {
  13906. container.push(step === NODE_NAVIGATION_STEP_FIRST_CHILD ? "firstChild" : "nextSibling");
  13907. }
  13908. }
  13909. return container.join(".");
  13910. }
  13911. function navigateToNode(from2, instructions) {
  13912. let node = from2;
  13913. for (let i = 0; i < instructions.length; i += 2) {
  13914. const step = instructions[i];
  13915. const repeat2 = instructions[i + 1];
  13916. for (let r = 0; r < repeat2; r++) {
  13917. if (ngDevMode && !node) {
  13918. throw nodeNotFoundAtPathError(from2, stringifyNavigationInstructions(instructions));
  13919. }
  13920. switch (step) {
  13921. case NODE_NAVIGATION_STEP_FIRST_CHILD:
  13922. node = node.firstChild;
  13923. break;
  13924. case NODE_NAVIGATION_STEP_NEXT_SIBLING:
  13925. node = node.nextSibling;
  13926. break;
  13927. }
  13928. }
  13929. }
  13930. if (ngDevMode && !node) {
  13931. throw nodeNotFoundAtPathError(from2, stringifyNavigationInstructions(instructions));
  13932. }
  13933. return node;
  13934. }
  13935. function locateRNodeByPath(path, lView) {
  13936. const [referenceNode, ...navigationInstructions] = decompressNodeLocation(path);
  13937. let ref;
  13938. if (referenceNode === REFERENCE_NODE_HOST) {
  13939. ref = lView[DECLARATION_COMPONENT_VIEW][HOST];
  13940. } else if (referenceNode === REFERENCE_NODE_BODY) {
  13941. ref = ɵɵresolveBody(lView[DECLARATION_COMPONENT_VIEW][HOST]);
  13942. } else {
  13943. const parentElementId = Number(referenceNode);
  13944. ref = unwrapRNode(lView[parentElementId + HEADER_OFFSET]);
  13945. }
  13946. return navigateToNode(ref, navigationInstructions);
  13947. }
  13948. function navigateBetween(start, finish) {
  13949. if (start === finish) {
  13950. return [];
  13951. } else if (start.parentElement == null || finish.parentElement == null) {
  13952. return null;
  13953. } else if (start.parentElement === finish.parentElement) {
  13954. return navigateBetweenSiblings(start, finish);
  13955. } else {
  13956. const parent = finish.parentElement;
  13957. const parentPath = navigateBetween(start, parent);
  13958. const childPath = navigateBetween(parent.firstChild, finish);
  13959. if (!parentPath || !childPath) return null;
  13960. return [
  13961. // First navigate to `finish`'s parent
  13962. ...parentPath,
  13963. // Then to its first child.
  13964. NODE_NAVIGATION_STEP_FIRST_CHILD,
  13965. // And finally from that node to `finish` (maybe a no-op if we're already there).
  13966. ...childPath
  13967. ];
  13968. }
  13969. }
  13970. function navigateBetweenSiblings(start, finish) {
  13971. const nav = [];
  13972. let node = null;
  13973. for (node = start; node != null && node !== finish; node = node.nextSibling) {
  13974. nav.push(NODE_NAVIGATION_STEP_NEXT_SIBLING);
  13975. }
  13976. return node == null ? null : nav;
  13977. }
  13978. function calcPathBetween(from2, to, fromNodeName) {
  13979. const path = navigateBetween(from2, to);
  13980. return path === null ? null : compressNodeLocation(fromNodeName, path);
  13981. }
  13982. function calcPathForNode(tNode, lView, excludedParentNodes) {
  13983. let parentTNode = tNode.parent;
  13984. let parentIndex;
  13985. let parentRNode;
  13986. let referenceNodeName;
  13987. while (parentTNode !== null && (isDisconnectedNode(parentTNode, lView) || excludedParentNodes?.has(parentTNode.index))) {
  13988. parentTNode = parentTNode.parent;
  13989. }
  13990. if (parentTNode === null || !(parentTNode.type & 3)) {
  13991. parentIndex = referenceNodeName = REFERENCE_NODE_HOST;
  13992. parentRNode = lView[DECLARATION_COMPONENT_VIEW][HOST];
  13993. } else {
  13994. parentIndex = parentTNode.index;
  13995. parentRNode = unwrapRNode(lView[parentIndex]);
  13996. referenceNodeName = renderStringify(parentIndex - HEADER_OFFSET);
  13997. }
  13998. let rNode = unwrapRNode(lView[tNode.index]);
  13999. if (tNode.type & (12 | 32)) {
  14000. const firstRNode = getFirstNativeNode(lView, tNode);
  14001. if (firstRNode) {
  14002. rNode = firstRNode;
  14003. }
  14004. }
  14005. let path = calcPathBetween(parentRNode, rNode, referenceNodeName);
  14006. if (path === null && parentRNode !== rNode) {
  14007. const body = parentRNode.ownerDocument.body;
  14008. path = calcPathBetween(body, rNode, REFERENCE_NODE_BODY);
  14009. if (path === null) {
  14010. throw nodeNotFoundError(lView, tNode);
  14011. }
  14012. }
  14013. return path;
  14014. }
  14015. function gatherDeferBlocksCommentNodes(doc, node) {
  14016. const commentNodesIterator = doc.createNodeIterator(node, NodeFilter.SHOW_COMMENT, {
  14017. acceptNode
  14018. });
  14019. let currentNode;
  14020. const nodesByBlockId = /* @__PURE__ */ new Map();
  14021. while (currentNode = commentNodesIterator.nextNode()) {
  14022. const nghPattern = "ngh=";
  14023. const content = currentNode?.textContent;
  14024. const nghIdx = content?.indexOf(nghPattern) ?? -1;
  14025. if (nghIdx > -1) {
  14026. const nghValue = content.substring(nghIdx + nghPattern.length).trim();
  14027. ngDevMode && assertEqual(nghValue.startsWith("d"), true, "Invalid defer block id found in a comment node.");
  14028. nodesByBlockId.set(nghValue, currentNode);
  14029. }
  14030. }
  14031. return nodesByBlockId;
  14032. }
  14033. function acceptNode(node) {
  14034. return node.textContent?.trimStart().startsWith("ngh=") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
  14035. }
  14036. var _isI18nHydrationSupportEnabled = false;
  14037. var _prepareI18nBlockForHydrationImpl = () => {
  14038. };
  14039. function setIsI18nHydrationSupportEnabled(enabled) {
  14040. _isI18nHydrationSupportEnabled = enabled;
  14041. }
  14042. function isI18nHydrationSupportEnabled() {
  14043. return _isI18nHydrationSupportEnabled;
  14044. }
  14045. function prepareI18nBlockForHydration(lView, index, parentTNode, subTemplateIndex) {
  14046. _prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex);
  14047. }
  14048. function enablePrepareI18nBlockForHydrationImpl() {
  14049. _prepareI18nBlockForHydrationImpl = prepareI18nBlockForHydrationImpl;
  14050. }
  14051. function isI18nHydrationEnabled(injector) {
  14052. injector = injector ?? inject(Injector);
  14053. return injector.get(IS_I18N_HYDRATION_ENABLED, false);
  14054. }
  14055. function getOrComputeI18nChildren(tView, context2) {
  14056. let i18nChildren = context2.i18nChildren.get(tView);
  14057. if (i18nChildren === void 0) {
  14058. i18nChildren = collectI18nChildren(tView);
  14059. context2.i18nChildren.set(tView, i18nChildren);
  14060. }
  14061. return i18nChildren;
  14062. }
  14063. function collectI18nChildren(tView) {
  14064. const children = /* @__PURE__ */ new Set();
  14065. function collectI18nViews(node) {
  14066. children.add(node.index);
  14067. switch (node.kind) {
  14068. case 1:
  14069. case 2: {
  14070. for (const childNode of node.children) {
  14071. collectI18nViews(childNode);
  14072. }
  14073. break;
  14074. }
  14075. case 3: {
  14076. for (const caseNodes of node.cases) {
  14077. for (const caseNode of caseNodes) {
  14078. collectI18nViews(caseNode);
  14079. }
  14080. }
  14081. break;
  14082. }
  14083. }
  14084. }
  14085. for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
  14086. const tI18n = tView.data[i];
  14087. if (!tI18n || !tI18n.ast) {
  14088. continue;
  14089. }
  14090. for (const node of tI18n.ast) {
  14091. collectI18nViews(node);
  14092. }
  14093. }
  14094. return children.size === 0 ? null : children;
  14095. }
  14096. function trySerializeI18nBlock(lView, index, context2) {
  14097. if (!context2.isI18nHydrationEnabled) {
  14098. return null;
  14099. }
  14100. const tView = lView[TVIEW];
  14101. const tI18n = tView.data[index];
  14102. if (!tI18n || !tI18n.ast) {
  14103. return null;
  14104. }
  14105. const parentTNode = tView.data[tI18n.parentTNodeIndex];
  14106. if (parentTNode && isI18nInSkipHydrationBlock(parentTNode)) {
  14107. return null;
  14108. }
  14109. const serializedI18nBlock = {
  14110. caseQueue: [],
  14111. disconnectedNodes: /* @__PURE__ */ new Set(),
  14112. disjointNodes: /* @__PURE__ */ new Set()
  14113. };
  14114. serializeI18nBlock(lView, serializedI18nBlock, context2, tI18n.ast);
  14115. return serializedI18nBlock.caseQueue.length === 0 && serializedI18nBlock.disconnectedNodes.size === 0 && serializedI18nBlock.disjointNodes.size === 0 ? null : serializedI18nBlock;
  14116. }
  14117. function serializeI18nBlock(lView, serializedI18nBlock, context2, nodes) {
  14118. let prevRNode = null;
  14119. for (const node of nodes) {
  14120. const nextRNode = serializeI18nNode(lView, serializedI18nBlock, context2, node);
  14121. if (nextRNode) {
  14122. if (isDisjointNode(prevRNode, nextRNode)) {
  14123. serializedI18nBlock.disjointNodes.add(node.index - HEADER_OFFSET);
  14124. }
  14125. prevRNode = nextRNode;
  14126. }
  14127. }
  14128. return prevRNode;
  14129. }
  14130. function isDisjointNode(prevNode, nextNode) {
  14131. return prevNode && prevNode.nextSibling !== nextNode;
  14132. }
  14133. function serializeI18nNode(lView, serializedI18nBlock, context2, node) {
  14134. const maybeRNode = unwrapRNode(lView[node.index]);
  14135. if (!maybeRNode || isDisconnectedRNode(maybeRNode)) {
  14136. serializedI18nBlock.disconnectedNodes.add(node.index - HEADER_OFFSET);
  14137. return null;
  14138. }
  14139. const rNode = maybeRNode;
  14140. switch (node.kind) {
  14141. case 0: {
  14142. processTextNodeBeforeSerialization(context2, rNode);
  14143. break;
  14144. }
  14145. case 1:
  14146. case 2: {
  14147. serializeI18nBlock(lView, serializedI18nBlock, context2, node.children);
  14148. break;
  14149. }
  14150. case 3: {
  14151. const currentCase = lView[node.currentCaseLViewIndex];
  14152. if (currentCase != null) {
  14153. const caseIdx = currentCase < 0 ? ~currentCase : currentCase;
  14154. serializedI18nBlock.caseQueue.push(caseIdx);
  14155. serializeI18nBlock(lView, serializedI18nBlock, context2, node.cases[caseIdx]);
  14156. }
  14157. break;
  14158. }
  14159. }
  14160. return getFirstNativeNodeForI18nNode(lView, node);
  14161. }
  14162. function getFirstNativeNodeForI18nNode(lView, node) {
  14163. const tView = lView[TVIEW];
  14164. const maybeTNode = tView.data[node.index];
  14165. if (isTNodeShape(maybeTNode)) {
  14166. return getFirstNativeNode(lView, maybeTNode);
  14167. } else if (node.kind === 3) {
  14168. const icuIterator = createIcuIterator(maybeTNode, lView);
  14169. let rNode = icuIterator();
  14170. return rNode ?? unwrapRNode(lView[node.index]);
  14171. } else {
  14172. return unwrapRNode(lView[node.index]) ?? null;
  14173. }
  14174. }
  14175. function setCurrentNode(state, node) {
  14176. state.currentNode = node;
  14177. }
  14178. function appendI18nNodeToCollection(context2, state, astNode) {
  14179. const noOffsetIndex = astNode.index - HEADER_OFFSET;
  14180. const {
  14181. disconnectedNodes
  14182. } = context2;
  14183. const currentNode = state.currentNode;
  14184. if (state.isConnected) {
  14185. context2.i18nNodes.set(noOffsetIndex, currentNode);
  14186. disconnectedNodes.delete(noOffsetIndex);
  14187. } else {
  14188. disconnectedNodes.add(noOffsetIndex);
  14189. }
  14190. return currentNode;
  14191. }
  14192. function skipSiblingNodes(state, skip2) {
  14193. let currentNode = state.currentNode;
  14194. for (let i = 0; i < skip2; i++) {
  14195. if (!currentNode) {
  14196. break;
  14197. }
  14198. currentNode = currentNode?.nextSibling ?? null;
  14199. }
  14200. return currentNode;
  14201. }
  14202. function forkHydrationState(state, nextNode) {
  14203. return {
  14204. currentNode: nextNode,
  14205. isConnected: state.isConnected
  14206. };
  14207. }
  14208. function prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex) {
  14209. const hydrationInfo = lView[HYDRATION];
  14210. if (!hydrationInfo) {
  14211. return;
  14212. }
  14213. if (!isI18nHydrationSupportEnabled() || parentTNode && (isI18nInSkipHydrationBlock(parentTNode) || isDisconnectedNode$1(hydrationInfo, parentTNode.index - HEADER_OFFSET))) {
  14214. return;
  14215. }
  14216. const tView = lView[TVIEW];
  14217. const tI18n = tView.data[index];
  14218. ngDevMode && assertDefined(tI18n, "Expected i18n data to be present in a given TView slot during hydration");
  14219. function findHydrationRoot() {
  14220. if (isRootTemplateMessage(subTemplateIndex)) {
  14221. ngDevMode && assertDefined(parentTNode, "Expected parent TNode while hydrating i18n root");
  14222. const rootNode = locateNextRNode(hydrationInfo, tView, lView, parentTNode);
  14223. return parentTNode.type & 8 ? rootNode : rootNode.firstChild;
  14224. }
  14225. return hydrationInfo?.firstChild;
  14226. }
  14227. const currentNode = findHydrationRoot();
  14228. ngDevMode && assertDefined(currentNode, "Expected root i18n node during hydration");
  14229. const disconnectedNodes = initDisconnectedNodes(hydrationInfo) ?? /* @__PURE__ */ new Set();
  14230. const i18nNodes = hydrationInfo.i18nNodes ??= /* @__PURE__ */ new Map();
  14231. const caseQueue = hydrationInfo.data[I18N_DATA]?.[index - HEADER_OFFSET] ?? [];
  14232. const dehydratedIcuData = hydrationInfo.dehydratedIcuData ??= /* @__PURE__ */ new Map();
  14233. collectI18nNodesFromDom({
  14234. hydrationInfo,
  14235. lView,
  14236. i18nNodes,
  14237. disconnectedNodes,
  14238. caseQueue,
  14239. dehydratedIcuData
  14240. }, {
  14241. currentNode,
  14242. isConnected: true
  14243. }, tI18n.ast);
  14244. hydrationInfo.disconnectedNodes = disconnectedNodes.size === 0 ? null : disconnectedNodes;
  14245. }
  14246. function collectI18nNodesFromDom(context2, state, nodeOrNodes) {
  14247. if (Array.isArray(nodeOrNodes)) {
  14248. let nextState = state;
  14249. for (const node of nodeOrNodes) {
  14250. const targetNode = tryLocateRNodeByPath(context2.hydrationInfo, context2.lView, node.index - HEADER_OFFSET);
  14251. if (targetNode) {
  14252. nextState = forkHydrationState(state, targetNode);
  14253. }
  14254. collectI18nNodesFromDom(context2, nextState, node);
  14255. }
  14256. } else {
  14257. if (context2.disconnectedNodes.has(nodeOrNodes.index - HEADER_OFFSET)) {
  14258. return;
  14259. }
  14260. switch (nodeOrNodes.kind) {
  14261. case 0: {
  14262. const currentNode = appendI18nNodeToCollection(context2, state, nodeOrNodes);
  14263. setCurrentNode(state, currentNode?.nextSibling ?? null);
  14264. break;
  14265. }
  14266. case 1: {
  14267. collectI18nNodesFromDom(context2, forkHydrationState(state, state.currentNode?.firstChild ?? null), nodeOrNodes.children);
  14268. const currentNode = appendI18nNodeToCollection(context2, state, nodeOrNodes);
  14269. setCurrentNode(state, currentNode?.nextSibling ?? null);
  14270. break;
  14271. }
  14272. case 2: {
  14273. const noOffsetIndex = nodeOrNodes.index - HEADER_OFFSET;
  14274. const {
  14275. hydrationInfo
  14276. } = context2;
  14277. const containerSize = getNgContainerSize(hydrationInfo, noOffsetIndex);
  14278. switch (nodeOrNodes.type) {
  14279. case 0: {
  14280. const currentNode = appendI18nNodeToCollection(context2, state, nodeOrNodes);
  14281. if (isSerializedElementContainer(hydrationInfo, noOffsetIndex)) {
  14282. collectI18nNodesFromDom(context2, state, nodeOrNodes.children);
  14283. const nextNode = skipSiblingNodes(state, 1);
  14284. setCurrentNode(state, nextNode);
  14285. } else {
  14286. collectI18nNodesFromDom(context2, forkHydrationState(state, state.currentNode?.firstChild ?? null), nodeOrNodes.children);
  14287. setCurrentNode(state, currentNode?.nextSibling ?? null);
  14288. if (containerSize !== null) {
  14289. const nextNode = skipSiblingNodes(state, containerSize + 1);
  14290. setCurrentNode(state, nextNode);
  14291. }
  14292. }
  14293. break;
  14294. }
  14295. case 1: {
  14296. ngDevMode && assertNotEqual(containerSize, null, "Expected a container size while hydrating i18n subtemplate");
  14297. appendI18nNodeToCollection(context2, state, nodeOrNodes);
  14298. const nextNode = skipSiblingNodes(state, containerSize + 1);
  14299. setCurrentNode(state, nextNode);
  14300. break;
  14301. }
  14302. }
  14303. break;
  14304. }
  14305. case 3: {
  14306. const selectedCase = state.isConnected ? context2.caseQueue.shift() : null;
  14307. const childState = {
  14308. currentNode: null,
  14309. isConnected: false
  14310. };
  14311. for (let i = 0; i < nodeOrNodes.cases.length; i++) {
  14312. collectI18nNodesFromDom(context2, i === selectedCase ? state : childState, nodeOrNodes.cases[i]);
  14313. }
  14314. if (selectedCase !== null) {
  14315. context2.dehydratedIcuData.set(nodeOrNodes.index, {
  14316. case: selectedCase,
  14317. node: nodeOrNodes
  14318. });
  14319. }
  14320. const currentNode = appendI18nNodeToCollection(context2, state, nodeOrNodes);
  14321. setCurrentNode(state, currentNode?.nextSibling ?? null);
  14322. break;
  14323. }
  14324. }
  14325. }
  14326. }
  14327. var _claimDehydratedIcuCaseImpl = () => {
  14328. };
  14329. function claimDehydratedIcuCase(lView, icuIndex, caseIndex) {
  14330. _claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex);
  14331. }
  14332. function enableClaimDehydratedIcuCaseImpl() {
  14333. _claimDehydratedIcuCaseImpl = claimDehydratedIcuCaseImpl;
  14334. }
  14335. function claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex) {
  14336. const dehydratedIcuDataMap = lView[HYDRATION]?.dehydratedIcuData;
  14337. if (dehydratedIcuDataMap) {
  14338. const dehydratedIcuData = dehydratedIcuDataMap.get(icuIndex);
  14339. if (dehydratedIcuData?.case === caseIndex) {
  14340. dehydratedIcuDataMap.delete(icuIndex);
  14341. }
  14342. }
  14343. }
  14344. function cleanupI18nHydrationData(lView) {
  14345. const hydrationInfo = lView[HYDRATION];
  14346. if (hydrationInfo) {
  14347. const {
  14348. i18nNodes,
  14349. dehydratedIcuData: dehydratedIcuDataMap
  14350. } = hydrationInfo;
  14351. if (i18nNodes && dehydratedIcuDataMap) {
  14352. const renderer = lView[RENDERER];
  14353. for (const dehydratedIcuData of dehydratedIcuDataMap.values()) {
  14354. cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData);
  14355. }
  14356. }
  14357. hydrationInfo.i18nNodes = void 0;
  14358. hydrationInfo.dehydratedIcuData = void 0;
  14359. }
  14360. }
  14361. function cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData) {
  14362. for (const node of dehydratedIcuData.node.cases[dehydratedIcuData.case]) {
  14363. const rNode = i18nNodes.get(node.index - HEADER_OFFSET);
  14364. if (rNode) {
  14365. nativeRemoveNode(renderer, rNode, false);
  14366. }
  14367. }
  14368. }
  14369. function removeDehydratedViews(lContainer) {
  14370. const views = lContainer[DEHYDRATED_VIEWS] ?? [];
  14371. const parentLView = lContainer[PARENT];
  14372. const renderer = parentLView[RENDERER];
  14373. const retainedViews = [];
  14374. for (const view of views) {
  14375. if (view.data[DEFER_BLOCK_ID] !== void 0) {
  14376. retainedViews.push(view);
  14377. } else {
  14378. removeDehydratedView(view, renderer);
  14379. ngDevMode && ngDevMode.dehydratedViewsRemoved++;
  14380. }
  14381. }
  14382. lContainer[DEHYDRATED_VIEWS] = retainedViews;
  14383. }
  14384. function removeDehydratedViewList(deferBlock) {
  14385. const {
  14386. lContainer
  14387. } = deferBlock;
  14388. const dehydratedViews = lContainer[DEHYDRATED_VIEWS];
  14389. if (dehydratedViews === null) return;
  14390. const parentLView = lContainer[PARENT];
  14391. const renderer = parentLView[RENDERER];
  14392. for (const view of dehydratedViews) {
  14393. removeDehydratedView(view, renderer);
  14394. ngDevMode && ngDevMode.dehydratedViewsRemoved++;
  14395. }
  14396. }
  14397. function removeDehydratedView(dehydratedView, renderer) {
  14398. let nodesRemoved = 0;
  14399. let currentRNode = dehydratedView.firstChild;
  14400. if (currentRNode) {
  14401. const numNodes = dehydratedView.data[NUM_ROOT_NODES];
  14402. while (nodesRemoved < numNodes) {
  14403. ngDevMode && validateSiblingNodeExists(currentRNode);
  14404. const nextSibling = currentRNode.nextSibling;
  14405. nativeRemoveNode(renderer, currentRNode, false);
  14406. currentRNode = nextSibling;
  14407. nodesRemoved++;
  14408. }
  14409. }
  14410. }
  14411. function cleanupLContainer(lContainer) {
  14412. removeDehydratedViews(lContainer);
  14413. const hostLView = lContainer[HOST];
  14414. if (isLView(hostLView)) {
  14415. cleanupLView(hostLView);
  14416. }
  14417. for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
  14418. cleanupLView(lContainer[i]);
  14419. }
  14420. }
  14421. function cleanupLView(lView) {
  14422. cleanupI18nHydrationData(lView);
  14423. const tView = lView[TVIEW];
  14424. for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
  14425. if (isLContainer(lView[i])) {
  14426. const lContainer = lView[i];
  14427. cleanupLContainer(lContainer);
  14428. } else if (isLView(lView[i])) {
  14429. cleanupLView(lView[i]);
  14430. }
  14431. }
  14432. }
  14433. function cleanupDehydratedViews(appRef) {
  14434. const viewRefs = appRef._views;
  14435. for (const viewRef of viewRefs) {
  14436. const lNode = getLNodeForHydration(viewRef);
  14437. if (lNode !== null && lNode[HOST] !== null) {
  14438. if (isLView(lNode)) {
  14439. cleanupLView(lNode);
  14440. } else {
  14441. cleanupLContainer(lNode);
  14442. }
  14443. ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++;
  14444. }
  14445. }
  14446. }
  14447. function cleanupHydratedDeferBlocks(deferBlock, hydratedBlocks, registry, appRef) {
  14448. if (deferBlock !== null) {
  14449. registry.cleanup(hydratedBlocks);
  14450. cleanupLContainer(deferBlock.lContainer);
  14451. cleanupDehydratedViews(appRef);
  14452. }
  14453. }
  14454. function locateDehydratedViewsInContainer(currentRNode, serializedViews) {
  14455. const dehydratedViews = [];
  14456. for (const serializedView of serializedViews) {
  14457. for (let i = 0; i < (serializedView[MULTIPLIER] ?? 1); i++) {
  14458. const view = {
  14459. data: serializedView,
  14460. firstChild: null
  14461. };
  14462. if (serializedView[NUM_ROOT_NODES] > 0) {
  14463. view.firstChild = currentRNode;
  14464. currentRNode = siblingAfter(serializedView[NUM_ROOT_NODES], currentRNode);
  14465. }
  14466. dehydratedViews.push(view);
  14467. }
  14468. }
  14469. return [currentRNode, dehydratedViews];
  14470. }
  14471. var _findMatchingDehydratedViewImpl = () => null;
  14472. function findMatchingDehydratedViewImpl(lContainer, template) {
  14473. const views = lContainer[DEHYDRATED_VIEWS];
  14474. if (!template || views === null || views.length === 0) {
  14475. return null;
  14476. }
  14477. const view = views[0];
  14478. if (view.data[TEMPLATE_ID] === template) {
  14479. return views.shift();
  14480. } else {
  14481. removeDehydratedViews(lContainer);
  14482. return null;
  14483. }
  14484. }
  14485. function enableFindMatchingDehydratedViewImpl() {
  14486. _findMatchingDehydratedViewImpl = findMatchingDehydratedViewImpl;
  14487. }
  14488. function findMatchingDehydratedView(lContainer, template) {
  14489. return _findMatchingDehydratedViewImpl(lContainer, template);
  14490. }
  14491. var ComponentRef$1 = class ComponentRef {
  14492. };
  14493. var ComponentFactory$1 = class ComponentFactory {
  14494. };
  14495. var _NullComponentFactoryResolver = class {
  14496. resolveComponentFactory(component) {
  14497. throw Error(`No component factory found for ${stringify(component)}.`);
  14498. }
  14499. };
  14500. var ComponentFactoryResolver$1 = class ComponentFactoryResolver {
  14501. static NULL = new _NullComponentFactoryResolver();
  14502. };
  14503. var RendererFactory2 = class {
  14504. };
  14505. var Renderer2 = class {
  14506. /**
  14507. * If null or undefined, the view engine won't call it.
  14508. * This is used as a performance optimization for production mode.
  14509. */
  14510. destroyNode = null;
  14511. /**
  14512. * @internal
  14513. * @nocollapse
  14514. */
  14515. static __NG_ELEMENT_ID__ = () => injectRenderer2();
  14516. };
  14517. function injectRenderer2() {
  14518. const lView = getLView();
  14519. const tNode = getCurrentTNode();
  14520. const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
  14521. return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
  14522. }
  14523. var Sanitizer = class _Sanitizer {
  14524. /** @nocollapse */
  14525. static ɵprov = (
  14526. /** @pureOrBreakMyCode */
  14527. ɵɵdefineInjectable({
  14528. token: _Sanitizer,
  14529. providedIn: "root",
  14530. factory: () => null
  14531. })
  14532. );
  14533. };
  14534. function isModuleWithProviders(value) {
  14535. return value.ngModule !== void 0;
  14536. }
  14537. function isNgModule(value) {
  14538. return !!getNgModuleDef(value);
  14539. }
  14540. function isPipe(value) {
  14541. return !!getPipeDef$1(value);
  14542. }
  14543. function isDirective(value) {
  14544. return !!getDirectiveDef(value);
  14545. }
  14546. function isComponent(value) {
  14547. return !!getComponentDef(value);
  14548. }
  14549. function getDependencyTypeForError(type) {
  14550. if (getComponentDef(type)) return "component";
  14551. if (getDirectiveDef(type)) return "directive";
  14552. if (getPipeDef$1(type)) return "pipe";
  14553. return "type";
  14554. }
  14555. function verifyStandaloneImport(depType, importingType) {
  14556. if (isForwardRef(depType)) {
  14557. depType = resolveForwardRef(depType);
  14558. if (!depType) {
  14559. throw new Error(`Expected forwardRef function, imported from "${stringifyForError(importingType)}", to return a standalone entity or NgModule but got "${stringifyForError(depType) || depType}".`);
  14560. }
  14561. }
  14562. if (getNgModuleDef(depType) == null) {
  14563. const def = getComponentDef(depType) || getDirectiveDef(depType) || getPipeDef$1(depType);
  14564. if (def != null) {
  14565. if (!def.standalone) {
  14566. throw new Error(`The "${stringifyForError(depType)}" ${getDependencyTypeForError(depType)}, imported from "${stringifyForError(importingType)}", is not standalone. Did you forget to add the standalone: true flag?`);
  14567. }
  14568. } else {
  14569. if (isModuleWithProviders(depType)) {
  14570. throw new Error(`A module with providers was imported from "${stringifyForError(importingType)}". Modules with providers are not supported in standalone components imports.`);
  14571. } else {
  14572. throw new Error(`The "${stringifyForError(depType)}" type, imported from "${stringifyForError(importingType)}", must be a standalone component / directive / pipe or an NgModule. Did you forget to add the required @Component / @Directive / @Pipe or @NgModule annotation?`);
  14573. }
  14574. }
  14575. }
  14576. }
  14577. var USE_RUNTIME_DEPS_TRACKER_FOR_JIT = true;
  14578. var DepsTracker = class {
  14579. ownerNgModule = /* @__PURE__ */ new Map();
  14580. ngModulesWithSomeUnresolvedDecls = /* @__PURE__ */ new Set();
  14581. ngModulesScopeCache = /* @__PURE__ */ new Map();
  14582. standaloneComponentsScopeCache = /* @__PURE__ */ new Map();
  14583. /**
  14584. * Attempts to resolve ng module's forward ref declarations as much as possible and add them to
  14585. * the `ownerNgModule` map. This method normally should be called after the initial parsing when
  14586. * all the forward refs are resolved (e.g., when trying to render a component)
  14587. */
  14588. resolveNgModulesDecls() {
  14589. if (this.ngModulesWithSomeUnresolvedDecls.size === 0) {
  14590. return;
  14591. }
  14592. for (const moduleType of this.ngModulesWithSomeUnresolvedDecls) {
  14593. const def = getNgModuleDef(moduleType);
  14594. if (def?.declarations) {
  14595. for (const decl of maybeUnwrapFn(def.declarations)) {
  14596. if (isComponent(decl)) {
  14597. this.ownerNgModule.set(decl, moduleType);
  14598. }
  14599. }
  14600. }
  14601. }
  14602. this.ngModulesWithSomeUnresolvedDecls.clear();
  14603. }
  14604. /** @override */
  14605. getComponentDependencies(type, rawImports) {
  14606. this.resolveNgModulesDecls();
  14607. const def = getComponentDef(type);
  14608. if (def === null) {
  14609. throw new Error(`Attempting to get component dependencies for a type that is not a component: ${type}`);
  14610. }
  14611. if (def.standalone) {
  14612. const scope = this.getStandaloneComponentScope(type, rawImports);
  14613. if (scope.compilation.isPoisoned) {
  14614. return {
  14615. dependencies: []
  14616. };
  14617. }
  14618. return {
  14619. dependencies: [...scope.compilation.directives, ...scope.compilation.pipes, ...scope.compilation.ngModules]
  14620. };
  14621. } else {
  14622. if (!this.ownerNgModule.has(type)) {
  14623. return {
  14624. dependencies: []
  14625. };
  14626. }
  14627. const scope = this.getNgModuleScope(this.ownerNgModule.get(type));
  14628. if (scope.compilation.isPoisoned) {
  14629. return {
  14630. dependencies: []
  14631. };
  14632. }
  14633. return {
  14634. dependencies: [...scope.compilation.directives, ...scope.compilation.pipes]
  14635. };
  14636. }
  14637. }
  14638. /**
  14639. * @override
  14640. * This implementation does not make use of param scopeInfo since it assumes the scope info is
  14641. * already added to the type itself through methods like {@link ɵɵsetNgModuleScope}
  14642. */
  14643. registerNgModule(type, scopeInfo) {
  14644. if (!isNgModule(type)) {
  14645. throw new Error(`Attempting to register a Type which is not NgModule as NgModule: ${type}`);
  14646. }
  14647. this.ngModulesWithSomeUnresolvedDecls.add(type);
  14648. }
  14649. /** @override */
  14650. clearScopeCacheFor(type) {
  14651. this.ngModulesScopeCache.delete(type);
  14652. this.standaloneComponentsScopeCache.delete(type);
  14653. }
  14654. /** @override */
  14655. getNgModuleScope(type) {
  14656. if (this.ngModulesScopeCache.has(type)) {
  14657. return this.ngModulesScopeCache.get(type);
  14658. }
  14659. const scope = this.computeNgModuleScope(type);
  14660. this.ngModulesScopeCache.set(type, scope);
  14661. return scope;
  14662. }
  14663. /** Compute NgModule scope afresh. */
  14664. computeNgModuleScope(type) {
  14665. const def = getNgModuleDef(type, true);
  14666. const scope = {
  14667. exported: {
  14668. directives: /* @__PURE__ */ new Set(),
  14669. pipes: /* @__PURE__ */ new Set()
  14670. },
  14671. compilation: {
  14672. directives: /* @__PURE__ */ new Set(),
  14673. pipes: /* @__PURE__ */ new Set()
  14674. }
  14675. };
  14676. for (const imported of maybeUnwrapFn(def.imports)) {
  14677. if (isNgModule(imported)) {
  14678. const importedScope = this.getNgModuleScope(imported);
  14679. addSet(importedScope.exported.directives, scope.compilation.directives);
  14680. addSet(importedScope.exported.pipes, scope.compilation.pipes);
  14681. } else if (isStandalone(imported)) {
  14682. if (isDirective(imported) || isComponent(imported)) {
  14683. scope.compilation.directives.add(imported);
  14684. } else if (isPipe(imported)) {
  14685. scope.compilation.pipes.add(imported);
  14686. } else {
  14687. throw new RuntimeError(980, "The standalone imported type is neither a component nor a directive nor a pipe");
  14688. }
  14689. } else {
  14690. scope.compilation.isPoisoned = true;
  14691. break;
  14692. }
  14693. }
  14694. if (!scope.compilation.isPoisoned) {
  14695. for (const decl of maybeUnwrapFn(def.declarations)) {
  14696. if (isNgModule(decl) || isStandalone(decl)) {
  14697. scope.compilation.isPoisoned = true;
  14698. break;
  14699. }
  14700. if (isPipe(decl)) {
  14701. scope.compilation.pipes.add(decl);
  14702. } else {
  14703. scope.compilation.directives.add(decl);
  14704. }
  14705. }
  14706. }
  14707. for (const exported of maybeUnwrapFn(def.exports)) {
  14708. if (isNgModule(exported)) {
  14709. const exportedScope = this.getNgModuleScope(exported);
  14710. addSet(exportedScope.exported.directives, scope.exported.directives);
  14711. addSet(exportedScope.exported.pipes, scope.exported.pipes);
  14712. addSet(exportedScope.exported.directives, scope.compilation.directives);
  14713. addSet(exportedScope.exported.pipes, scope.compilation.pipes);
  14714. } else if (isPipe(exported)) {
  14715. scope.exported.pipes.add(exported);
  14716. } else {
  14717. scope.exported.directives.add(exported);
  14718. }
  14719. }
  14720. return scope;
  14721. }
  14722. /** @override */
  14723. getStandaloneComponentScope(type, rawImports) {
  14724. if (this.standaloneComponentsScopeCache.has(type)) {
  14725. return this.standaloneComponentsScopeCache.get(type);
  14726. }
  14727. const ans = this.computeStandaloneComponentScope(type, rawImports);
  14728. this.standaloneComponentsScopeCache.set(type, ans);
  14729. return ans;
  14730. }
  14731. computeStandaloneComponentScope(type, rawImports) {
  14732. const ans = {
  14733. compilation: {
  14734. // Standalone components are always able to self-reference.
  14735. directives: /* @__PURE__ */ new Set([type]),
  14736. pipes: /* @__PURE__ */ new Set(),
  14737. ngModules: /* @__PURE__ */ new Set()
  14738. }
  14739. };
  14740. for (const rawImport of flatten(rawImports ?? [])) {
  14741. const imported = resolveForwardRef(rawImport);
  14742. try {
  14743. verifyStandaloneImport(imported, type);
  14744. } catch (e) {
  14745. ans.compilation.isPoisoned = true;
  14746. return ans;
  14747. }
  14748. if (isNgModule(imported)) {
  14749. ans.compilation.ngModules.add(imported);
  14750. const importedScope = this.getNgModuleScope(imported);
  14751. if (importedScope.exported.isPoisoned) {
  14752. ans.compilation.isPoisoned = true;
  14753. return ans;
  14754. }
  14755. addSet(importedScope.exported.directives, ans.compilation.directives);
  14756. addSet(importedScope.exported.pipes, ans.compilation.pipes);
  14757. } else if (isPipe(imported)) {
  14758. ans.compilation.pipes.add(imported);
  14759. } else if (isDirective(imported) || isComponent(imported)) {
  14760. ans.compilation.directives.add(imported);
  14761. } else {
  14762. ans.compilation.isPoisoned = true;
  14763. return ans;
  14764. }
  14765. }
  14766. return ans;
  14767. }
  14768. /** @override */
  14769. isOrphanComponent(cmp) {
  14770. const def = getComponentDef(cmp);
  14771. if (!def || def.standalone) {
  14772. return false;
  14773. }
  14774. this.resolveNgModulesDecls();
  14775. return !this.ownerNgModule.has(cmp);
  14776. }
  14777. };
  14778. function addSet(sourceSet, targetSet) {
  14779. for (const m of sourceSet) {
  14780. targetSet.add(m);
  14781. }
  14782. }
  14783. var depsTracker = new DepsTracker();
  14784. function computeStaticStyling(tNode, attrs, writeToHost) {
  14785. ngDevMode && assertFirstCreatePass(getTView(), "Expecting to be called in first template pass only");
  14786. let styles = writeToHost ? tNode.styles : null;
  14787. let classes = writeToHost ? tNode.classes : null;
  14788. let mode = 0;
  14789. if (attrs !== null) {
  14790. for (let i = 0; i < attrs.length; i++) {
  14791. const value = attrs[i];
  14792. if (typeof value === "number") {
  14793. mode = value;
  14794. } else if (mode == 1) {
  14795. classes = concatStringsWithSpace(classes, value);
  14796. } else if (mode == 2) {
  14797. const style = value;
  14798. const styleValue = attrs[++i];
  14799. styles = concatStringsWithSpace(styles, style + ": " + styleValue + ";");
  14800. }
  14801. }
  14802. }
  14803. writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles;
  14804. writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes;
  14805. }
  14806. function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
  14807. const lView = getLView();
  14808. if (lView === null) {
  14809. ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
  14810. return ɵɵinject(token, flags);
  14811. }
  14812. const tNode = getCurrentTNode();
  14813. const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
  14814. ngDevMode && emitInjectEvent(token, value, flags);
  14815. return value;
  14816. }
  14817. function ɵɵinvalidFactory() {
  14818. const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : "invalid";
  14819. throw new Error(msg);
  14820. }
  14821. function resolveDirectives(tView, lView, tNode, localRefs, directiveMatcher) {
  14822. ngDevMode && assertFirstCreatePass(tView);
  14823. const exportsMap = localRefs === null ? null : {
  14824. "": -1
  14825. };
  14826. const matchedDirectiveDefs = directiveMatcher(tView, tNode);
  14827. if (matchedDirectiveDefs !== null) {
  14828. let directiveDefs;
  14829. let hostDirectiveDefs = null;
  14830. let hostDirectiveRanges = null;
  14831. const hostDirectiveResolution = resolveHostDirectives(matchedDirectiveDefs);
  14832. if (hostDirectiveResolution === null) {
  14833. directiveDefs = matchedDirectiveDefs;
  14834. } else {
  14835. [directiveDefs, hostDirectiveDefs, hostDirectiveRanges] = hostDirectiveResolution;
  14836. }
  14837. initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs, hostDirectiveRanges);
  14838. }
  14839. if (exportsMap !== null && localRefs !== null) {
  14840. cacheMatchingLocalNames(tNode, localRefs, exportsMap);
  14841. }
  14842. }
  14843. function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
  14844. const localNames = tNode.localNames = [];
  14845. for (let i = 0; i < localRefs.length; i += 2) {
  14846. const index = exportsMap[localRefs[i + 1]];
  14847. if (index == null) throw new RuntimeError(-301, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
  14848. localNames.push(localRefs[i], index);
  14849. }
  14850. }
  14851. function resolveHostDirectives(matches) {
  14852. let componentDef = null;
  14853. let hasHostDirectives = false;
  14854. for (let i = 0; i < matches.length; i++) {
  14855. const def = matches[i];
  14856. if (i === 0 && isComponentDef(def)) {
  14857. componentDef = def;
  14858. }
  14859. if (def.findHostDirectiveDefs !== null) {
  14860. hasHostDirectives = true;
  14861. break;
  14862. }
  14863. }
  14864. if (!hasHostDirectives) {
  14865. return null;
  14866. }
  14867. let allDirectiveDefs = null;
  14868. let hostDirectiveDefs = null;
  14869. let hostDirectiveRanges = null;
  14870. for (const def of matches) {
  14871. if (def.findHostDirectiveDefs !== null) {
  14872. allDirectiveDefs ??= [];
  14873. hostDirectiveDefs ??= /* @__PURE__ */ new Map();
  14874. hostDirectiveRanges ??= /* @__PURE__ */ new Map();
  14875. resolveHostDirectivesForDef(def, allDirectiveDefs, hostDirectiveRanges, hostDirectiveDefs);
  14876. }
  14877. if (def === componentDef) {
  14878. allDirectiveDefs ??= [];
  14879. allDirectiveDefs.push(def);
  14880. }
  14881. }
  14882. if (allDirectiveDefs !== null) {
  14883. allDirectiveDefs.push(...componentDef === null ? matches : matches.slice(1));
  14884. ngDevMode && assertNoDuplicateDirectives(allDirectiveDefs);
  14885. return [allDirectiveDefs, hostDirectiveDefs, hostDirectiveRanges];
  14886. }
  14887. return null;
  14888. }
  14889. function resolveHostDirectivesForDef(def, allDirectiveDefs, hostDirectiveRanges, hostDirectiveDefs) {
  14890. ngDevMode && assertDefined(def.findHostDirectiveDefs, "Expected host directive resolve function");
  14891. const start = allDirectiveDefs.length;
  14892. def.findHostDirectiveDefs(def, allDirectiveDefs, hostDirectiveDefs);
  14893. hostDirectiveRanges.set(def, [start, allDirectiveDefs.length - 1]);
  14894. }
  14895. function markAsComponentHost(tView, hostTNode, componentOffset) {
  14896. ngDevMode && assertFirstCreatePass(tView);
  14897. ngDevMode && assertGreaterThan(componentOffset, -1, "componentOffset must be great than -1");
  14898. hostTNode.componentOffset = componentOffset;
  14899. (tView.components ??= []).push(hostTNode.index);
  14900. }
  14901. function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs, hostDirectiveRanges) {
  14902. ngDevMode && assertFirstCreatePass(tView);
  14903. const directivesLength = directives.length;
  14904. let hasSeenComponent = false;
  14905. for (let i = 0; i < directivesLength; i++) {
  14906. const def = directives[i];
  14907. if (!hasSeenComponent && isComponentDef(def)) {
  14908. hasSeenComponent = true;
  14909. markAsComponentHost(tView, tNode, i);
  14910. }
  14911. diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, def.type);
  14912. }
  14913. initTNodeFlags(tNode, tView.data.length, directivesLength);
  14914. for (let i = 0; i < directivesLength; i++) {
  14915. const def = directives[i];
  14916. if (def.providersResolver) def.providersResolver(def);
  14917. }
  14918. let preOrderHooksFound = false;
  14919. let preOrderCheckHooksFound = false;
  14920. let directiveIdx = allocExpando(tView, lView, directivesLength, null);
  14921. ngDevMode && assertSame(directiveIdx, tNode.directiveStart, "TNode.directiveStart should point to just allocated space");
  14922. if (directivesLength > 0) {
  14923. tNode.directiveToIndex = /* @__PURE__ */ new Map();
  14924. }
  14925. for (let i = 0; i < directivesLength; i++) {
  14926. const def = directives[i];
  14927. tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
  14928. configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
  14929. saveNameToExportMap(directiveIdx, def, exportsMap);
  14930. if (hostDirectiveRanges !== null && hostDirectiveRanges.has(def)) {
  14931. const [start, end] = hostDirectiveRanges.get(def);
  14932. tNode.directiveToIndex.set(def.type, [directiveIdx, start + tNode.directiveStart, end + tNode.directiveStart]);
  14933. } else if (hostDirectiveDefs === null || !hostDirectiveDefs.has(def)) {
  14934. tNode.directiveToIndex.set(def.type, directiveIdx);
  14935. }
  14936. if (def.contentQueries !== null) tNode.flags |= 4;
  14937. if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0) tNode.flags |= 64;
  14938. const lifeCycleHooks = def.type.prototype;
  14939. if (!preOrderHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
  14940. (tView.preOrderHooks ??= []).push(tNode.index);
  14941. preOrderHooksFound = true;
  14942. }
  14943. if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
  14944. (tView.preOrderCheckHooks ??= []).push(tNode.index);
  14945. preOrderCheckHooksFound = true;
  14946. }
  14947. directiveIdx++;
  14948. }
  14949. initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
  14950. }
  14951. function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs) {
  14952. ngDevMode && assertFirstCreatePass(tView);
  14953. for (let index = tNode.directiveStart; index < tNode.directiveEnd; index++) {
  14954. const directiveDef = tView.data[index];
  14955. if (hostDirectiveDefs === null || !hostDirectiveDefs.has(directiveDef)) {
  14956. setupSelectorMatchedInputsOrOutputs(0, tNode, directiveDef, index);
  14957. setupSelectorMatchedInputsOrOutputs(1, tNode, directiveDef, index);
  14958. setupInitialInputs(tNode, index, false);
  14959. } else {
  14960. const hostDirectiveDef = hostDirectiveDefs.get(directiveDef);
  14961. setupHostDirectiveInputsOrOutputs(0, tNode, hostDirectiveDef, index);
  14962. setupHostDirectiveInputsOrOutputs(1, tNode, hostDirectiveDef, index);
  14963. setupInitialInputs(tNode, index, true);
  14964. }
  14965. }
  14966. }
  14967. function setupSelectorMatchedInputsOrOutputs(mode, tNode, def, directiveIndex) {
  14968. const aliasMap = mode === 0 ? def.inputs : def.outputs;
  14969. for (const publicName in aliasMap) {
  14970. if (aliasMap.hasOwnProperty(publicName)) {
  14971. let bindings;
  14972. if (mode === 0) {
  14973. bindings = tNode.inputs ??= {};
  14974. } else {
  14975. bindings = tNode.outputs ??= {};
  14976. }
  14977. bindings[publicName] ??= [];
  14978. bindings[publicName].push(directiveIndex);
  14979. setShadowStylingInputFlags(tNode, publicName);
  14980. }
  14981. }
  14982. }
  14983. function setupHostDirectiveInputsOrOutputs(mode, tNode, config2, directiveIndex) {
  14984. const aliasMap = mode === 0 ? config2.inputs : config2.outputs;
  14985. for (const initialName in aliasMap) {
  14986. if (aliasMap.hasOwnProperty(initialName)) {
  14987. const publicName = aliasMap[initialName];
  14988. let bindings;
  14989. if (mode === 0) {
  14990. bindings = tNode.hostDirectiveInputs ??= {};
  14991. } else {
  14992. bindings = tNode.hostDirectiveOutputs ??= {};
  14993. }
  14994. bindings[publicName] ??= [];
  14995. bindings[publicName].push(directiveIndex, initialName);
  14996. setShadowStylingInputFlags(tNode, publicName);
  14997. }
  14998. }
  14999. }
  15000. function setShadowStylingInputFlags(tNode, publicName) {
  15001. if (publicName === "class") {
  15002. tNode.flags |= 8;
  15003. } else if (publicName === "style") {
  15004. tNode.flags |= 16;
  15005. }
  15006. }
  15007. function setupInitialInputs(tNode, directiveIndex, isHostDirective) {
  15008. const {
  15009. attrs,
  15010. inputs,
  15011. hostDirectiveInputs
  15012. } = tNode;
  15013. if (attrs === null || !isHostDirective && inputs === null || isHostDirective && hostDirectiveInputs === null || // Do not use unbound attributes as inputs to structural directives, since structural
  15014. // directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
  15015. isInlineTemplate(tNode)) {
  15016. tNode.initialInputs ??= [];
  15017. tNode.initialInputs.push(null);
  15018. return;
  15019. }
  15020. let inputsToStore = null;
  15021. let i = 0;
  15022. while (i < attrs.length) {
  15023. const attrName = attrs[i];
  15024. if (attrName === 0) {
  15025. i += 4;
  15026. continue;
  15027. } else if (attrName === 5) {
  15028. i += 2;
  15029. continue;
  15030. } else if (typeof attrName === "number") {
  15031. break;
  15032. }
  15033. if (!isHostDirective && inputs.hasOwnProperty(attrName)) {
  15034. const inputConfig = inputs[attrName];
  15035. for (const index of inputConfig) {
  15036. if (index === directiveIndex) {
  15037. inputsToStore ??= [];
  15038. inputsToStore.push(attrName, attrs[i + 1]);
  15039. break;
  15040. }
  15041. }
  15042. } else if (isHostDirective && hostDirectiveInputs.hasOwnProperty(attrName)) {
  15043. const config2 = hostDirectiveInputs[attrName];
  15044. for (let j = 0; j < config2.length; j += 2) {
  15045. if (config2[j] === directiveIndex) {
  15046. inputsToStore ??= [];
  15047. inputsToStore.push(config2[j + 1], attrs[i + 1]);
  15048. break;
  15049. }
  15050. }
  15051. }
  15052. i += 2;
  15053. }
  15054. tNode.initialInputs ??= [];
  15055. tNode.initialInputs.push(inputsToStore);
  15056. }
  15057. function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
  15058. ngDevMode && assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, "Must be in Expando section");
  15059. tView.data[directiveIndex] = def;
  15060. const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
  15061. const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
  15062. tView.blueprint[directiveIndex] = nodeInjectorFactory;
  15063. lView[directiveIndex] = nodeInjectorFactory;
  15064. registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
  15065. }
  15066. function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
  15067. ngDevMode && assertFirstCreatePass(tView);
  15068. const hostBindings = def.hostBindings;
  15069. if (hostBindings) {
  15070. let hostBindingOpCodes = tView.hostBindingOpCodes;
  15071. if (hostBindingOpCodes === null) {
  15072. hostBindingOpCodes = tView.hostBindingOpCodes = [];
  15073. }
  15074. const elementIndx = ~tNode.index;
  15075. if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
  15076. hostBindingOpCodes.push(elementIndx);
  15077. }
  15078. hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
  15079. }
  15080. }
  15081. function lastSelectedElementIdx(hostBindingOpCodes) {
  15082. let i = hostBindingOpCodes.length;
  15083. while (i > 0) {
  15084. const value = hostBindingOpCodes[--i];
  15085. if (typeof value === "number" && value < 0) {
  15086. return value;
  15087. }
  15088. }
  15089. return 0;
  15090. }
  15091. function saveNameToExportMap(directiveIdx, def, exportsMap) {
  15092. if (exportsMap) {
  15093. if (def.exportAs) {
  15094. for (let i = 0; i < def.exportAs.length; i++) {
  15095. exportsMap[def.exportAs[i]] = directiveIdx;
  15096. }
  15097. }
  15098. if (isComponentDef(def)) exportsMap[""] = directiveIdx;
  15099. }
  15100. }
  15101. function initTNodeFlags(tNode, index, numberOfDirectives) {
  15102. ngDevMode && assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, "Reached the max number of directives");
  15103. tNode.flags |= 1;
  15104. tNode.directiveStart = index;
  15105. tNode.directiveEnd = index + numberOfDirectives;
  15106. tNode.providerIndexes = index;
  15107. }
  15108. function assertNoDuplicateDirectives(directives) {
  15109. if (directives.length < 2) {
  15110. return;
  15111. }
  15112. const seenDirectives = /* @__PURE__ */ new Set();
  15113. for (const current of directives) {
  15114. if (seenDirectives.has(current)) {
  15115. throw new RuntimeError(309, `Directive ${current.type.name} matches multiple times on the same element. Directives can only match an element once.`);
  15116. }
  15117. seenDirectives.add(current);
  15118. }
  15119. }
  15120. function elementStartFirstCreatePass(index, tView, lView, name, directiveMatcher, bindingsEnabled, attrsIndex, localRefsIndex) {
  15121. ngDevMode && assertFirstCreatePass(tView);
  15122. ngDevMode && ngDevMode.firstCreatePass++;
  15123. const tViewConsts = tView.consts;
  15124. const attrs = getConstant(tViewConsts, attrsIndex);
  15125. const tNode = getOrCreateTNode(tView, index, 2, name, attrs);
  15126. if (bindingsEnabled) {
  15127. resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), directiveMatcher);
  15128. }
  15129. tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
  15130. if (tNode.attrs !== null) {
  15131. computeStaticStyling(tNode, tNode.attrs, false);
  15132. }
  15133. if (tNode.mergedAttrs !== null) {
  15134. computeStaticStyling(tNode, tNode.mergedAttrs, true);
  15135. }
  15136. if (tView.queries !== null) {
  15137. tView.queries.elementStart(tView, tNode);
  15138. }
  15139. return tNode;
  15140. }
  15141. function elementEndFirstCreatePass(tView, tNode) {
  15142. ngDevMode && assertFirstCreatePass(tView);
  15143. registerPostOrderHooks(tView, tNode);
  15144. if (isContentQueryHost(tNode)) {
  15145. tView.queries.elementEnd(tNode);
  15146. }
  15147. }
  15148. var ComponentFactoryResolver2 = class extends ComponentFactoryResolver$1 {
  15149. ngModule;
  15150. /**
  15151. * @param ngModule The NgModuleRef to which all resolved factories are bound.
  15152. */
  15153. constructor(ngModule) {
  15154. super();
  15155. this.ngModule = ngModule;
  15156. }
  15157. resolveComponentFactory(component) {
  15158. ngDevMode && assertComponentType(component);
  15159. const componentDef = getComponentDef(component);
  15160. return new ComponentFactory2(componentDef, this.ngModule);
  15161. }
  15162. };
  15163. function toInputRefArray(map2) {
  15164. return Object.keys(map2).map((name) => {
  15165. const [propName, flags, transform] = map2[name];
  15166. const inputData = {
  15167. propName,
  15168. templateName: name,
  15169. isSignal: (flags & InputFlags.SignalBased) !== 0
  15170. };
  15171. if (transform) {
  15172. inputData.transform = transform;
  15173. }
  15174. return inputData;
  15175. });
  15176. }
  15177. function toOutputRefArray(map2) {
  15178. return Object.keys(map2).map((name) => ({
  15179. propName: map2[name],
  15180. templateName: name
  15181. }));
  15182. }
  15183. function verifyNotAnOrphanComponent(componentDef) {
  15184. if ((typeof ngJitMode === "undefined" || ngJitMode) && componentDef.debugInfo?.forbidOrphanRendering) {
  15185. if (depsTracker.isOrphanComponent(componentDef.type)) {
  15186. throw new RuntimeError(981, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(componentDef.type)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
  15187. }
  15188. }
  15189. }
  15190. function createRootViewInjector(componentDef, environmentInjector, injector) {
  15191. let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ? environmentInjector : environmentInjector?.injector;
  15192. if (realEnvironmentInjector && componentDef.getStandaloneInjector !== null) {
  15193. realEnvironmentInjector = componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector;
  15194. }
  15195. const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
  15196. return rootViewInjector;
  15197. }
  15198. function createRootLViewEnvironment(rootLViewInjector) {
  15199. const rendererFactory = rootLViewInjector.get(RendererFactory2, null);
  15200. if (rendererFactory === null) {
  15201. throw new RuntimeError(407, ngDevMode && "Angular was not able to inject a renderer (RendererFactory2). Likely this is due to a broken DI hierarchy. Make sure that any injector used to create this component has a correct parent.");
  15202. }
  15203. const sanitizer = rootLViewInjector.get(Sanitizer, null);
  15204. const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null);
  15205. return {
  15206. rendererFactory,
  15207. sanitizer,
  15208. changeDetectionScheduler
  15209. };
  15210. }
  15211. function createHostElement(componentDef, render) {
  15212. const tagName = (componentDef.selectors[0][0] || "div").toLowerCase();
  15213. const namespace = tagName === "svg" ? SVG_NAMESPACE : tagName === "math" ? MATH_ML_NAMESPACE : null;
  15214. return createElementNode(render, tagName, namespace);
  15215. }
  15216. var ComponentFactory2 = class extends ComponentFactory$1 {
  15217. componentDef;
  15218. ngModule;
  15219. selector;
  15220. componentType;
  15221. ngContentSelectors;
  15222. isBoundToModule;
  15223. cachedInputs = null;
  15224. cachedOutputs = null;
  15225. get inputs() {
  15226. this.cachedInputs ??= toInputRefArray(this.componentDef.inputs);
  15227. return this.cachedInputs;
  15228. }
  15229. get outputs() {
  15230. this.cachedOutputs ??= toOutputRefArray(this.componentDef.outputs);
  15231. return this.cachedOutputs;
  15232. }
  15233. /**
  15234. * @param componentDef The component definition.
  15235. * @param ngModule The NgModuleRef to which the factory is bound.
  15236. */
  15237. constructor(componentDef, ngModule) {
  15238. super();
  15239. this.componentDef = componentDef;
  15240. this.ngModule = ngModule;
  15241. this.componentType = componentDef.type;
  15242. this.selector = stringifyCSSSelectorList(componentDef.selectors);
  15243. this.ngContentSelectors = componentDef.ngContentSelectors ?? [];
  15244. this.isBoundToModule = !!ngModule;
  15245. }
  15246. create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
  15247. profiler(
  15248. 22
  15249. /* ProfilerEvent.DynamicComponentStart */
  15250. );
  15251. const prevConsumer = setActiveConsumer(null);
  15252. try {
  15253. const cmpDef = this.componentDef;
  15254. ngDevMode && verifyNotAnOrphanComponent(cmpDef);
  15255. const tAttributes = rootSelectorOrNode ? ["ng-version", "19.2.4"] : (
  15256. // Extract attributes and classes from the first selector only to match VE behavior.
  15257. extractAttrsAndClassesFromSelector(this.componentDef.selectors[0])
  15258. );
  15259. const rootTView = createTView(0, null, null, 1, 0, null, null, null, null, [tAttributes], null);
  15260. const rootViewInjector = createRootViewInjector(cmpDef, environmentInjector || this.ngModule, injector);
  15261. const environment = createRootLViewEnvironment(rootViewInjector);
  15262. const hostRenderer = environment.rendererFactory.createRenderer(null, cmpDef);
  15263. const hostElement = rootSelectorOrNode ? locateHostElement(hostRenderer, rootSelectorOrNode, cmpDef.encapsulation, rootViewInjector) : createHostElement(cmpDef, hostRenderer);
  15264. const rootLView = createLView(null, rootTView, null, 512 | getInitialLViewFlagsFromDef(cmpDef), null, null, environment, hostRenderer, rootViewInjector, null, retrieveHydrationInfo(
  15265. hostElement,
  15266. rootViewInjector,
  15267. true
  15268. /* isRootView */
  15269. ));
  15270. rootLView[HEADER_OFFSET] = hostElement;
  15271. enterView(rootLView);
  15272. let componentView = null;
  15273. try {
  15274. const hostTNode = elementStartFirstCreatePass(HEADER_OFFSET, rootTView, rootLView, "#host", () => [this.componentDef], true, 0);
  15275. if (hostElement) {
  15276. setupStaticAttributes(hostRenderer, hostElement, hostTNode);
  15277. attachPatchData(hostElement, rootLView);
  15278. }
  15279. createDirectivesInstances(rootTView, rootLView, hostTNode);
  15280. executeContentQueries(rootTView, hostTNode, rootLView);
  15281. elementEndFirstCreatePass(rootTView, hostTNode);
  15282. if (projectableNodes !== void 0) {
  15283. projectNodes(hostTNode, this.ngContentSelectors, projectableNodes);
  15284. }
  15285. componentView = getComponentLViewByIndex(hostTNode.index, rootLView);
  15286. rootLView[CONTEXT] = componentView[CONTEXT];
  15287. renderView(rootTView, rootLView, null);
  15288. } catch (e) {
  15289. if (componentView !== null) {
  15290. unregisterLView(componentView);
  15291. }
  15292. unregisterLView(rootLView);
  15293. throw e;
  15294. } finally {
  15295. profiler(
  15296. 23
  15297. /* ProfilerEvent.DynamicComponentEnd */
  15298. );
  15299. leaveView();
  15300. }
  15301. return new ComponentRef2(this.componentType, rootLView);
  15302. } finally {
  15303. setActiveConsumer(prevConsumer);
  15304. }
  15305. }
  15306. };
  15307. var ComponentRef2 = class extends ComponentRef$1 {
  15308. _rootLView;
  15309. instance;
  15310. hostView;
  15311. changeDetectorRef;
  15312. componentType;
  15313. location;
  15314. previousInputValues = null;
  15315. _tNode;
  15316. constructor(componentType, _rootLView) {
  15317. super();
  15318. this._rootLView = _rootLView;
  15319. this._tNode = getTNode(_rootLView[TVIEW], HEADER_OFFSET);
  15320. this.location = createElementRef(this._tNode, _rootLView);
  15321. this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT];
  15322. this.hostView = this.changeDetectorRef = new ViewRef$1(
  15323. _rootLView,
  15324. void 0,
  15325. false
  15326. /* notifyErrorHandler */
  15327. );
  15328. this.componentType = componentType;
  15329. }
  15330. setInput(name, value) {
  15331. const tNode = this._tNode;
  15332. this.previousInputValues ??= /* @__PURE__ */ new Map();
  15333. if (this.previousInputValues.has(name) && Object.is(this.previousInputValues.get(name), value)) {
  15334. return;
  15335. }
  15336. const lView = this._rootLView;
  15337. const hasSetInput = setAllInputsForProperty(tNode, lView[TVIEW], lView, name, value);
  15338. this.previousInputValues.set(name, value);
  15339. const childComponentLView = getComponentLViewByIndex(tNode.index, lView);
  15340. markViewDirty(
  15341. childComponentLView,
  15342. 1
  15343. /* NotificationSource.SetInput */
  15344. );
  15345. if (ngDevMode && !hasSetInput) {
  15346. const cmpNameForError = stringifyForError(this.componentType);
  15347. let message = `Can't set value of the '${name}' input on the '${cmpNameForError}' component. `;
  15348. message += `Make sure that the '${name}' property is annotated with @Input() or a mapped @Input('${name}') exists.`;
  15349. reportUnknownPropertyError(message);
  15350. }
  15351. }
  15352. get injector() {
  15353. return new NodeInjector(this._tNode, this._rootLView);
  15354. }
  15355. destroy() {
  15356. this.hostView.destroy();
  15357. }
  15358. onDestroy(callback) {
  15359. this.hostView.onDestroy(callback);
  15360. }
  15361. };
  15362. function projectNodes(tNode, ngContentSelectors, projectableNodes) {
  15363. const projection = tNode.projection = [];
  15364. for (let i = 0; i < ngContentSelectors.length; i++) {
  15365. const nodesforSlot = projectableNodes[i];
  15366. projection.push(nodesforSlot != null && nodesforSlot.length ? Array.from(nodesforSlot) : null);
  15367. }
  15368. }
  15369. var ViewContainerRef = class {
  15370. /**
  15371. * @internal
  15372. * @nocollapse
  15373. */
  15374. static __NG_ELEMENT_ID__ = injectViewContainerRef;
  15375. };
  15376. function injectViewContainerRef() {
  15377. const previousTNode = getCurrentTNode();
  15378. return createContainerRef(previousTNode, getLView());
  15379. }
  15380. var VE_ViewContainerRef = ViewContainerRef;
  15381. var R3ViewContainerRef = class ViewContainerRef2 extends VE_ViewContainerRef {
  15382. _lContainer;
  15383. _hostTNode;
  15384. _hostLView;
  15385. constructor(_lContainer, _hostTNode, _hostLView) {
  15386. super();
  15387. this._lContainer = _lContainer;
  15388. this._hostTNode = _hostTNode;
  15389. this._hostLView = _hostLView;
  15390. }
  15391. get element() {
  15392. return createElementRef(this._hostTNode, this._hostLView);
  15393. }
  15394. get injector() {
  15395. return new NodeInjector(this._hostTNode, this._hostLView);
  15396. }
  15397. /** @deprecated No replacement */
  15398. get parentInjector() {
  15399. const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView);
  15400. if (hasParentInjector(parentLocation)) {
  15401. const parentView = getParentInjectorView(parentLocation, this._hostLView);
  15402. const injectorIndex = getParentInjectorIndex(parentLocation);
  15403. ngDevMode && assertNodeInjector(parentView, injectorIndex);
  15404. const parentTNode = parentView[TVIEW].data[
  15405. injectorIndex + 8
  15406. /* NodeInjectorOffset.TNODE */
  15407. ];
  15408. return new NodeInjector(parentTNode, parentView);
  15409. } else {
  15410. return new NodeInjector(null, this._hostLView);
  15411. }
  15412. }
  15413. clear() {
  15414. while (this.length > 0) {
  15415. this.remove(this.length - 1);
  15416. }
  15417. }
  15418. get(index) {
  15419. const viewRefs = getViewRefs(this._lContainer);
  15420. return viewRefs !== null && viewRefs[index] || null;
  15421. }
  15422. get length() {
  15423. return this._lContainer.length - CONTAINER_HEADER_OFFSET;
  15424. }
  15425. createEmbeddedView(templateRef, context2, indexOrOptions) {
  15426. let index;
  15427. let injector;
  15428. if (typeof indexOrOptions === "number") {
  15429. index = indexOrOptions;
  15430. } else if (indexOrOptions != null) {
  15431. index = indexOrOptions.index;
  15432. injector = indexOrOptions.injector;
  15433. }
  15434. const dehydratedView = findMatchingDehydratedView(this._lContainer, templateRef.ssrId);
  15435. const viewRef = templateRef.createEmbeddedViewImpl(context2 || {}, injector, dehydratedView);
  15436. this.insertImpl(viewRef, index, shouldAddViewToDom(this._hostTNode, dehydratedView));
  15437. return viewRef;
  15438. }
  15439. createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector) {
  15440. const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType);
  15441. let index;
  15442. if (isComponentFactory) {
  15443. if (ngDevMode) {
  15444. assertEqual(typeof indexOrOptions !== "object", true, "It looks like Component factory was provided as the first argument and an options object as the second argument. This combination of arguments is incompatible. You can either change the first argument to provide Component type or change the second argument to be a number (representing an index at which to insert the new component's host view into this container)");
  15445. }
  15446. index = indexOrOptions;
  15447. } else {
  15448. if (ngDevMode) {
  15449. assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. Please check whether provided class has @Component decorator.`);
  15450. assertEqual(typeof indexOrOptions !== "number", true, "It looks like Component type was provided as the first argument and a number (representing an index at which to insert the new component's host view into this container as the second argument. This combination of arguments is incompatible. Please use an object as the second argument instead.");
  15451. }
  15452. const options = indexOrOptions || {};
  15453. if (ngDevMode && options.environmentInjector && options.ngModuleRef) {
  15454. throwError2(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`);
  15455. }
  15456. index = options.index;
  15457. injector = options.injector;
  15458. projectableNodes = options.projectableNodes;
  15459. environmentInjector = options.environmentInjector || options.ngModuleRef;
  15460. }
  15461. const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory2(getComponentDef(componentFactoryOrType));
  15462. const contextInjector = injector || this.parentInjector;
  15463. if (!environmentInjector && componentFactory.ngModule == null) {
  15464. const _injector = isComponentFactory ? contextInjector : this.parentInjector;
  15465. const result = _injector.get(EnvironmentInjector, null);
  15466. if (result) {
  15467. environmentInjector = result;
  15468. }
  15469. }
  15470. const componentDef = getComponentDef(componentFactory.componentType ?? {});
  15471. const dehydratedView = findMatchingDehydratedView(this._lContainer, componentDef?.id ?? null);
  15472. const rNode = dehydratedView?.firstChild ?? null;
  15473. const componentRef = componentFactory.create(contextInjector, projectableNodes, rNode, environmentInjector);
  15474. this.insertImpl(componentRef.hostView, index, shouldAddViewToDom(this._hostTNode, dehydratedView));
  15475. return componentRef;
  15476. }
  15477. insert(viewRef, index) {
  15478. return this.insertImpl(viewRef, index, true);
  15479. }
  15480. insertImpl(viewRef, index, addToDOM) {
  15481. const lView = viewRef._lView;
  15482. if (ngDevMode && viewRef.destroyed) {
  15483. throw new Error("Cannot insert a destroyed View in a ViewContainer!");
  15484. }
  15485. if (viewAttachedToContainer(lView)) {
  15486. const prevIdx = this.indexOf(viewRef);
  15487. if (prevIdx !== -1) {
  15488. this.detach(prevIdx);
  15489. } else {
  15490. const prevLContainer = lView[PARENT];
  15491. ngDevMode && assertEqual(isLContainer(prevLContainer), true, "An attached view should have its PARENT point to a container.");
  15492. const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]);
  15493. prevVCRef.detach(prevVCRef.indexOf(viewRef));
  15494. }
  15495. }
  15496. const adjustedIdx = this._adjustIndex(index);
  15497. const lContainer = this._lContainer;
  15498. addLViewToLContainer(lContainer, lView, adjustedIdx, addToDOM);
  15499. viewRef.attachToViewContainerRef();
  15500. addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef);
  15501. return viewRef;
  15502. }
  15503. move(viewRef, newIndex) {
  15504. if (ngDevMode && viewRef.destroyed) {
  15505. throw new Error("Cannot move a destroyed View in a ViewContainer!");
  15506. }
  15507. return this.insert(viewRef, newIndex);
  15508. }
  15509. indexOf(viewRef) {
  15510. const viewRefsArr = getViewRefs(this._lContainer);
  15511. return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1;
  15512. }
  15513. remove(index) {
  15514. const adjustedIdx = this._adjustIndex(index, -1);
  15515. const detachedView = detachView(this._lContainer, adjustedIdx);
  15516. if (detachedView) {
  15517. removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx);
  15518. destroyLView(detachedView[TVIEW], detachedView);
  15519. }
  15520. }
  15521. detach(index) {
  15522. const adjustedIdx = this._adjustIndex(index, -1);
  15523. const view = detachView(this._lContainer, adjustedIdx);
  15524. const wasDetached = view && removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx) != null;
  15525. return wasDetached ? new ViewRef$1(view) : null;
  15526. }
  15527. _adjustIndex(index, shift = 0) {
  15528. if (index == null) {
  15529. return this.length + shift;
  15530. }
  15531. if (ngDevMode) {
  15532. assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`);
  15533. assertLessThan(index, this.length + 1 + shift, "index");
  15534. }
  15535. return index;
  15536. }
  15537. };
  15538. function getViewRefs(lContainer) {
  15539. return lContainer[VIEW_REFS];
  15540. }
  15541. function getOrCreateViewRefs(lContainer) {
  15542. return lContainer[VIEW_REFS] || (lContainer[VIEW_REFS] = []);
  15543. }
  15544. function createContainerRef(hostTNode, hostLView) {
  15545. ngDevMode && assertTNodeType(
  15546. hostTNode,
  15547. 12 | 3
  15548. /* TNodeType.AnyRNode */
  15549. );
  15550. let lContainer;
  15551. const slotValue = hostLView[hostTNode.index];
  15552. if (isLContainer(slotValue)) {
  15553. lContainer = slotValue;
  15554. } else {
  15555. lContainer = createLContainer(slotValue, hostLView, null, hostTNode);
  15556. hostLView[hostTNode.index] = lContainer;
  15557. addToEndOfViewTree(hostLView, lContainer);
  15558. }
  15559. _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue);
  15560. return new R3ViewContainerRef(lContainer, hostTNode, hostLView);
  15561. }
  15562. function insertAnchorNode(hostLView, hostTNode) {
  15563. const renderer = hostLView[RENDERER];
  15564. ngDevMode && ngDevMode.rendererCreateComment++;
  15565. const commentNode = renderer.createComment(ngDevMode ? "container" : "");
  15566. const hostNative = getNativeByTNode(hostTNode, hostLView);
  15567. const parentOfHostNative = renderer.parentNode(hostNative);
  15568. nativeInsertBefore(renderer, parentOfHostNative, commentNode, renderer.nextSibling(hostNative), false);
  15569. return commentNode;
  15570. }
  15571. var _locateOrCreateAnchorNode = createAnchorNode;
  15572. var _populateDehydratedViewsInLContainer = () => false;
  15573. function populateDehydratedViewsInLContainer(lContainer, tNode, hostLView) {
  15574. return _populateDehydratedViewsInLContainer(lContainer, tNode, hostLView);
  15575. }
  15576. function createAnchorNode(lContainer, hostLView, hostTNode, slotValue) {
  15577. if (lContainer[NATIVE]) return;
  15578. let commentNode;
  15579. if (hostTNode.type & 8) {
  15580. commentNode = unwrapRNode(slotValue);
  15581. } else {
  15582. commentNode = insertAnchorNode(hostLView, hostTNode);
  15583. }
  15584. lContainer[NATIVE] = commentNode;
  15585. }
  15586. function populateDehydratedViewsInLContainerImpl(lContainer, tNode, hostLView) {
  15587. if (lContainer[NATIVE] && lContainer[DEHYDRATED_VIEWS]) {
  15588. return true;
  15589. }
  15590. const hydrationInfo = hostLView[HYDRATION];
  15591. const noOffsetIndex = tNode.index - HEADER_OFFSET;
  15592. const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock(tNode) || isDisconnectedNode$1(hydrationInfo, noOffsetIndex);
  15593. if (isNodeCreationMode) {
  15594. return false;
  15595. }
  15596. const currentRNode = getSegmentHead(hydrationInfo, noOffsetIndex);
  15597. const serializedViews = hydrationInfo.data[CONTAINERS]?.[noOffsetIndex];
  15598. ngDevMode && assertDefined(serializedViews, "Unexpected state: no hydration info available for a given TNode, which represents a view container.");
  15599. const [commentNode, dehydratedViews] = locateDehydratedViewsInContainer(currentRNode, serializedViews);
  15600. if (ngDevMode) {
  15601. validateMatchingNode(commentNode, Node.COMMENT_NODE, null, hostLView, tNode, true);
  15602. markRNodeAsClaimedByHydration(commentNode, false);
  15603. }
  15604. lContainer[NATIVE] = commentNode;
  15605. lContainer[DEHYDRATED_VIEWS] = dehydratedViews;
  15606. return true;
  15607. }
  15608. function locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue) {
  15609. if (!_populateDehydratedViewsInLContainer(lContainer, hostTNode, hostLView)) {
  15610. createAnchorNode(lContainer, hostLView, hostTNode, slotValue);
  15611. }
  15612. }
  15613. function enableLocateOrCreateContainerRefImpl() {
  15614. _locateOrCreateAnchorNode = locateOrCreateAnchorNode;
  15615. _populateDehydratedViewsInLContainer = populateDehydratedViewsInLContainerImpl;
  15616. }
  15617. var LQuery_ = class _LQuery_ {
  15618. queryList;
  15619. matches = null;
  15620. constructor(queryList) {
  15621. this.queryList = queryList;
  15622. }
  15623. clone() {
  15624. return new _LQuery_(this.queryList);
  15625. }
  15626. setDirty() {
  15627. this.queryList.setDirty();
  15628. }
  15629. };
  15630. var LQueries_ = class _LQueries_ {
  15631. queries;
  15632. constructor(queries = []) {
  15633. this.queries = queries;
  15634. }
  15635. createEmbeddedView(tView) {
  15636. const tQueries = tView.queries;
  15637. if (tQueries !== null) {
  15638. const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length;
  15639. const viewLQueries = [];
  15640. for (let i = 0; i < noOfInheritedQueries; i++) {
  15641. const tQuery = tQueries.getByIndex(i);
  15642. const parentLQuery = this.queries[tQuery.indexInDeclarationView];
  15643. viewLQueries.push(parentLQuery.clone());
  15644. }
  15645. return new _LQueries_(viewLQueries);
  15646. }
  15647. return null;
  15648. }
  15649. insertView(tView) {
  15650. this.dirtyQueriesWithMatches(tView);
  15651. }
  15652. detachView(tView) {
  15653. this.dirtyQueriesWithMatches(tView);
  15654. }
  15655. finishViewCreation(tView) {
  15656. this.dirtyQueriesWithMatches(tView);
  15657. }
  15658. dirtyQueriesWithMatches(tView) {
  15659. for (let i = 0; i < this.queries.length; i++) {
  15660. if (getTQuery(tView, i).matches !== null) {
  15661. this.queries[i].setDirty();
  15662. }
  15663. }
  15664. }
  15665. };
  15666. var TQueryMetadata_ = class {
  15667. flags;
  15668. read;
  15669. predicate;
  15670. constructor(predicate, flags, read = null) {
  15671. this.flags = flags;
  15672. this.read = read;
  15673. if (typeof predicate === "string") {
  15674. this.predicate = splitQueryMultiSelectors(predicate);
  15675. } else {
  15676. this.predicate = predicate;
  15677. }
  15678. }
  15679. };
  15680. var TQueries_ = class _TQueries_ {
  15681. queries;
  15682. constructor(queries = []) {
  15683. this.queries = queries;
  15684. }
  15685. elementStart(tView, tNode) {
  15686. ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only");
  15687. for (let i = 0; i < this.queries.length; i++) {
  15688. this.queries[i].elementStart(tView, tNode);
  15689. }
  15690. }
  15691. elementEnd(tNode) {
  15692. for (let i = 0; i < this.queries.length; i++) {
  15693. this.queries[i].elementEnd(tNode);
  15694. }
  15695. }
  15696. embeddedTView(tNode) {
  15697. let queriesForTemplateRef = null;
  15698. for (let i = 0; i < this.length; i++) {
  15699. const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0;
  15700. const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex);
  15701. if (tqueryClone) {
  15702. tqueryClone.indexInDeclarationView = i;
  15703. if (queriesForTemplateRef !== null) {
  15704. queriesForTemplateRef.push(tqueryClone);
  15705. } else {
  15706. queriesForTemplateRef = [tqueryClone];
  15707. }
  15708. }
  15709. }
  15710. return queriesForTemplateRef !== null ? new _TQueries_(queriesForTemplateRef) : null;
  15711. }
  15712. template(tView, tNode) {
  15713. ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only");
  15714. for (let i = 0; i < this.queries.length; i++) {
  15715. this.queries[i].template(tView, tNode);
  15716. }
  15717. }
  15718. getByIndex(index) {
  15719. ngDevMode && assertIndexInRange(this.queries, index);
  15720. return this.queries[index];
  15721. }
  15722. get length() {
  15723. return this.queries.length;
  15724. }
  15725. track(tquery) {
  15726. this.queries.push(tquery);
  15727. }
  15728. };
  15729. var TQuery_ = class _TQuery_ {
  15730. metadata;
  15731. matches = null;
  15732. indexInDeclarationView = -1;
  15733. crossesNgTemplate = false;
  15734. /**
  15735. * A node index on which a query was declared (-1 for view queries and ones inherited from the
  15736. * declaration template). We use this index (alongside with _appliesToNextNode flag) to know
  15737. * when to apply content queries to elements in a template.
  15738. */
  15739. _declarationNodeIndex;
  15740. /**
  15741. * A flag indicating if a given query still applies to nodes it is crossing. We use this flag
  15742. * (alongside with _declarationNodeIndex) to know when to stop applying content queries to
  15743. * elements in a template.
  15744. */
  15745. _appliesToNextNode = true;
  15746. constructor(metadata, nodeIndex = -1) {
  15747. this.metadata = metadata;
  15748. this._declarationNodeIndex = nodeIndex;
  15749. }
  15750. elementStart(tView, tNode) {
  15751. if (this.isApplyingToNode(tNode)) {
  15752. this.matchTNode(tView, tNode);
  15753. }
  15754. }
  15755. elementEnd(tNode) {
  15756. if (this._declarationNodeIndex === tNode.index) {
  15757. this._appliesToNextNode = false;
  15758. }
  15759. }
  15760. template(tView, tNode) {
  15761. this.elementStart(tView, tNode);
  15762. }
  15763. embeddedTView(tNode, childQueryIndex) {
  15764. if (this.isApplyingToNode(tNode)) {
  15765. this.crossesNgTemplate = true;
  15766. this.addMatch(-tNode.index, childQueryIndex);
  15767. return new _TQuery_(this.metadata);
  15768. }
  15769. return null;
  15770. }
  15771. isApplyingToNode(tNode) {
  15772. if (this._appliesToNextNode && (this.metadata.flags & 1) !== 1) {
  15773. const declarationNodeIdx = this._declarationNodeIndex;
  15774. let parent = tNode.parent;
  15775. while (parent !== null && parent.type & 8 && parent.index !== declarationNodeIdx) {
  15776. parent = parent.parent;
  15777. }
  15778. return declarationNodeIdx === (parent !== null ? parent.index : -1);
  15779. }
  15780. return this._appliesToNextNode;
  15781. }
  15782. matchTNode(tView, tNode) {
  15783. const predicate = this.metadata.predicate;
  15784. if (Array.isArray(predicate)) {
  15785. for (let i = 0; i < predicate.length; i++) {
  15786. const name = predicate[i];
  15787. this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name));
  15788. this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name, false, false));
  15789. }
  15790. } else {
  15791. if (predicate === TemplateRef) {
  15792. if (tNode.type & 4) {
  15793. this.matchTNodeWithReadOption(tView, tNode, -1);
  15794. }
  15795. } else {
  15796. this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false));
  15797. }
  15798. }
  15799. }
  15800. matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) {
  15801. if (nodeMatchIdx !== null) {
  15802. const read = this.metadata.read;
  15803. if (read !== null) {
  15804. if (read === ElementRef || read === ViewContainerRef || read === TemplateRef && tNode.type & 4) {
  15805. this.addMatch(tNode.index, -2);
  15806. } else {
  15807. const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false);
  15808. if (directiveOrProviderIdx !== null) {
  15809. this.addMatch(tNode.index, directiveOrProviderIdx);
  15810. }
  15811. }
  15812. } else {
  15813. this.addMatch(tNode.index, nodeMatchIdx);
  15814. }
  15815. }
  15816. }
  15817. addMatch(tNodeIdx, matchIdx) {
  15818. if (this.matches === null) {
  15819. this.matches = [tNodeIdx, matchIdx];
  15820. } else {
  15821. this.matches.push(tNodeIdx, matchIdx);
  15822. }
  15823. }
  15824. };
  15825. function getIdxOfMatchingSelector(tNode, selector) {
  15826. const localNames = tNode.localNames;
  15827. if (localNames !== null) {
  15828. for (let i = 0; i < localNames.length; i += 2) {
  15829. if (localNames[i] === selector) {
  15830. return localNames[i + 1];
  15831. }
  15832. }
  15833. }
  15834. return null;
  15835. }
  15836. function createResultByTNodeType(tNode, currentView) {
  15837. if (tNode.type & (3 | 8)) {
  15838. return createElementRef(tNode, currentView);
  15839. } else if (tNode.type & 4) {
  15840. return createTemplateRef(tNode, currentView);
  15841. }
  15842. return null;
  15843. }
  15844. function createResultForNode(lView, tNode, matchingIdx, read) {
  15845. if (matchingIdx === -1) {
  15846. return createResultByTNodeType(tNode, lView);
  15847. } else if (matchingIdx === -2) {
  15848. return createSpecialToken(lView, tNode, read);
  15849. } else {
  15850. return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode);
  15851. }
  15852. }
  15853. function createSpecialToken(lView, tNode, read) {
  15854. if (read === ElementRef) {
  15855. return createElementRef(tNode, lView);
  15856. } else if (read === TemplateRef) {
  15857. return createTemplateRef(tNode, lView);
  15858. } else if (read === ViewContainerRef) {
  15859. ngDevMode && assertTNodeType(
  15860. tNode,
  15861. 3 | 12
  15862. /* TNodeType.AnyContainer */
  15863. );
  15864. return createContainerRef(tNode, lView);
  15865. } else {
  15866. ngDevMode && throwError2(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`);
  15867. }
  15868. }
  15869. function materializeViewResults(tView, lView, tQuery, queryIndex) {
  15870. const lQuery = lView[QUERIES].queries[queryIndex];
  15871. if (lQuery.matches === null) {
  15872. const tViewData = tView.data;
  15873. const tQueryMatches = tQuery.matches;
  15874. const result = [];
  15875. for (let i = 0; tQueryMatches !== null && i < tQueryMatches.length; i += 2) {
  15876. const matchedNodeIdx = tQueryMatches[i];
  15877. if (matchedNodeIdx < 0) {
  15878. result.push(null);
  15879. } else {
  15880. ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx);
  15881. const tNode = tViewData[matchedNodeIdx];
  15882. result.push(createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read));
  15883. }
  15884. }
  15885. lQuery.matches = result;
  15886. }
  15887. return lQuery.matches;
  15888. }
  15889. function collectQueryResults(tView, lView, queryIndex, result) {
  15890. const tQuery = tView.queries.getByIndex(queryIndex);
  15891. const tQueryMatches = tQuery.matches;
  15892. if (tQueryMatches !== null) {
  15893. const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex);
  15894. for (let i = 0; i < tQueryMatches.length; i += 2) {
  15895. const tNodeIdx = tQueryMatches[i];
  15896. if (tNodeIdx > 0) {
  15897. result.push(lViewResults[i / 2]);
  15898. } else {
  15899. const childQueryIndex = tQueryMatches[i + 1];
  15900. const declarationLContainer = lView[-tNodeIdx];
  15901. ngDevMode && assertLContainer(declarationLContainer);
  15902. for (let i2 = CONTAINER_HEADER_OFFSET; i2 < declarationLContainer.length; i2++) {
  15903. const embeddedLView = declarationLContainer[i2];
  15904. if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) {
  15905. collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
  15906. }
  15907. }
  15908. if (declarationLContainer[MOVED_VIEWS] !== null) {
  15909. const embeddedLViews = declarationLContainer[MOVED_VIEWS];
  15910. for (let i2 = 0; i2 < embeddedLViews.length; i2++) {
  15911. const embeddedLView = embeddedLViews[i2];
  15912. collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
  15913. }
  15914. }
  15915. }
  15916. }
  15917. }
  15918. return result;
  15919. }
  15920. function loadQueryInternal(lView, queryIndex) {
  15921. ngDevMode && assertDefined(lView[QUERIES], "LQueries should be defined when trying to load a query");
  15922. ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex);
  15923. return lView[QUERIES].queries[queryIndex].queryList;
  15924. }
  15925. function createLQuery(tView, lView, flags) {
  15926. const queryList = new QueryList(
  15927. (flags & 4) === 4
  15928. /* QueryFlags.emitDistinctChangesOnly */
  15929. );
  15930. storeCleanupWithContext(tView, lView, queryList, queryList.destroy);
  15931. const lQueries = (lView[QUERIES] ??= new LQueries_()).queries;
  15932. return lQueries.push(new LQuery_(queryList)) - 1;
  15933. }
  15934. function createViewQuery(predicate, flags, read) {
  15935. ngDevMode && assertNumber(flags, "Expecting flags");
  15936. const tView = getTView();
  15937. if (tView.firstCreatePass) {
  15938. createTQuery(tView, new TQueryMetadata_(predicate, flags, read), -1);
  15939. if ((flags & 2) === 2) {
  15940. tView.staticViewQueries = true;
  15941. }
  15942. }
  15943. return createLQuery(tView, getLView(), flags);
  15944. }
  15945. function createContentQuery(directiveIndex, predicate, flags, read) {
  15946. ngDevMode && assertNumber(flags, "Expecting flags");
  15947. const tView = getTView();
  15948. if (tView.firstCreatePass) {
  15949. const tNode = getCurrentTNode();
  15950. createTQuery(tView, new TQueryMetadata_(predicate, flags, read), tNode.index);
  15951. saveContentQueryAndDirectiveIndex(tView, directiveIndex);
  15952. if ((flags & 2) === 2) {
  15953. tView.staticContentQueries = true;
  15954. }
  15955. }
  15956. return createLQuery(tView, getLView(), flags);
  15957. }
  15958. function splitQueryMultiSelectors(locator) {
  15959. return locator.split(",").map((s) => s.trim());
  15960. }
  15961. function createTQuery(tView, metadata, nodeIndex) {
  15962. if (tView.queries === null) tView.queries = new TQueries_();
  15963. tView.queries.track(new TQuery_(metadata, nodeIndex));
  15964. }
  15965. function saveContentQueryAndDirectiveIndex(tView, directiveIndex) {
  15966. const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []);
  15967. const lastSavedDirectiveIndex = tViewContentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1;
  15968. if (directiveIndex !== lastSavedDirectiveIndex) {
  15969. tViewContentQueries.push(tView.queries.length - 1, directiveIndex);
  15970. }
  15971. }
  15972. function getTQuery(tView, index) {
  15973. ngDevMode && assertDefined(tView.queries, "TQueries must be defined to retrieve a TQuery");
  15974. return tView.queries.getByIndex(index);
  15975. }
  15976. function getQueryResults(lView, queryIndex) {
  15977. const tView = lView[TVIEW];
  15978. const tQuery = getTQuery(tView, queryIndex);
  15979. return tQuery.crossesNgTemplate ? collectQueryResults(tView, lView, queryIndex, []) : materializeViewResults(tView, lView, tQuery, queryIndex);
  15980. }
  15981. function createQuerySignalFn(firstOnly, required, opts) {
  15982. let node;
  15983. const signalFn = createComputed(() => {
  15984. node._dirtyCounter();
  15985. const value = refreshSignalQuery(node, firstOnly);
  15986. if (required && value === void 0) {
  15987. throw new RuntimeError(-951, ngDevMode && "Child query result is required but no value is available.");
  15988. }
  15989. return value;
  15990. });
  15991. node = signalFn[SIGNAL];
  15992. node._dirtyCounter = signal(0);
  15993. node._flatValue = void 0;
  15994. if (ngDevMode) {
  15995. signalFn.toString = () => `[Query Signal]`;
  15996. node.debugName = opts?.debugName;
  15997. }
  15998. return signalFn;
  15999. }
  16000. function createSingleResultOptionalQuerySignalFn(opts) {
  16001. return createQuerySignalFn(
  16002. /* firstOnly */
  16003. true,
  16004. /* required */
  16005. false,
  16006. opts
  16007. );
  16008. }
  16009. function createSingleResultRequiredQuerySignalFn(opts) {
  16010. return createQuerySignalFn(
  16011. /* firstOnly */
  16012. true,
  16013. /* required */
  16014. true,
  16015. opts
  16016. );
  16017. }
  16018. function createMultiResultQuerySignalFn(opts) {
  16019. return createQuerySignalFn(
  16020. /* firstOnly */
  16021. false,
  16022. /* required */
  16023. false,
  16024. opts
  16025. );
  16026. }
  16027. function bindQueryToSignal(target, queryIndex) {
  16028. const node = target[SIGNAL];
  16029. node._lView = getLView();
  16030. node._queryIndex = queryIndex;
  16031. node._queryList = loadQueryInternal(node._lView, queryIndex);
  16032. node._queryList.onDirty(() => node._dirtyCounter.update((v) => v + 1));
  16033. }
  16034. function refreshSignalQuery(node, firstOnly) {
  16035. const lView = node._lView;
  16036. const queryIndex = node._queryIndex;
  16037. if (lView === void 0 || queryIndex === void 0 || lView[FLAGS] & 4) {
  16038. return firstOnly ? void 0 : EMPTY_ARRAY;
  16039. }
  16040. const queryList = loadQueryInternal(lView, queryIndex);
  16041. const results = getQueryResults(lView, queryIndex);
  16042. queryList.reset(results, unwrapElementRef);
  16043. if (firstOnly) {
  16044. return queryList.first;
  16045. } else {
  16046. const resultChanged = queryList._changesDetected;
  16047. if (resultChanged || node._flatValue === void 0) {
  16048. return node._flatValue = queryList.toArray();
  16049. }
  16050. return node._flatValue;
  16051. }
  16052. }
  16053. function viewChildFn(locator, opts) {
  16054. ngDevMode && assertInInjectionContext(viewChild);
  16055. return createSingleResultOptionalQuerySignalFn(opts);
  16056. }
  16057. function viewChildRequiredFn(locator, opts) {
  16058. ngDevMode && assertInInjectionContext(viewChild);
  16059. return createSingleResultRequiredQuerySignalFn(opts);
  16060. }
  16061. var viewChild = (() => {
  16062. viewChildFn.required = viewChildRequiredFn;
  16063. return viewChildFn;
  16064. })();
  16065. function viewChildren(locator, opts) {
  16066. ngDevMode && assertInInjectionContext(viewChildren);
  16067. return createMultiResultQuerySignalFn(opts);
  16068. }
  16069. function contentChildFn(locator, opts) {
  16070. ngDevMode && assertInInjectionContext(contentChild);
  16071. return createSingleResultOptionalQuerySignalFn(opts);
  16072. }
  16073. function contentChildRequiredFn(locator, opts) {
  16074. ngDevMode && assertInInjectionContext(contentChildren);
  16075. return createSingleResultRequiredQuerySignalFn(opts);
  16076. }
  16077. var contentChild = (() => {
  16078. contentChildFn.required = contentChildRequiredFn;
  16079. return contentChildFn;
  16080. })();
  16081. function contentChildren(locator, opts) {
  16082. return createMultiResultQuerySignalFn(opts);
  16083. }
  16084. function createModelSignal(initialValue, opts) {
  16085. const node = Object.create(INPUT_SIGNAL_NODE);
  16086. const emitterRef = new OutputEmitterRef();
  16087. node.value = initialValue;
  16088. function getter() {
  16089. producerAccessed(node);
  16090. assertModelSet(node.value);
  16091. return node.value;
  16092. }
  16093. getter[SIGNAL] = node;
  16094. getter.asReadonly = signalAsReadonlyFn.bind(getter);
  16095. getter.set = (newValue) => {
  16096. if (!node.equal(node.value, newValue)) {
  16097. signalSetFn(node, newValue);
  16098. emitterRef.emit(newValue);
  16099. }
  16100. };
  16101. getter.update = (updateFn) => {
  16102. assertModelSet(node.value);
  16103. getter.set(updateFn(node.value));
  16104. };
  16105. getter.subscribe = emitterRef.subscribe.bind(emitterRef);
  16106. getter.destroyRef = emitterRef.destroyRef;
  16107. if (ngDevMode) {
  16108. getter.toString = () => `[Model Signal: ${getter()}]`;
  16109. node.debugName = opts?.debugName;
  16110. }
  16111. return getter;
  16112. }
  16113. function assertModelSet(value) {
  16114. if (value === REQUIRED_UNSET_VALUE) {
  16115. throw new RuntimeError(952, ngDevMode && "Model is required but no value is available yet.");
  16116. }
  16117. }
  16118. function modelFunction(initialValue, opts) {
  16119. ngDevMode && assertInInjectionContext(model);
  16120. return createModelSignal(initialValue, opts);
  16121. }
  16122. function modelRequiredFunction(opts) {
  16123. ngDevMode && assertInInjectionContext(model);
  16124. return createModelSignal(REQUIRED_UNSET_VALUE, opts);
  16125. }
  16126. var model = (() => {
  16127. modelFunction.required = modelRequiredFunction;
  16128. return modelFunction;
  16129. })();
  16130. var emitDistinctChangesOnlyDefaultValue = true;
  16131. var Query = class {
  16132. };
  16133. var ContentChildren = makePropDecorator("ContentChildren", (selector, opts = {}) => __spreadValues({
  16134. selector,
  16135. first: false,
  16136. isViewQuery: false,
  16137. descendants: false,
  16138. emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue
  16139. }, opts), Query);
  16140. var ContentChild = makePropDecorator("ContentChild", (selector, opts = {}) => __spreadValues({
  16141. selector,
  16142. first: true,
  16143. isViewQuery: false,
  16144. descendants: true
  16145. }, opts), Query);
  16146. var ViewChildren = makePropDecorator("ViewChildren", (selector, opts = {}) => __spreadValues({
  16147. selector,
  16148. first: false,
  16149. isViewQuery: true,
  16150. descendants: true,
  16151. emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue
  16152. }, opts), Query);
  16153. var ViewChild = makePropDecorator("ViewChild", (selector, opts) => __spreadValues({
  16154. selector,
  16155. first: true,
  16156. isViewQuery: true,
  16157. descendants: true
  16158. }, opts), Query);
  16159. function resolveComponentResources(resourceResolver) {
  16160. const componentResolved = [];
  16161. const urlMap = /* @__PURE__ */ new Map();
  16162. function cachedResourceResolve(url) {
  16163. let promise = urlMap.get(url);
  16164. if (!promise) {
  16165. const resp = resourceResolver(url);
  16166. urlMap.set(url, promise = resp.then(unwrapResponse));
  16167. }
  16168. return promise;
  16169. }
  16170. componentResourceResolutionQueue.forEach((component, type) => {
  16171. const promises = [];
  16172. if (component.templateUrl) {
  16173. promises.push(cachedResourceResolve(component.templateUrl).then((template) => {
  16174. component.template = template;
  16175. }));
  16176. }
  16177. const styles = typeof component.styles === "string" ? [component.styles] : component.styles || [];
  16178. component.styles = styles;
  16179. if (component.styleUrl && component.styleUrls?.length) {
  16180. throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple");
  16181. } else if (component.styleUrls?.length) {
  16182. const styleOffset = component.styles.length;
  16183. const styleUrls = component.styleUrls;
  16184. component.styleUrls.forEach((styleUrl, index) => {
  16185. styles.push("");
  16186. promises.push(cachedResourceResolve(styleUrl).then((style) => {
  16187. styles[styleOffset + index] = style;
  16188. styleUrls.splice(styleUrls.indexOf(styleUrl), 1);
  16189. if (styleUrls.length == 0) {
  16190. component.styleUrls = void 0;
  16191. }
  16192. }));
  16193. });
  16194. } else if (component.styleUrl) {
  16195. promises.push(cachedResourceResolve(component.styleUrl).then((style) => {
  16196. styles.push(style);
  16197. component.styleUrl = void 0;
  16198. }));
  16199. }
  16200. const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type));
  16201. componentResolved.push(fullyResolved);
  16202. });
  16203. clearResolutionOfComponentResourcesQueue();
  16204. return Promise.all(componentResolved).then(() => void 0);
  16205. }
  16206. var componentResourceResolutionQueue = /* @__PURE__ */ new Map();
  16207. var componentDefPendingResolution = /* @__PURE__ */ new Set();
  16208. function maybeQueueResolutionOfComponentResources(type, metadata) {
  16209. if (componentNeedsResolution(metadata)) {
  16210. componentResourceResolutionQueue.set(type, metadata);
  16211. componentDefPendingResolution.add(type);
  16212. }
  16213. }
  16214. function isComponentDefPendingResolution(type) {
  16215. return componentDefPendingResolution.has(type);
  16216. }
  16217. function componentNeedsResolution(component) {
  16218. return !!(component.templateUrl && !component.hasOwnProperty("template") || component.styleUrls && component.styleUrls.length || component.styleUrl);
  16219. }
  16220. function clearResolutionOfComponentResourcesQueue() {
  16221. const old = componentResourceResolutionQueue;
  16222. componentResourceResolutionQueue = /* @__PURE__ */ new Map();
  16223. return old;
  16224. }
  16225. function restoreComponentResolutionQueue(queue2) {
  16226. componentDefPendingResolution.clear();
  16227. queue2.forEach((_, type) => componentDefPendingResolution.add(type));
  16228. componentResourceResolutionQueue = queue2;
  16229. }
  16230. function isComponentResourceResolutionQueueEmpty() {
  16231. return componentResourceResolutionQueue.size === 0;
  16232. }
  16233. function unwrapResponse(response) {
  16234. return typeof response == "string" ? response : response.text();
  16235. }
  16236. function componentDefResolved(type) {
  16237. componentDefPendingResolution.delete(type);
  16238. }
  16239. var modules = /* @__PURE__ */ new Map();
  16240. var checkForDuplicateNgModules = true;
  16241. function assertSameOrNotExisting(id, type, incoming) {
  16242. if (type && type !== incoming && checkForDuplicateNgModules) {
  16243. throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`);
  16244. }
  16245. }
  16246. function registerNgModuleType(ngModuleType, id) {
  16247. const existing = modules.get(id) || null;
  16248. assertSameOrNotExisting(id, existing, ngModuleType);
  16249. modules.set(id, ngModuleType);
  16250. }
  16251. function getRegisteredNgModuleType(id) {
  16252. return modules.get(id);
  16253. }
  16254. function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
  16255. checkForDuplicateNgModules = !allowDuplicates;
  16256. }
  16257. function ɵɵvalidateIframeAttribute(attrValue, tagName, attrName) {
  16258. const lView = getLView();
  16259. const tNode = getSelectedTNode();
  16260. const element = getNativeByTNode(tNode, lView);
  16261. if (tNode.type === 2 && tagName.toLowerCase() === "iframe") {
  16262. const iframe = element;
  16263. iframe.src = "";
  16264. iframe.srcdoc = trustedHTMLFromString("");
  16265. nativeRemoveNode(lView[RENDERER], iframe);
  16266. const errorMessage = ngDevMode && `Angular has detected that the \`${attrName}\` was applied as a binding to an <iframe>${getTemplateLocationDetails(lView)}. For security reasons, the \`${attrName}\` can be set on an <iframe> as a static attribute only.
  16267. To fix this, switch the \`${attrName}\` binding to a static attribute in a template or in host bindings section.`;
  16268. throw new RuntimeError(-910, errorMessage);
  16269. }
  16270. return attrValue;
  16271. }
  16272. var NgModuleRef$1 = class NgModuleRef {
  16273. };
  16274. var NgModuleFactory$1 = class NgModuleFactory {
  16275. };
  16276. function createNgModule(ngModule, parentInjector) {
  16277. return new NgModuleRef2(ngModule, parentInjector ?? null, []);
  16278. }
  16279. var createNgModuleRef = createNgModule;
  16280. var NgModuleRef2 = class extends NgModuleRef$1 {
  16281. ngModuleType;
  16282. _parent;
  16283. // tslint:disable-next-line:require-internal-with-underscore
  16284. _bootstrapComponents = [];
  16285. _r3Injector;
  16286. instance;
  16287. destroyCbs = [];
  16288. // When bootstrapping a module we have a dependency graph that looks like this:
  16289. // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
  16290. // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
  16291. // circular dependency which will result in a runtime error, because the injector doesn't
  16292. // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
  16293. // and providing it, rather than letting the injector resolve it.
  16294. componentFactoryResolver = new ComponentFactoryResolver2(this);
  16295. constructor(ngModuleType, _parent, additionalProviders, runInjectorInitializers = true) {
  16296. super();
  16297. this.ngModuleType = ngModuleType;
  16298. this._parent = _parent;
  16299. const ngModuleDef = getNgModuleDef(ngModuleType);
  16300. ngDevMode && assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
  16301. this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
  16302. this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [{
  16303. provide: NgModuleRef$1,
  16304. useValue: this
  16305. }, {
  16306. provide: ComponentFactoryResolver$1,
  16307. useValue: this.componentFactoryResolver
  16308. }, ...additionalProviders], stringify(ngModuleType), /* @__PURE__ */ new Set(["environment"]));
  16309. if (runInjectorInitializers) {
  16310. this.resolveInjectorInitializers();
  16311. }
  16312. }
  16313. resolveInjectorInitializers() {
  16314. this._r3Injector.resolveInjectorInitializers();
  16315. this.instance = this._r3Injector.get(this.ngModuleType);
  16316. }
  16317. get injector() {
  16318. return this._r3Injector;
  16319. }
  16320. destroy() {
  16321. ngDevMode && assertDefined(this.destroyCbs, "NgModule already destroyed");
  16322. const injector = this._r3Injector;
  16323. !injector.destroyed && injector.destroy();
  16324. this.destroyCbs.forEach((fn) => fn());
  16325. this.destroyCbs = null;
  16326. }
  16327. onDestroy(callback) {
  16328. ngDevMode && assertDefined(this.destroyCbs, "NgModule already destroyed");
  16329. this.destroyCbs.push(callback);
  16330. }
  16331. };
  16332. var NgModuleFactory2 = class extends NgModuleFactory$1 {
  16333. moduleType;
  16334. constructor(moduleType) {
  16335. super();
  16336. this.moduleType = moduleType;
  16337. }
  16338. create(parentInjector) {
  16339. return new NgModuleRef2(this.moduleType, parentInjector, []);
  16340. }
  16341. };
  16342. function createNgModuleRefWithProviders(moduleType, parentInjector, additionalProviders) {
  16343. return new NgModuleRef2(moduleType, parentInjector, additionalProviders, false);
  16344. }
  16345. var EnvironmentNgModuleRefAdapter = class extends NgModuleRef$1 {
  16346. injector;
  16347. componentFactoryResolver = new ComponentFactoryResolver2(this);
  16348. instance = null;
  16349. constructor(config2) {
  16350. super();
  16351. const injector = new R3Injector([...config2.providers, {
  16352. provide: NgModuleRef$1,
  16353. useValue: this
  16354. }, {
  16355. provide: ComponentFactoryResolver$1,
  16356. useValue: this.componentFactoryResolver
  16357. }], config2.parent || getNullInjector(), config2.debugName, /* @__PURE__ */ new Set(["environment"]));
  16358. this.injector = injector;
  16359. if (config2.runEnvironmentInitializers) {
  16360. injector.resolveInjectorInitializers();
  16361. }
  16362. }
  16363. destroy() {
  16364. this.injector.destroy();
  16365. }
  16366. onDestroy(callback) {
  16367. this.injector.onDestroy(callback);
  16368. }
  16369. };
  16370. function createEnvironmentInjector(providers, parent, debugName = null) {
  16371. const adapter = new EnvironmentNgModuleRefAdapter({
  16372. providers,
  16373. parent,
  16374. debugName,
  16375. runEnvironmentInitializers: true
  16376. });
  16377. return adapter.injector;
  16378. }
  16379. var StandaloneService = class _StandaloneService {
  16380. _injector;
  16381. cachedInjectors = /* @__PURE__ */ new Map();
  16382. constructor(_injector) {
  16383. this._injector = _injector;
  16384. }
  16385. getOrCreateStandaloneInjector(componentDef) {
  16386. if (!componentDef.standalone) {
  16387. return null;
  16388. }
  16389. if (!this.cachedInjectors.has(componentDef)) {
  16390. const providers = internalImportProvidersFrom(false, componentDef.type);
  16391. const standaloneInjector = providers.length > 0 ? createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) : null;
  16392. this.cachedInjectors.set(componentDef, standaloneInjector);
  16393. }
  16394. return this.cachedInjectors.get(componentDef);
  16395. }
  16396. ngOnDestroy() {
  16397. try {
  16398. for (const injector of this.cachedInjectors.values()) {
  16399. if (injector !== null) {
  16400. injector.destroy();
  16401. }
  16402. }
  16403. } finally {
  16404. this.cachedInjectors.clear();
  16405. }
  16406. }
  16407. /** @nocollapse */
  16408. static ɵprov = (
  16409. /** @pureOrBreakMyCode */
  16410. ɵɵdefineInjectable({
  16411. token: _StandaloneService,
  16412. providedIn: "environment",
  16413. factory: () => new _StandaloneService(ɵɵinject(EnvironmentInjector))
  16414. })
  16415. );
  16416. };
  16417. function ɵɵdefineComponent(componentDefinition) {
  16418. return noSideEffects(() => {
  16419. (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode();
  16420. const baseDef = getNgDirectiveDef(componentDefinition);
  16421. const def = __spreadProps(__spreadValues({}, baseDef), {
  16422. decls: componentDefinition.decls,
  16423. vars: componentDefinition.vars,
  16424. template: componentDefinition.template,
  16425. consts: componentDefinition.consts || null,
  16426. ngContentSelectors: componentDefinition.ngContentSelectors,
  16427. onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
  16428. directiveDefs: null,
  16429. // assigned in noSideEffects
  16430. pipeDefs: null,
  16431. // assigned in noSideEffects
  16432. dependencies: baseDef.standalone && componentDefinition.dependencies || null,
  16433. getStandaloneInjector: baseDef.standalone ? (parentInjector) => {
  16434. return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(def);
  16435. } : null,
  16436. getExternalStyles: null,
  16437. signals: componentDefinition.signals ?? false,
  16438. data: componentDefinition.data || {},
  16439. encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
  16440. styles: componentDefinition.styles || EMPTY_ARRAY,
  16441. _: null,
  16442. schemas: componentDefinition.schemas || null,
  16443. tView: null,
  16444. id: ""
  16445. });
  16446. if (baseDef.standalone) {
  16447. performanceMarkFeature("NgStandalone");
  16448. }
  16449. initFeatures(def);
  16450. const dependencies = componentDefinition.dependencies;
  16451. def.directiveDefs = extractDefListOrFactory(
  16452. dependencies,
  16453. /* pipeDef */
  16454. false
  16455. );
  16456. def.pipeDefs = extractDefListOrFactory(
  16457. dependencies,
  16458. /* pipeDef */
  16459. true
  16460. );
  16461. def.id = getComponentId(def);
  16462. return def;
  16463. });
  16464. }
  16465. function extractDirectiveDef(type) {
  16466. return getComponentDef(type) || getDirectiveDef(type);
  16467. }
  16468. function nonNull(value) {
  16469. return value !== null;
  16470. }
  16471. function ɵɵdefineNgModule(def) {
  16472. return noSideEffects(() => {
  16473. const res = {
  16474. type: def.type,
  16475. bootstrap: def.bootstrap || EMPTY_ARRAY,
  16476. declarations: def.declarations || EMPTY_ARRAY,
  16477. imports: def.imports || EMPTY_ARRAY,
  16478. exports: def.exports || EMPTY_ARRAY,
  16479. transitiveCompileScopes: null,
  16480. schemas: def.schemas || null,
  16481. id: def.id || null
  16482. };
  16483. return res;
  16484. });
  16485. }
  16486. function parseAndConvertInputsForDefinition(obj, declaredInputs) {
  16487. if (obj == null) return EMPTY_OBJ;
  16488. const newLookup = {};
  16489. for (const minifiedKey in obj) {
  16490. if (obj.hasOwnProperty(minifiedKey)) {
  16491. const value = obj[minifiedKey];
  16492. let publicName;
  16493. let declaredName;
  16494. let inputFlags;
  16495. let transform;
  16496. if (Array.isArray(value)) {
  16497. inputFlags = value[0];
  16498. publicName = value[1];
  16499. declaredName = value[2] ?? publicName;
  16500. transform = value[3] || null;
  16501. } else {
  16502. publicName = value;
  16503. declaredName = value;
  16504. inputFlags = InputFlags.None;
  16505. transform = null;
  16506. }
  16507. newLookup[publicName] = [minifiedKey, inputFlags, transform];
  16508. declaredInputs[publicName] = declaredName;
  16509. }
  16510. }
  16511. return newLookup;
  16512. }
  16513. function parseAndConvertOutputsForDefinition(obj) {
  16514. if (obj == null) return EMPTY_OBJ;
  16515. const newLookup = {};
  16516. for (const minifiedKey in obj) {
  16517. if (obj.hasOwnProperty(minifiedKey)) {
  16518. newLookup[obj[minifiedKey]] = minifiedKey;
  16519. }
  16520. }
  16521. return newLookup;
  16522. }
  16523. function ɵɵdefineDirective(directiveDefinition) {
  16524. return noSideEffects(() => {
  16525. const def = getNgDirectiveDef(directiveDefinition);
  16526. initFeatures(def);
  16527. return def;
  16528. });
  16529. }
  16530. function ɵɵdefinePipe(pipeDef) {
  16531. return {
  16532. type: pipeDef.type,
  16533. name: pipeDef.name,
  16534. factory: null,
  16535. pure: pipeDef.pure !== false,
  16536. standalone: pipeDef.standalone ?? true,
  16537. onDestroy: pipeDef.type.prototype.ngOnDestroy || null
  16538. };
  16539. }
  16540. function getNgDirectiveDef(directiveDefinition) {
  16541. const declaredInputs = {};
  16542. return {
  16543. type: directiveDefinition.type,
  16544. providersResolver: null,
  16545. factory: null,
  16546. hostBindings: directiveDefinition.hostBindings || null,
  16547. hostVars: directiveDefinition.hostVars || 0,
  16548. hostAttrs: directiveDefinition.hostAttrs || null,
  16549. contentQueries: directiveDefinition.contentQueries || null,
  16550. declaredInputs,
  16551. inputConfig: directiveDefinition.inputs || EMPTY_OBJ,
  16552. exportAs: directiveDefinition.exportAs || null,
  16553. standalone: directiveDefinition.standalone ?? true,
  16554. signals: directiveDefinition.signals === true,
  16555. selectors: directiveDefinition.selectors || EMPTY_ARRAY,
  16556. viewQuery: directiveDefinition.viewQuery || null,
  16557. features: directiveDefinition.features || null,
  16558. setInput: null,
  16559. findHostDirectiveDefs: null,
  16560. hostDirectives: null,
  16561. inputs: parseAndConvertInputsForDefinition(directiveDefinition.inputs, declaredInputs),
  16562. outputs: parseAndConvertOutputsForDefinition(directiveDefinition.outputs),
  16563. debugInfo: null
  16564. };
  16565. }
  16566. function initFeatures(definition) {
  16567. definition.features?.forEach((fn) => fn(definition));
  16568. }
  16569. function extractDefListOrFactory(dependencies, pipeDef) {
  16570. if (!dependencies) {
  16571. return null;
  16572. }
  16573. const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;
  16574. return () => (typeof dependencies === "function" ? dependencies() : dependencies).map((dep) => defExtractor(dep)).filter(nonNull);
  16575. }
  16576. var GENERATED_COMP_IDS = /* @__PURE__ */ new Map();
  16577. function getComponentId(componentDef) {
  16578. let hash = 0;
  16579. const componentDefConsts = typeof componentDef.consts === "function" ? "" : componentDef.consts;
  16580. const hashSelectors = [
  16581. componentDef.selectors,
  16582. componentDef.ngContentSelectors,
  16583. componentDef.hostVars,
  16584. componentDef.hostAttrs,
  16585. componentDefConsts,
  16586. componentDef.vars,
  16587. componentDef.decls,
  16588. componentDef.encapsulation,
  16589. componentDef.standalone,
  16590. componentDef.signals,
  16591. componentDef.exportAs,
  16592. JSON.stringify(componentDef.inputs),
  16593. JSON.stringify(componentDef.outputs),
  16594. // We cannot use 'componentDef.type.name' as the name of the symbol will change and will not
  16595. // match in the server and browser bundles.
  16596. Object.getOwnPropertyNames(componentDef.type.prototype),
  16597. !!componentDef.contentQueries,
  16598. !!componentDef.viewQuery
  16599. ];
  16600. if (typeof ngDevMode === "undefined" || ngDevMode) {
  16601. for (const item of hashSelectors) {
  16602. assertNotEqual(typeof item, "function", "Internal error: attempting to use a function in component id computation logic.");
  16603. }
  16604. }
  16605. for (const char of hashSelectors.join("|")) {
  16606. hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
  16607. }
  16608. hash += 2147483647 + 1;
  16609. const compId = "c" + hash;
  16610. if ((typeof ngDevMode === "undefined" || ngDevMode) && true) {
  16611. if (GENERATED_COMP_IDS.has(compId)) {
  16612. const previousCompDefType = GENERATED_COMP_IDS.get(compId);
  16613. if (previousCompDefType !== componentDef.type) {
  16614. console.warn(formatRuntimeError(-912, `Component ID generation collision detected. Components '${previousCompDefType.name}' and '${componentDef.type.name}' with selector '${stringifyCSSSelectorList(componentDef.selectors)}' generated the same component ID. To fix this, you can change the selector of one of those components or add an extra host attribute to force a different ID.`));
  16615. }
  16616. } else {
  16617. GENERATED_COMP_IDS.set(compId, componentDef.type);
  16618. }
  16619. }
  16620. return compId;
  16621. }
  16622. function getSuperType(type) {
  16623. return Object.getPrototypeOf(type.prototype).constructor;
  16624. }
  16625. function ɵɵInheritDefinitionFeature(definition) {
  16626. let superType = getSuperType(definition.type);
  16627. let shouldInheritFields = true;
  16628. const inheritanceChain = [definition];
  16629. while (superType) {
  16630. let superDef = void 0;
  16631. if (isComponentDef(definition)) {
  16632. superDef = superType.ɵcmp || superType.ɵdir;
  16633. } else {
  16634. if (superType.ɵcmp) {
  16635. throw new RuntimeError(903, ngDevMode && `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
  16636. }
  16637. superDef = superType.ɵdir;
  16638. }
  16639. if (superDef) {
  16640. if (shouldInheritFields) {
  16641. inheritanceChain.push(superDef);
  16642. const writeableDef = definition;
  16643. writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
  16644. writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
  16645. writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
  16646. const superHostBindings = superDef.hostBindings;
  16647. superHostBindings && inheritHostBindings(definition, superHostBindings);
  16648. const superViewQuery = superDef.viewQuery;
  16649. const superContentQueries = superDef.contentQueries;
  16650. superViewQuery && inheritViewQuery(definition, superViewQuery);
  16651. superContentQueries && inheritContentQueries(definition, superContentQueries);
  16652. mergeInputsWithTransforms(definition, superDef);
  16653. fillProperties(definition.outputs, superDef.outputs);
  16654. if (isComponentDef(superDef) && superDef.data.animation) {
  16655. const defData = definition.data;
  16656. defData.animation = (defData.animation || []).concat(superDef.data.animation);
  16657. }
  16658. }
  16659. const features = superDef.features;
  16660. if (features) {
  16661. for (let i = 0; i < features.length; i++) {
  16662. const feature = features[i];
  16663. if (feature && feature.ngInherit) {
  16664. feature(definition);
  16665. }
  16666. if (feature === ɵɵInheritDefinitionFeature) {
  16667. shouldInheritFields = false;
  16668. }
  16669. }
  16670. }
  16671. }
  16672. superType = Object.getPrototypeOf(superType);
  16673. }
  16674. mergeHostAttrsAcrossInheritance(inheritanceChain);
  16675. }
  16676. function mergeInputsWithTransforms(target, source) {
  16677. for (const key in source.inputs) {
  16678. if (!source.inputs.hasOwnProperty(key)) {
  16679. continue;
  16680. }
  16681. if (target.inputs.hasOwnProperty(key)) {
  16682. continue;
  16683. }
  16684. const value = source.inputs[key];
  16685. if (value !== void 0) {
  16686. target.inputs[key] = value;
  16687. target.declaredInputs[key] = source.declaredInputs[key];
  16688. }
  16689. }
  16690. }
  16691. function mergeHostAttrsAcrossInheritance(inheritanceChain) {
  16692. let hostVars = 0;
  16693. let hostAttrs = null;
  16694. for (let i = inheritanceChain.length - 1; i >= 0; i--) {
  16695. const def = inheritanceChain[i];
  16696. def.hostVars = hostVars += def.hostVars;
  16697. def.hostAttrs = mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
  16698. }
  16699. }
  16700. function maybeUnwrapEmpty(value) {
  16701. if (value === EMPTY_OBJ) {
  16702. return {};
  16703. } else if (value === EMPTY_ARRAY) {
  16704. return [];
  16705. } else {
  16706. return value;
  16707. }
  16708. }
  16709. function inheritViewQuery(definition, superViewQuery) {
  16710. const prevViewQuery = definition.viewQuery;
  16711. if (prevViewQuery) {
  16712. definition.viewQuery = (rf, ctx) => {
  16713. superViewQuery(rf, ctx);
  16714. prevViewQuery(rf, ctx);
  16715. };
  16716. } else {
  16717. definition.viewQuery = superViewQuery;
  16718. }
  16719. }
  16720. function inheritContentQueries(definition, superContentQueries) {
  16721. const prevContentQueries = definition.contentQueries;
  16722. if (prevContentQueries) {
  16723. definition.contentQueries = (rf, ctx, directiveIndex) => {
  16724. superContentQueries(rf, ctx, directiveIndex);
  16725. prevContentQueries(rf, ctx, directiveIndex);
  16726. };
  16727. } else {
  16728. definition.contentQueries = superContentQueries;
  16729. }
  16730. }
  16731. function inheritHostBindings(definition, superHostBindings) {
  16732. const prevHostBindings = definition.hostBindings;
  16733. if (prevHostBindings) {
  16734. definition.hostBindings = (rf, ctx) => {
  16735. superHostBindings(rf, ctx);
  16736. prevHostBindings(rf, ctx);
  16737. };
  16738. } else {
  16739. definition.hostBindings = superHostBindings;
  16740. }
  16741. }
  16742. var COPY_DIRECTIVE_FIELDS = [
  16743. // The child class should use the providers of its parent.
  16744. "providersResolver"
  16745. // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
  16746. // as inputs, outputs, and host binding functions.
  16747. ];
  16748. var COPY_COMPONENT_FIELDS = [
  16749. // The child class should use the template function of its parent, including all template
  16750. // semantics.
  16751. "template",
  16752. "decls",
  16753. "consts",
  16754. "vars",
  16755. "onPush",
  16756. "ngContentSelectors",
  16757. // The child class should use the CSS styles of its parent, including all styling semantics.
  16758. "styles",
  16759. "encapsulation",
  16760. // The child class should be checked by the runtime in the same way as its parent.
  16761. "schemas"
  16762. ];
  16763. function ɵɵCopyDefinitionFeature(definition) {
  16764. let superType = getSuperType(definition.type);
  16765. let superDef = void 0;
  16766. if (isComponentDef(definition)) {
  16767. superDef = superType.ɵcmp;
  16768. } else {
  16769. superDef = superType.ɵdir;
  16770. }
  16771. const defAny = definition;
  16772. for (const field of COPY_DIRECTIVE_FIELDS) {
  16773. defAny[field] = superDef[field];
  16774. }
  16775. if (isComponentDef(superDef)) {
  16776. for (const field of COPY_COMPONENT_FIELDS) {
  16777. defAny[field] = superDef[field];
  16778. }
  16779. }
  16780. }
  16781. function ɵɵHostDirectivesFeature(rawHostDirectives) {
  16782. const feature = (definition) => {
  16783. const isEager = Array.isArray(rawHostDirectives);
  16784. if (definition.hostDirectives === null) {
  16785. definition.findHostDirectiveDefs = findHostDirectiveDefs;
  16786. definition.hostDirectives = isEager ? rawHostDirectives.map(createHostDirectiveDef) : [rawHostDirectives];
  16787. } else if (isEager) {
  16788. definition.hostDirectives.unshift(...rawHostDirectives.map(createHostDirectiveDef));
  16789. } else {
  16790. definition.hostDirectives.unshift(rawHostDirectives);
  16791. }
  16792. };
  16793. feature.ngInherit = true;
  16794. return feature;
  16795. }
  16796. function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs) {
  16797. if (currentDef.hostDirectives !== null) {
  16798. for (const configOrFn of currentDef.hostDirectives) {
  16799. if (typeof configOrFn === "function") {
  16800. const resolved2 = configOrFn();
  16801. for (const config2 of resolved2) {
  16802. trackHostDirectiveDef(createHostDirectiveDef(config2), matchedDefs, hostDirectiveDefs);
  16803. }
  16804. } else {
  16805. trackHostDirectiveDef(configOrFn, matchedDefs, hostDirectiveDefs);
  16806. }
  16807. }
  16808. }
  16809. }
  16810. function trackHostDirectiveDef(def, matchedDefs, hostDirectiveDefs) {
  16811. const hostDirectiveDef = getDirectiveDef(def.directive);
  16812. if (typeof ngDevMode === "undefined" || ngDevMode) {
  16813. validateHostDirective(def, hostDirectiveDef);
  16814. }
  16815. patchDeclaredInputs(hostDirectiveDef.declaredInputs, def.inputs);
  16816. findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
  16817. hostDirectiveDefs.set(hostDirectiveDef, def);
  16818. matchedDefs.push(hostDirectiveDef);
  16819. }
  16820. function createHostDirectiveDef(config2) {
  16821. return typeof config2 === "function" ? {
  16822. directive: resolveForwardRef(config2),
  16823. inputs: EMPTY_OBJ,
  16824. outputs: EMPTY_OBJ
  16825. } : {
  16826. directive: resolveForwardRef(config2.directive),
  16827. inputs: bindingArrayToMap(config2.inputs),
  16828. outputs: bindingArrayToMap(config2.outputs)
  16829. };
  16830. }
  16831. function bindingArrayToMap(bindings) {
  16832. if (bindings === void 0 || bindings.length === 0) {
  16833. return EMPTY_OBJ;
  16834. }
  16835. const result = {};
  16836. for (let i = 0; i < bindings.length; i += 2) {
  16837. result[bindings[i]] = bindings[i + 1];
  16838. }
  16839. return result;
  16840. }
  16841. function patchDeclaredInputs(declaredInputs, exposedInputs) {
  16842. for (const publicName in exposedInputs) {
  16843. if (exposedInputs.hasOwnProperty(publicName)) {
  16844. const remappedPublicName = exposedInputs[publicName];
  16845. const privateName = declaredInputs[publicName];
  16846. if ((typeof ngDevMode === "undefined" || ngDevMode) && declaredInputs.hasOwnProperty(remappedPublicName)) {
  16847. assertEqual(declaredInputs[remappedPublicName], declaredInputs[publicName], `Conflicting host directive input alias ${publicName}.`);
  16848. }
  16849. declaredInputs[remappedPublicName] = privateName;
  16850. }
  16851. }
  16852. }
  16853. function validateHostDirective(hostDirectiveConfig, directiveDef) {
  16854. const type = hostDirectiveConfig.directive;
  16855. if (directiveDef === null) {
  16856. if (getComponentDef(type) !== null) {
  16857. throw new RuntimeError(310, `Host directive ${type.name} cannot be a component.`);
  16858. }
  16859. throw new RuntimeError(307, `Could not resolve metadata for host directive ${type.name}. Make sure that the ${type.name} class is annotated with an @Directive decorator.`);
  16860. }
  16861. if (!directiveDef.standalone) {
  16862. throw new RuntimeError(308, `Host directive ${directiveDef.type.name} must be standalone.`);
  16863. }
  16864. validateMappings("input", directiveDef, hostDirectiveConfig.inputs);
  16865. validateMappings("output", directiveDef, hostDirectiveConfig.outputs);
  16866. }
  16867. function validateMappings(bindingType, def, hostDirectiveBindings) {
  16868. const className = def.type.name;
  16869. const bindings = bindingType === "input" ? def.inputs : def.outputs;
  16870. for (const publicName in hostDirectiveBindings) {
  16871. if (hostDirectiveBindings.hasOwnProperty(publicName)) {
  16872. if (!bindings.hasOwnProperty(publicName)) {
  16873. throw new RuntimeError(311, `Directive ${className} does not have an ${bindingType} with a public name of ${publicName}.`);
  16874. }
  16875. const remappedPublicName = hostDirectiveBindings[publicName];
  16876. if (bindings.hasOwnProperty(remappedPublicName) && remappedPublicName !== publicName) {
  16877. throw new RuntimeError(312, `Cannot alias ${bindingType} ${publicName} of host directive ${className} to ${remappedPublicName}, because it already has a different ${bindingType} with the same public name.`);
  16878. }
  16879. }
  16880. }
  16881. }
  16882. function isListLikeIterable(obj) {
  16883. if (!isJsObject(obj)) return false;
  16884. return Array.isArray(obj) || !(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
  16885. Symbol.iterator in obj;
  16886. }
  16887. function areIterablesEqual(a, b, comparator) {
  16888. const iterator1 = a[Symbol.iterator]();
  16889. const iterator2 = b[Symbol.iterator]();
  16890. while (true) {
  16891. const item1 = iterator1.next();
  16892. const item2 = iterator2.next();
  16893. if (item1.done && item2.done) return true;
  16894. if (item1.done || item2.done) return false;
  16895. if (!comparator(item1.value, item2.value)) return false;
  16896. }
  16897. }
  16898. function iterateListLike(obj, fn) {
  16899. if (Array.isArray(obj)) {
  16900. for (let i = 0; i < obj.length; i++) {
  16901. fn(obj[i]);
  16902. }
  16903. } else {
  16904. const iterator2 = obj[Symbol.iterator]();
  16905. let item;
  16906. while (!(item = iterator2.next()).done) {
  16907. fn(item.value);
  16908. }
  16909. }
  16910. }
  16911. function isJsObject(o) {
  16912. return o !== null && (typeof o === "function" || typeof o === "object");
  16913. }
  16914. function devModeEqual(a, b) {
  16915. const isListLikeIterableA = isListLikeIterable(a);
  16916. const isListLikeIterableB = isListLikeIterable(b);
  16917. if (isListLikeIterableA && isListLikeIterableB) {
  16918. return areIterablesEqual(a, b, devModeEqual);
  16919. } else {
  16920. const isAObject = a && (typeof a === "object" || typeof a === "function");
  16921. const isBObject = b && (typeof b === "object" || typeof b === "function");
  16922. if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
  16923. return true;
  16924. } else {
  16925. return Object.is(a, b);
  16926. }
  16927. }
  16928. }
  16929. function updateBinding(lView, bindingIndex, value) {
  16930. return lView[bindingIndex] = value;
  16931. }
  16932. function getBinding(lView, bindingIndex) {
  16933. ngDevMode && assertIndexInRange(lView, bindingIndex);
  16934. ngDevMode && assertNotSame(lView[bindingIndex], NO_CHANGE, "Stored value should never be NO_CHANGE.");
  16935. return lView[bindingIndex];
  16936. }
  16937. function bindingUpdated(lView, bindingIndex, value) {
  16938. ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
  16939. ngDevMode && assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
  16940. const oldValue = lView[bindingIndex];
  16941. if (Object.is(oldValue, value)) {
  16942. return false;
  16943. } else {
  16944. if (ngDevMode && isInCheckNoChangesMode()) {
  16945. const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : void 0;
  16946. if (!devModeEqual(oldValueToCompare, value)) {
  16947. const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
  16948. throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName, lView);
  16949. }
  16950. return false;
  16951. }
  16952. lView[bindingIndex] = value;
  16953. return true;
  16954. }
  16955. }
  16956. function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
  16957. const different = bindingUpdated(lView, bindingIndex, exp1);
  16958. return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
  16959. }
  16960. function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
  16961. const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
  16962. return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
  16963. }
  16964. function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
  16965. const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
  16966. return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
  16967. }
  16968. function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrs, localRefsIndex) {
  16969. ngDevMode && assertFirstCreatePass(tView);
  16970. ngDevMode && ngDevMode.firstCreatePass++;
  16971. const tViewConsts = tView.consts;
  16972. const tNode = getOrCreateTNode(tView, index, 4, tagName || null, attrs || null);
  16973. if (getBindingsEnabled()) {
  16974. resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), findDirectiveDefMatches);
  16975. }
  16976. tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
  16977. registerPostOrderHooks(tView, tNode);
  16978. const embeddedTView = tNode.tView = createTView(
  16979. 2,
  16980. tNode,
  16981. templateFn,
  16982. decls,
  16983. vars,
  16984. tView.directiveRegistry,
  16985. tView.pipeRegistry,
  16986. null,
  16987. tView.schemas,
  16988. tViewConsts,
  16989. null
  16990. /* ssrId */
  16991. );
  16992. if (tView.queries !== null) {
  16993. tView.queries.template(tView, tNode);
  16994. embeddedTView.queries = tView.queries.embeddedTView(tNode);
  16995. }
  16996. return tNode;
  16997. }
  16998. function declareTemplate(declarationLView, declarationTView, index, templateFn, decls, vars, tagName, attrs, localRefsIndex, localRefExtractor) {
  16999. const adjustedIndex = index + HEADER_OFFSET;
  17000. const tNode = declarationTView.firstCreatePass ? templateFirstCreatePass(adjustedIndex, declarationTView, declarationLView, templateFn, decls, vars, tagName, attrs, localRefsIndex) : declarationTView.data[adjustedIndex];
  17001. setCurrentTNode(tNode, false);
  17002. const comment = _locateOrCreateContainerAnchor(declarationTView, declarationLView, tNode, index);
  17003. if (wasLastNodeCreated()) {
  17004. appendChild(declarationTView, declarationLView, comment, tNode);
  17005. }
  17006. attachPatchData(comment, declarationLView);
  17007. const lContainer = createLContainer(comment, declarationLView, comment, tNode);
  17008. declarationLView[adjustedIndex] = lContainer;
  17009. addToEndOfViewTree(declarationLView, lContainer);
  17010. populateDehydratedViewsInLContainer(lContainer, tNode, declarationLView);
  17011. if (isDirectiveHost(tNode)) {
  17012. createDirectivesInstances(declarationTView, declarationLView, tNode);
  17013. }
  17014. if (localRefsIndex != null) {
  17015. saveResolvedLocalsInData(declarationLView, tNode, localRefExtractor);
  17016. }
  17017. return tNode;
  17018. }
  17019. function ɵɵtemplate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
  17020. const lView = getLView();
  17021. const tView = getTView();
  17022. const attrs = getConstant(tView.consts, attrsIndex);
  17023. declareTemplate(lView, tView, index, templateFn, decls, vars, tagName, attrs, localRefsIndex, localRefExtractor);
  17024. return ɵɵtemplate;
  17025. }
  17026. var _locateOrCreateContainerAnchor = createContainerAnchorImpl;
  17027. function createContainerAnchorImpl(tView, lView, tNode, index) {
  17028. lastNodeWasCreated(true);
  17029. return lView[RENDERER].createComment(ngDevMode ? "container" : "");
  17030. }
  17031. function locateOrCreateContainerAnchorImpl(tView, lView, tNode, index) {
  17032. const hydrationInfo = lView[HYDRATION];
  17033. const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDetachedByI18n(tNode) || isDisconnectedNode$1(hydrationInfo, index);
  17034. lastNodeWasCreated(isNodeCreationMode);
  17035. if (isNodeCreationMode) {
  17036. return createContainerAnchorImpl(tView, lView);
  17037. }
  17038. const ssrId = hydrationInfo.data[TEMPLATES]?.[index] ?? null;
  17039. if (ssrId !== null && tNode.tView !== null) {
  17040. if (tNode.tView.ssrId === null) {
  17041. tNode.tView.ssrId = ssrId;
  17042. } else {
  17043. ngDevMode && assertEqual(tNode.tView.ssrId, ssrId, "Unexpected value of the `ssrId` for this TView");
  17044. }
  17045. }
  17046. const currentRNode = locateNextRNode(hydrationInfo, tView, lView, tNode);
  17047. ngDevMode && validateNodeExists(currentRNode, lView, tNode);
  17048. setSegmentHead(hydrationInfo, index, currentRNode);
  17049. const viewContainerSize = calcSerializedContainerSize(hydrationInfo, index);
  17050. const comment = siblingAfter(viewContainerSize, currentRNode);
  17051. if (ngDevMode) {
  17052. validateMatchingNode(comment, Node.COMMENT_NODE, null, lView, tNode);
  17053. markRNodeAsClaimedByHydration(comment);
  17054. }
  17055. return comment;
  17056. }
  17057. function enableLocateOrCreateContainerAnchorImpl() {
  17058. _locateOrCreateContainerAnchor = locateOrCreateContainerAnchorImpl;
  17059. }
  17060. function onIdle(callback, injector) {
  17061. const scheduler = injector.get(IdleScheduler);
  17062. const cleanupFn = () => scheduler.remove(callback);
  17063. scheduler.add(callback);
  17064. return cleanupFn;
  17065. }
  17066. var _requestIdleCallback = () => typeof requestIdleCallback !== "undefined" ? requestIdleCallback : setTimeout;
  17067. var _cancelIdleCallback = () => typeof requestIdleCallback !== "undefined" ? cancelIdleCallback : clearTimeout;
  17068. var IdleScheduler = class _IdleScheduler {
  17069. // Indicates whether current callbacks are being invoked.
  17070. executingCallbacks = false;
  17071. // Currently scheduled idle callback id.
  17072. idleId = null;
  17073. // Set of callbacks to be invoked next.
  17074. current = /* @__PURE__ */ new Set();
  17075. // Set of callbacks collected while invoking current set of callbacks.
  17076. // Those callbacks are scheduled for the next idle period.
  17077. deferred = /* @__PURE__ */ new Set();
  17078. ngZone = inject(NgZone);
  17079. requestIdleCallbackFn = _requestIdleCallback().bind(globalThis);
  17080. cancelIdleCallbackFn = _cancelIdleCallback().bind(globalThis);
  17081. add(callback) {
  17082. const target = this.executingCallbacks ? this.deferred : this.current;
  17083. target.add(callback);
  17084. if (this.idleId === null) {
  17085. this.scheduleIdleCallback();
  17086. }
  17087. }
  17088. remove(callback) {
  17089. const {
  17090. current,
  17091. deferred
  17092. } = this;
  17093. current.delete(callback);
  17094. deferred.delete(callback);
  17095. if (current.size === 0 && deferred.size === 0) {
  17096. this.cancelIdleCallback();
  17097. }
  17098. }
  17099. scheduleIdleCallback() {
  17100. const callback = () => {
  17101. this.cancelIdleCallback();
  17102. this.executingCallbacks = true;
  17103. for (const callback2 of this.current) {
  17104. callback2();
  17105. }
  17106. this.current.clear();
  17107. this.executingCallbacks = false;
  17108. if (this.deferred.size > 0) {
  17109. for (const callback2 of this.deferred) {
  17110. this.current.add(callback2);
  17111. }
  17112. this.deferred.clear();
  17113. this.scheduleIdleCallback();
  17114. }
  17115. };
  17116. this.idleId = this.requestIdleCallbackFn(() => this.ngZone.run(callback));
  17117. }
  17118. cancelIdleCallback() {
  17119. if (this.idleId !== null) {
  17120. this.cancelIdleCallbackFn(this.idleId);
  17121. this.idleId = null;
  17122. }
  17123. }
  17124. ngOnDestroy() {
  17125. this.cancelIdleCallback();
  17126. this.current.clear();
  17127. this.deferred.clear();
  17128. }
  17129. /** @nocollapse */
  17130. static ɵprov = (
  17131. /** @pureOrBreakMyCode */
  17132. ɵɵdefineInjectable({
  17133. token: _IdleScheduler,
  17134. providedIn: "root",
  17135. factory: () => new _IdleScheduler()
  17136. })
  17137. );
  17138. };
  17139. function onTimer(delay2) {
  17140. return (callback, injector) => scheduleTimerTrigger(delay2, callback, injector);
  17141. }
  17142. function scheduleTimerTrigger(delay2, callback, injector) {
  17143. const scheduler = injector.get(TimerScheduler);
  17144. const ngZone = injector.get(NgZone);
  17145. const cleanupFn = () => scheduler.remove(callback);
  17146. scheduler.add(delay2, callback, ngZone);
  17147. return cleanupFn;
  17148. }
  17149. var TimerScheduler = class _TimerScheduler {
  17150. // Indicates whether current callbacks are being invoked.
  17151. executingCallbacks = false;
  17152. // Currently scheduled `setTimeout` id.
  17153. timeoutId = null;
  17154. // When currently scheduled timer would fire.
  17155. invokeTimerAt = null;
  17156. // List of callbacks to be invoked.
  17157. // For each callback we also store a timestamp on when the callback
  17158. // should be invoked. We store timestamps and callback functions
  17159. // in a flat array to avoid creating new objects for each entry.
  17160. // [timestamp1, callback1, timestamp2, callback2, ...]
  17161. current = [];
  17162. // List of callbacks collected while invoking current set of callbacks.
  17163. // Those callbacks are added to the "current" queue at the end of
  17164. // the current callback invocation. The shape of this list is the same
  17165. // as the shape of the `current` list.
  17166. deferred = [];
  17167. add(delay2, callback, ngZone) {
  17168. const target = this.executingCallbacks ? this.deferred : this.current;
  17169. this.addToQueue(target, Date.now() + delay2, callback);
  17170. this.scheduleTimer(ngZone);
  17171. }
  17172. remove(callback) {
  17173. const {
  17174. current,
  17175. deferred
  17176. } = this;
  17177. const callbackIndex = this.removeFromQueue(current, callback);
  17178. if (callbackIndex === -1) {
  17179. this.removeFromQueue(deferred, callback);
  17180. }
  17181. if (current.length === 0 && deferred.length === 0) {
  17182. this.clearTimeout();
  17183. }
  17184. }
  17185. addToQueue(target, invokeAt, callback) {
  17186. let insertAtIndex = target.length;
  17187. for (let i = 0; i < target.length; i += 2) {
  17188. const invokeQueuedCallbackAt = target[i];
  17189. if (invokeQueuedCallbackAt > invokeAt) {
  17190. insertAtIndex = i;
  17191. break;
  17192. }
  17193. }
  17194. arrayInsert2(target, insertAtIndex, invokeAt, callback);
  17195. }
  17196. removeFromQueue(target, callback) {
  17197. let index = -1;
  17198. for (let i = 0; i < target.length; i += 2) {
  17199. const queuedCallback = target[i + 1];
  17200. if (queuedCallback === callback) {
  17201. index = i;
  17202. break;
  17203. }
  17204. }
  17205. if (index > -1) {
  17206. arraySplice(target, index, 2);
  17207. }
  17208. return index;
  17209. }
  17210. scheduleTimer(ngZone) {
  17211. const callback = () => {
  17212. this.clearTimeout();
  17213. this.executingCallbacks = true;
  17214. const current = [...this.current];
  17215. const now = Date.now();
  17216. for (let i = 0; i < current.length; i += 2) {
  17217. const invokeAt = current[i];
  17218. const callback2 = current[i + 1];
  17219. if (invokeAt <= now) {
  17220. callback2();
  17221. } else {
  17222. break;
  17223. }
  17224. }
  17225. let lastCallbackIndex = -1;
  17226. for (let i = 0; i < this.current.length; i += 2) {
  17227. const invokeAt = this.current[i];
  17228. if (invokeAt <= now) {
  17229. lastCallbackIndex = i + 1;
  17230. } else {
  17231. break;
  17232. }
  17233. }
  17234. if (lastCallbackIndex >= 0) {
  17235. arraySplice(this.current, 0, lastCallbackIndex + 1);
  17236. }
  17237. this.executingCallbacks = false;
  17238. if (this.deferred.length > 0) {
  17239. for (let i = 0; i < this.deferred.length; i += 2) {
  17240. const invokeAt = this.deferred[i];
  17241. const callback2 = this.deferred[i + 1];
  17242. this.addToQueue(this.current, invokeAt, callback2);
  17243. }
  17244. this.deferred.length = 0;
  17245. }
  17246. this.scheduleTimer(ngZone);
  17247. };
  17248. const FRAME_DURATION_MS = 16;
  17249. if (this.current.length > 0) {
  17250. const now = Date.now();
  17251. const invokeAt = this.current[0];
  17252. if (this.timeoutId === null || // Reschedule a timer in case a queue contains an item with
  17253. // an earlier timestamp and the delta is more than an average
  17254. // frame duration.
  17255. this.invokeTimerAt && this.invokeTimerAt - invokeAt > FRAME_DURATION_MS) {
  17256. this.clearTimeout();
  17257. const timeout2 = Math.max(invokeAt - now, FRAME_DURATION_MS);
  17258. this.invokeTimerAt = invokeAt;
  17259. this.timeoutId = ngZone.runOutsideAngular(() => {
  17260. return setTimeout(() => ngZone.run(callback), timeout2);
  17261. });
  17262. }
  17263. }
  17264. }
  17265. clearTimeout() {
  17266. if (this.timeoutId !== null) {
  17267. clearTimeout(this.timeoutId);
  17268. this.timeoutId = null;
  17269. }
  17270. }
  17271. ngOnDestroy() {
  17272. this.clearTimeout();
  17273. this.current.length = 0;
  17274. this.deferred.length = 0;
  17275. }
  17276. /** @nocollapse */
  17277. static ɵprov = (
  17278. /** @pureOrBreakMyCode */
  17279. ɵɵdefineInjectable({
  17280. token: _TimerScheduler,
  17281. providedIn: "root",
  17282. factory: () => new _TimerScheduler()
  17283. })
  17284. );
  17285. };
  17286. var CachedInjectorService = class _CachedInjectorService {
  17287. cachedInjectors = /* @__PURE__ */ new Map();
  17288. getOrCreateInjector(key, parentInjector, providers, debugName) {
  17289. if (!this.cachedInjectors.has(key)) {
  17290. const injector = providers.length > 0 ? createEnvironmentInjector(providers, parentInjector, debugName) : null;
  17291. this.cachedInjectors.set(key, injector);
  17292. }
  17293. return this.cachedInjectors.get(key);
  17294. }
  17295. ngOnDestroy() {
  17296. try {
  17297. for (const injector of this.cachedInjectors.values()) {
  17298. if (injector !== null) {
  17299. injector.destroy();
  17300. }
  17301. }
  17302. } finally {
  17303. this.cachedInjectors.clear();
  17304. }
  17305. }
  17306. /** @nocollapse */
  17307. static ɵprov = (
  17308. /** @pureOrBreakMyCode */
  17309. ɵɵdefineInjectable({
  17310. token: _CachedInjectorService,
  17311. providedIn: "environment",
  17312. factory: () => new _CachedInjectorService()
  17313. })
  17314. );
  17315. };
  17316. var DEFER_BLOCK_DEPENDENCY_INTERCEPTOR = new InjectionToken("DEFER_BLOCK_DEPENDENCY_INTERCEPTOR");
  17317. var DEFER_BLOCK_CONFIG = new InjectionToken(ngDevMode ? "DEFER_BLOCK_CONFIG" : "");
  17318. function getOrCreateEnvironmentInjector(parentInjector, tDetails, providers) {
  17319. return parentInjector.get(CachedInjectorService).getOrCreateInjector(tDetails, parentInjector, providers, ngDevMode ? "DeferBlock Injector" : "");
  17320. }
  17321. function createDeferBlockInjector(parentInjector, tDetails, providers) {
  17322. if (parentInjector instanceof ChainedInjector) {
  17323. const origInjector = parentInjector.injector;
  17324. const parentEnvInjector2 = parentInjector.parentInjector;
  17325. const envInjector = getOrCreateEnvironmentInjector(parentEnvInjector2, tDetails, providers);
  17326. return new ChainedInjector(origInjector, envInjector);
  17327. }
  17328. const parentEnvInjector = parentInjector.get(EnvironmentInjector);
  17329. if (parentEnvInjector !== parentInjector) {
  17330. const envInjector = getOrCreateEnvironmentInjector(parentEnvInjector, tDetails, providers);
  17331. return new ChainedInjector(parentInjector, envInjector);
  17332. }
  17333. return getOrCreateEnvironmentInjector(parentInjector, tDetails, providers);
  17334. }
  17335. function renderDeferBlockState(newState, tNode, lContainer, skipTimerScheduling = false) {
  17336. const hostLView = lContainer[PARENT];
  17337. const hostTView = hostLView[TVIEW];
  17338. if (isDestroyed(hostLView)) return;
  17339. ngDevMode && assertTNodeForLView(tNode, hostLView);
  17340. const lDetails = getLDeferBlockDetails(hostLView, tNode);
  17341. ngDevMode && assertDefined(lDetails, "Expected a defer block state defined");
  17342. const currentState = lDetails[DEFER_BLOCK_STATE];
  17343. const ssrState = lDetails[SSR_BLOCK_STATE];
  17344. if (ssrState !== null && newState < ssrState) {
  17345. return;
  17346. }
  17347. if (isValidStateChange(currentState, newState) && isValidStateChange(lDetails[NEXT_DEFER_BLOCK_STATE] ?? -1, newState)) {
  17348. const tDetails = getTDeferBlockDetails(hostTView, tNode);
  17349. const needsScheduling = !skipTimerScheduling && true && (getLoadingBlockAfter(tDetails) !== null || getMinimumDurationForState(tDetails, DeferBlockState.Loading) !== null || getMinimumDurationForState(tDetails, DeferBlockState.Placeholder));
  17350. if (ngDevMode && needsScheduling) {
  17351. assertDefined(applyDeferBlockStateWithSchedulingImpl, "Expected scheduling function to be defined");
  17352. }
  17353. const applyStateFn = needsScheduling ? applyDeferBlockStateWithSchedulingImpl : applyDeferBlockState;
  17354. try {
  17355. applyStateFn(newState, lDetails, lContainer, tNode, hostLView);
  17356. } catch (error) {
  17357. handleError$1(hostLView, error);
  17358. }
  17359. }
  17360. }
  17361. function findMatchingDehydratedViewForDeferBlock(lContainer, lDetails) {
  17362. const dehydratedViewIx = lContainer[DEHYDRATED_VIEWS]?.findIndex((view) => view.data[DEFER_BLOCK_STATE$1] === lDetails[DEFER_BLOCK_STATE]) ?? -1;
  17363. const dehydratedView = dehydratedViewIx > -1 ? lContainer[DEHYDRATED_VIEWS][dehydratedViewIx] : null;
  17364. return {
  17365. dehydratedView,
  17366. dehydratedViewIx
  17367. };
  17368. }
  17369. function applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView) {
  17370. profiler(
  17371. 20
  17372. /* ProfilerEvent.DeferBlockStateStart */
  17373. );
  17374. const stateTmplIndex = getTemplateIndexForState(newState, hostLView, tNode);
  17375. if (stateTmplIndex !== null) {
  17376. lDetails[DEFER_BLOCK_STATE] = newState;
  17377. const hostTView = hostLView[TVIEW];
  17378. const adjustedIndex = stateTmplIndex + HEADER_OFFSET;
  17379. const activeBlockTNode = getTNode(hostTView, adjustedIndex);
  17380. const viewIndex = 0;
  17381. removeLViewFromLContainer(lContainer, viewIndex);
  17382. let injector;
  17383. if (newState === DeferBlockState.Complete) {
  17384. const tDetails = getTDeferBlockDetails(hostTView, tNode);
  17385. const providers = tDetails.providers;
  17386. if (providers && providers.length > 0) {
  17387. injector = createDeferBlockInjector(hostLView[INJECTOR], tDetails, providers);
  17388. }
  17389. }
  17390. const {
  17391. dehydratedView,
  17392. dehydratedViewIx
  17393. } = findMatchingDehydratedViewForDeferBlock(lContainer, lDetails);
  17394. const embeddedLView = createAndRenderEmbeddedLView(hostLView, activeBlockTNode, null, {
  17395. injector,
  17396. dehydratedView
  17397. });
  17398. addLViewToLContainer(lContainer, embeddedLView, viewIndex, shouldAddViewToDom(activeBlockTNode, dehydratedView));
  17399. markViewDirty(
  17400. embeddedLView,
  17401. 2
  17402. /* NotificationSource.DeferBlockStateUpdate */
  17403. );
  17404. if (dehydratedViewIx > -1) {
  17405. lContainer[DEHYDRATED_VIEWS]?.splice(dehydratedViewIx, 1);
  17406. }
  17407. if ((newState === DeferBlockState.Complete || newState === DeferBlockState.Error) && Array.isArray(lDetails[ON_COMPLETE_FNS])) {
  17408. for (const callback of lDetails[ON_COMPLETE_FNS]) {
  17409. callback();
  17410. }
  17411. lDetails[ON_COMPLETE_FNS] = null;
  17412. }
  17413. }
  17414. profiler(
  17415. 21
  17416. /* ProfilerEvent.DeferBlockStateEnd */
  17417. );
  17418. }
  17419. function applyDeferBlockStateWithScheduling(newState, lDetails, lContainer, tNode, hostLView) {
  17420. const now = Date.now();
  17421. const hostTView = hostLView[TVIEW];
  17422. const tDetails = getTDeferBlockDetails(hostTView, tNode);
  17423. if (lDetails[STATE_IS_FROZEN_UNTIL] === null || lDetails[STATE_IS_FROZEN_UNTIL] <= now) {
  17424. lDetails[STATE_IS_FROZEN_UNTIL] = null;
  17425. const loadingAfter = getLoadingBlockAfter(tDetails);
  17426. const inLoadingAfterPhase = lDetails[LOADING_AFTER_CLEANUP_FN] !== null;
  17427. if (newState === DeferBlockState.Loading && loadingAfter !== null && !inLoadingAfterPhase) {
  17428. lDetails[NEXT_DEFER_BLOCK_STATE] = newState;
  17429. const cleanupFn = scheduleDeferBlockUpdate(loadingAfter, lDetails, tNode, lContainer, hostLView);
  17430. lDetails[LOADING_AFTER_CLEANUP_FN] = cleanupFn;
  17431. } else {
  17432. if (newState > DeferBlockState.Loading && inLoadingAfterPhase) {
  17433. lDetails[LOADING_AFTER_CLEANUP_FN]();
  17434. lDetails[LOADING_AFTER_CLEANUP_FN] = null;
  17435. lDetails[NEXT_DEFER_BLOCK_STATE] = null;
  17436. }
  17437. applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView);
  17438. const duration = getMinimumDurationForState(tDetails, newState);
  17439. if (duration !== null) {
  17440. lDetails[STATE_IS_FROZEN_UNTIL] = now + duration;
  17441. scheduleDeferBlockUpdate(duration, lDetails, tNode, lContainer, hostLView);
  17442. }
  17443. }
  17444. } else {
  17445. lDetails[NEXT_DEFER_BLOCK_STATE] = newState;
  17446. }
  17447. }
  17448. function scheduleDeferBlockUpdate(timeout2, lDetails, tNode, lContainer, hostLView) {
  17449. const callback = () => {
  17450. const nextState = lDetails[NEXT_DEFER_BLOCK_STATE];
  17451. lDetails[STATE_IS_FROZEN_UNTIL] = null;
  17452. lDetails[NEXT_DEFER_BLOCK_STATE] = null;
  17453. if (nextState !== null) {
  17454. renderDeferBlockState(nextState, tNode, lContainer);
  17455. }
  17456. };
  17457. return scheduleTimerTrigger(timeout2, callback, hostLView[INJECTOR]);
  17458. }
  17459. function isValidStateChange(currentState, newState) {
  17460. return currentState < newState;
  17461. }
  17462. function renderPlaceholder(lView, tNode) {
  17463. const lContainer = lView[tNode.index];
  17464. ngDevMode && assertLContainer(lContainer);
  17465. renderDeferBlockState(DeferBlockState.Placeholder, tNode, lContainer);
  17466. }
  17467. function renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer) {
  17468. ngDevMode && assertDefined(tDetails.loadingPromise, "Expected loading Promise to exist on this defer block");
  17469. tDetails.loadingPromise.then(() => {
  17470. if (tDetails.loadingState === DeferDependenciesLoadingState.COMPLETE) {
  17471. ngDevMode && assertDeferredDependenciesLoaded(tDetails);
  17472. renderDeferBlockState(DeferBlockState.Complete, tNode, lContainer);
  17473. } else if (tDetails.loadingState === DeferDependenciesLoadingState.FAILED) {
  17474. renderDeferBlockState(DeferBlockState.Error, tNode, lContainer);
  17475. }
  17476. });
  17477. }
  17478. var applyDeferBlockStateWithSchedulingImpl = null;
  17479. function ɵɵdeferEnableTimerScheduling(tView, tDetails, placeholderConfigIndex, loadingConfigIndex) {
  17480. const tViewConsts = tView.consts;
  17481. if (placeholderConfigIndex != null) {
  17482. tDetails.placeholderBlockConfig = getConstant(tViewConsts, placeholderConfigIndex);
  17483. }
  17484. if (loadingConfigIndex != null) {
  17485. tDetails.loadingBlockConfig = getConstant(tViewConsts, loadingConfigIndex);
  17486. }
  17487. if (applyDeferBlockStateWithSchedulingImpl === null) {
  17488. applyDeferBlockStateWithSchedulingImpl = applyDeferBlockStateWithScheduling;
  17489. }
  17490. }
  17491. var ASYNC_COMPONENT_METADATA_FN = "__ngAsyncComponentMetadataFn__";
  17492. function getAsyncClassMetadataFn(type) {
  17493. const componentClass = type;
  17494. return componentClass[ASYNC_COMPONENT_METADATA_FN] ?? null;
  17495. }
  17496. function setClassMetadataAsync(type, dependencyLoaderFn, metadataSetterFn) {
  17497. const componentClass = type;
  17498. componentClass[ASYNC_COMPONENT_METADATA_FN] = () => Promise.all(dependencyLoaderFn()).then((dependencies) => {
  17499. metadataSetterFn(...dependencies);
  17500. componentClass[ASYNC_COMPONENT_METADATA_FN] = null;
  17501. return dependencies;
  17502. });
  17503. return componentClass[ASYNC_COMPONENT_METADATA_FN];
  17504. }
  17505. function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
  17506. return noSideEffects(() => {
  17507. const clazz = type;
  17508. if (decorators !== null) {
  17509. if (clazz.hasOwnProperty("decorators") && clazz.decorators !== void 0) {
  17510. clazz.decorators.push(...decorators);
  17511. } else {
  17512. clazz.decorators = decorators;
  17513. }
  17514. }
  17515. if (ctorParameters !== null) {
  17516. clazz.ctorParameters = ctorParameters;
  17517. }
  17518. if (propDecorators !== null) {
  17519. if (clazz.hasOwnProperty("propDecorators") && clazz.propDecorators !== void 0) {
  17520. clazz.propDecorators = __spreadValues(__spreadValues({}, clazz.propDecorators), propDecorators);
  17521. } else {
  17522. clazz.propDecorators = propDecorators;
  17523. }
  17524. }
  17525. });
  17526. }
  17527. var Console = class _Console {
  17528. log(message) {
  17529. console.log(message);
  17530. }
  17531. // Note: for reporting errors use `DOM.logError()` as it is platform specific
  17532. warn(message) {
  17533. console.warn(message);
  17534. }
  17535. static ɵfac = function Console_Factory(__ngFactoryType__) {
  17536. return new (__ngFactoryType__ || _Console)();
  17537. };
  17538. static ɵprov = ɵɵdefineInjectable({
  17539. token: _Console,
  17540. factory: _Console.ɵfac,
  17541. providedIn: "platform"
  17542. });
  17543. };
  17544. (() => {
  17545. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Console, [{
  17546. type: Injectable,
  17547. args: [{
  17548. providedIn: "platform"
  17549. }]
  17550. }], null, null);
  17551. })();
  17552. var DIDebugData = class {
  17553. resolverToTokenToDependencies = /* @__PURE__ */ new WeakMap();
  17554. resolverToProviders = /* @__PURE__ */ new WeakMap();
  17555. resolverToEffects = /* @__PURE__ */ new WeakMap();
  17556. standaloneInjectorToComponent = /* @__PURE__ */ new WeakMap();
  17557. reset() {
  17558. this.resolverToTokenToDependencies = /* @__PURE__ */ new WeakMap();
  17559. this.resolverToProviders = /* @__PURE__ */ new WeakMap();
  17560. this.standaloneInjectorToComponent = /* @__PURE__ */ new WeakMap();
  17561. }
  17562. };
  17563. var frameworkDIDebugData = new DIDebugData();
  17564. function getFrameworkDIDebugData() {
  17565. return frameworkDIDebugData;
  17566. }
  17567. function setupFrameworkInjectorProfiler() {
  17568. frameworkDIDebugData.reset();
  17569. setInjectorProfiler((injectorProfilerEvent) => handleInjectorProfilerEvent(injectorProfilerEvent));
  17570. }
  17571. function handleInjectorProfilerEvent(injectorProfilerEvent) {
  17572. const {
  17573. context: context2,
  17574. type
  17575. } = injectorProfilerEvent;
  17576. if (type === 0) {
  17577. handleInjectEvent(context2, injectorProfilerEvent.service);
  17578. } else if (type === 1) {
  17579. handleInstanceCreatedByInjectorEvent(context2, injectorProfilerEvent.instance);
  17580. } else if (type === 2) {
  17581. handleProviderConfiguredEvent(context2, injectorProfilerEvent.providerRecord);
  17582. } else if (type === 3) {
  17583. handleEffectCreatedEvent(context2, injectorProfilerEvent.effect);
  17584. }
  17585. }
  17586. function handleEffectCreatedEvent(context2, effect2) {
  17587. const diResolver = getDIResolver(context2.injector);
  17588. if (diResolver === null) {
  17589. throwError2("An EffectCreated event must be run within an injection context.");
  17590. }
  17591. const {
  17592. resolverToEffects
  17593. } = frameworkDIDebugData;
  17594. if (!resolverToEffects.has(diResolver)) {
  17595. resolverToEffects.set(diResolver, []);
  17596. }
  17597. resolverToEffects.get(diResolver).push(effect2);
  17598. }
  17599. function handleInjectEvent(context2, data) {
  17600. const diResolver = getDIResolver(context2.injector);
  17601. if (diResolver === null) {
  17602. throwError2("An Inject event must be run within an injection context.");
  17603. }
  17604. const diResolverToInstantiatedToken = frameworkDIDebugData.resolverToTokenToDependencies;
  17605. if (!diResolverToInstantiatedToken.has(diResolver)) {
  17606. diResolverToInstantiatedToken.set(diResolver, /* @__PURE__ */ new WeakMap());
  17607. }
  17608. if (!canBeHeldWeakly(context2.token)) {
  17609. return;
  17610. }
  17611. const instantiatedTokenToDependencies = diResolverToInstantiatedToken.get(diResolver);
  17612. if (!instantiatedTokenToDependencies.has(context2.token)) {
  17613. instantiatedTokenToDependencies.set(context2.token, []);
  17614. }
  17615. const {
  17616. token,
  17617. value,
  17618. flags
  17619. } = data;
  17620. assertDefined(context2.token, "Injector profiler context token is undefined.");
  17621. const dependencies = instantiatedTokenToDependencies.get(context2.token);
  17622. assertDefined(dependencies, "Could not resolve dependencies for token.");
  17623. if (context2.injector instanceof NodeInjector) {
  17624. dependencies.push({
  17625. token,
  17626. value,
  17627. flags,
  17628. injectedIn: getNodeInjectorContext(context2.injector)
  17629. });
  17630. } else {
  17631. dependencies.push({
  17632. token,
  17633. value,
  17634. flags
  17635. });
  17636. }
  17637. }
  17638. function getNodeInjectorContext(injector) {
  17639. if (!(injector instanceof NodeInjector)) {
  17640. throwError2("getNodeInjectorContext must be called with a NodeInjector");
  17641. }
  17642. const lView = getNodeInjectorLView(injector);
  17643. const tNode = getNodeInjectorTNode(injector);
  17644. if (tNode === null) {
  17645. return;
  17646. }
  17647. assertTNodeForLView(tNode, lView);
  17648. return {
  17649. lView,
  17650. tNode
  17651. };
  17652. }
  17653. function handleInstanceCreatedByInjectorEvent(context2, data) {
  17654. const {
  17655. value
  17656. } = data;
  17657. if (getDIResolver(context2.injector) === null) {
  17658. throwError2("An InjectorCreatedInstance event must be run within an injection context.");
  17659. }
  17660. let standaloneComponent = void 0;
  17661. if (typeof value === "object") {
  17662. standaloneComponent = value?.constructor;
  17663. }
  17664. if (standaloneComponent == void 0 || !isStandaloneComponent(standaloneComponent)) {
  17665. return;
  17666. }
  17667. const environmentInjector = context2.injector.get(EnvironmentInjector, null, {
  17668. optional: true
  17669. });
  17670. if (environmentInjector === null) {
  17671. return;
  17672. }
  17673. const {
  17674. standaloneInjectorToComponent
  17675. } = frameworkDIDebugData;
  17676. if (standaloneInjectorToComponent.has(environmentInjector)) {
  17677. return;
  17678. }
  17679. standaloneInjectorToComponent.set(environmentInjector, standaloneComponent);
  17680. }
  17681. function isStandaloneComponent(value) {
  17682. const def = getComponentDef(value);
  17683. return !!def?.standalone;
  17684. }
  17685. function handleProviderConfiguredEvent(context2, data) {
  17686. const {
  17687. resolverToProviders
  17688. } = frameworkDIDebugData;
  17689. let diResolver;
  17690. if (context2?.injector instanceof NodeInjector) {
  17691. diResolver = getNodeInjectorTNode(context2.injector);
  17692. } else {
  17693. diResolver = context2.injector;
  17694. }
  17695. if (diResolver === null) {
  17696. throwError2("A ProviderConfigured event must be run within an injection context.");
  17697. }
  17698. if (!resolverToProviders.has(diResolver)) {
  17699. resolverToProviders.set(diResolver, []);
  17700. }
  17701. resolverToProviders.get(diResolver).push(data);
  17702. }
  17703. function getDIResolver(injector) {
  17704. let diResolver = null;
  17705. if (injector === void 0) {
  17706. return diResolver;
  17707. }
  17708. if (injector instanceof NodeInjector) {
  17709. diResolver = getNodeInjectorLView(injector);
  17710. } else {
  17711. diResolver = injector;
  17712. }
  17713. return diResolver;
  17714. }
  17715. function canBeHeldWeakly(value) {
  17716. return value !== null && (typeof value === "object" || typeof value === "function" || typeof value === "symbol");
  17717. }
  17718. function applyChanges(component) {
  17719. ngDevMode && assertDefined(component, "component");
  17720. markViewDirty(
  17721. getComponentViewByInstance(component),
  17722. 3
  17723. /* NotificationSource.DebugApplyChanges */
  17724. );
  17725. getRootComponents(component).forEach((rootComponent) => detectChanges(rootComponent));
  17726. }
  17727. function detectChanges(component) {
  17728. const view = getComponentViewByInstance(component);
  17729. view[FLAGS] |= 1024;
  17730. detectChangesInternal(view);
  17731. }
  17732. function getDeferBlocks$1(lView, deferBlocks) {
  17733. const tView = lView[TVIEW];
  17734. for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
  17735. if (isLContainer(lView[i])) {
  17736. const lContainer = lView[i];
  17737. const isLast = i === tView.bindingStartIndex - 1;
  17738. if (!isLast) {
  17739. const tNode = tView.data[i];
  17740. const tDetails = getTDeferBlockDetails(tView, tNode);
  17741. if (isTDeferBlockDetails(tDetails)) {
  17742. deferBlocks.push({
  17743. lContainer,
  17744. lView,
  17745. tNode,
  17746. tDetails
  17747. });
  17748. continue;
  17749. }
  17750. }
  17751. for (let i2 = CONTAINER_HEADER_OFFSET; i2 < lContainer.length; i2++) {
  17752. getDeferBlocks$1(lContainer[i2], deferBlocks);
  17753. }
  17754. } else if (isLView(lView[i])) {
  17755. getDeferBlocks$1(lView[i], deferBlocks);
  17756. }
  17757. }
  17758. }
  17759. function getDeferBlocks(node) {
  17760. const results = [];
  17761. const lView = getLContext(node)?.lView;
  17762. if (lView) {
  17763. findDeferBlocks(node, lView, results);
  17764. }
  17765. return results;
  17766. }
  17767. function findDeferBlocks(node, lView, results) {
  17768. const registry = lView[INJECTOR].get(DEHYDRATED_BLOCK_REGISTRY, null, {
  17769. optional: true
  17770. });
  17771. const blocks = [];
  17772. getDeferBlocks$1(lView, blocks);
  17773. for (const details of blocks) {
  17774. const native = getNativeByTNode(details.tNode, details.lView);
  17775. const lDetails = getLDeferBlockDetails(details.lView, details.tNode);
  17776. if (!node.contains(native)) {
  17777. continue;
  17778. }
  17779. const tDetails = details.tDetails;
  17780. const renderedLView = getRendererLView(details);
  17781. const rootNodes = [];
  17782. if (renderedLView !== null) {
  17783. collectNativeNodes(renderedLView[TVIEW], renderedLView, renderedLView[TVIEW].firstChild, rootNodes);
  17784. }
  17785. const data = {
  17786. state: stringifyState(lDetails[DEFER_BLOCK_STATE]),
  17787. incrementalHydrationState: inferHydrationState(tDetails, lDetails, registry),
  17788. hasErrorBlock: tDetails.errorTmplIndex !== null,
  17789. loadingBlock: {
  17790. exists: tDetails.loadingTmplIndex !== null,
  17791. minimumTime: tDetails.loadingBlockConfig?.[MINIMUM_SLOT] ?? null,
  17792. afterTime: tDetails.loadingBlockConfig?.[LOADING_AFTER_SLOT] ?? null
  17793. },
  17794. placeholderBlock: {
  17795. exists: tDetails.placeholderTmplIndex !== null,
  17796. minimumTime: tDetails.placeholderBlockConfig?.[MINIMUM_SLOT] ?? null
  17797. },
  17798. triggers: tDetails.debug?.triggers ? Array.from(tDetails.debug.triggers).sort() : [],
  17799. rootNodes
  17800. };
  17801. results.push(data);
  17802. if (renderedLView !== null) {
  17803. findDeferBlocks(node, renderedLView, results);
  17804. }
  17805. }
  17806. }
  17807. function stringifyState(state) {
  17808. switch (state) {
  17809. case DeferBlockState.Complete:
  17810. return "complete";
  17811. case DeferBlockState.Loading:
  17812. return "loading";
  17813. case DeferBlockState.Placeholder:
  17814. return "placeholder";
  17815. case DeferBlockState.Error:
  17816. return "error";
  17817. case DeferBlockInternalState.Initial:
  17818. return "initial";
  17819. default:
  17820. throw new Error(`Unrecognized state ${state}`);
  17821. }
  17822. }
  17823. function inferHydrationState(tDetails, lDetails, registry) {
  17824. if (registry === null || lDetails[SSR_UNIQUE_ID] === null || tDetails.hydrateTriggers === null || tDetails.hydrateTriggers.has(
  17825. 7
  17826. /* DeferBlockTrigger.Never */
  17827. )) {
  17828. return "not-configured";
  17829. }
  17830. return registry.has(lDetails[SSR_UNIQUE_ID]) ? "dehydrated" : "hydrated";
  17831. }
  17832. function getRendererLView(details) {
  17833. if (details.lContainer.length <= CONTAINER_HEADER_OFFSET) {
  17834. return null;
  17835. }
  17836. const lView = details.lContainer[CONTAINER_HEADER_OFFSET];
  17837. ngDevMode && assertLView(lView);
  17838. return lView;
  17839. }
  17840. function getDependenciesFromInjectable(injector, token) {
  17841. const instance = injector.get(token, null, {
  17842. self: true,
  17843. optional: true
  17844. });
  17845. if (instance === null) {
  17846. throw new Error(`Unable to determine instance of ${token} in given injector`);
  17847. }
  17848. const unformattedDependencies = getDependenciesForTokenInInjector(token, injector);
  17849. const resolutionPath = getInjectorResolutionPath(injector);
  17850. const dependencies = unformattedDependencies.map((dep) => {
  17851. const formattedDependency = {
  17852. value: dep.value
  17853. };
  17854. const flags = dep.flags;
  17855. formattedDependency.flags = {
  17856. optional: (8 & flags) === 8,
  17857. host: (1 & flags) === 1,
  17858. self: (2 & flags) === 2,
  17859. skipSelf: (4 & flags) === 4
  17860. /* InternalInjectFlags.SkipSelf */
  17861. };
  17862. for (let i = 0; i < resolutionPath.length; i++) {
  17863. const injectorToCheck = resolutionPath[i];
  17864. if (i === 0 && formattedDependency.flags.skipSelf) {
  17865. continue;
  17866. }
  17867. if (formattedDependency.flags.host && injectorToCheck instanceof EnvironmentInjector) {
  17868. break;
  17869. }
  17870. const instance2 = injectorToCheck.get(dep.token, null, {
  17871. self: true,
  17872. optional: true
  17873. });
  17874. if (instance2 !== null) {
  17875. if (formattedDependency.flags.host) {
  17876. const firstInjector = resolutionPath[0];
  17877. const lookupFromFirstInjector = firstInjector.get(dep.token, null, __spreadProps(__spreadValues({}, formattedDependency.flags), {
  17878. optional: true
  17879. }));
  17880. if (lookupFromFirstInjector !== null) {
  17881. formattedDependency.providedIn = injectorToCheck;
  17882. }
  17883. break;
  17884. }
  17885. formattedDependency.providedIn = injectorToCheck;
  17886. break;
  17887. }
  17888. if (i === 0 && formattedDependency.flags.self) {
  17889. break;
  17890. }
  17891. }
  17892. if (dep.token) formattedDependency.token = dep.token;
  17893. return formattedDependency;
  17894. });
  17895. return {
  17896. instance,
  17897. dependencies
  17898. };
  17899. }
  17900. function getDependenciesForTokenInInjector(token, injector) {
  17901. const {
  17902. resolverToTokenToDependencies
  17903. } = getFrameworkDIDebugData();
  17904. if (!(injector instanceof NodeInjector)) {
  17905. return resolverToTokenToDependencies.get(injector)?.get?.(token) ?? [];
  17906. }
  17907. const lView = getNodeInjectorLView(injector);
  17908. const tokenDependencyMap = resolverToTokenToDependencies.get(lView);
  17909. const dependencies = tokenDependencyMap?.get(token) ?? [];
  17910. return dependencies.filter((dependency) => {
  17911. const dependencyNode = dependency.injectedIn?.tNode;
  17912. if (dependencyNode === void 0) {
  17913. return false;
  17914. }
  17915. const instanceNode = getNodeInjectorTNode(injector);
  17916. assertTNode(dependencyNode);
  17917. assertTNode(instanceNode);
  17918. return dependencyNode === instanceNode;
  17919. });
  17920. }
  17921. function getProviderImportsContainer(injector) {
  17922. const {
  17923. standaloneInjectorToComponent
  17924. } = getFrameworkDIDebugData();
  17925. if (standaloneInjectorToComponent.has(injector)) {
  17926. return standaloneInjectorToComponent.get(injector);
  17927. }
  17928. const defTypeRef = injector.get(NgModuleRef$1, null, {
  17929. self: true,
  17930. optional: true
  17931. });
  17932. if (defTypeRef === null) {
  17933. return null;
  17934. }
  17935. if (defTypeRef.instance === null) {
  17936. return null;
  17937. }
  17938. return defTypeRef.instance.constructor;
  17939. }
  17940. function getNodeInjectorProviders(injector) {
  17941. const diResolver = getNodeInjectorTNode(injector);
  17942. const {
  17943. resolverToProviders
  17944. } = getFrameworkDIDebugData();
  17945. return resolverToProviders.get(diResolver) ?? [];
  17946. }
  17947. function getProviderImportPaths(providerImportsContainer) {
  17948. const providerToPath = /* @__PURE__ */ new Map();
  17949. const visitedContainers = /* @__PURE__ */ new Set();
  17950. const visitor = walkProviderTreeToDiscoverImportPaths(providerToPath, visitedContainers);
  17951. walkProviderTree(providerImportsContainer, visitor, [], /* @__PURE__ */ new Set());
  17952. return providerToPath;
  17953. }
  17954. function walkProviderTreeToDiscoverImportPaths(providerToPath, visitedContainers) {
  17955. return (provider, container) => {
  17956. if (!providerToPath.has(provider)) {
  17957. providerToPath.set(provider, [container]);
  17958. }
  17959. if (!visitedContainers.has(container)) {
  17960. for (const prov of providerToPath.keys()) {
  17961. const existingImportPath = providerToPath.get(prov);
  17962. let containerDef = getInjectorDef(container);
  17963. if (!containerDef) {
  17964. const ngModule = container.ngModule;
  17965. containerDef = getInjectorDef(ngModule);
  17966. }
  17967. if (!containerDef) {
  17968. return;
  17969. }
  17970. const lastContainerAddedToPath = existingImportPath[0];
  17971. let isNextStepInPath = false;
  17972. deepForEach(containerDef.imports, (moduleImport) => {
  17973. if (isNextStepInPath) {
  17974. return;
  17975. }
  17976. isNextStepInPath = moduleImport.ngModule === lastContainerAddedToPath || moduleImport === lastContainerAddedToPath;
  17977. if (isNextStepInPath) {
  17978. providerToPath.get(prov)?.unshift(container);
  17979. }
  17980. });
  17981. }
  17982. }
  17983. visitedContainers.add(container);
  17984. };
  17985. }
  17986. function getEnvironmentInjectorProviders(injector) {
  17987. const providerRecordsWithoutImportPaths = getFrameworkDIDebugData().resolverToProviders.get(injector) ?? [];
  17988. if (isPlatformInjector(injector)) {
  17989. return providerRecordsWithoutImportPaths;
  17990. }
  17991. const providerImportsContainer = getProviderImportsContainer(injector);
  17992. if (providerImportsContainer === null) {
  17993. return providerRecordsWithoutImportPaths;
  17994. }
  17995. const providerToPath = getProviderImportPaths(providerImportsContainer);
  17996. const providerRecords = [];
  17997. for (const providerRecord of providerRecordsWithoutImportPaths) {
  17998. const provider = providerRecord.provider;
  17999. const token = provider.provide;
  18000. if (token === ENVIRONMENT_INITIALIZER || token === INJECTOR_DEF_TYPES) {
  18001. continue;
  18002. }
  18003. let importPath = providerToPath.get(provider) ?? [];
  18004. const def = getComponentDef(providerImportsContainer);
  18005. const isStandaloneComponent2 = !!def?.standalone;
  18006. if (isStandaloneComponent2) {
  18007. importPath = [providerImportsContainer, ...importPath];
  18008. }
  18009. providerRecords.push(__spreadProps(__spreadValues({}, providerRecord), {
  18010. importPath
  18011. }));
  18012. }
  18013. return providerRecords;
  18014. }
  18015. function isPlatformInjector(injector) {
  18016. return injector instanceof R3Injector && injector.scopes.has("platform");
  18017. }
  18018. function getInjectorProviders(injector) {
  18019. if (injector instanceof NodeInjector) {
  18020. return getNodeInjectorProviders(injector);
  18021. } else if (injector instanceof EnvironmentInjector) {
  18022. return getEnvironmentInjectorProviders(injector);
  18023. }
  18024. throwError2("getInjectorProviders only supports NodeInjector and EnvironmentInjector");
  18025. }
  18026. function getInjectorMetadata(injector) {
  18027. if (injector instanceof NodeInjector) {
  18028. const lView = getNodeInjectorLView(injector);
  18029. const tNode = getNodeInjectorTNode(injector);
  18030. assertTNodeForLView(tNode, lView);
  18031. return {
  18032. type: "element",
  18033. source: getNativeByTNode(tNode, lView)
  18034. };
  18035. }
  18036. if (injector instanceof R3Injector) {
  18037. return {
  18038. type: "environment",
  18039. source: injector.source ?? null
  18040. };
  18041. }
  18042. if (injector instanceof NullInjector) {
  18043. return {
  18044. type: "null",
  18045. source: null
  18046. };
  18047. }
  18048. return null;
  18049. }
  18050. function getInjectorResolutionPath(injector) {
  18051. const resolutionPath = [injector];
  18052. getInjectorResolutionPathHelper(injector, resolutionPath);
  18053. return resolutionPath;
  18054. }
  18055. function getInjectorResolutionPathHelper(injector, resolutionPath) {
  18056. const parent = getInjectorParent(injector);
  18057. if (parent === null) {
  18058. if (injector instanceof NodeInjector) {
  18059. const firstInjector = resolutionPath[0];
  18060. if (firstInjector instanceof NodeInjector) {
  18061. const moduleInjector = getModuleInjectorOfNodeInjector(firstInjector);
  18062. if (moduleInjector === null) {
  18063. throwError2("NodeInjector must have some connection to the module injector tree");
  18064. }
  18065. resolutionPath.push(moduleInjector);
  18066. getInjectorResolutionPathHelper(moduleInjector, resolutionPath);
  18067. }
  18068. return resolutionPath;
  18069. }
  18070. } else {
  18071. resolutionPath.push(parent);
  18072. getInjectorResolutionPathHelper(parent, resolutionPath);
  18073. }
  18074. return resolutionPath;
  18075. }
  18076. function getInjectorParent(injector) {
  18077. if (injector instanceof R3Injector) {
  18078. const parent = injector.parent;
  18079. if (isRouterOutletInjector(parent)) {
  18080. return parent.parentInjector;
  18081. }
  18082. return parent;
  18083. }
  18084. let tNode;
  18085. let lView;
  18086. if (injector instanceof NodeInjector) {
  18087. tNode = getNodeInjectorTNode(injector);
  18088. lView = getNodeInjectorLView(injector);
  18089. } else if (injector instanceof NullInjector) {
  18090. return null;
  18091. } else if (injector instanceof ChainedInjector) {
  18092. return injector.parentInjector;
  18093. } else {
  18094. throwError2("getInjectorParent only support injectors of type R3Injector, NodeInjector, NullInjector");
  18095. }
  18096. const parentLocation = getParentInjectorLocation(tNode, lView);
  18097. if (hasParentInjector(parentLocation)) {
  18098. const parentInjectorIndex = getParentInjectorIndex(parentLocation);
  18099. const parentLView = getParentInjectorView(parentLocation, lView);
  18100. const parentTView = parentLView[TVIEW];
  18101. const parentTNode = parentTView.data[
  18102. parentInjectorIndex + 8
  18103. /* NodeInjectorOffset.TNODE */
  18104. ];
  18105. return new NodeInjector(parentTNode, parentLView);
  18106. } else {
  18107. const chainedInjector = lView[INJECTOR];
  18108. const injectorParent = chainedInjector.injector?.parent;
  18109. if (injectorParent instanceof NodeInjector) {
  18110. return injectorParent;
  18111. }
  18112. }
  18113. return null;
  18114. }
  18115. function getModuleInjectorOfNodeInjector(injector) {
  18116. let lView;
  18117. if (injector instanceof NodeInjector) {
  18118. lView = getNodeInjectorLView(injector);
  18119. } else {
  18120. throwError2("getModuleInjectorOfNodeInjector must be called with a NodeInjector");
  18121. }
  18122. const inj = lView[INJECTOR];
  18123. const moduleInjector = inj instanceof ChainedInjector ? inj.parentInjector : inj.parent;
  18124. if (!moduleInjector) {
  18125. throwError2("NodeInjector must have some connection to the module injector tree");
  18126. }
  18127. return moduleInjector;
  18128. }
  18129. function isComputedNode(node) {
  18130. return node.kind === "computed";
  18131. }
  18132. function isTemplateEffectNode(node) {
  18133. return node.kind === "template";
  18134. }
  18135. function isEffectNode(node) {
  18136. return node.kind === "effect";
  18137. }
  18138. function isSignalNode(node) {
  18139. return node.kind === "signal";
  18140. }
  18141. function getTemplateConsumer(injector) {
  18142. const tNode = getNodeInjectorTNode(injector);
  18143. assertTNode(tNode);
  18144. const lView = getNodeInjectorLView(injector);
  18145. assertLView(lView);
  18146. const templateLView = lView[tNode.index];
  18147. assertLView(templateLView);
  18148. return templateLView[REACTIVE_TEMPLATE_CONSUMER];
  18149. }
  18150. function getNodesAndEdgesFromSignalMap(signalMap) {
  18151. const nodes = Array.from(signalMap.keys());
  18152. const debugSignalGraphNodes = [];
  18153. const edges = [];
  18154. for (const [consumer, producers] of signalMap.entries()) {
  18155. const consumerIndex = nodes.indexOf(consumer);
  18156. if (isComputedNode(consumer) || isSignalNode(consumer)) {
  18157. debugSignalGraphNodes.push({
  18158. label: consumer.debugName,
  18159. value: consumer.value,
  18160. kind: consumer.kind
  18161. });
  18162. } else if (isTemplateEffectNode(consumer)) {
  18163. debugSignalGraphNodes.push({
  18164. label: consumer.debugName ?? consumer.lView?.[HOST]?.tagName?.toLowerCase?.(),
  18165. kind: consumer.kind
  18166. });
  18167. } else if (isEffectNode(consumer)) {
  18168. debugSignalGraphNodes.push({
  18169. label: consumer.debugName,
  18170. kind: consumer.kind
  18171. });
  18172. } else {
  18173. debugSignalGraphNodes.push({
  18174. label: consumer.debugName,
  18175. kind: consumer.kind
  18176. });
  18177. }
  18178. for (const producer of producers) {
  18179. edges.push({
  18180. consumer: consumerIndex,
  18181. producer: nodes.indexOf(producer)
  18182. });
  18183. }
  18184. }
  18185. return {
  18186. nodes: debugSignalGraphNodes,
  18187. edges
  18188. };
  18189. }
  18190. function extractEffectsFromInjector(injector) {
  18191. let diResolver = injector;
  18192. if (injector instanceof NodeInjector) {
  18193. const lView = getNodeInjectorLView(injector);
  18194. diResolver = lView;
  18195. }
  18196. const resolverToEffects = getFrameworkDIDebugData().resolverToEffects;
  18197. const effects = resolverToEffects.get(diResolver) ?? [];
  18198. return effects.map((effect2) => effect2[SIGNAL]);
  18199. }
  18200. function extractSignalNodesAndEdgesFromRoots(nodes, signalDependenciesMap = /* @__PURE__ */ new Map()) {
  18201. for (const node of nodes) {
  18202. if (signalDependenciesMap.has(node)) {
  18203. continue;
  18204. }
  18205. const producerNodes = node.producerNode ?? [];
  18206. signalDependenciesMap.set(node, producerNodes);
  18207. extractSignalNodesAndEdgesFromRoots(producerNodes, signalDependenciesMap);
  18208. }
  18209. return signalDependenciesMap;
  18210. }
  18211. function getSignalGraph(injector) {
  18212. let templateConsumer = null;
  18213. if (!(injector instanceof NodeInjector) && !(injector instanceof R3Injector)) {
  18214. return throwError2("getSignalGraph must be called with a NodeInjector or R3Injector");
  18215. }
  18216. if (injector instanceof NodeInjector) {
  18217. templateConsumer = getTemplateConsumer(injector);
  18218. }
  18219. const nonTemplateEffectNodes = extractEffectsFromInjector(injector);
  18220. const signalNodes = templateConsumer ? [templateConsumer, ...nonTemplateEffectNodes] : nonTemplateEffectNodes;
  18221. const signalDependenciesMap = extractSignalNodesAndEdgesFromRoots(signalNodes);
  18222. return getNodesAndEdgesFromSignalMap(signalDependenciesMap);
  18223. }
  18224. var GLOBAL_PUBLISH_EXPANDO_KEY = "ng";
  18225. var globalUtilsFunctions = {
  18226. /**
  18227. * Warning: functions that start with `ɵ` are considered *INTERNAL* and should not be relied upon
  18228. * in application's code. The contract of those functions might be changed in any release and/or a
  18229. * function can be removed completely.
  18230. */
  18231. "ɵgetDependenciesFromInjectable": getDependenciesFromInjectable,
  18232. "ɵgetInjectorProviders": getInjectorProviders,
  18233. "ɵgetInjectorResolutionPath": getInjectorResolutionPath,
  18234. "ɵgetInjectorMetadata": getInjectorMetadata,
  18235. "ɵsetProfiler": setProfiler,
  18236. "ɵgetSignalGraph": getSignalGraph,
  18237. "ɵgetDeferBlocks": getDeferBlocks,
  18238. "getDirectiveMetadata": getDirectiveMetadata$1,
  18239. "getComponent": getComponent,
  18240. "getContext": getContext,
  18241. "getListeners": getListeners,
  18242. "getOwningComponent": getOwningComponent,
  18243. "getHostElement": getHostElement,
  18244. "getInjector": getInjector,
  18245. "getRootComponents": getRootComponents,
  18246. "getDirectives": getDirectives,
  18247. "applyChanges": applyChanges,
  18248. "isSignal": isSignal
  18249. };
  18250. var _published = false;
  18251. function publishDefaultGlobalUtils$1() {
  18252. if (!_published) {
  18253. _published = true;
  18254. if (typeof window !== "undefined") {
  18255. setupFrameworkInjectorProfiler();
  18256. }
  18257. for (const [methodName, method] of Object.entries(globalUtilsFunctions)) {
  18258. publishGlobalUtil(methodName, method);
  18259. }
  18260. }
  18261. }
  18262. function publishGlobalUtil(name, fn) {
  18263. publishUtil(name, fn);
  18264. }
  18265. function publishExternalGlobalUtil(name, fn) {
  18266. publishUtil(name, fn);
  18267. }
  18268. function publishUtil(name, fn) {
  18269. if (typeof COMPILED === "undefined" || !COMPILED) {
  18270. const w = _global;
  18271. ngDevMode && assertDefined(fn, "function not defined");
  18272. w[GLOBAL_PUBLISH_EXPANDO_KEY] ??= {};
  18273. w[GLOBAL_PUBLISH_EXPANDO_KEY][name] = fn;
  18274. }
  18275. }
  18276. var TESTABILITY = new InjectionToken("");
  18277. var TESTABILITY_GETTER = new InjectionToken("");
  18278. var Testability = class _Testability {
  18279. _ngZone;
  18280. registry;
  18281. _isZoneStable = true;
  18282. _callbacks = [];
  18283. taskTrackingZone = null;
  18284. constructor(_ngZone, registry, testabilityGetter) {
  18285. this._ngZone = _ngZone;
  18286. this.registry = registry;
  18287. if (!_testabilityGetter) {
  18288. setTestabilityGetter(testabilityGetter);
  18289. testabilityGetter.addToWindow(registry);
  18290. }
  18291. this._watchAngularEvents();
  18292. _ngZone.run(() => {
  18293. this.taskTrackingZone = typeof Zone == "undefined" ? null : Zone.current.get("TaskTrackingZone");
  18294. });
  18295. }
  18296. _watchAngularEvents() {
  18297. this._ngZone.onUnstable.subscribe({
  18298. next: () => {
  18299. this._isZoneStable = false;
  18300. }
  18301. });
  18302. this._ngZone.runOutsideAngular(() => {
  18303. this._ngZone.onStable.subscribe({
  18304. next: () => {
  18305. NgZone.assertNotInAngularZone();
  18306. queueMicrotask(() => {
  18307. this._isZoneStable = true;
  18308. this._runCallbacksIfReady();
  18309. });
  18310. }
  18311. });
  18312. });
  18313. }
  18314. /**
  18315. * Whether an associated application is stable
  18316. */
  18317. isStable() {
  18318. return this._isZoneStable && !this._ngZone.hasPendingMacrotasks;
  18319. }
  18320. _runCallbacksIfReady() {
  18321. if (this.isStable()) {
  18322. queueMicrotask(() => {
  18323. while (this._callbacks.length !== 0) {
  18324. let cb = this._callbacks.pop();
  18325. clearTimeout(cb.timeoutId);
  18326. cb.doneCb();
  18327. }
  18328. });
  18329. } else {
  18330. let pending = this.getPendingTasks();
  18331. this._callbacks = this._callbacks.filter((cb) => {
  18332. if (cb.updateCb && cb.updateCb(pending)) {
  18333. clearTimeout(cb.timeoutId);
  18334. return false;
  18335. }
  18336. return true;
  18337. });
  18338. }
  18339. }
  18340. getPendingTasks() {
  18341. if (!this.taskTrackingZone) {
  18342. return [];
  18343. }
  18344. return this.taskTrackingZone.macroTasks.map((t) => {
  18345. return {
  18346. source: t.source,
  18347. // From TaskTrackingZone:
  18348. // https://github.com/angular/zone.js/blob/master/lib/zone-spec/task-tracking.ts#L40
  18349. creationLocation: t.creationLocation,
  18350. data: t.data
  18351. };
  18352. });
  18353. }
  18354. addCallback(cb, timeout2, updateCb) {
  18355. let timeoutId = -1;
  18356. if (timeout2 && timeout2 > 0) {
  18357. timeoutId = setTimeout(() => {
  18358. this._callbacks = this._callbacks.filter((cb2) => cb2.timeoutId !== timeoutId);
  18359. cb();
  18360. }, timeout2);
  18361. }
  18362. this._callbacks.push({
  18363. doneCb: cb,
  18364. timeoutId,
  18365. updateCb
  18366. });
  18367. }
  18368. /**
  18369. * Wait for the application to be stable with a timeout. If the timeout is reached before that
  18370. * happens, the callback receives a list of the macro tasks that were pending, otherwise null.
  18371. *
  18372. * @param doneCb The callback to invoke when Angular is stable or the timeout expires
  18373. * whichever comes first.
  18374. * @param timeout Optional. The maximum time to wait for Angular to become stable. If not
  18375. * specified, whenStable() will wait forever.
  18376. * @param updateCb Optional. If specified, this callback will be invoked whenever the set of
  18377. * pending macrotasks changes. If this callback returns true doneCb will not be invoked
  18378. * and no further updates will be issued.
  18379. */
  18380. whenStable(doneCb, timeout2, updateCb) {
  18381. if (updateCb && !this.taskTrackingZone) {
  18382. throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');
  18383. }
  18384. this.addCallback(doneCb, timeout2, updateCb);
  18385. this._runCallbacksIfReady();
  18386. }
  18387. /**
  18388. * Registers an application with a testability hook so that it can be tracked.
  18389. * @param token token of application, root element
  18390. *
  18391. * @internal
  18392. */
  18393. registerApplication(token) {
  18394. this.registry.registerApplication(token, this);
  18395. }
  18396. /**
  18397. * Unregisters an application.
  18398. * @param token token of application, root element
  18399. *
  18400. * @internal
  18401. */
  18402. unregisterApplication(token) {
  18403. this.registry.unregisterApplication(token);
  18404. }
  18405. /**
  18406. * Find providers by name
  18407. * @param using The root element to search from
  18408. * @param provider The name of binding variable
  18409. * @param exactMatch Whether using exactMatch
  18410. */
  18411. findProviders(using2, provider, exactMatch) {
  18412. return [];
  18413. }
  18414. static ɵfac = function Testability_Factory(__ngFactoryType__) {
  18415. return new (__ngFactoryType__ || _Testability)(ɵɵinject(NgZone), ɵɵinject(TestabilityRegistry), ɵɵinject(TESTABILITY_GETTER));
  18416. };
  18417. static ɵprov = ɵɵdefineInjectable({
  18418. token: _Testability,
  18419. factory: _Testability.ɵfac
  18420. });
  18421. };
  18422. (() => {
  18423. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Testability, [{
  18424. type: Injectable
  18425. }], () => [{
  18426. type: NgZone
  18427. }, {
  18428. type: TestabilityRegistry
  18429. }, {
  18430. type: void 0,
  18431. decorators: [{
  18432. type: Inject,
  18433. args: [TESTABILITY_GETTER]
  18434. }]
  18435. }], null);
  18436. })();
  18437. var TestabilityRegistry = class _TestabilityRegistry {
  18438. /** @internal */
  18439. _applications = /* @__PURE__ */ new Map();
  18440. /**
  18441. * Registers an application with a testability hook so that it can be tracked
  18442. * @param token token of application, root element
  18443. * @param testability Testability hook
  18444. */
  18445. registerApplication(token, testability) {
  18446. this._applications.set(token, testability);
  18447. }
  18448. /**
  18449. * Unregisters an application.
  18450. * @param token token of application, root element
  18451. */
  18452. unregisterApplication(token) {
  18453. this._applications.delete(token);
  18454. }
  18455. /**
  18456. * Unregisters all applications
  18457. */
  18458. unregisterAllApplications() {
  18459. this._applications.clear();
  18460. }
  18461. /**
  18462. * Get a testability hook associated with the application
  18463. * @param elem root element
  18464. */
  18465. getTestability(elem) {
  18466. return this._applications.get(elem) || null;
  18467. }
  18468. /**
  18469. * Get all registered testabilities
  18470. */
  18471. getAllTestabilities() {
  18472. return Array.from(this._applications.values());
  18473. }
  18474. /**
  18475. * Get all registered applications(root elements)
  18476. */
  18477. getAllRootElements() {
  18478. return Array.from(this._applications.keys());
  18479. }
  18480. /**
  18481. * Find testability of a node in the Tree
  18482. * @param elem node
  18483. * @param findInAncestors whether finding testability in ancestors if testability was not found in
  18484. * current node
  18485. */
  18486. findTestabilityInTree(elem, findInAncestors = true) {
  18487. return _testabilityGetter?.findTestabilityInTree(this, elem, findInAncestors) ?? null;
  18488. }
  18489. static ɵfac = function TestabilityRegistry_Factory(__ngFactoryType__) {
  18490. return new (__ngFactoryType__ || _TestabilityRegistry)();
  18491. };
  18492. static ɵprov = ɵɵdefineInjectable({
  18493. token: _TestabilityRegistry,
  18494. factory: _TestabilityRegistry.ɵfac,
  18495. providedIn: "platform"
  18496. });
  18497. };
  18498. (() => {
  18499. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TestabilityRegistry, [{
  18500. type: Injectable,
  18501. args: [{
  18502. providedIn: "platform"
  18503. }]
  18504. }], null, null);
  18505. })();
  18506. function setTestabilityGetter(getter) {
  18507. _testabilityGetter = getter;
  18508. }
  18509. var _testabilityGetter;
  18510. var EffectScheduler = class _EffectScheduler {
  18511. /** @nocollapse */
  18512. static ɵprov = (
  18513. /** @pureOrBreakMyCode */
  18514. ɵɵdefineInjectable({
  18515. token: _EffectScheduler,
  18516. providedIn: "root",
  18517. factory: () => new ZoneAwareEffectScheduler()
  18518. })
  18519. );
  18520. };
  18521. var ZoneAwareEffectScheduler = class {
  18522. queuedEffectCount = 0;
  18523. queues = /* @__PURE__ */ new Map();
  18524. schedule(handle) {
  18525. this.enqueue(handle);
  18526. }
  18527. remove(handle) {
  18528. const zone = handle.zone;
  18529. const queue2 = this.queues.get(zone);
  18530. if (!queue2.has(handle)) {
  18531. return;
  18532. }
  18533. queue2.delete(handle);
  18534. this.queuedEffectCount--;
  18535. }
  18536. enqueue(handle) {
  18537. const zone = handle.zone;
  18538. if (!this.queues.has(zone)) {
  18539. this.queues.set(zone, /* @__PURE__ */ new Set());
  18540. }
  18541. const queue2 = this.queues.get(zone);
  18542. if (queue2.has(handle)) {
  18543. return;
  18544. }
  18545. this.queuedEffectCount++;
  18546. queue2.add(handle);
  18547. }
  18548. /**
  18549. * Run all scheduled effects.
  18550. *
  18551. * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
  18552. * ordering guarantee between effects scheduled in different zones.
  18553. */
  18554. flush() {
  18555. while (this.queuedEffectCount > 0) {
  18556. for (const [zone, queue2] of this.queues) {
  18557. if (zone === null) {
  18558. this.flushQueue(queue2);
  18559. } else {
  18560. zone.run(() => this.flushQueue(queue2));
  18561. }
  18562. }
  18563. }
  18564. }
  18565. flushQueue(queue2) {
  18566. for (const handle of queue2) {
  18567. queue2.delete(handle);
  18568. this.queuedEffectCount--;
  18569. handle.run();
  18570. }
  18571. }
  18572. };
  18573. function isPromise2(obj) {
  18574. return !!obj && typeof obj.then === "function";
  18575. }
  18576. function isSubscribable(obj) {
  18577. return !!obj && typeof obj.subscribe === "function";
  18578. }
  18579. var APP_INITIALIZER = new InjectionToken(ngDevMode ? "Application Initializer" : "");
  18580. function provideAppInitializer(initializerFn) {
  18581. return makeEnvironmentProviders([{
  18582. provide: APP_INITIALIZER,
  18583. multi: true,
  18584. useValue: initializerFn
  18585. }]);
  18586. }
  18587. var ApplicationInitStatus = class _ApplicationInitStatus {
  18588. // Using non null assertion, these fields are defined below
  18589. // within the `new Promise` callback (synchronously).
  18590. resolve;
  18591. reject;
  18592. initialized = false;
  18593. done = false;
  18594. donePromise = new Promise((res, rej) => {
  18595. this.resolve = res;
  18596. this.reject = rej;
  18597. });
  18598. appInits = inject(APP_INITIALIZER, {
  18599. optional: true
  18600. }) ?? [];
  18601. injector = inject(Injector);
  18602. constructor() {
  18603. if ((typeof ngDevMode === "undefined" || ngDevMode) && !Array.isArray(this.appInits)) {
  18604. throw new RuntimeError(-209, `Unexpected type of the \`APP_INITIALIZER\` token value (expected an array, but got ${typeof this.appInits}). Please check that the \`APP_INITIALIZER\` token is configured as a \`multi: true\` provider.`);
  18605. }
  18606. }
  18607. /** @internal */
  18608. runInitializers() {
  18609. if (this.initialized) {
  18610. return;
  18611. }
  18612. const asyncInitPromises = [];
  18613. for (const appInits of this.appInits) {
  18614. const initResult = runInInjectionContext(this.injector, appInits);
  18615. if (isPromise2(initResult)) {
  18616. asyncInitPromises.push(initResult);
  18617. } else if (isSubscribable(initResult)) {
  18618. const observableAsPromise = new Promise((resolve, reject) => {
  18619. initResult.subscribe({
  18620. complete: resolve,
  18621. error: reject
  18622. });
  18623. });
  18624. asyncInitPromises.push(observableAsPromise);
  18625. }
  18626. }
  18627. const complete = () => {
  18628. this.done = true;
  18629. this.resolve();
  18630. };
  18631. Promise.all(asyncInitPromises).then(() => {
  18632. complete();
  18633. }).catch((e) => {
  18634. this.reject(e);
  18635. });
  18636. if (asyncInitPromises.length === 0) {
  18637. complete();
  18638. }
  18639. this.initialized = true;
  18640. }
  18641. static ɵfac = function ApplicationInitStatus_Factory(__ngFactoryType__) {
  18642. return new (__ngFactoryType__ || _ApplicationInitStatus)();
  18643. };
  18644. static ɵprov = ɵɵdefineInjectable({
  18645. token: _ApplicationInitStatus,
  18646. factory: _ApplicationInitStatus.ɵfac,
  18647. providedIn: "root"
  18648. });
  18649. };
  18650. (() => {
  18651. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationInitStatus, [{
  18652. type: Injectable,
  18653. args: [{
  18654. providedIn: "root"
  18655. }]
  18656. }], () => [], null);
  18657. })();
  18658. var APP_BOOTSTRAP_LISTENER = new InjectionToken(ngDevMode ? "appBootstrapListener" : "");
  18659. function publishDefaultGlobalUtils() {
  18660. ngDevMode && publishDefaultGlobalUtils$1();
  18661. }
  18662. function publishSignalConfiguration() {
  18663. setThrowInvalidWriteToSignalError(() => {
  18664. throw new RuntimeError(600, ngDevMode && "Writing to signals is not allowed in a `computed`.");
  18665. });
  18666. }
  18667. function isBoundToModule(cf) {
  18668. return cf.isBoundToModule;
  18669. }
  18670. var NgProbeToken = class {
  18671. name;
  18672. token;
  18673. constructor(name, token) {
  18674. this.name = name;
  18675. this.token = token;
  18676. }
  18677. };
  18678. var MAXIMUM_REFRESH_RERUNS = 10;
  18679. function optionsReducer(dst, objs) {
  18680. if (Array.isArray(objs)) {
  18681. return objs.reduce(optionsReducer, dst);
  18682. }
  18683. return __spreadValues(__spreadValues({}, dst), objs);
  18684. }
  18685. var ApplicationRef = class _ApplicationRef {
  18686. /** @internal */
  18687. _runningTick = false;
  18688. _destroyed = false;
  18689. _destroyListeners = [];
  18690. /** @internal */
  18691. _views = [];
  18692. internalErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
  18693. afterRenderManager = inject(AfterRenderManager);
  18694. zonelessEnabled = inject(ZONELESS_ENABLED);
  18695. rootEffectScheduler = inject(EffectScheduler);
  18696. /**
  18697. * Current dirty state of the application across a number of dimensions (views, afterRender hooks,
  18698. * etc).
  18699. *
  18700. * A flag set here means that `tick()` will attempt to resolve the dirtiness when executed.
  18701. *
  18702. * @internal
  18703. */
  18704. dirtyFlags = 0;
  18705. /**
  18706. * Most recent snapshot from the `TracingService`, if any.
  18707. *
  18708. * This snapshot attempts to capture the context when `tick()` was first
  18709. * scheduled. It then runs wrapped in this context.
  18710. *
  18711. * @internal
  18712. */
  18713. tracingSnapshot = null;
  18714. // Needed for ComponentFixture temporarily during migration of autoDetect behavior
  18715. // Eventually the hostView of the fixture should just attach to ApplicationRef.
  18716. externalTestViews = /* @__PURE__ */ new Set();
  18717. /** @internal */
  18718. afterTick = new Subject();
  18719. /** @internal */
  18720. get allViews() {
  18721. return [...this.externalTestViews.keys(), ...this._views];
  18722. }
  18723. /**
  18724. * Indicates whether this instance was destroyed.
  18725. */
  18726. get destroyed() {
  18727. return this._destroyed;
  18728. }
  18729. /**
  18730. * Get a list of component types registered to this application.
  18731. * This list is populated even before the component is created.
  18732. */
  18733. componentTypes = [];
  18734. /**
  18735. * Get a list of components registered to this application.
  18736. */
  18737. components = [];
  18738. /**
  18739. * Returns an Observable that indicates when the application is stable or unstable.
  18740. */
  18741. isStable = inject(PendingTasksInternal).hasPendingTasks.pipe(map((pending) => !pending));
  18742. constructor() {
  18743. inject(TracingService, {
  18744. optional: true
  18745. });
  18746. }
  18747. /**
  18748. * @returns A promise that resolves when the application becomes stable
  18749. */
  18750. whenStable() {
  18751. let subscription;
  18752. return new Promise((resolve) => {
  18753. subscription = this.isStable.subscribe({
  18754. next: (stable) => {
  18755. if (stable) {
  18756. resolve();
  18757. }
  18758. }
  18759. });
  18760. }).finally(() => {
  18761. subscription.unsubscribe();
  18762. });
  18763. }
  18764. _injector = inject(EnvironmentInjector);
  18765. _rendererFactory = null;
  18766. /**
  18767. * The `EnvironmentInjector` used to create this application.
  18768. */
  18769. get injector() {
  18770. return this._injector;
  18771. }
  18772. /**
  18773. * Bootstrap a component onto the element identified by its selector or, optionally, to a
  18774. * specified element.
  18775. *
  18776. * @usageNotes
  18777. * ### Bootstrap process
  18778. *
  18779. * When bootstrapping a component, Angular mounts it onto a target DOM element
  18780. * and kicks off automatic change detection. The target DOM element can be
  18781. * provided using the `rootSelectorOrNode` argument.
  18782. *
  18783. * If the target DOM element is not provided, Angular tries to find one on a page
  18784. * using the `selector` of the component that is being bootstrapped
  18785. * (first matched element is used).
  18786. *
  18787. * ### Example
  18788. *
  18789. * Generally, we define the component to bootstrap in the `bootstrap` array of `NgModule`,
  18790. * but it requires us to know the component while writing the application code.
  18791. *
  18792. * Imagine a situation where we have to wait for an API call to decide about the component to
  18793. * bootstrap. We can use the `ngDoBootstrap` hook of the `NgModule` and call this method to
  18794. * dynamically bootstrap a component.
  18795. *
  18796. * {@example core/ts/platform/platform.ts region='componentSelector'}
  18797. *
  18798. * Optionally, a component can be mounted onto a DOM element that does not match the
  18799. * selector of the bootstrapped component.
  18800. *
  18801. * In the following example, we are providing a CSS selector to match the target element.
  18802. *
  18803. * {@example core/ts/platform/platform.ts region='cssSelector'}
  18804. *
  18805. * While in this example, we are providing reference to a DOM node.
  18806. *
  18807. * {@example core/ts/platform/platform.ts region='domNode'}
  18808. */
  18809. bootstrap(componentOrFactory, rootSelectorOrNode) {
  18810. profiler(
  18811. 10
  18812. /* ProfilerEvent.BootstrapComponentStart */
  18813. );
  18814. (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
  18815. const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
  18816. const initStatus = this._injector.get(ApplicationInitStatus);
  18817. if (!initStatus.done) {
  18818. let errorMessage = "";
  18819. if (typeof ngDevMode === "undefined" || ngDevMode) {
  18820. const standalone = !isComponentFactory && isStandalone(componentOrFactory);
  18821. errorMessage = "Cannot bootstrap as there are still asynchronous initializers running." + (standalone ? "" : " Bootstrap components in the `ngDoBootstrap` method of the root module.");
  18822. }
  18823. throw new RuntimeError(405, errorMessage);
  18824. }
  18825. let componentFactory;
  18826. if (isComponentFactory) {
  18827. componentFactory = componentOrFactory;
  18828. } else {
  18829. const resolver = this._injector.get(ComponentFactoryResolver$1);
  18830. componentFactory = resolver.resolveComponentFactory(componentOrFactory);
  18831. }
  18832. this.componentTypes.push(componentFactory.componentType);
  18833. const ngModule = isBoundToModule(componentFactory) ? void 0 : this._injector.get(NgModuleRef$1);
  18834. const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
  18835. const compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
  18836. const nativeElement = compRef.location.nativeElement;
  18837. const testability = compRef.injector.get(TESTABILITY, null);
  18838. testability?.registerApplication(nativeElement);
  18839. compRef.onDestroy(() => {
  18840. this.detachView(compRef.hostView);
  18841. remove(this.components, compRef);
  18842. testability?.unregisterApplication(nativeElement);
  18843. });
  18844. this._loadComponent(compRef);
  18845. if (typeof ngDevMode === "undefined" || ngDevMode) {
  18846. const _console = this._injector.get(Console);
  18847. _console.log(`Angular is running in development mode.`);
  18848. }
  18849. profiler(11, compRef);
  18850. return compRef;
  18851. }
  18852. /**
  18853. * Invoke this method to explicitly process change detection and its side-effects.
  18854. *
  18855. * In development mode, `tick()` also performs a second change detection cycle to ensure that no
  18856. * further changes are detected. If additional changes are picked up during this second cycle,
  18857. * bindings in the app have side-effects that cannot be resolved in a single change detection
  18858. * pass.
  18859. * In this case, Angular throws an error, since an Angular application can only have one change
  18860. * detection pass during which all change detection must complete.
  18861. */
  18862. tick() {
  18863. if (!this.zonelessEnabled) {
  18864. this.dirtyFlags |= 1;
  18865. }
  18866. this._tick();
  18867. }
  18868. /** @internal */
  18869. _tick() {
  18870. profiler(
  18871. 12
  18872. /* ProfilerEvent.ChangeDetectionStart */
  18873. );
  18874. if (this.tracingSnapshot !== null) {
  18875. this.tracingSnapshot.run(TracingAction.CHANGE_DETECTION, this.tickImpl);
  18876. } else {
  18877. this.tickImpl();
  18878. }
  18879. }
  18880. tickImpl = () => {
  18881. (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
  18882. if (this._runningTick) {
  18883. throw new RuntimeError(101, ngDevMode && "ApplicationRef.tick is called recursively");
  18884. }
  18885. const prevConsumer = setActiveConsumer(null);
  18886. try {
  18887. this._runningTick = true;
  18888. this.synchronize();
  18889. if (typeof ngDevMode === "undefined" || ngDevMode) {
  18890. for (let view of this.allViews) {
  18891. view.checkNoChanges();
  18892. }
  18893. }
  18894. } catch (e) {
  18895. this.internalErrorHandler(e);
  18896. } finally {
  18897. this._runningTick = false;
  18898. this.tracingSnapshot?.dispose();
  18899. this.tracingSnapshot = null;
  18900. setActiveConsumer(prevConsumer);
  18901. this.afterTick.next();
  18902. profiler(
  18903. 13
  18904. /* ProfilerEvent.ChangeDetectionEnd */
  18905. );
  18906. }
  18907. };
  18908. /**
  18909. * Performs the core work of synchronizing the application state with the UI, resolving any
  18910. * pending dirtiness (potentially in a loop).
  18911. */
  18912. synchronize() {
  18913. if (this._rendererFactory === null && !this._injector.destroyed) {
  18914. this._rendererFactory = this._injector.get(RendererFactory2, null, {
  18915. optional: true
  18916. });
  18917. }
  18918. let runs = 0;
  18919. while (this.dirtyFlags !== 0 && runs++ < MAXIMUM_REFRESH_RERUNS) {
  18920. profiler(
  18921. 14
  18922. /* ProfilerEvent.ChangeDetectionSyncStart */
  18923. );
  18924. this.synchronizeOnce();
  18925. profiler(
  18926. 15
  18927. /* ProfilerEvent.ChangeDetectionSyncEnd */
  18928. );
  18929. }
  18930. if ((typeof ngDevMode === "undefined" || ngDevMode) && runs >= MAXIMUM_REFRESH_RERUNS) {
  18931. throw new RuntimeError(103, ngDevMode && "Infinite change detection while refreshing application views. Ensure views are not calling `markForCheck` on every template execution or that afterRender hooks always mark views for check.");
  18932. }
  18933. }
  18934. /**
  18935. * Perform a single synchronization pass.
  18936. */
  18937. synchronizeOnce() {
  18938. if (this.dirtyFlags & 16) {
  18939. this.dirtyFlags &= -17;
  18940. this.rootEffectScheduler.flush();
  18941. }
  18942. if (this.dirtyFlags & 7) {
  18943. const useGlobalCheck = Boolean(
  18944. this.dirtyFlags & 1
  18945. /* ApplicationRefDirtyFlags.ViewTreeGlobal */
  18946. );
  18947. this.dirtyFlags &= -8;
  18948. this.dirtyFlags |= 8;
  18949. for (let {
  18950. _lView,
  18951. notifyErrorHandler
  18952. } of this.allViews) {
  18953. detectChangesInViewIfRequired(_lView, notifyErrorHandler, useGlobalCheck, this.zonelessEnabled);
  18954. }
  18955. this.dirtyFlags &= -5;
  18956. this.syncDirtyFlagsWithViews();
  18957. if (this.dirtyFlags & (7 | 16)) {
  18958. return;
  18959. }
  18960. } else {
  18961. this._rendererFactory?.begin?.();
  18962. this._rendererFactory?.end?.();
  18963. }
  18964. if (this.dirtyFlags & 8) {
  18965. this.dirtyFlags &= -9;
  18966. this.afterRenderManager.execute();
  18967. }
  18968. this.syncDirtyFlagsWithViews();
  18969. }
  18970. /**
  18971. * Checks `allViews` for views which require refresh/traversal, and updates `dirtyFlags`
  18972. * accordingly, with two potential behaviors:
  18973. *
  18974. * 1. If any of our views require updating, then this adds the `ViewTreeTraversal` dirty flag.
  18975. * This _should_ be a no-op, since the scheduler should've added the flag at the same time the
  18976. * view was marked as needing updating.
  18977. *
  18978. * TODO(alxhub): figure out if this behavior is still needed for edge cases.
  18979. *
  18980. * 2. If none of our views require updating, then clear the view-related `dirtyFlag`s. This
  18981. * happens when the scheduler is notified of a view becoming dirty, but the view itself isn't
  18982. * reachable through traversal from our roots (e.g. it's detached from the CD tree).
  18983. */
  18984. syncDirtyFlagsWithViews() {
  18985. if (this.allViews.some(({
  18986. _lView
  18987. }) => requiresRefreshOrTraversal(_lView))) {
  18988. this.dirtyFlags |= 2;
  18989. return;
  18990. } else {
  18991. this.dirtyFlags &= -8;
  18992. }
  18993. }
  18994. /**
  18995. * Attaches a view so that it will be dirty checked.
  18996. * The view will be automatically detached when it is destroyed.
  18997. * This will throw if the view is already attached to a ViewContainer.
  18998. */
  18999. attachView(viewRef) {
  19000. (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
  19001. const view = viewRef;
  19002. this._views.push(view);
  19003. view.attachToAppRef(this);
  19004. }
  19005. /**
  19006. * Detaches a view from dirty checking again.
  19007. */
  19008. detachView(viewRef) {
  19009. (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
  19010. const view = viewRef;
  19011. remove(this._views, view);
  19012. view.detachFromAppRef();
  19013. }
  19014. _loadComponent(componentRef) {
  19015. this.attachView(componentRef.hostView);
  19016. this.tick();
  19017. this.components.push(componentRef);
  19018. const listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []);
  19019. if (ngDevMode && !Array.isArray(listeners)) {
  19020. throw new RuntimeError(-209, `Unexpected type of the \`APP_BOOTSTRAP_LISTENER\` token value (expected an array, but got ${typeof listeners}). Please check that the \`APP_BOOTSTRAP_LISTENER\` token is configured as a \`multi: true\` provider.`);
  19021. }
  19022. listeners.forEach((listener) => listener(componentRef));
  19023. }
  19024. /** @internal */
  19025. ngOnDestroy() {
  19026. if (this._destroyed) return;
  19027. try {
  19028. this._destroyListeners.forEach((listener) => listener());
  19029. this._views.slice().forEach((view) => view.destroy());
  19030. } finally {
  19031. this._destroyed = true;
  19032. this._views = [];
  19033. this._destroyListeners = [];
  19034. }
  19035. }
  19036. /**
  19037. * Registers a listener to be called when an instance is destroyed.
  19038. *
  19039. * @param callback A callback function to add as a listener.
  19040. * @returns A function which unregisters a listener.
  19041. */
  19042. onDestroy(callback) {
  19043. (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
  19044. this._destroyListeners.push(callback);
  19045. return () => remove(this._destroyListeners, callback);
  19046. }
  19047. /**
  19048. * Destroys an Angular application represented by this `ApplicationRef`. Calling this function
  19049. * will destroy the associated environment injectors as well as all the bootstrapped components
  19050. * with their views.
  19051. */
  19052. destroy() {
  19053. if (this._destroyed) {
  19054. throw new RuntimeError(406, ngDevMode && "This instance of the `ApplicationRef` has already been destroyed.");
  19055. }
  19056. const injector = this._injector;
  19057. if (injector.destroy && !injector.destroyed) {
  19058. injector.destroy();
  19059. }
  19060. }
  19061. /**
  19062. * Returns the number of attached views.
  19063. */
  19064. get viewCount() {
  19065. return this._views.length;
  19066. }
  19067. static ɵfac = function ApplicationRef_Factory(__ngFactoryType__) {
  19068. return new (__ngFactoryType__ || _ApplicationRef)();
  19069. };
  19070. static ɵprov = ɵɵdefineInjectable({
  19071. token: _ApplicationRef,
  19072. factory: _ApplicationRef.ɵfac,
  19073. providedIn: "root"
  19074. });
  19075. };
  19076. (() => {
  19077. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
  19078. type: Injectable,
  19079. args: [{
  19080. providedIn: "root"
  19081. }]
  19082. }], () => [], null);
  19083. })();
  19084. function warnIfDestroyed(destroyed) {
  19085. if (destroyed) {
  19086. console.warn(formatRuntimeError(406, "This instance of the `ApplicationRef` has already been destroyed."));
  19087. }
  19088. }
  19089. function remove(list, el) {
  19090. const index = list.indexOf(el);
  19091. if (index > -1) {
  19092. list.splice(index, 1);
  19093. }
  19094. }
  19095. function detectChangesInViewIfRequired(lView, notifyErrorHandler, isFirstPass, zonelessEnabled) {
  19096. if (!isFirstPass && !requiresRefreshOrTraversal(lView)) {
  19097. return;
  19098. }
  19099. const mode = isFirstPass && !zonelessEnabled ? (
  19100. // The first pass is always in Global mode, which includes `CheckAlways` views.
  19101. 0
  19102. ) : (
  19103. // Only refresh views with the `RefreshView` flag or views is a changed signal
  19104. 1
  19105. );
  19106. detectChangesInternal(lView, notifyErrorHandler, mode);
  19107. }
  19108. function scheduleDelayedTrigger(scheduleFn) {
  19109. const lView = getLView();
  19110. const tNode = getCurrentTNode();
  19111. renderPlaceholder(lView, tNode);
  19112. if (!shouldTriggerDeferBlock(0, lView)) return;
  19113. const injector = lView[INJECTOR];
  19114. const lDetails = getLDeferBlockDetails(lView, tNode);
  19115. const cleanupFn = scheduleFn(() => triggerDeferBlock(0, lView, tNode), injector);
  19116. storeTriggerCleanupFn(0, lDetails, cleanupFn);
  19117. }
  19118. function scheduleDelayedPrefetching(scheduleFn, trigger) {
  19119. if (false) return;
  19120. const lView = getLView();
  19121. const injector = lView[INJECTOR];
  19122. const tNode = getCurrentTNode();
  19123. const tView = lView[TVIEW];
  19124. const tDetails = getTDeferBlockDetails(tView, tNode);
  19125. if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
  19126. const lDetails = getLDeferBlockDetails(lView, tNode);
  19127. const prefetch = () => triggerPrefetching(tDetails, lView, tNode);
  19128. const cleanupFn = scheduleFn(prefetch, injector);
  19129. storeTriggerCleanupFn(1, lDetails, cleanupFn);
  19130. }
  19131. }
  19132. function scheduleDelayedHydrating(scheduleFn, lView, tNode) {
  19133. if (false) return;
  19134. const injector = lView[INJECTOR];
  19135. const lDetails = getLDeferBlockDetails(lView, tNode);
  19136. const ssrUniqueId = lDetails[SSR_UNIQUE_ID];
  19137. ngDevMode && assertSsrIdDefined(ssrUniqueId);
  19138. const cleanupFn = scheduleFn(() => triggerHydrationFromBlockName(injector, ssrUniqueId), injector);
  19139. storeTriggerCleanupFn(2, lDetails, cleanupFn);
  19140. }
  19141. function triggerPrefetching(tDetails, lView, tNode) {
  19142. triggerResourceLoading(tDetails, lView, tNode);
  19143. }
  19144. function triggerResourceLoading(tDetails, lView, tNode) {
  19145. const injector = lView[INJECTOR];
  19146. const tView = lView[TVIEW];
  19147. if (tDetails.loadingState !== DeferDependenciesLoadingState.NOT_STARTED) {
  19148. return tDetails.loadingPromise ?? Promise.resolve();
  19149. }
  19150. const lDetails = getLDeferBlockDetails(lView, tNode);
  19151. const primaryBlockTNode = getPrimaryBlockTNode(tView, tDetails);
  19152. tDetails.loadingState = DeferDependenciesLoadingState.IN_PROGRESS;
  19153. invokeTriggerCleanupFns(1, lDetails);
  19154. let dependenciesFn = tDetails.dependencyResolverFn;
  19155. if (ngDevMode) {
  19156. const deferDependencyInterceptor = injector.get(DEFER_BLOCK_DEPENDENCY_INTERCEPTOR, null, {
  19157. optional: true
  19158. });
  19159. if (deferDependencyInterceptor) {
  19160. dependenciesFn = deferDependencyInterceptor.intercept(dependenciesFn);
  19161. }
  19162. }
  19163. const pendingTasks = injector.get(PendingTasksInternal);
  19164. const taskId = pendingTasks.add();
  19165. if (!dependenciesFn) {
  19166. tDetails.loadingPromise = Promise.resolve().then(() => {
  19167. tDetails.loadingPromise = null;
  19168. tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
  19169. pendingTasks.remove(taskId);
  19170. });
  19171. return tDetails.loadingPromise;
  19172. }
  19173. tDetails.loadingPromise = Promise.allSettled(dependenciesFn()).then((results) => {
  19174. let failed = false;
  19175. const directiveDefs = [];
  19176. const pipeDefs = [];
  19177. for (const result of results) {
  19178. if (result.status === "fulfilled") {
  19179. const dependency = result.value;
  19180. const directiveDef = getComponentDef(dependency) || getDirectiveDef(dependency);
  19181. if (directiveDef) {
  19182. directiveDefs.push(directiveDef);
  19183. } else {
  19184. const pipeDef = getPipeDef$1(dependency);
  19185. if (pipeDef) {
  19186. pipeDefs.push(pipeDef);
  19187. }
  19188. }
  19189. } else {
  19190. failed = true;
  19191. break;
  19192. }
  19193. }
  19194. tDetails.loadingPromise = null;
  19195. pendingTasks.remove(taskId);
  19196. if (failed) {
  19197. tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
  19198. if (tDetails.errorTmplIndex === null) {
  19199. const templateLocation = ngDevMode ? getTemplateLocationDetails(lView) : "";
  19200. const error = new RuntimeError(-750, ngDevMode && `Loading dependencies for \`@defer\` block failed, but no \`@error\` block was configured${templateLocation}. Consider using the \`@error\` block to render an error state.`);
  19201. handleError$1(lView, error);
  19202. }
  19203. } else {
  19204. tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
  19205. const primaryBlockTView = primaryBlockTNode.tView;
  19206. if (directiveDefs.length > 0) {
  19207. primaryBlockTView.directiveRegistry = addDepsToRegistry(primaryBlockTView.directiveRegistry, directiveDefs);
  19208. const directiveTypes = directiveDefs.map((def) => def.type);
  19209. const providers = internalImportProvidersFrom(false, ...directiveTypes);
  19210. tDetails.providers = providers;
  19211. }
  19212. if (pipeDefs.length > 0) {
  19213. primaryBlockTView.pipeRegistry = addDepsToRegistry(primaryBlockTView.pipeRegistry, pipeDefs);
  19214. }
  19215. }
  19216. });
  19217. return tDetails.loadingPromise;
  19218. }
  19219. function shouldTriggerDeferBlock(triggerType, lView) {
  19220. if (triggerType === 0 && true && false) {
  19221. return false;
  19222. }
  19223. const injector = lView[INJECTOR];
  19224. const config2 = injector.get(DEFER_BLOCK_CONFIG, null, {
  19225. optional: true
  19226. });
  19227. if (config2?.behavior === DeferBlockBehavior.Manual) {
  19228. return false;
  19229. }
  19230. return true;
  19231. }
  19232. function triggerDeferBlock(triggerType, lView, tNode) {
  19233. const tView = lView[TVIEW];
  19234. const lContainer = lView[tNode.index];
  19235. ngDevMode && assertLContainer(lContainer);
  19236. if (!shouldTriggerDeferBlock(triggerType, lView)) return;
  19237. const lDetails = getLDeferBlockDetails(lView, tNode);
  19238. const tDetails = getTDeferBlockDetails(tView, tNode);
  19239. invokeAllTriggerCleanupFns(lDetails);
  19240. switch (tDetails.loadingState) {
  19241. case DeferDependenciesLoadingState.NOT_STARTED:
  19242. renderDeferBlockState(DeferBlockState.Loading, tNode, lContainer);
  19243. triggerResourceLoading(tDetails, lView, tNode);
  19244. if (tDetails.loadingState === DeferDependenciesLoadingState.IN_PROGRESS) {
  19245. renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer);
  19246. }
  19247. break;
  19248. case DeferDependenciesLoadingState.IN_PROGRESS:
  19249. renderDeferBlockState(DeferBlockState.Loading, tNode, lContainer);
  19250. renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer);
  19251. break;
  19252. case DeferDependenciesLoadingState.COMPLETE:
  19253. ngDevMode && assertDeferredDependenciesLoaded(tDetails);
  19254. renderDeferBlockState(DeferBlockState.Complete, tNode, lContainer);
  19255. break;
  19256. case DeferDependenciesLoadingState.FAILED:
  19257. renderDeferBlockState(DeferBlockState.Error, tNode, lContainer);
  19258. break;
  19259. default:
  19260. if (ngDevMode) {
  19261. throwError2("Unknown defer block state");
  19262. }
  19263. }
  19264. }
  19265. function triggerHydrationFromBlockName(injector, blockName, replayQueuedEventsFn) {
  19266. return __async(this, null, function* () {
  19267. const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  19268. const blocksBeingHydrated = dehydratedBlockRegistry.hydrating;
  19269. if (blocksBeingHydrated.has(blockName)) {
  19270. return;
  19271. }
  19272. const {
  19273. parentBlockPromise,
  19274. hydrationQueue
  19275. } = getParentBlockHydrationQueue(blockName, injector);
  19276. if (hydrationQueue.length === 0) return;
  19277. if (parentBlockPromise !== null) {
  19278. hydrationQueue.shift();
  19279. }
  19280. populateHydratingStateForQueue(dehydratedBlockRegistry, hydrationQueue);
  19281. if (parentBlockPromise !== null) {
  19282. yield parentBlockPromise;
  19283. }
  19284. const topmostParentBlock = hydrationQueue[0];
  19285. if (dehydratedBlockRegistry.has(topmostParentBlock)) {
  19286. yield triggerHydrationForBlockQueue(injector, hydrationQueue, replayQueuedEventsFn);
  19287. } else {
  19288. dehydratedBlockRegistry.awaitParentBlock(topmostParentBlock, () => __async(this, null, function* () {
  19289. return yield triggerHydrationForBlockQueue(injector, hydrationQueue, replayQueuedEventsFn);
  19290. }));
  19291. }
  19292. });
  19293. }
  19294. function triggerHydrationForBlockQueue(injector, hydrationQueue, replayQueuedEventsFn) {
  19295. return __async(this, null, function* () {
  19296. const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  19297. const blocksBeingHydrated = dehydratedBlockRegistry.hydrating;
  19298. const pendingTasks = injector.get(PendingTasksInternal);
  19299. const taskId = pendingTasks.add();
  19300. for (let blockQueueIdx = 0; blockQueueIdx < hydrationQueue.length; blockQueueIdx++) {
  19301. const dehydratedBlockId = hydrationQueue[blockQueueIdx];
  19302. const dehydratedDeferBlock = dehydratedBlockRegistry.get(dehydratedBlockId);
  19303. if (dehydratedDeferBlock != null) {
  19304. yield triggerResourceLoadingForHydration(dehydratedDeferBlock);
  19305. yield nextRender(injector);
  19306. if (deferBlockHasErrored(dehydratedDeferBlock)) {
  19307. removeDehydratedViewList(dehydratedDeferBlock);
  19308. cleanupRemainingHydrationQueue(hydrationQueue.slice(blockQueueIdx), dehydratedBlockRegistry);
  19309. break;
  19310. }
  19311. blocksBeingHydrated.get(dehydratedBlockId).resolve();
  19312. } else {
  19313. cleanupParentContainer(blockQueueIdx, hydrationQueue, dehydratedBlockRegistry);
  19314. cleanupRemainingHydrationQueue(hydrationQueue.slice(blockQueueIdx), dehydratedBlockRegistry);
  19315. break;
  19316. }
  19317. }
  19318. const lastBlockName = hydrationQueue[hydrationQueue.length - 1];
  19319. yield blocksBeingHydrated.get(lastBlockName)?.promise;
  19320. pendingTasks.remove(taskId);
  19321. if (replayQueuedEventsFn) {
  19322. replayQueuedEventsFn(hydrationQueue);
  19323. }
  19324. cleanupHydratedDeferBlocks(dehydratedBlockRegistry.get(lastBlockName), hydrationQueue, dehydratedBlockRegistry, injector.get(ApplicationRef));
  19325. });
  19326. }
  19327. function deferBlockHasErrored(deferBlock) {
  19328. return getLDeferBlockDetails(deferBlock.lView, deferBlock.tNode)[DEFER_BLOCK_STATE] === DeferBlockState.Error;
  19329. }
  19330. function cleanupParentContainer(currentBlockIdx, hydrationQueue, dehydratedBlockRegistry) {
  19331. const parentDeferBlockIdx = currentBlockIdx - 1;
  19332. const parentDeferBlock = parentDeferBlockIdx > -1 ? dehydratedBlockRegistry.get(hydrationQueue[parentDeferBlockIdx]) : null;
  19333. if (parentDeferBlock) {
  19334. cleanupLContainer(parentDeferBlock.lContainer);
  19335. }
  19336. }
  19337. function cleanupRemainingHydrationQueue(hydrationQueue, dehydratedBlockRegistry) {
  19338. const blocksBeingHydrated = dehydratedBlockRegistry.hydrating;
  19339. for (const dehydratedBlockId in hydrationQueue) {
  19340. blocksBeingHydrated.get(dehydratedBlockId)?.reject();
  19341. }
  19342. dehydratedBlockRegistry.cleanup(hydrationQueue);
  19343. }
  19344. function populateHydratingStateForQueue(registry, queue2) {
  19345. for (let blockId of queue2) {
  19346. registry.hydrating.set(blockId, Promise.withResolvers());
  19347. }
  19348. }
  19349. function nextRender(injector) {
  19350. return new Promise((resolveFn) => afterNextRender(resolveFn, {
  19351. injector
  19352. }));
  19353. }
  19354. function triggerResourceLoadingForHydration(dehydratedBlock) {
  19355. return __async(this, null, function* () {
  19356. const {
  19357. tNode,
  19358. lView
  19359. } = dehydratedBlock;
  19360. const lDetails = getLDeferBlockDetails(lView, tNode);
  19361. return new Promise((resolve) => {
  19362. onDeferBlockCompletion(lDetails, resolve);
  19363. triggerDeferBlock(2, lView, tNode);
  19364. });
  19365. });
  19366. }
  19367. function onDeferBlockCompletion(lDetails, callback) {
  19368. if (!Array.isArray(lDetails[ON_COMPLETE_FNS])) {
  19369. lDetails[ON_COMPLETE_FNS] = [];
  19370. }
  19371. lDetails[ON_COMPLETE_FNS].push(callback);
  19372. }
  19373. function shouldAttachTrigger(triggerType, lView, tNode) {
  19374. if (triggerType === 0) {
  19375. return shouldAttachRegularTrigger(lView, tNode);
  19376. } else if (triggerType === 2) {
  19377. return !shouldAttachRegularTrigger(lView, tNode);
  19378. }
  19379. return true;
  19380. }
  19381. function shouldAttachRegularTrigger(lView, tNode) {
  19382. const injector = lView[INJECTOR];
  19383. const tDetails = getTDeferBlockDetails(lView[TVIEW], tNode);
  19384. const incrementalHydrationEnabled = isIncrementalHydrationEnabled(injector);
  19385. const hasHydrateTriggers = tDetails.flags !== null && (tDetails.flags & 1) === 1;
  19386. if (false) {
  19387. return !incrementalHydrationEnabled || !hasHydrateTriggers;
  19388. }
  19389. const lDetails = getLDeferBlockDetails(lView, tNode);
  19390. const wasServerSideRendered = lDetails[SSR_UNIQUE_ID] !== null;
  19391. if (hasHydrateTriggers && wasServerSideRendered && incrementalHydrationEnabled) {
  19392. return false;
  19393. }
  19394. return true;
  19395. }
  19396. function getHydrateTriggers(tView, tNode) {
  19397. const tDetails = getTDeferBlockDetails(tView, tNode);
  19398. return tDetails.hydrateTriggers ??= /* @__PURE__ */ new Map();
  19399. }
  19400. function processAndInitTriggers(injector, blockData, nodes) {
  19401. const idleElements = [];
  19402. const timerElements = [];
  19403. const viewportElements = [];
  19404. const immediateElements = [];
  19405. for (let [blockId, blockSummary] of blockData) {
  19406. const commentNode = nodes.get(blockId);
  19407. if (commentNode !== void 0) {
  19408. const numRootNodes = blockSummary.data[NUM_ROOT_NODES];
  19409. let currentNode = commentNode;
  19410. for (let i = 0; i < numRootNodes; i++) {
  19411. currentNode = currentNode.previousSibling;
  19412. if (currentNode.nodeType !== Node.ELEMENT_NODE) {
  19413. continue;
  19414. }
  19415. const elementTrigger = {
  19416. el: currentNode,
  19417. blockName: blockId
  19418. };
  19419. if (blockSummary.hydrate.idle) {
  19420. idleElements.push(elementTrigger);
  19421. }
  19422. if (blockSummary.hydrate.immediate) {
  19423. immediateElements.push(elementTrigger);
  19424. }
  19425. if (blockSummary.hydrate.timer !== null) {
  19426. elementTrigger.delay = blockSummary.hydrate.timer;
  19427. timerElements.push(elementTrigger);
  19428. }
  19429. if (blockSummary.hydrate.viewport) {
  19430. viewportElements.push(elementTrigger);
  19431. }
  19432. }
  19433. }
  19434. }
  19435. setIdleTriggers(injector, idleElements);
  19436. setImmediateTriggers(injector, immediateElements);
  19437. setViewportTriggers(injector, viewportElements);
  19438. setTimerTriggers(injector, timerElements);
  19439. }
  19440. function setIdleTriggers(injector, elementTriggers) {
  19441. for (const elementTrigger of elementTriggers) {
  19442. const registry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  19443. const onInvoke = () => triggerHydrationFromBlockName(injector, elementTrigger.blockName);
  19444. const cleanupFn = onIdle(onInvoke, injector);
  19445. registry.addCleanupFn(elementTrigger.blockName, cleanupFn);
  19446. }
  19447. }
  19448. function setViewportTriggers(injector, elementTriggers) {
  19449. if (elementTriggers.length > 0) {
  19450. const registry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  19451. for (let elementTrigger of elementTriggers) {
  19452. const cleanupFn = onViewport(elementTrigger.el, () => triggerHydrationFromBlockName(injector, elementTrigger.blockName), injector);
  19453. registry.addCleanupFn(elementTrigger.blockName, cleanupFn);
  19454. }
  19455. }
  19456. }
  19457. function setTimerTriggers(injector, elementTriggers) {
  19458. for (const elementTrigger of elementTriggers) {
  19459. const registry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  19460. const onInvoke = () => triggerHydrationFromBlockName(injector, elementTrigger.blockName);
  19461. const timerFn = onTimer(elementTrigger.delay);
  19462. const cleanupFn = timerFn(onInvoke, injector);
  19463. registry.addCleanupFn(elementTrigger.blockName, cleanupFn);
  19464. }
  19465. }
  19466. function setImmediateTriggers(injector, elementTriggers) {
  19467. for (const elementTrigger of elementTriggers) {
  19468. triggerHydrationFromBlockName(injector, elementTrigger.blockName);
  19469. }
  19470. }
  19471. function ɵɵdefer(index, primaryTmplIndex, dependencyResolverFn, loadingTmplIndex, placeholderTmplIndex, errorTmplIndex, loadingConfigIndex, placeholderConfigIndex, enableTimerScheduling, flags) {
  19472. const lView = getLView();
  19473. const tView = getTView();
  19474. const adjustedIndex = index + HEADER_OFFSET;
  19475. const tNode = declareTemplate(lView, tView, index, null, 0, 0);
  19476. const injector = lView[INJECTOR];
  19477. if (tView.firstCreatePass) {
  19478. performanceMarkFeature("NgDefer");
  19479. const tDetails = {
  19480. primaryTmplIndex,
  19481. loadingTmplIndex: loadingTmplIndex ?? null,
  19482. placeholderTmplIndex: placeholderTmplIndex ?? null,
  19483. errorTmplIndex: errorTmplIndex ?? null,
  19484. placeholderBlockConfig: null,
  19485. loadingBlockConfig: null,
  19486. dependencyResolverFn: dependencyResolverFn ?? null,
  19487. loadingState: DeferDependenciesLoadingState.NOT_STARTED,
  19488. loadingPromise: null,
  19489. providers: null,
  19490. hydrateTriggers: null,
  19491. debug: null,
  19492. flags: flags ?? 0
  19493. /* TDeferDetailsFlags.Default */
  19494. };
  19495. enableTimerScheduling?.(tView, tDetails, placeholderConfigIndex, loadingConfigIndex);
  19496. setTDeferBlockDetails(tView, adjustedIndex, tDetails);
  19497. }
  19498. const lContainer = lView[adjustedIndex];
  19499. populateDehydratedViewsInLContainer(lContainer, tNode, lView);
  19500. let ssrBlockState = null;
  19501. let ssrUniqueId = null;
  19502. if (lContainer[DEHYDRATED_VIEWS]?.length > 0) {
  19503. const info = lContainer[DEHYDRATED_VIEWS][0].data;
  19504. ssrUniqueId = info[DEFER_BLOCK_ID] ?? null;
  19505. ssrBlockState = info[DEFER_BLOCK_STATE$1];
  19506. }
  19507. const lDetails = [
  19508. null,
  19509. // NEXT_DEFER_BLOCK_STATE
  19510. DeferBlockInternalState.Initial,
  19511. // DEFER_BLOCK_STATE
  19512. null,
  19513. // STATE_IS_FROZEN_UNTIL
  19514. null,
  19515. // LOADING_AFTER_CLEANUP_FN
  19516. null,
  19517. // TRIGGER_CLEANUP_FNS
  19518. null,
  19519. // PREFETCH_TRIGGER_CLEANUP_FNS
  19520. ssrUniqueId,
  19521. // SSR_UNIQUE_ID
  19522. ssrBlockState,
  19523. // SSR_BLOCK_STATE
  19524. null,
  19525. // ON_COMPLETE_FNS
  19526. null
  19527. // HYDRATE_TRIGGER_CLEANUP_FNS
  19528. ];
  19529. setLDeferBlockDetails(lView, adjustedIndex, lDetails);
  19530. let registry = null;
  19531. if (ssrUniqueId !== null) {
  19532. ngDevMode && assertIncrementalHydrationIsConfigured(injector);
  19533. registry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  19534. registry.add(ssrUniqueId, {
  19535. lView,
  19536. tNode,
  19537. lContainer
  19538. });
  19539. }
  19540. const onLViewDestroy = () => {
  19541. invokeAllTriggerCleanupFns(lDetails);
  19542. if (ssrUniqueId !== null) {
  19543. registry?.cleanup([ssrUniqueId]);
  19544. }
  19545. };
  19546. storeTriggerCleanupFn(0, lDetails, () => removeLViewOnDestroy(lView, onLViewDestroy));
  19547. storeLViewOnDestroy(lView, onLViewDestroy);
  19548. }
  19549. function ɵɵdeferWhen(rawValue) {
  19550. const lView = getLView();
  19551. const tNode = getSelectedTNode();
  19552. if (ngDevMode) {
  19553. trackTriggerForDebugging(lView[TVIEW], tNode, "when <expression>");
  19554. }
  19555. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19556. const bindingIndex = nextBindingIndex();
  19557. if (bindingUpdated(lView, bindingIndex, rawValue)) {
  19558. const prevConsumer = setActiveConsumer(null);
  19559. try {
  19560. const value = Boolean(rawValue);
  19561. const lDetails = getLDeferBlockDetails(lView, tNode);
  19562. const renderedState = lDetails[DEFER_BLOCK_STATE];
  19563. if (value === false && renderedState === DeferBlockInternalState.Initial) {
  19564. renderPlaceholder(lView, tNode);
  19565. } else if (value === true && (renderedState === DeferBlockInternalState.Initial || renderedState === DeferBlockState.Placeholder)) {
  19566. triggerDeferBlock(0, lView, tNode);
  19567. }
  19568. } finally {
  19569. setActiveConsumer(prevConsumer);
  19570. }
  19571. }
  19572. }
  19573. function ɵɵdeferPrefetchWhen(rawValue) {
  19574. const lView = getLView();
  19575. const tNode = getSelectedTNode();
  19576. if (ngDevMode) {
  19577. trackTriggerForDebugging(lView[TVIEW], tNode, "prefetch when <expression>");
  19578. }
  19579. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19580. const bindingIndex = nextBindingIndex();
  19581. if (bindingUpdated(lView, bindingIndex, rawValue)) {
  19582. const prevConsumer = setActiveConsumer(null);
  19583. try {
  19584. const value = Boolean(rawValue);
  19585. const tView = lView[TVIEW];
  19586. const tNode2 = getSelectedTNode();
  19587. const tDetails = getTDeferBlockDetails(tView, tNode2);
  19588. if (value === true && tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
  19589. triggerPrefetching(tDetails, lView, tNode2);
  19590. }
  19591. } finally {
  19592. setActiveConsumer(prevConsumer);
  19593. }
  19594. }
  19595. }
  19596. function ɵɵdeferHydrateWhen(rawValue) {
  19597. const lView = getLView();
  19598. const tNode = getSelectedTNode();
  19599. if (ngDevMode) {
  19600. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate when <expression>");
  19601. }
  19602. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19603. const bindingIndex = nextBindingIndex();
  19604. const tView = getTView();
  19605. const hydrateTriggers = getHydrateTriggers(tView, tNode);
  19606. hydrateTriggers.set(6, null);
  19607. if (bindingUpdated(lView, bindingIndex, rawValue)) {
  19608. if (false) {
  19609. triggerDeferBlock(2, lView, tNode);
  19610. } else {
  19611. const injector = lView[INJECTOR];
  19612. const prevConsumer = setActiveConsumer(null);
  19613. try {
  19614. const value = Boolean(rawValue);
  19615. if (value === true) {
  19616. const lDetails = getLDeferBlockDetails(lView, tNode);
  19617. const ssrUniqueId = lDetails[SSR_UNIQUE_ID];
  19618. ngDevMode && assertSsrIdDefined(ssrUniqueId);
  19619. triggerHydrationFromBlockName(injector, ssrUniqueId);
  19620. }
  19621. } finally {
  19622. setActiveConsumer(prevConsumer);
  19623. }
  19624. }
  19625. }
  19626. }
  19627. function ɵɵdeferHydrateNever() {
  19628. const lView = getLView();
  19629. const tNode = getCurrentTNode();
  19630. if (ngDevMode) {
  19631. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate never");
  19632. }
  19633. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19634. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19635. hydrateTriggers.set(7, null);
  19636. if (false) {
  19637. triggerDeferBlock(2, lView, tNode);
  19638. }
  19639. }
  19640. function ɵɵdeferOnIdle() {
  19641. const lView = getLView();
  19642. const tNode = getCurrentTNode();
  19643. if (ngDevMode) {
  19644. trackTriggerForDebugging(lView[TVIEW], tNode, "on idle");
  19645. }
  19646. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19647. scheduleDelayedTrigger(onIdle);
  19648. }
  19649. function ɵɵdeferPrefetchOnIdle() {
  19650. const lView = getLView();
  19651. const tNode = getCurrentTNode();
  19652. if (ngDevMode) {
  19653. trackTriggerForDebugging(lView[TVIEW], tNode, "prefetch on idle");
  19654. }
  19655. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19656. scheduleDelayedPrefetching(onIdle);
  19657. }
  19658. function ɵɵdeferHydrateOnIdle() {
  19659. const lView = getLView();
  19660. const tNode = getCurrentTNode();
  19661. if (ngDevMode) {
  19662. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on idle");
  19663. }
  19664. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19665. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19666. hydrateTriggers.set(0, null);
  19667. if (false) {
  19668. triggerDeferBlock(2, lView, tNode);
  19669. } else {
  19670. scheduleDelayedHydrating(onIdle, lView, tNode);
  19671. }
  19672. }
  19673. function ɵɵdeferOnImmediate() {
  19674. const lView = getLView();
  19675. const tNode = getCurrentTNode();
  19676. if (ngDevMode) {
  19677. trackTriggerForDebugging(lView[TVIEW], tNode, "on immediate");
  19678. }
  19679. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19680. const tDetails = getTDeferBlockDetails(lView[TVIEW], tNode);
  19681. if (tDetails.loadingTmplIndex === null) {
  19682. renderPlaceholder(lView, tNode);
  19683. }
  19684. triggerDeferBlock(0, lView, tNode);
  19685. }
  19686. function ɵɵdeferPrefetchOnImmediate() {
  19687. const lView = getLView();
  19688. const tNode = getCurrentTNode();
  19689. if (ngDevMode) {
  19690. trackTriggerForDebugging(lView[TVIEW], tNode, "prefetch on immediate");
  19691. }
  19692. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19693. const tView = lView[TVIEW];
  19694. const tDetails = getTDeferBlockDetails(tView, tNode);
  19695. if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
  19696. triggerResourceLoading(tDetails, lView, tNode);
  19697. }
  19698. }
  19699. function ɵɵdeferHydrateOnImmediate() {
  19700. const lView = getLView();
  19701. const tNode = getCurrentTNode();
  19702. if (ngDevMode) {
  19703. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on immediate");
  19704. }
  19705. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19706. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19707. hydrateTriggers.set(1, null);
  19708. if (false) {
  19709. triggerDeferBlock(2, lView, tNode);
  19710. } else {
  19711. const injector = lView[INJECTOR];
  19712. const lDetails = getLDeferBlockDetails(lView, tNode);
  19713. const ssrUniqueId = lDetails[SSR_UNIQUE_ID];
  19714. ngDevMode && assertSsrIdDefined(ssrUniqueId);
  19715. triggerHydrationFromBlockName(injector, ssrUniqueId);
  19716. }
  19717. }
  19718. function ɵɵdeferOnTimer(delay2) {
  19719. const lView = getLView();
  19720. const tNode = getCurrentTNode();
  19721. if (ngDevMode) {
  19722. trackTriggerForDebugging(lView[TVIEW], tNode, `on timer(${delay2}ms)`);
  19723. }
  19724. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19725. scheduleDelayedTrigger(onTimer(delay2));
  19726. }
  19727. function ɵɵdeferPrefetchOnTimer(delay2) {
  19728. const lView = getLView();
  19729. const tNode = getCurrentTNode();
  19730. if (ngDevMode) {
  19731. trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on timer(${delay2}ms)`);
  19732. }
  19733. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19734. scheduleDelayedPrefetching(onTimer(delay2));
  19735. }
  19736. function ɵɵdeferHydrateOnTimer(delay2) {
  19737. const lView = getLView();
  19738. const tNode = getCurrentTNode();
  19739. if (ngDevMode) {
  19740. trackTriggerForDebugging(lView[TVIEW], tNode, `hydrate on timer(${delay2}ms)`);
  19741. }
  19742. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19743. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19744. hydrateTriggers.set(5, {
  19745. delay: delay2
  19746. });
  19747. if (false) {
  19748. triggerDeferBlock(2, lView, tNode);
  19749. } else {
  19750. scheduleDelayedHydrating(onTimer(delay2), lView, tNode);
  19751. }
  19752. }
  19753. function ɵɵdeferOnHover(triggerIndex, walkUpTimes) {
  19754. const lView = getLView();
  19755. const tNode = getCurrentTNode();
  19756. if (ngDevMode) {
  19757. trackTriggerForDebugging(lView[TVIEW], tNode, `on hover${walkUpTimes === -1 ? "" : "(<target>)"}`);
  19758. }
  19759. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19760. renderPlaceholder(lView, tNode);
  19761. if (true) {
  19762. registerDomTrigger(
  19763. lView,
  19764. tNode,
  19765. triggerIndex,
  19766. walkUpTimes,
  19767. onHover,
  19768. () => triggerDeferBlock(0, lView, tNode),
  19769. 0
  19770. /* TriggerType.Regular */
  19771. );
  19772. }
  19773. }
  19774. function ɵɵdeferPrefetchOnHover(triggerIndex, walkUpTimes) {
  19775. const lView = getLView();
  19776. const tNode = getCurrentTNode();
  19777. if (ngDevMode) {
  19778. trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on hover${walkUpTimes === -1 ? "" : "(<target>)"}`);
  19779. }
  19780. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19781. const tView = lView[TVIEW];
  19782. const tDetails = getTDeferBlockDetails(tView, tNode);
  19783. if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
  19784. registerDomTrigger(
  19785. lView,
  19786. tNode,
  19787. triggerIndex,
  19788. walkUpTimes,
  19789. onHover,
  19790. () => triggerPrefetching(tDetails, lView, tNode),
  19791. 1
  19792. /* TriggerType.Prefetch */
  19793. );
  19794. }
  19795. }
  19796. function ɵɵdeferHydrateOnHover() {
  19797. const lView = getLView();
  19798. const tNode = getCurrentTNode();
  19799. if (ngDevMode) {
  19800. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on hover");
  19801. }
  19802. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19803. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19804. hydrateTriggers.set(4, null);
  19805. if (false) {
  19806. triggerDeferBlock(2, lView, tNode);
  19807. }
  19808. }
  19809. function ɵɵdeferOnInteraction(triggerIndex, walkUpTimes) {
  19810. const lView = getLView();
  19811. const tNode = getCurrentTNode();
  19812. if (ngDevMode) {
  19813. trackTriggerForDebugging(lView[TVIEW], tNode, `on interaction${walkUpTimes === -1 ? "" : "(<target>)"}`);
  19814. }
  19815. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19816. renderPlaceholder(lView, tNode);
  19817. if (true) {
  19818. registerDomTrigger(
  19819. lView,
  19820. tNode,
  19821. triggerIndex,
  19822. walkUpTimes,
  19823. onInteraction,
  19824. () => triggerDeferBlock(0, lView, tNode),
  19825. 0
  19826. /* TriggerType.Regular */
  19827. );
  19828. }
  19829. }
  19830. function ɵɵdeferPrefetchOnInteraction(triggerIndex, walkUpTimes) {
  19831. const lView = getLView();
  19832. const tNode = getCurrentTNode();
  19833. if (ngDevMode) {
  19834. trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on interaction${walkUpTimes === -1 ? "" : "(<target>)"}`);
  19835. }
  19836. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19837. const tView = lView[TVIEW];
  19838. const tDetails = getTDeferBlockDetails(tView, tNode);
  19839. if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
  19840. registerDomTrigger(
  19841. lView,
  19842. tNode,
  19843. triggerIndex,
  19844. walkUpTimes,
  19845. onInteraction,
  19846. () => triggerPrefetching(tDetails, lView, tNode),
  19847. 1
  19848. /* TriggerType.Prefetch */
  19849. );
  19850. }
  19851. }
  19852. function ɵɵdeferHydrateOnInteraction() {
  19853. const lView = getLView();
  19854. const tNode = getCurrentTNode();
  19855. if (ngDevMode) {
  19856. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on interaction");
  19857. }
  19858. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19859. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19860. hydrateTriggers.set(3, null);
  19861. if (false) {
  19862. triggerDeferBlock(2, lView, tNode);
  19863. }
  19864. }
  19865. function ɵɵdeferOnViewport(triggerIndex, walkUpTimes) {
  19866. const lView = getLView();
  19867. const tNode = getCurrentTNode();
  19868. if (ngDevMode) {
  19869. trackTriggerForDebugging(lView[TVIEW], tNode, `on viewport${walkUpTimes === -1 ? "" : "(<target>)"}`);
  19870. }
  19871. if (!shouldAttachTrigger(0, lView, tNode)) return;
  19872. renderPlaceholder(lView, tNode);
  19873. if (true) {
  19874. registerDomTrigger(
  19875. lView,
  19876. tNode,
  19877. triggerIndex,
  19878. walkUpTimes,
  19879. onViewport,
  19880. () => triggerDeferBlock(0, lView, tNode),
  19881. 0
  19882. /* TriggerType.Regular */
  19883. );
  19884. }
  19885. }
  19886. function ɵɵdeferPrefetchOnViewport(triggerIndex, walkUpTimes) {
  19887. const lView = getLView();
  19888. const tNode = getCurrentTNode();
  19889. if (ngDevMode) {
  19890. trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on viewport${walkUpTimes === -1 ? "" : "(<target>)"}`);
  19891. }
  19892. if (!shouldAttachTrigger(1, lView, tNode)) return;
  19893. const tView = lView[TVIEW];
  19894. const tDetails = getTDeferBlockDetails(tView, tNode);
  19895. if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
  19896. registerDomTrigger(
  19897. lView,
  19898. tNode,
  19899. triggerIndex,
  19900. walkUpTimes,
  19901. onViewport,
  19902. () => triggerPrefetching(tDetails, lView, tNode),
  19903. 1
  19904. /* TriggerType.Prefetch */
  19905. );
  19906. }
  19907. }
  19908. function ɵɵdeferHydrateOnViewport() {
  19909. const lView = getLView();
  19910. const tNode = getCurrentTNode();
  19911. if (ngDevMode) {
  19912. trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on viewport");
  19913. }
  19914. if (!shouldAttachTrigger(2, lView, tNode)) return;
  19915. const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  19916. hydrateTriggers.set(2, null);
  19917. if (false) {
  19918. triggerDeferBlock(2, lView, tNode);
  19919. }
  19920. }
  19921. function ɵɵattribute(name, value, sanitizer, namespace) {
  19922. const lView = getLView();
  19923. const bindingIndex = nextBindingIndex();
  19924. if (bindingUpdated(lView, bindingIndex, value)) {
  19925. const tView = getTView();
  19926. const tNode = getSelectedTNode();
  19927. elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
  19928. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, "attr." + name, bindingIndex);
  19929. }
  19930. return ɵɵattribute;
  19931. }
  19932. function interpolationV(lView, values) {
  19933. ngDevMode && assertLessThan(2, values.length, "should have at least 3 values");
  19934. ngDevMode && assertEqual(values.length % 2, 1, "should have an odd number of values");
  19935. let isBindingUpdated = false;
  19936. let bindingIndex = getBindingIndex();
  19937. for (let i = 1; i < values.length; i += 2) {
  19938. isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
  19939. }
  19940. setBindingIndex(bindingIndex);
  19941. if (!isBindingUpdated) {
  19942. return NO_CHANGE;
  19943. }
  19944. let content = values[0];
  19945. for (let i = 1; i < values.length; i += 2) {
  19946. content += renderStringify(values[i]) + values[i + 1];
  19947. }
  19948. return content;
  19949. }
  19950. function interpolation1(lView, prefix, v0, suffix) {
  19951. const different = bindingUpdated(lView, nextBindingIndex(), v0);
  19952. return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
  19953. }
  19954. function interpolation2(lView, prefix, v0, i0, v1, suffix) {
  19955. const bindingIndex = getBindingIndex();
  19956. const different = bindingUpdated2(lView, bindingIndex, v0, v1);
  19957. incrementBindingIndex(2);
  19958. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
  19959. }
  19960. function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
  19961. const bindingIndex = getBindingIndex();
  19962. const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
  19963. incrementBindingIndex(3);
  19964. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix : NO_CHANGE;
  19965. }
  19966. function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
  19967. const bindingIndex = getBindingIndex();
  19968. const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  19969. incrementBindingIndex(4);
  19970. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + suffix : NO_CHANGE;
  19971. }
  19972. function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
  19973. const bindingIndex = getBindingIndex();
  19974. let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  19975. different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
  19976. incrementBindingIndex(5);
  19977. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix : NO_CHANGE;
  19978. }
  19979. function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
  19980. const bindingIndex = getBindingIndex();
  19981. let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  19982. different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
  19983. incrementBindingIndex(6);
  19984. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix : NO_CHANGE;
  19985. }
  19986. function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
  19987. const bindingIndex = getBindingIndex();
  19988. let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  19989. different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
  19990. incrementBindingIndex(7);
  19991. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + suffix : NO_CHANGE;
  19992. }
  19993. function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
  19994. const bindingIndex = getBindingIndex();
  19995. let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  19996. different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
  19997. incrementBindingIndex(8);
  19998. return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix : NO_CHANGE;
  19999. }
  20000. function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
  20001. const lView = getLView();
  20002. const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
  20003. if (interpolatedValue !== NO_CHANGE) {
  20004. const tNode = getSelectedTNode();
  20005. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20006. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 1, prefix, suffix);
  20007. }
  20008. return ɵɵattributeInterpolate1;
  20009. }
  20010. function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
  20011. const lView = getLView();
  20012. const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
  20013. if (interpolatedValue !== NO_CHANGE) {
  20014. const tNode = getSelectedTNode();
  20015. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20016. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 2, prefix, i0, suffix);
  20017. }
  20018. return ɵɵattributeInterpolate2;
  20019. }
  20020. function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
  20021. const lView = getLView();
  20022. const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
  20023. if (interpolatedValue !== NO_CHANGE) {
  20024. const tNode = getSelectedTNode();
  20025. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20026. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
  20027. }
  20028. return ɵɵattributeInterpolate3;
  20029. }
  20030. function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
  20031. const lView = getLView();
  20032. const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
  20033. if (interpolatedValue !== NO_CHANGE) {
  20034. const tNode = getSelectedTNode();
  20035. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20036. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
  20037. }
  20038. return ɵɵattributeInterpolate4;
  20039. }
  20040. function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
  20041. const lView = getLView();
  20042. const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
  20043. if (interpolatedValue !== NO_CHANGE) {
  20044. const tNode = getSelectedTNode();
  20045. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20046. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
  20047. }
  20048. return ɵɵattributeInterpolate5;
  20049. }
  20050. function ɵɵattributeInterpolate6(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer, namespace) {
  20051. const lView = getLView();
  20052. const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
  20053. if (interpolatedValue !== NO_CHANGE) {
  20054. const tNode = getSelectedTNode();
  20055. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20056. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
  20057. }
  20058. return ɵɵattributeInterpolate6;
  20059. }
  20060. function ɵɵattributeInterpolate7(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer, namespace) {
  20061. const lView = getLView();
  20062. const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  20063. if (interpolatedValue !== NO_CHANGE) {
  20064. const tNode = getSelectedTNode();
  20065. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20066. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
  20067. }
  20068. return ɵɵattributeInterpolate7;
  20069. }
  20070. function ɵɵattributeInterpolate8(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer, namespace) {
  20071. const lView = getLView();
  20072. const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  20073. if (interpolatedValue !== NO_CHANGE) {
  20074. const tNode = getSelectedTNode();
  20075. elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
  20076. ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
  20077. }
  20078. return ɵɵattributeInterpolate8;
  20079. }
  20080. function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
  20081. const lView = getLView();
  20082. const interpolated = interpolationV(lView, values);
  20083. if (interpolated !== NO_CHANGE) {
  20084. const tNode = getSelectedTNode();
  20085. elementAttributeInternal(tNode, lView, attrName, interpolated, sanitizer, namespace);
  20086. if (ngDevMode) {
  20087. const interpolationInBetween = [values[0]];
  20088. for (let i = 2; i < values.length; i += 2) {
  20089. interpolationInBetween.push(values[i]);
  20090. }
  20091. storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
  20092. }
  20093. }
  20094. return ɵɵattributeInterpolateV;
  20095. }
  20096. function toTStylingRange(prev, next) {
  20097. ngDevMode && assertNumberInRange(
  20098. prev,
  20099. 0,
  20100. 32767
  20101. /* StylingRange.UNSIGNED_MASK */
  20102. );
  20103. ngDevMode && assertNumberInRange(
  20104. next,
  20105. 0,
  20106. 32767
  20107. /* StylingRange.UNSIGNED_MASK */
  20108. );
  20109. return prev << 17 | next << 2;
  20110. }
  20111. function getTStylingRangePrev(tStylingRange) {
  20112. ngDevMode && assertNumber(tStylingRange, "expected number");
  20113. return tStylingRange >> 17 & 32767;
  20114. }
  20115. function getTStylingRangePrevDuplicate(tStylingRange) {
  20116. ngDevMode && assertNumber(tStylingRange, "expected number");
  20117. return (tStylingRange & 2) == 2;
  20118. }
  20119. function setTStylingRangePrev(tStylingRange, previous) {
  20120. ngDevMode && assertNumber(tStylingRange, "expected number");
  20121. ngDevMode && assertNumberInRange(
  20122. previous,
  20123. 0,
  20124. 32767
  20125. /* StylingRange.UNSIGNED_MASK */
  20126. );
  20127. return tStylingRange & 131071 | previous << 17;
  20128. }
  20129. function setTStylingRangePrevDuplicate(tStylingRange) {
  20130. ngDevMode && assertNumber(tStylingRange, "expected number");
  20131. return tStylingRange | 2;
  20132. }
  20133. function getTStylingRangeNext(tStylingRange) {
  20134. ngDevMode && assertNumber(tStylingRange, "expected number");
  20135. return (tStylingRange & 131068) >> 2;
  20136. }
  20137. function setTStylingRangeNext(tStylingRange, next) {
  20138. ngDevMode && assertNumber(tStylingRange, "expected number");
  20139. ngDevMode && assertNumberInRange(
  20140. next,
  20141. 0,
  20142. 32767
  20143. /* StylingRange.UNSIGNED_MASK */
  20144. );
  20145. return tStylingRange & -131069 | //
  20146. next << 2;
  20147. }
  20148. function getTStylingRangeNextDuplicate(tStylingRange) {
  20149. ngDevMode && assertNumber(tStylingRange, "expected number");
  20150. return (tStylingRange & 1) === 1;
  20151. }
  20152. function setTStylingRangeNextDuplicate(tStylingRange) {
  20153. ngDevMode && assertNumber(tStylingRange, "expected number");
  20154. return tStylingRange | 1;
  20155. }
  20156. function insertTStylingBinding(tData, tNode, tStylingKeyWithStatic, index, isHostBinding, isClassBinding) {
  20157. ngDevMode && assertFirstUpdatePass(getTView());
  20158. let tBindings = isClassBinding ? tNode.classBindings : tNode.styleBindings;
  20159. let tmplHead = getTStylingRangePrev(tBindings);
  20160. let tmplTail = getTStylingRangeNext(tBindings);
  20161. tData[index] = tStylingKeyWithStatic;
  20162. let isKeyDuplicateOfStatic = false;
  20163. let tStylingKey;
  20164. if (Array.isArray(tStylingKeyWithStatic)) {
  20165. const staticKeyValueArray = tStylingKeyWithStatic;
  20166. tStylingKey = staticKeyValueArray[1];
  20167. if (tStylingKey === null || keyValueArrayIndexOf(staticKeyValueArray, tStylingKey) > 0) {
  20168. isKeyDuplicateOfStatic = true;
  20169. }
  20170. } else {
  20171. tStylingKey = tStylingKeyWithStatic;
  20172. }
  20173. if (isHostBinding) {
  20174. const hasTemplateBindings = tmplTail !== 0;
  20175. if (hasTemplateBindings) {
  20176. const previousNode = getTStylingRangePrev(tData[tmplHead + 1]);
  20177. tData[index + 1] = toTStylingRange(previousNode, tmplHead);
  20178. if (previousNode !== 0) {
  20179. tData[previousNode + 1] = setTStylingRangeNext(tData[previousNode + 1], index);
  20180. }
  20181. tData[tmplHead + 1] = setTStylingRangePrev(tData[tmplHead + 1], index);
  20182. } else {
  20183. tData[index + 1] = toTStylingRange(tmplHead, 0);
  20184. if (tmplHead !== 0) {
  20185. tData[tmplHead + 1] = setTStylingRangeNext(tData[tmplHead + 1], index);
  20186. }
  20187. tmplHead = index;
  20188. }
  20189. } else {
  20190. tData[index + 1] = toTStylingRange(tmplTail, 0);
  20191. ngDevMode && assertEqual(tmplHead !== 0 && tmplTail === 0, false, "Adding template bindings after hostBindings is not allowed.");
  20192. if (tmplHead === 0) {
  20193. tmplHead = index;
  20194. } else {
  20195. tData[tmplTail + 1] = setTStylingRangeNext(tData[tmplTail + 1], index);
  20196. }
  20197. tmplTail = index;
  20198. }
  20199. if (isKeyDuplicateOfStatic) {
  20200. tData[index + 1] = setTStylingRangePrevDuplicate(tData[index + 1]);
  20201. }
  20202. markDuplicates(tData, tStylingKey, index, true);
  20203. markDuplicates(tData, tStylingKey, index, false);
  20204. markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding);
  20205. tBindings = toTStylingRange(tmplHead, tmplTail);
  20206. if (isClassBinding) {
  20207. tNode.classBindings = tBindings;
  20208. } else {
  20209. tNode.styleBindings = tBindings;
  20210. }
  20211. }
  20212. function markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding) {
  20213. const residual = isClassBinding ? tNode.residualClasses : tNode.residualStyles;
  20214. if (residual != null && typeof tStylingKey == "string" && keyValueArrayIndexOf(residual, tStylingKey) >= 0) {
  20215. tData[index + 1] = setTStylingRangeNextDuplicate(tData[index + 1]);
  20216. }
  20217. }
  20218. function markDuplicates(tData, tStylingKey, index, isPrevDir) {
  20219. const tStylingAtIndex = tData[index + 1];
  20220. const isMap = tStylingKey === null;
  20221. let cursor = isPrevDir ? getTStylingRangePrev(tStylingAtIndex) : getTStylingRangeNext(tStylingAtIndex);
  20222. let foundDuplicate = false;
  20223. while (cursor !== 0 && (foundDuplicate === false || isMap)) {
  20224. ngDevMode && assertIndexInRange(tData, cursor);
  20225. const tStylingValueAtCursor = tData[cursor];
  20226. const tStyleRangeAtCursor = tData[cursor + 1];
  20227. if (isStylingMatch(tStylingValueAtCursor, tStylingKey)) {
  20228. foundDuplicate = true;
  20229. tData[cursor + 1] = isPrevDir ? setTStylingRangeNextDuplicate(tStyleRangeAtCursor) : setTStylingRangePrevDuplicate(tStyleRangeAtCursor);
  20230. }
  20231. cursor = isPrevDir ? getTStylingRangePrev(tStyleRangeAtCursor) : getTStylingRangeNext(tStyleRangeAtCursor);
  20232. }
  20233. if (foundDuplicate) {
  20234. tData[index + 1] = isPrevDir ? setTStylingRangePrevDuplicate(tStylingAtIndex) : setTStylingRangeNextDuplicate(tStylingAtIndex);
  20235. }
  20236. }
  20237. function isStylingMatch(tStylingKeyCursor, tStylingKey) {
  20238. ngDevMode && assertNotEqual(Array.isArray(tStylingKey), true, "Expected that 'tStylingKey' has been unwrapped");
  20239. if (tStylingKeyCursor === null || // If the cursor is `null` it means that we have map at that
  20240. // location so we must assume that we have a match.
  20241. tStylingKey == null || // If `tStylingKey` is `null` then it is a map therefor assume that it
  20242. // contains a match.
  20243. (Array.isArray(tStylingKeyCursor) ? tStylingKeyCursor[1] : tStylingKeyCursor) === tStylingKey) {
  20244. return true;
  20245. } else if (Array.isArray(tStylingKeyCursor) && typeof tStylingKey === "string") {
  20246. return keyValueArrayIndexOf(tStylingKeyCursor, tStylingKey) >= 0;
  20247. }
  20248. return false;
  20249. }
  20250. var parserState = {
  20251. textEnd: 0,
  20252. key: 0,
  20253. keyEnd: 0,
  20254. value: 0,
  20255. valueEnd: 0
  20256. };
  20257. function getLastParsedKey(text) {
  20258. return text.substring(parserState.key, parserState.keyEnd);
  20259. }
  20260. function getLastParsedValue(text) {
  20261. return text.substring(parserState.value, parserState.valueEnd);
  20262. }
  20263. function parseClassName(text) {
  20264. resetParserState(text);
  20265. return parseClassNameNext(text, consumeWhitespace(text, 0, parserState.textEnd));
  20266. }
  20267. function parseClassNameNext(text, index) {
  20268. const end = parserState.textEnd;
  20269. if (end === index) {
  20270. return -1;
  20271. }
  20272. index = parserState.keyEnd = consumeClassToken(text, parserState.key = index, end);
  20273. return consumeWhitespace(text, index, end);
  20274. }
  20275. function parseStyle(text) {
  20276. resetParserState(text);
  20277. return parseStyleNext(text, consumeWhitespace(text, 0, parserState.textEnd));
  20278. }
  20279. function parseStyleNext(text, startIndex) {
  20280. const end = parserState.textEnd;
  20281. let index = parserState.key = consumeWhitespace(text, startIndex, end);
  20282. if (end === index) {
  20283. return -1;
  20284. }
  20285. index = parserState.keyEnd = consumeStyleKey(text, index, end);
  20286. index = consumeSeparator(
  20287. text,
  20288. index,
  20289. end,
  20290. 58
  20291. /* CharCode.COLON */
  20292. );
  20293. index = parserState.value = consumeWhitespace(text, index, end);
  20294. index = parserState.valueEnd = consumeStyleValue(text, index, end);
  20295. return consumeSeparator(
  20296. text,
  20297. index,
  20298. end,
  20299. 59
  20300. /* CharCode.SEMI_COLON */
  20301. );
  20302. }
  20303. function resetParserState(text) {
  20304. parserState.key = 0;
  20305. parserState.keyEnd = 0;
  20306. parserState.value = 0;
  20307. parserState.valueEnd = 0;
  20308. parserState.textEnd = text.length;
  20309. }
  20310. function consumeWhitespace(text, startIndex, endIndex) {
  20311. while (startIndex < endIndex && text.charCodeAt(startIndex) <= 32) {
  20312. startIndex++;
  20313. }
  20314. return startIndex;
  20315. }
  20316. function consumeClassToken(text, startIndex, endIndex) {
  20317. while (startIndex < endIndex && text.charCodeAt(startIndex) > 32) {
  20318. startIndex++;
  20319. }
  20320. return startIndex;
  20321. }
  20322. function consumeStyleKey(text, startIndex, endIndex) {
  20323. let ch;
  20324. while (startIndex < endIndex && ((ch = text.charCodeAt(startIndex)) === 45 || ch === 95 || (ch & -33) >= 65 && (ch & -33) <= 90 || ch >= 48 && ch <= 57)) {
  20325. startIndex++;
  20326. }
  20327. return startIndex;
  20328. }
  20329. function consumeSeparator(text, startIndex, endIndex, separator) {
  20330. startIndex = consumeWhitespace(text, startIndex, endIndex);
  20331. if (startIndex < endIndex) {
  20332. if (ngDevMode && text.charCodeAt(startIndex) !== separator) {
  20333. malformedStyleError(text, String.fromCharCode(separator), startIndex);
  20334. }
  20335. startIndex++;
  20336. }
  20337. return startIndex;
  20338. }
  20339. function consumeStyleValue(text, startIndex, endIndex) {
  20340. let ch1 = -1;
  20341. let ch2 = -1;
  20342. let ch3 = -1;
  20343. let i = startIndex;
  20344. let lastChIndex = i;
  20345. while (i < endIndex) {
  20346. const ch = text.charCodeAt(i++);
  20347. if (ch === 59) {
  20348. return lastChIndex;
  20349. } else if (ch === 34 || ch === 39) {
  20350. lastChIndex = i = consumeQuotedText(text, ch, i, endIndex);
  20351. } else if (startIndex === i - 4 && // We have seen only 4 characters so far "URL(" (Ignore "foo_URL()")
  20352. ch3 === 85 && ch2 === 82 && ch1 === 76 && ch === 40) {
  20353. lastChIndex = i = consumeQuotedText(text, 41, i, endIndex);
  20354. } else if (ch > 32) {
  20355. lastChIndex = i;
  20356. }
  20357. ch3 = ch2;
  20358. ch2 = ch1;
  20359. ch1 = ch & -33;
  20360. }
  20361. return lastChIndex;
  20362. }
  20363. function consumeQuotedText(text, quoteCharCode, startIndex, endIndex) {
  20364. let ch1 = -1;
  20365. let index = startIndex;
  20366. while (index < endIndex) {
  20367. const ch = text.charCodeAt(index++);
  20368. if (ch == quoteCharCode && ch1 !== 92) {
  20369. return index;
  20370. }
  20371. if (ch == 92 && ch1 === 92) {
  20372. ch1 = 0;
  20373. } else {
  20374. ch1 = ch;
  20375. }
  20376. }
  20377. throw ngDevMode ? malformedStyleError(text, String.fromCharCode(quoteCharCode), endIndex) : new Error();
  20378. }
  20379. function malformedStyleError(text, expecting, index) {
  20380. ngDevMode && assertEqual(typeof text === "string", true, "String expected here");
  20381. throw throwError2(`Malformed style at location ${index} in string '` + text.substring(0, index) + "[>>" + text.substring(index, index + 1) + "<<]" + text.slice(index + 1) + `'. Expecting '${expecting}'.`);
  20382. }
  20383. function ɵɵproperty(propName, value, sanitizer) {
  20384. const lView = getLView();
  20385. const bindingIndex = nextBindingIndex();
  20386. if (bindingUpdated(lView, bindingIndex, value)) {
  20387. const tView = getTView();
  20388. const tNode = getSelectedTNode();
  20389. elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, false);
  20390. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  20391. }
  20392. return ɵɵproperty;
  20393. }
  20394. function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased) {
  20395. setAllInputsForProperty(tNode, tView, lView, isClassBased ? "class" : "style", value);
  20396. }
  20397. function ɵɵstyleProp(prop, value, suffix) {
  20398. checkStylingProperty(prop, value, suffix, false);
  20399. return ɵɵstyleProp;
  20400. }
  20401. function ɵɵclassProp(className, value) {
  20402. checkStylingProperty(className, value, null, true);
  20403. return ɵɵclassProp;
  20404. }
  20405. function ɵɵstyleMap(styles) {
  20406. checkStylingMap(styleKeyValueArraySet, styleStringParser, styles, false);
  20407. }
  20408. function styleStringParser(keyValueArray, text) {
  20409. for (let i = parseStyle(text); i >= 0; i = parseStyleNext(text, i)) {
  20410. styleKeyValueArraySet(keyValueArray, getLastParsedKey(text), getLastParsedValue(text));
  20411. }
  20412. }
  20413. function ɵɵclassMap(classes) {
  20414. checkStylingMap(classKeyValueArraySet, classStringParser, classes, true);
  20415. }
  20416. function classStringParser(keyValueArray, text) {
  20417. for (let i = parseClassName(text); i >= 0; i = parseClassNameNext(text, i)) {
  20418. keyValueArraySet(keyValueArray, getLastParsedKey(text), true);
  20419. }
  20420. }
  20421. function checkStylingProperty(prop, value, suffix, isClassBased) {
  20422. const lView = getLView();
  20423. const tView = getTView();
  20424. const bindingIndex = incrementBindingIndex(2);
  20425. if (tView.firstUpdatePass) {
  20426. stylingFirstUpdatePass(tView, prop, bindingIndex, isClassBased);
  20427. }
  20428. if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
  20429. const tNode = tView.data[getSelectedIndex()];
  20430. updateStyling(tView, tNode, lView, lView[RENDERER], prop, lView[bindingIndex + 1] = normalizeSuffix(value, suffix), isClassBased, bindingIndex);
  20431. }
  20432. }
  20433. function checkStylingMap(keyValueArraySet2, stringParser, value, isClassBased) {
  20434. const tView = getTView();
  20435. const bindingIndex = incrementBindingIndex(2);
  20436. if (tView.firstUpdatePass) {
  20437. stylingFirstUpdatePass(tView, null, bindingIndex, isClassBased);
  20438. }
  20439. const lView = getLView();
  20440. if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
  20441. const tNode = tView.data[getSelectedIndex()];
  20442. if (hasStylingInputShadow(tNode, isClassBased) && !isInHostBindings(tView, bindingIndex)) {
  20443. if (ngDevMode) {
  20444. const tStylingKey = tView.data[bindingIndex];
  20445. assertEqual(Array.isArray(tStylingKey) ? tStylingKey[1] : tStylingKey, false, "Styling linked list shadow input should be marked as 'false'");
  20446. }
  20447. let staticPrefix = isClassBased ? tNode.classesWithoutHost : tNode.stylesWithoutHost;
  20448. ngDevMode && isClassBased === false && staticPrefix !== null && assertEqual(staticPrefix.endsWith(";"), true, "Expecting static portion to end with ';'");
  20449. if (staticPrefix !== null) {
  20450. value = concatStringsWithSpace(staticPrefix, value ? value : "");
  20451. }
  20452. setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased);
  20453. } else {
  20454. updateStylingMap(tView, tNode, lView, lView[RENDERER], lView[bindingIndex + 1], lView[bindingIndex + 1] = toStylingKeyValueArray(keyValueArraySet2, stringParser, value), isClassBased, bindingIndex);
  20455. }
  20456. }
  20457. }
  20458. function isInHostBindings(tView, bindingIndex) {
  20459. return bindingIndex >= tView.expandoStartIndex;
  20460. }
  20461. function stylingFirstUpdatePass(tView, tStylingKey, bindingIndex, isClassBased) {
  20462. ngDevMode && assertFirstUpdatePass(tView);
  20463. const tData = tView.data;
  20464. if (tData[bindingIndex + 1] === null) {
  20465. const tNode = tData[getSelectedIndex()];
  20466. ngDevMode && assertDefined(tNode, "TNode expected");
  20467. const isHostBindings = isInHostBindings(tView, bindingIndex);
  20468. if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) {
  20469. tStylingKey = false;
  20470. }
  20471. tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased);
  20472. insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased);
  20473. }
  20474. }
  20475. function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
  20476. const hostDirectiveDef = getCurrentDirectiveDef(tData);
  20477. let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
  20478. if (hostDirectiveDef === null) {
  20479. const isFirstStylingInstructionInTemplate = (isClassBased ? tNode.classBindings : tNode.styleBindings) === 0;
  20480. if (isFirstStylingInstructionInTemplate) {
  20481. stylingKey = collectStylingFromDirectives(null, tData, tNode, stylingKey, isClassBased);
  20482. stylingKey = collectStylingFromTAttrs(stylingKey, tNode.attrs, isClassBased);
  20483. residual = null;
  20484. }
  20485. } else {
  20486. const directiveStylingLast = tNode.directiveStylingLast;
  20487. const isFirstStylingInstructionInHostBinding = directiveStylingLast === -1 || tData[directiveStylingLast] !== hostDirectiveDef;
  20488. if (isFirstStylingInstructionInHostBinding) {
  20489. stylingKey = collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased);
  20490. if (residual === null) {
  20491. let templateStylingKey = getTemplateHeadTStylingKey(tData, tNode, isClassBased);
  20492. if (templateStylingKey !== void 0 && Array.isArray(templateStylingKey)) {
  20493. templateStylingKey = collectStylingFromDirectives(null, tData, tNode, templateStylingKey[1], isClassBased);
  20494. templateStylingKey = collectStylingFromTAttrs(templateStylingKey, tNode.attrs, isClassBased);
  20495. setTemplateHeadTStylingKey(tData, tNode, isClassBased, templateStylingKey);
  20496. }
  20497. } else {
  20498. residual = collectResidual(tData, tNode, isClassBased);
  20499. }
  20500. }
  20501. }
  20502. if (residual !== void 0) {
  20503. isClassBased ? tNode.residualClasses = residual : tNode.residualStyles = residual;
  20504. }
  20505. return stylingKey;
  20506. }
  20507. function getTemplateHeadTStylingKey(tData, tNode, isClassBased) {
  20508. const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
  20509. if (getTStylingRangeNext(bindings) === 0) {
  20510. return void 0;
  20511. }
  20512. return tData[getTStylingRangePrev(bindings)];
  20513. }
  20514. function setTemplateHeadTStylingKey(tData, tNode, isClassBased, tStylingKey) {
  20515. const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
  20516. ngDevMode && assertNotEqual(getTStylingRangeNext(bindings), 0, "Expecting to have at least one template styling binding.");
  20517. tData[getTStylingRangePrev(bindings)] = tStylingKey;
  20518. }
  20519. function collectResidual(tData, tNode, isClassBased) {
  20520. let residual = void 0;
  20521. const directiveEnd = tNode.directiveEnd;
  20522. ngDevMode && assertNotEqual(tNode.directiveStylingLast, -1, "By the time this function gets called at least one hostBindings-node styling instruction must have executed.");
  20523. for (let i = 1 + tNode.directiveStylingLast; i < directiveEnd; i++) {
  20524. const attrs = tData[i].hostAttrs;
  20525. residual = collectStylingFromTAttrs(residual, attrs, isClassBased);
  20526. }
  20527. return collectStylingFromTAttrs(residual, tNode.attrs, isClassBased);
  20528. }
  20529. function collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased) {
  20530. let currentDirective = null;
  20531. const directiveEnd = tNode.directiveEnd;
  20532. let directiveStylingLast = tNode.directiveStylingLast;
  20533. if (directiveStylingLast === -1) {
  20534. directiveStylingLast = tNode.directiveStart;
  20535. } else {
  20536. directiveStylingLast++;
  20537. }
  20538. while (directiveStylingLast < directiveEnd) {
  20539. currentDirective = tData[directiveStylingLast];
  20540. ngDevMode && assertDefined(currentDirective, "expected to be defined");
  20541. stylingKey = collectStylingFromTAttrs(stylingKey, currentDirective.hostAttrs, isClassBased);
  20542. if (currentDirective === hostDirectiveDef) break;
  20543. directiveStylingLast++;
  20544. }
  20545. if (hostDirectiveDef !== null) {
  20546. tNode.directiveStylingLast = directiveStylingLast;
  20547. }
  20548. return stylingKey;
  20549. }
  20550. function collectStylingFromTAttrs(stylingKey, attrs, isClassBased) {
  20551. const desiredMarker = isClassBased ? 1 : 2;
  20552. let currentMarker = -1;
  20553. if (attrs !== null) {
  20554. for (let i = 0; i < attrs.length; i++) {
  20555. const item = attrs[i];
  20556. if (typeof item === "number") {
  20557. currentMarker = item;
  20558. } else {
  20559. if (currentMarker === desiredMarker) {
  20560. if (!Array.isArray(stylingKey)) {
  20561. stylingKey = stylingKey === void 0 ? [] : ["", stylingKey];
  20562. }
  20563. keyValueArraySet(stylingKey, item, isClassBased ? true : attrs[++i]);
  20564. }
  20565. }
  20566. }
  20567. }
  20568. return stylingKey === void 0 ? null : stylingKey;
  20569. }
  20570. function toStylingKeyValueArray(keyValueArraySet2, stringParser, value) {
  20571. if (value == null || value === "") return EMPTY_ARRAY;
  20572. const styleKeyValueArray = [];
  20573. const unwrappedValue = unwrapSafeValue(value);
  20574. if (Array.isArray(unwrappedValue)) {
  20575. for (let i = 0; i < unwrappedValue.length; i++) {
  20576. keyValueArraySet2(styleKeyValueArray, unwrappedValue[i], true);
  20577. }
  20578. } else if (typeof unwrappedValue === "object") {
  20579. for (const key in unwrappedValue) {
  20580. if (unwrappedValue.hasOwnProperty(key)) {
  20581. keyValueArraySet2(styleKeyValueArray, key, unwrappedValue[key]);
  20582. }
  20583. }
  20584. } else if (typeof unwrappedValue === "string") {
  20585. stringParser(styleKeyValueArray, unwrappedValue);
  20586. } else {
  20587. ngDevMode && throwError2("Unsupported styling type " + typeof unwrappedValue + ": " + unwrappedValue);
  20588. }
  20589. return styleKeyValueArray;
  20590. }
  20591. function styleKeyValueArraySet(keyValueArray, key, value) {
  20592. keyValueArraySet(keyValueArray, key, unwrapSafeValue(value));
  20593. }
  20594. function classKeyValueArraySet(keyValueArray, key, value) {
  20595. const stringKey = String(key);
  20596. if (stringKey !== "" && !stringKey.includes(" ")) {
  20597. keyValueArraySet(keyValueArray, stringKey, value);
  20598. }
  20599. }
  20600. function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {
  20601. if (oldKeyValueArray === NO_CHANGE) {
  20602. oldKeyValueArray = EMPTY_ARRAY;
  20603. }
  20604. let oldIndex = 0;
  20605. let newIndex = 0;
  20606. let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;
  20607. let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;
  20608. while (oldKey !== null || newKey !== null) {
  20609. ngDevMode && assertLessThan(oldIndex, 999, "Are we stuck in infinite loop?");
  20610. ngDevMode && assertLessThan(newIndex, 999, "Are we stuck in infinite loop?");
  20611. const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : void 0;
  20612. const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : void 0;
  20613. let setKey = null;
  20614. let setValue = void 0;
  20615. if (oldKey === newKey) {
  20616. oldIndex += 2;
  20617. newIndex += 2;
  20618. if (oldValue !== newValue) {
  20619. setKey = newKey;
  20620. setValue = newValue;
  20621. }
  20622. } else if (newKey === null || oldKey !== null && oldKey < newKey) {
  20623. oldIndex += 2;
  20624. setKey = oldKey;
  20625. } else {
  20626. ngDevMode && assertDefined(newKey, "Expecting to have a valid key");
  20627. newIndex += 2;
  20628. setKey = newKey;
  20629. setValue = newValue;
  20630. }
  20631. if (setKey !== null) {
  20632. updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);
  20633. }
  20634. oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;
  20635. newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;
  20636. }
  20637. }
  20638. function updateStyling(tView, tNode, lView, renderer, prop, value, isClassBased, bindingIndex) {
  20639. if (!(tNode.type & 3)) {
  20640. return;
  20641. }
  20642. const tData = tView.data;
  20643. const tRange = tData[bindingIndex + 1];
  20644. const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) ? findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) : void 0;
  20645. if (!isStylingValuePresent(higherPriorityValue)) {
  20646. if (!isStylingValuePresent(value)) {
  20647. if (getTStylingRangePrevDuplicate(tRange)) {
  20648. value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased);
  20649. }
  20650. }
  20651. const rNode = getNativeByIndex(getSelectedIndex(), lView);
  20652. applyStyling(renderer, isClassBased, rNode, prop, value);
  20653. }
  20654. }
  20655. function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
  20656. const isPrevDirection = tNode === null;
  20657. let value = void 0;
  20658. while (index > 0) {
  20659. const rawKey = tData[index];
  20660. const containsStatics = Array.isArray(rawKey);
  20661. const key = containsStatics ? rawKey[1] : rawKey;
  20662. const isStylingMap = key === null;
  20663. let valueAtLViewIndex = lView[index + 1];
  20664. if (valueAtLViewIndex === NO_CHANGE) {
  20665. valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : void 0;
  20666. }
  20667. let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) : key === prop ? valueAtLViewIndex : void 0;
  20668. if (containsStatics && !isStylingValuePresent(currentValue)) {
  20669. currentValue = keyValueArrayGet(rawKey, prop);
  20670. }
  20671. if (isStylingValuePresent(currentValue)) {
  20672. value = currentValue;
  20673. if (isPrevDirection) {
  20674. return value;
  20675. }
  20676. }
  20677. const tRange = tData[index + 1];
  20678. index = isPrevDirection ? getTStylingRangePrev(tRange) : getTStylingRangeNext(tRange);
  20679. }
  20680. if (tNode !== null) {
  20681. let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
  20682. if (residual != null) {
  20683. value = keyValueArrayGet(residual, prop);
  20684. }
  20685. }
  20686. return value;
  20687. }
  20688. function isStylingValuePresent(value) {
  20689. return value !== void 0;
  20690. }
  20691. function normalizeSuffix(value, suffix) {
  20692. if (value == null || value === "") ;
  20693. else if (typeof suffix === "string") {
  20694. value = value + suffix;
  20695. } else if (typeof value === "object") {
  20696. value = stringify(unwrapSafeValue(value));
  20697. }
  20698. return value;
  20699. }
  20700. function hasStylingInputShadow(tNode, isClassBased) {
  20701. return (tNode.flags & (isClassBased ? 8 : 16)) !== 0;
  20702. }
  20703. function ɵɵclassMapInterpolate1(prefix, v0, suffix) {
  20704. const lView = getLView();
  20705. const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
  20706. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20707. }
  20708. function ɵɵclassMapInterpolate2(prefix, v0, i0, v1, suffix) {
  20709. const lView = getLView();
  20710. const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
  20711. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20712. }
  20713. function ɵɵclassMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
  20714. const lView = getLView();
  20715. const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
  20716. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20717. }
  20718. function ɵɵclassMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
  20719. const lView = getLView();
  20720. const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
  20721. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20722. }
  20723. function ɵɵclassMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
  20724. const lView = getLView();
  20725. const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
  20726. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20727. }
  20728. function ɵɵclassMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
  20729. const lView = getLView();
  20730. const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
  20731. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20732. }
  20733. function ɵɵclassMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
  20734. const lView = getLView();
  20735. const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  20736. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20737. }
  20738. function ɵɵclassMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
  20739. const lView = getLView();
  20740. const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  20741. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20742. }
  20743. function ɵɵclassMapInterpolateV(values) {
  20744. const lView = getLView();
  20745. const interpolatedValue = interpolationV(lView, values);
  20746. checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
  20747. }
  20748. function ɵɵcomponentInstance() {
  20749. const instance = getLView()[DECLARATION_COMPONENT_VIEW][CONTEXT];
  20750. ngDevMode && assertDefined(instance, "Expected component instance to be defined");
  20751. return instance;
  20752. }
  20753. var LiveCollection = class {
  20754. destroy(item) {
  20755. }
  20756. updateValue(index, value) {
  20757. }
  20758. // operations below could be implemented on top of the operations defined so far, but having
  20759. // them explicitly allow clear expression of intent and potentially more performant
  20760. // implementations
  20761. swap(index1, index2) {
  20762. const startIdx = Math.min(index1, index2);
  20763. const endIdx = Math.max(index1, index2);
  20764. const endItem = this.detach(endIdx);
  20765. if (endIdx - startIdx > 1) {
  20766. const startItem = this.detach(startIdx);
  20767. this.attach(startIdx, endItem);
  20768. this.attach(endIdx, startItem);
  20769. } else {
  20770. this.attach(startIdx, endItem);
  20771. }
  20772. }
  20773. move(prevIndex, newIdx) {
  20774. this.attach(newIdx, this.detach(prevIndex));
  20775. }
  20776. };
  20777. function valuesMatching(liveIdx, liveValue, newIdx, newValue, trackBy) {
  20778. if (liveIdx === newIdx && Object.is(liveValue, newValue)) {
  20779. return 1;
  20780. } else if (Object.is(trackBy(liveIdx, liveValue), trackBy(newIdx, newValue))) {
  20781. return -1;
  20782. }
  20783. return 0;
  20784. }
  20785. function recordDuplicateKeys(keyToIdx, key, idx) {
  20786. const idxSoFar = keyToIdx.get(key);
  20787. if (idxSoFar !== void 0) {
  20788. idxSoFar.add(idx);
  20789. } else {
  20790. keyToIdx.set(key, /* @__PURE__ */ new Set([idx]));
  20791. }
  20792. }
  20793. function reconcile(liveCollection, newCollection, trackByFn) {
  20794. let detachedItems = void 0;
  20795. let liveKeysInTheFuture = void 0;
  20796. let liveStartIdx = 0;
  20797. let liveEndIdx = liveCollection.length - 1;
  20798. const duplicateKeys = ngDevMode ? /* @__PURE__ */ new Map() : void 0;
  20799. if (Array.isArray(newCollection)) {
  20800. let newEndIdx = newCollection.length - 1;
  20801. while (liveStartIdx <= liveEndIdx && liveStartIdx <= newEndIdx) {
  20802. const liveStartValue = liveCollection.at(liveStartIdx);
  20803. const newStartValue = newCollection[liveStartIdx];
  20804. if (ngDevMode) {
  20805. recordDuplicateKeys(duplicateKeys, trackByFn(liveStartIdx, newStartValue), liveStartIdx);
  20806. }
  20807. const isStartMatching = valuesMatching(liveStartIdx, liveStartValue, liveStartIdx, newStartValue, trackByFn);
  20808. if (isStartMatching !== 0) {
  20809. if (isStartMatching < 0) {
  20810. liveCollection.updateValue(liveStartIdx, newStartValue);
  20811. }
  20812. liveStartIdx++;
  20813. continue;
  20814. }
  20815. const liveEndValue = liveCollection.at(liveEndIdx);
  20816. const newEndValue = newCollection[newEndIdx];
  20817. if (ngDevMode) {
  20818. recordDuplicateKeys(duplicateKeys, trackByFn(newEndIdx, newEndValue), newEndIdx);
  20819. }
  20820. const isEndMatching = valuesMatching(liveEndIdx, liveEndValue, newEndIdx, newEndValue, trackByFn);
  20821. if (isEndMatching !== 0) {
  20822. if (isEndMatching < 0) {
  20823. liveCollection.updateValue(liveEndIdx, newEndValue);
  20824. }
  20825. liveEndIdx--;
  20826. newEndIdx--;
  20827. continue;
  20828. }
  20829. const liveStartKey = trackByFn(liveStartIdx, liveStartValue);
  20830. const liveEndKey = trackByFn(liveEndIdx, liveEndValue);
  20831. const newStartKey = trackByFn(liveStartIdx, newStartValue);
  20832. if (Object.is(newStartKey, liveEndKey)) {
  20833. const newEndKey = trackByFn(newEndIdx, newEndValue);
  20834. if (Object.is(newEndKey, liveStartKey)) {
  20835. liveCollection.swap(liveStartIdx, liveEndIdx);
  20836. liveCollection.updateValue(liveEndIdx, newEndValue);
  20837. newEndIdx--;
  20838. liveEndIdx--;
  20839. } else {
  20840. liveCollection.move(liveEndIdx, liveStartIdx);
  20841. }
  20842. liveCollection.updateValue(liveStartIdx, newStartValue);
  20843. liveStartIdx++;
  20844. continue;
  20845. }
  20846. detachedItems ??= new UniqueValueMultiKeyMap();
  20847. liveKeysInTheFuture ??= initLiveItemsInTheFuture(liveCollection, liveStartIdx, liveEndIdx, trackByFn);
  20848. if (attachPreviouslyDetached(liveCollection, detachedItems, liveStartIdx, newStartKey)) {
  20849. liveCollection.updateValue(liveStartIdx, newStartValue);
  20850. liveStartIdx++;
  20851. liveEndIdx++;
  20852. } else if (!liveKeysInTheFuture.has(newStartKey)) {
  20853. const newItem = liveCollection.create(liveStartIdx, newCollection[liveStartIdx]);
  20854. liveCollection.attach(liveStartIdx, newItem);
  20855. liveStartIdx++;
  20856. liveEndIdx++;
  20857. } else {
  20858. detachedItems.set(liveStartKey, liveCollection.detach(liveStartIdx));
  20859. liveEndIdx--;
  20860. }
  20861. }
  20862. while (liveStartIdx <= newEndIdx) {
  20863. createOrAttach(liveCollection, detachedItems, trackByFn, liveStartIdx, newCollection[liveStartIdx]);
  20864. liveStartIdx++;
  20865. }
  20866. } else if (newCollection != null) {
  20867. const newCollectionIterator = newCollection[Symbol.iterator]();
  20868. let newIterationResult = newCollectionIterator.next();
  20869. while (!newIterationResult.done && liveStartIdx <= liveEndIdx) {
  20870. const liveValue = liveCollection.at(liveStartIdx);
  20871. const newValue = newIterationResult.value;
  20872. if (ngDevMode) {
  20873. recordDuplicateKeys(duplicateKeys, trackByFn(liveStartIdx, newValue), liveStartIdx);
  20874. }
  20875. const isStartMatching = valuesMatching(liveStartIdx, liveValue, liveStartIdx, newValue, trackByFn);
  20876. if (isStartMatching !== 0) {
  20877. if (isStartMatching < 0) {
  20878. liveCollection.updateValue(liveStartIdx, newValue);
  20879. }
  20880. liveStartIdx++;
  20881. newIterationResult = newCollectionIterator.next();
  20882. } else {
  20883. detachedItems ??= new UniqueValueMultiKeyMap();
  20884. liveKeysInTheFuture ??= initLiveItemsInTheFuture(liveCollection, liveStartIdx, liveEndIdx, trackByFn);
  20885. const newKey = trackByFn(liveStartIdx, newValue);
  20886. if (attachPreviouslyDetached(liveCollection, detachedItems, liveStartIdx, newKey)) {
  20887. liveCollection.updateValue(liveStartIdx, newValue);
  20888. liveStartIdx++;
  20889. liveEndIdx++;
  20890. newIterationResult = newCollectionIterator.next();
  20891. } else if (!liveKeysInTheFuture.has(newKey)) {
  20892. liveCollection.attach(liveStartIdx, liveCollection.create(liveStartIdx, newValue));
  20893. liveStartIdx++;
  20894. liveEndIdx++;
  20895. newIterationResult = newCollectionIterator.next();
  20896. } else {
  20897. const liveKey = trackByFn(liveStartIdx, liveValue);
  20898. detachedItems.set(liveKey, liveCollection.detach(liveStartIdx));
  20899. liveEndIdx--;
  20900. }
  20901. }
  20902. }
  20903. while (!newIterationResult.done) {
  20904. createOrAttach(liveCollection, detachedItems, trackByFn, liveCollection.length, newIterationResult.value);
  20905. newIterationResult = newCollectionIterator.next();
  20906. }
  20907. }
  20908. while (liveStartIdx <= liveEndIdx) {
  20909. liveCollection.destroy(liveCollection.detach(liveEndIdx--));
  20910. }
  20911. detachedItems?.forEach((item) => {
  20912. liveCollection.destroy(item);
  20913. });
  20914. if (ngDevMode) {
  20915. let duplicatedKeysMsg = [];
  20916. for (const [key, idxSet] of duplicateKeys) {
  20917. if (idxSet.size > 1) {
  20918. const idx = [...idxSet].sort((a, b) => a - b);
  20919. for (let i = 1; i < idx.length; i++) {
  20920. duplicatedKeysMsg.push(`key "${stringifyForError(key)}" at index "${idx[i - 1]}" and "${idx[i]}"`);
  20921. }
  20922. }
  20923. }
  20924. if (duplicatedKeysMsg.length > 0) {
  20925. const message = formatRuntimeError(-955, "The provided track expression resulted in duplicated keys for a given collection. Adjust the tracking expression such that it uniquely identifies all the items in the collection. Duplicated keys were: \n" + duplicatedKeysMsg.join(", \n") + ".");
  20926. console.warn(message);
  20927. }
  20928. }
  20929. }
  20930. function attachPreviouslyDetached(prevCollection, detachedItems, index, key) {
  20931. if (detachedItems !== void 0 && detachedItems.has(key)) {
  20932. prevCollection.attach(index, detachedItems.get(key));
  20933. detachedItems.delete(key);
  20934. return true;
  20935. }
  20936. return false;
  20937. }
  20938. function createOrAttach(liveCollection, detachedItems, trackByFn, index, value) {
  20939. if (!attachPreviouslyDetached(liveCollection, detachedItems, index, trackByFn(index, value))) {
  20940. const newItem = liveCollection.create(index, value);
  20941. liveCollection.attach(index, newItem);
  20942. } else {
  20943. liveCollection.updateValue(index, value);
  20944. }
  20945. }
  20946. function initLiveItemsInTheFuture(liveCollection, start, end, trackByFn) {
  20947. const keys = /* @__PURE__ */ new Set();
  20948. for (let i = start; i <= end; i++) {
  20949. keys.add(trackByFn(i, liveCollection.at(i)));
  20950. }
  20951. return keys;
  20952. }
  20953. var UniqueValueMultiKeyMap = class {
  20954. // A map from a key to the first value corresponding to this key.
  20955. kvMap = /* @__PURE__ */ new Map();
  20956. // A map that acts as a linked list of values - each value maps to the next value in this "linked
  20957. // list" (this only works if values are unique). Allocated lazily to avoid memory consumption when
  20958. // there are no duplicated values.
  20959. _vMap = void 0;
  20960. has(key) {
  20961. return this.kvMap.has(key);
  20962. }
  20963. delete(key) {
  20964. if (!this.has(key)) return false;
  20965. const value = this.kvMap.get(key);
  20966. if (this._vMap !== void 0 && this._vMap.has(value)) {
  20967. this.kvMap.set(key, this._vMap.get(value));
  20968. this._vMap.delete(value);
  20969. } else {
  20970. this.kvMap.delete(key);
  20971. }
  20972. return true;
  20973. }
  20974. get(key) {
  20975. return this.kvMap.get(key);
  20976. }
  20977. set(key, value) {
  20978. if (this.kvMap.has(key)) {
  20979. let prevValue = this.kvMap.get(key);
  20980. if (ngDevMode && prevValue === value) {
  20981. throw new Error(`Detected a duplicated value ${value} for the key ${key}`);
  20982. }
  20983. if (this._vMap === void 0) {
  20984. this._vMap = /* @__PURE__ */ new Map();
  20985. }
  20986. const vMap = this._vMap;
  20987. while (vMap.has(prevValue)) {
  20988. prevValue = vMap.get(prevValue);
  20989. }
  20990. vMap.set(prevValue, value);
  20991. } else {
  20992. this.kvMap.set(key, value);
  20993. }
  20994. }
  20995. forEach(cb) {
  20996. for (let [key, value] of this.kvMap) {
  20997. cb(value, key);
  20998. if (this._vMap !== void 0) {
  20999. const vMap = this._vMap;
  21000. while (vMap.has(value)) {
  21001. value = vMap.get(value);
  21002. cb(value, key);
  21003. }
  21004. }
  21005. }
  21006. }
  21007. };
  21008. function ɵɵconditional(matchingTemplateIndex, contextValue) {
  21009. performanceMarkFeature("NgControlFlow");
  21010. const hostLView = getLView();
  21011. const bindingIndex = nextBindingIndex();
  21012. const prevMatchingTemplateIndex = hostLView[bindingIndex] !== NO_CHANGE ? hostLView[bindingIndex] : -1;
  21013. const prevContainer = prevMatchingTemplateIndex !== -1 ? getLContainer(hostLView, HEADER_OFFSET + prevMatchingTemplateIndex) : void 0;
  21014. const viewInContainerIdx = 0;
  21015. if (bindingUpdated(hostLView, bindingIndex, matchingTemplateIndex)) {
  21016. const prevConsumer = setActiveConsumer(null);
  21017. try {
  21018. if (prevContainer !== void 0) {
  21019. removeLViewFromLContainer(prevContainer, viewInContainerIdx);
  21020. }
  21021. if (matchingTemplateIndex !== -1) {
  21022. const nextLContainerIndex = HEADER_OFFSET + matchingTemplateIndex;
  21023. const nextContainer = getLContainer(hostLView, nextLContainerIndex);
  21024. const templateTNode = getExistingTNode(hostLView[TVIEW], nextLContainerIndex);
  21025. const dehydratedView = findMatchingDehydratedView(nextContainer, templateTNode.tView.ssrId);
  21026. const embeddedLView = createAndRenderEmbeddedLView(hostLView, templateTNode, contextValue, {
  21027. dehydratedView
  21028. });
  21029. addLViewToLContainer(nextContainer, embeddedLView, viewInContainerIdx, shouldAddViewToDom(templateTNode, dehydratedView));
  21030. }
  21031. } finally {
  21032. setActiveConsumer(prevConsumer);
  21033. }
  21034. } else if (prevContainer !== void 0) {
  21035. const lView = getLViewFromLContainer(prevContainer, viewInContainerIdx);
  21036. if (lView !== void 0) {
  21037. lView[CONTEXT] = contextValue;
  21038. }
  21039. }
  21040. }
  21041. var RepeaterContext = class {
  21042. lContainer;
  21043. $implicit;
  21044. $index;
  21045. constructor(lContainer, $implicit, $index) {
  21046. this.lContainer = lContainer;
  21047. this.$implicit = $implicit;
  21048. this.$index = $index;
  21049. }
  21050. get $count() {
  21051. return this.lContainer.length - CONTAINER_HEADER_OFFSET;
  21052. }
  21053. };
  21054. function ɵɵrepeaterTrackByIndex(index) {
  21055. return index;
  21056. }
  21057. function ɵɵrepeaterTrackByIdentity(_, value) {
  21058. return value;
  21059. }
  21060. var RepeaterMetadata = class {
  21061. hasEmptyBlock;
  21062. trackByFn;
  21063. liveCollection;
  21064. constructor(hasEmptyBlock, trackByFn, liveCollection) {
  21065. this.hasEmptyBlock = hasEmptyBlock;
  21066. this.trackByFn = trackByFn;
  21067. this.liveCollection = liveCollection;
  21068. }
  21069. };
  21070. function ɵɵrepeaterCreate(index, templateFn, decls, vars, tagName, attrsIndex, trackByFn, trackByUsesComponentInstance, emptyTemplateFn, emptyDecls, emptyVars, emptyTagName, emptyAttrsIndex) {
  21071. performanceMarkFeature("NgControlFlow");
  21072. ngDevMode && assertFunction(trackByFn, `A track expression must be a function, was ${typeof trackByFn} instead.`);
  21073. const lView = getLView();
  21074. const tView = getTView();
  21075. const hasEmptyBlock = emptyTemplateFn !== void 0;
  21076. const hostLView = getLView();
  21077. const boundTrackBy = trackByUsesComponentInstance ? (
  21078. // We only want to bind when necessary, because it produces a
  21079. // new function. For pure functions it's not necessary.
  21080. trackByFn.bind(hostLView[DECLARATION_COMPONENT_VIEW][CONTEXT])
  21081. ) : trackByFn;
  21082. const metadata = new RepeaterMetadata(hasEmptyBlock, boundTrackBy);
  21083. hostLView[HEADER_OFFSET + index] = metadata;
  21084. declareTemplate(lView, tView, index + 1, templateFn, decls, vars, tagName, getConstant(tView.consts, attrsIndex));
  21085. if (hasEmptyBlock) {
  21086. ngDevMode && assertDefined(emptyDecls, "Missing number of declarations for the empty repeater block.");
  21087. ngDevMode && assertDefined(emptyVars, "Missing number of bindings for the empty repeater block.");
  21088. declareTemplate(lView, tView, index + 2, emptyTemplateFn, emptyDecls, emptyVars, emptyTagName, getConstant(tView.consts, emptyAttrsIndex));
  21089. }
  21090. }
  21091. function isViewExpensiveToRecreate(lView) {
  21092. return lView.length - HEADER_OFFSET > 2;
  21093. }
  21094. var OperationsCounter = class {
  21095. created = 0;
  21096. destroyed = 0;
  21097. reset() {
  21098. this.created = 0;
  21099. this.destroyed = 0;
  21100. }
  21101. recordCreate() {
  21102. this.created++;
  21103. }
  21104. recordDestroy() {
  21105. this.destroyed++;
  21106. }
  21107. /**
  21108. * A method indicating if the entire collection was re-created as part of the reconciliation pass.
  21109. * Used to warn developers about the usage of a tracking function that might result in excessive
  21110. * amount of view creation / destroy operations.
  21111. *
  21112. * @returns boolean value indicating if a live collection was re-created
  21113. */
  21114. wasReCreated(collectionLen) {
  21115. return collectionLen > 0 && this.created === this.destroyed && this.created === collectionLen;
  21116. }
  21117. };
  21118. var LiveCollectionLContainerImpl = class extends LiveCollection {
  21119. lContainer;
  21120. hostLView;
  21121. templateTNode;
  21122. operationsCounter = ngDevMode ? new OperationsCounter() : void 0;
  21123. /**
  21124. Property indicating if indexes in the repeater context need to be updated following the live
  21125. collection changes. Index updates are necessary if and only if views are inserted / removed in
  21126. the middle of LContainer. Adds and removals at the end don't require index updates.
  21127. */
  21128. needsIndexUpdate = false;
  21129. constructor(lContainer, hostLView, templateTNode) {
  21130. super();
  21131. this.lContainer = lContainer;
  21132. this.hostLView = hostLView;
  21133. this.templateTNode = templateTNode;
  21134. }
  21135. get length() {
  21136. return this.lContainer.length - CONTAINER_HEADER_OFFSET;
  21137. }
  21138. at(index) {
  21139. return this.getLView(index)[CONTEXT].$implicit;
  21140. }
  21141. attach(index, lView) {
  21142. const dehydratedView = lView[HYDRATION];
  21143. this.needsIndexUpdate ||= index !== this.length;
  21144. addLViewToLContainer(this.lContainer, lView, index, shouldAddViewToDom(this.templateTNode, dehydratedView));
  21145. }
  21146. detach(index) {
  21147. this.needsIndexUpdate ||= index !== this.length - 1;
  21148. return detachExistingView(this.lContainer, index);
  21149. }
  21150. create(index, value) {
  21151. const dehydratedView = findMatchingDehydratedView(this.lContainer, this.templateTNode.tView.ssrId);
  21152. const embeddedLView = createAndRenderEmbeddedLView(this.hostLView, this.templateTNode, new RepeaterContext(this.lContainer, value, index), {
  21153. dehydratedView
  21154. });
  21155. this.operationsCounter?.recordCreate();
  21156. return embeddedLView;
  21157. }
  21158. destroy(lView) {
  21159. destroyLView(lView[TVIEW], lView);
  21160. this.operationsCounter?.recordDestroy();
  21161. }
  21162. updateValue(index, value) {
  21163. this.getLView(index)[CONTEXT].$implicit = value;
  21164. }
  21165. reset() {
  21166. this.needsIndexUpdate = false;
  21167. this.operationsCounter?.reset();
  21168. }
  21169. updateIndexes() {
  21170. if (this.needsIndexUpdate) {
  21171. for (let i = 0; i < this.length; i++) {
  21172. this.getLView(i)[CONTEXT].$index = i;
  21173. }
  21174. }
  21175. }
  21176. getLView(index) {
  21177. return getExistingLViewFromLContainer(this.lContainer, index);
  21178. }
  21179. };
  21180. function ɵɵrepeater(collection) {
  21181. const prevConsumer = setActiveConsumer(null);
  21182. const metadataSlotIdx = getSelectedIndex();
  21183. try {
  21184. const hostLView = getLView();
  21185. const hostTView = hostLView[TVIEW];
  21186. const metadata = hostLView[metadataSlotIdx];
  21187. const containerIndex = metadataSlotIdx + 1;
  21188. const lContainer = getLContainer(hostLView, containerIndex);
  21189. if (metadata.liveCollection === void 0) {
  21190. const itemTemplateTNode = getExistingTNode(hostTView, containerIndex);
  21191. metadata.liveCollection = new LiveCollectionLContainerImpl(lContainer, hostLView, itemTemplateTNode);
  21192. } else {
  21193. metadata.liveCollection.reset();
  21194. }
  21195. const liveCollection = metadata.liveCollection;
  21196. reconcile(liveCollection, collection, metadata.trackByFn);
  21197. if (ngDevMode && metadata.trackByFn === ɵɵrepeaterTrackByIdentity && liveCollection.operationsCounter?.wasReCreated(liveCollection.length) && isViewExpensiveToRecreate(getExistingLViewFromLContainer(lContainer, 0))) {
  21198. const message = formatRuntimeError(-956, `The configured tracking expression (track by identity) caused re-creation of the entire collection of size ${liveCollection.length}. This is an expensive operation requiring destruction and subsequent creation of DOM nodes, directives, components etc. Please review the "track expression" and make sure that it uniquely identifies items in a collection.`);
  21199. console.warn(message);
  21200. }
  21201. liveCollection.updateIndexes();
  21202. if (metadata.hasEmptyBlock) {
  21203. const bindingIndex = nextBindingIndex();
  21204. const isCollectionEmpty = liveCollection.length === 0;
  21205. if (bindingUpdated(hostLView, bindingIndex, isCollectionEmpty)) {
  21206. const emptyTemplateIndex = metadataSlotIdx + 2;
  21207. const lContainerForEmpty = getLContainer(hostLView, emptyTemplateIndex);
  21208. if (isCollectionEmpty) {
  21209. const emptyTemplateTNode = getExistingTNode(hostTView, emptyTemplateIndex);
  21210. const dehydratedView = findMatchingDehydratedView(lContainerForEmpty, emptyTemplateTNode.tView.ssrId);
  21211. const embeddedLView = createAndRenderEmbeddedLView(hostLView, emptyTemplateTNode, void 0, {
  21212. dehydratedView
  21213. });
  21214. addLViewToLContainer(lContainerForEmpty, embeddedLView, 0, shouldAddViewToDom(emptyTemplateTNode, dehydratedView));
  21215. } else {
  21216. removeLViewFromLContainer(lContainerForEmpty, 0);
  21217. }
  21218. }
  21219. }
  21220. } finally {
  21221. setActiveConsumer(prevConsumer);
  21222. }
  21223. }
  21224. function getLContainer(lView, index) {
  21225. const lContainer = lView[index];
  21226. ngDevMode && assertLContainer(lContainer);
  21227. return lContainer;
  21228. }
  21229. function detachExistingView(lContainer, index) {
  21230. const existingLView = detachView(lContainer, index);
  21231. ngDevMode && assertLView(existingLView);
  21232. return existingLView;
  21233. }
  21234. function getExistingLViewFromLContainer(lContainer, index) {
  21235. const existingLView = getLViewFromLContainer(lContainer, index);
  21236. ngDevMode && assertLView(existingLView);
  21237. return existingLView;
  21238. }
  21239. function getExistingTNode(tView, index) {
  21240. const tNode = getTNode(tView, index);
  21241. ngDevMode && assertTNode(tNode);
  21242. return tNode;
  21243. }
  21244. function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
  21245. const lView = getLView();
  21246. const tView = getTView();
  21247. const adjustedIndex = HEADER_OFFSET + index;
  21248. ngDevMode && assertEqual(getBindingIndex(), tView.bindingStartIndex, "elements should be created before any bindings");
  21249. ngDevMode && assertIndexInRange(lView, adjustedIndex);
  21250. const renderer = lView[RENDERER];
  21251. const tNode = tView.firstCreatePass ? elementStartFirstCreatePass(adjustedIndex, tView, lView, name, findDirectiveDefMatches, getBindingsEnabled(), attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
  21252. const native = _locateOrCreateElementNode(tView, lView, tNode, renderer, name, index);
  21253. lView[adjustedIndex] = native;
  21254. const hasDirectives = isDirectiveHost(tNode);
  21255. if (ngDevMode && tView.firstCreatePass) {
  21256. validateElementIsKnown(native, lView, tNode.value, tView.schemas, hasDirectives);
  21257. }
  21258. setCurrentTNode(tNode, true);
  21259. setupStaticAttributes(renderer, native, tNode);
  21260. if (!isDetachedByI18n(tNode) && wasLastNodeCreated()) {
  21261. appendChild(tView, lView, native, tNode);
  21262. }
  21263. if (getElementDepthCount() === 0 || hasDirectives) {
  21264. attachPatchData(native, lView);
  21265. }
  21266. increaseElementDepthCount();
  21267. if (hasDirectives) {
  21268. createDirectivesInstances(tView, lView, tNode);
  21269. executeContentQueries(tView, tNode, lView);
  21270. }
  21271. if (localRefsIndex !== null) {
  21272. saveResolvedLocalsInData(lView, tNode);
  21273. }
  21274. return ɵɵelementStart;
  21275. }
  21276. function ɵɵelementEnd() {
  21277. let currentTNode = getCurrentTNode();
  21278. ngDevMode && assertDefined(currentTNode, "No parent node to close.");
  21279. if (isCurrentTNodeParent()) {
  21280. setCurrentTNodeAsNotParent();
  21281. } else {
  21282. ngDevMode && assertHasParent(getCurrentTNode());
  21283. currentTNode = currentTNode.parent;
  21284. setCurrentTNode(currentTNode, false);
  21285. }
  21286. const tNode = currentTNode;
  21287. ngDevMode && assertTNodeType(
  21288. tNode,
  21289. 3
  21290. /* TNodeType.AnyRNode */
  21291. );
  21292. if (isSkipHydrationRootTNode(tNode)) {
  21293. leaveSkipHydrationBlock();
  21294. }
  21295. decreaseElementDepthCount();
  21296. const tView = getTView();
  21297. if (tView.firstCreatePass) {
  21298. elementEndFirstCreatePass(tView, tNode);
  21299. }
  21300. if (tNode.classesWithoutHost != null && hasClassInput(tNode)) {
  21301. setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.classesWithoutHost, true);
  21302. }
  21303. if (tNode.stylesWithoutHost != null && hasStyleInput(tNode)) {
  21304. setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.stylesWithoutHost, false);
  21305. }
  21306. return ɵɵelementEnd;
  21307. }
  21308. function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
  21309. ɵɵelementStart(index, name, attrsIndex, localRefsIndex);
  21310. ɵɵelementEnd();
  21311. return ɵɵelement;
  21312. }
  21313. var _locateOrCreateElementNode = (tView, lView, tNode, renderer, name, index) => {
  21314. lastNodeWasCreated(true);
  21315. return createElementNode(renderer, name, getNamespace());
  21316. };
  21317. function locateOrCreateElementNodeImpl(tView, lView, tNode, renderer, name, index) {
  21318. const hydrationInfo = lView[HYDRATION];
  21319. const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDetachedByI18n(tNode) || isDisconnectedNode$1(hydrationInfo, index);
  21320. lastNodeWasCreated(isNodeCreationMode);
  21321. if (isNodeCreationMode) {
  21322. return createElementNode(renderer, name, getNamespace());
  21323. }
  21324. const native = locateNextRNode(hydrationInfo, tView, lView, tNode);
  21325. ngDevMode && validateMatchingNode(native, Node.ELEMENT_NODE, name, lView, tNode);
  21326. ngDevMode && markRNodeAsClaimedByHydration(native);
  21327. if (getSerializedContainerViews(hydrationInfo, index)) {
  21328. ngDevMode && validateNodeExists(native.nextSibling, lView, tNode);
  21329. setSegmentHead(hydrationInfo, index, native.nextSibling);
  21330. }
  21331. if (hydrationInfo && (hasSkipHydrationAttrOnTNode(tNode) || hasSkipHydrationAttrOnRElement(native))) {
  21332. if (isComponentHost(tNode)) {
  21333. enterSkipHydrationBlock(tNode);
  21334. clearElementContents(native);
  21335. ngDevMode && markRNodeAsSkippedByHydration(native);
  21336. } else if (ngDevMode) {
  21337. throw invalidSkipHydrationHost(native);
  21338. }
  21339. }
  21340. return native;
  21341. }
  21342. function enableLocateOrCreateElementNodeImpl() {
  21343. _locateOrCreateElementNode = locateOrCreateElementNodeImpl;
  21344. }
  21345. function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) {
  21346. ngDevMode && ngDevMode.firstCreatePass++;
  21347. const tViewConsts = tView.consts;
  21348. const attrs = getConstant(tViewConsts, attrsIndex);
  21349. const tNode = getOrCreateTNode(tView, index, 8, "ng-container", attrs);
  21350. if (attrs !== null) {
  21351. computeStaticStyling(tNode, attrs, true);
  21352. }
  21353. const localRefs = getConstant(tViewConsts, localRefsIndex);
  21354. if (getBindingsEnabled()) {
  21355. resolveDirectives(tView, lView, tNode, localRefs, findDirectiveDefMatches);
  21356. }
  21357. tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
  21358. if (tView.queries !== null) {
  21359. tView.queries.elementStart(tView, tNode);
  21360. }
  21361. return tNode;
  21362. }
  21363. function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
  21364. const lView = getLView();
  21365. const tView = getTView();
  21366. const adjustedIndex = index + HEADER_OFFSET;
  21367. ngDevMode && assertIndexInRange(lView, adjustedIndex);
  21368. ngDevMode && assertEqual(getBindingIndex(), tView.bindingStartIndex, "element containers should be created before any bindings");
  21369. const tNode = tView.firstCreatePass ? elementContainerStartFirstCreatePass(adjustedIndex, tView, lView, attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
  21370. setCurrentTNode(tNode, true);
  21371. const comment = _locateOrCreateElementContainerNode(tView, lView, tNode, index);
  21372. lView[adjustedIndex] = comment;
  21373. if (wasLastNodeCreated()) {
  21374. appendChild(tView, lView, comment, tNode);
  21375. }
  21376. attachPatchData(comment, lView);
  21377. if (isDirectiveHost(tNode)) {
  21378. createDirectivesInstances(tView, lView, tNode);
  21379. executeContentQueries(tView, tNode, lView);
  21380. }
  21381. if (localRefsIndex != null) {
  21382. saveResolvedLocalsInData(lView, tNode);
  21383. }
  21384. return ɵɵelementContainerStart;
  21385. }
  21386. function ɵɵelementContainerEnd() {
  21387. let currentTNode = getCurrentTNode();
  21388. const tView = getTView();
  21389. if (isCurrentTNodeParent()) {
  21390. setCurrentTNodeAsNotParent();
  21391. } else {
  21392. ngDevMode && assertHasParent(currentTNode);
  21393. currentTNode = currentTNode.parent;
  21394. setCurrentTNode(currentTNode, false);
  21395. }
  21396. ngDevMode && assertTNodeType(
  21397. currentTNode,
  21398. 8
  21399. /* TNodeType.ElementContainer */
  21400. );
  21401. if (tView.firstCreatePass) {
  21402. registerPostOrderHooks(tView, currentTNode);
  21403. if (isContentQueryHost(currentTNode)) {
  21404. tView.queries.elementEnd(currentTNode);
  21405. }
  21406. }
  21407. return ɵɵelementContainerEnd;
  21408. }
  21409. function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
  21410. ɵɵelementContainerStart(index, attrsIndex, localRefsIndex);
  21411. ɵɵelementContainerEnd();
  21412. return ɵɵelementContainer;
  21413. }
  21414. var _locateOrCreateElementContainerNode = (tView, lView, tNode, index) => {
  21415. lastNodeWasCreated(true);
  21416. return createCommentNode(lView[RENDERER], ngDevMode ? "ng-container" : "");
  21417. };
  21418. function locateOrCreateElementContainerNode(tView, lView, tNode, index) {
  21419. let comment;
  21420. const hydrationInfo = lView[HYDRATION];
  21421. const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDisconnectedNode$1(hydrationInfo, index) || isDetachedByI18n(tNode);
  21422. lastNodeWasCreated(isNodeCreationMode);
  21423. if (isNodeCreationMode) {
  21424. return createCommentNode(lView[RENDERER], ngDevMode ? "ng-container" : "");
  21425. }
  21426. const currentRNode = locateNextRNode(hydrationInfo, tView, lView, tNode);
  21427. ngDevMode && validateNodeExists(currentRNode, lView, tNode);
  21428. const ngContainerSize = getNgContainerSize(hydrationInfo, index);
  21429. ngDevMode && assertNumber(ngContainerSize, "Unexpected state: hydrating an <ng-container>, but no hydration info is available.");
  21430. setSegmentHead(hydrationInfo, index, currentRNode);
  21431. comment = siblingAfter(ngContainerSize, currentRNode);
  21432. if (ngDevMode) {
  21433. validateMatchingNode(comment, Node.COMMENT_NODE, null, lView, tNode);
  21434. markRNodeAsClaimedByHydration(comment);
  21435. }
  21436. return comment;
  21437. }
  21438. function enableLocateOrCreateElementContainerNodeImpl() {
  21439. _locateOrCreateElementContainerNode = locateOrCreateElementContainerNode;
  21440. }
  21441. function ɵɵgetCurrentView() {
  21442. return getLView();
  21443. }
  21444. function ɵɵhostProperty(propName, value, sanitizer) {
  21445. const lView = getLView();
  21446. const bindingIndex = nextBindingIndex();
  21447. if (bindingUpdated(lView, bindingIndex, value)) {
  21448. const tView = getTView();
  21449. const tNode = getSelectedTNode();
  21450. elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, true);
  21451. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  21452. }
  21453. return ɵɵhostProperty;
  21454. }
  21455. function ɵɵsyntheticHostProperty(propName, value, sanitizer) {
  21456. const lView = getLView();
  21457. const bindingIndex = nextBindingIndex();
  21458. if (bindingUpdated(lView, bindingIndex, value)) {
  21459. const tView = getTView();
  21460. const tNode = getSelectedTNode();
  21461. const currentDef = getCurrentDirectiveDef(tView.data);
  21462. const renderer = loadComponentRenderer(currentDef, tNode, lView);
  21463. elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true);
  21464. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  21465. }
  21466. return ɵɵsyntheticHostProperty;
  21467. }
  21468. var u = void 0;
  21469. function plural(val) {
  21470. const i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\.?/, "").length;
  21471. if (i === 1 && v === 0) return 1;
  21472. return 5;
  21473. }
  21474. var localeEn = ["en", [["a", "p"], ["AM", "PM"], u], [["AM", "PM"], u, u], [["S", "M", "T", "W", "T", "F", "S"], ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]], u, [["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]], u, [["B", "A"], ["BC", "AD"], ["Before Christ", "Anno Domini"]], 0, [6, 0], ["M/d/yy", "MMM d, y", "MMMM d, y", "EEEE, MMMM d, y"], ["h:mm a", "h:mm:ss a", "h:mm:ss a z", "h:mm:ss a zzzz"], ["{1}, {0}", u, "{1} 'at' {0}", u], [".", ",", ";", "%", "+", "-", "E", "×", "‰", "∞", "NaN", ":"], ["#,##0.###", "#,##0%", "¤#,##0.00", "#E0"], "USD", "$", "US Dollar", {}, "ltr", plural];
  21475. var LOCALE_DATA = {};
  21476. function registerLocaleData(data, localeId, extraData) {
  21477. if (typeof localeId !== "string") {
  21478. extraData = localeId;
  21479. localeId = data[LocaleDataIndex.LocaleId];
  21480. }
  21481. localeId = localeId.toLowerCase().replace(/_/g, "-");
  21482. LOCALE_DATA[localeId] = data;
  21483. if (extraData) {
  21484. LOCALE_DATA[localeId][LocaleDataIndex.ExtraData] = extraData;
  21485. }
  21486. }
  21487. function findLocaleData(locale) {
  21488. const normalizedLocale = normalizeLocale(locale);
  21489. let match = getLocaleData(normalizedLocale);
  21490. if (match) {
  21491. return match;
  21492. }
  21493. const parentLocale = normalizedLocale.split("-")[0];
  21494. match = getLocaleData(parentLocale);
  21495. if (match) {
  21496. return match;
  21497. }
  21498. if (parentLocale === "en") {
  21499. return localeEn;
  21500. }
  21501. throw new RuntimeError(701, ngDevMode && `Missing locale data for the locale "${locale}".`);
  21502. }
  21503. function getLocaleCurrencyCode(locale) {
  21504. const data = findLocaleData(locale);
  21505. return data[LocaleDataIndex.CurrencyCode] || null;
  21506. }
  21507. function getLocalePluralCase(locale) {
  21508. const data = findLocaleData(locale);
  21509. return data[LocaleDataIndex.PluralCase];
  21510. }
  21511. function getLocaleData(normalizedLocale) {
  21512. if (!(normalizedLocale in LOCALE_DATA)) {
  21513. LOCALE_DATA[normalizedLocale] = _global.ng && _global.ng.common && _global.ng.common.locales && _global.ng.common.locales[normalizedLocale];
  21514. }
  21515. return LOCALE_DATA[normalizedLocale];
  21516. }
  21517. function unregisterAllLocaleData() {
  21518. LOCALE_DATA = {};
  21519. }
  21520. var LocaleDataIndex;
  21521. (function(LocaleDataIndex2) {
  21522. LocaleDataIndex2[LocaleDataIndex2["LocaleId"] = 0] = "LocaleId";
  21523. LocaleDataIndex2[LocaleDataIndex2["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
  21524. LocaleDataIndex2[LocaleDataIndex2["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
  21525. LocaleDataIndex2[LocaleDataIndex2["DaysFormat"] = 3] = "DaysFormat";
  21526. LocaleDataIndex2[LocaleDataIndex2["DaysStandalone"] = 4] = "DaysStandalone";
  21527. LocaleDataIndex2[LocaleDataIndex2["MonthsFormat"] = 5] = "MonthsFormat";
  21528. LocaleDataIndex2[LocaleDataIndex2["MonthsStandalone"] = 6] = "MonthsStandalone";
  21529. LocaleDataIndex2[LocaleDataIndex2["Eras"] = 7] = "Eras";
  21530. LocaleDataIndex2[LocaleDataIndex2["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
  21531. LocaleDataIndex2[LocaleDataIndex2["WeekendRange"] = 9] = "WeekendRange";
  21532. LocaleDataIndex2[LocaleDataIndex2["DateFormat"] = 10] = "DateFormat";
  21533. LocaleDataIndex2[LocaleDataIndex2["TimeFormat"] = 11] = "TimeFormat";
  21534. LocaleDataIndex2[LocaleDataIndex2["DateTimeFormat"] = 12] = "DateTimeFormat";
  21535. LocaleDataIndex2[LocaleDataIndex2["NumberSymbols"] = 13] = "NumberSymbols";
  21536. LocaleDataIndex2[LocaleDataIndex2["NumberFormats"] = 14] = "NumberFormats";
  21537. LocaleDataIndex2[LocaleDataIndex2["CurrencyCode"] = 15] = "CurrencyCode";
  21538. LocaleDataIndex2[LocaleDataIndex2["CurrencySymbol"] = 16] = "CurrencySymbol";
  21539. LocaleDataIndex2[LocaleDataIndex2["CurrencyName"] = 17] = "CurrencyName";
  21540. LocaleDataIndex2[LocaleDataIndex2["Currencies"] = 18] = "Currencies";
  21541. LocaleDataIndex2[LocaleDataIndex2["Directionality"] = 19] = "Directionality";
  21542. LocaleDataIndex2[LocaleDataIndex2["PluralCase"] = 20] = "PluralCase";
  21543. LocaleDataIndex2[LocaleDataIndex2["ExtraData"] = 21] = "ExtraData";
  21544. })(LocaleDataIndex || (LocaleDataIndex = {}));
  21545. function normalizeLocale(locale) {
  21546. return locale.toLowerCase().replace(/_/g, "-");
  21547. }
  21548. var pluralMapping = ["zero", "one", "two", "few", "many"];
  21549. function getPluralCase(value, locale) {
  21550. const plural2 = getLocalePluralCase(locale)(parseInt(value, 10));
  21551. const result = pluralMapping[plural2];
  21552. return result !== void 0 ? result : "other";
  21553. }
  21554. var DEFAULT_LOCALE_ID = "en-US";
  21555. var USD_CURRENCY_CODE = "USD";
  21556. var ELEMENT_MARKER = {
  21557. marker: "element"
  21558. };
  21559. var ICU_MARKER = {
  21560. marker: "ICU"
  21561. };
  21562. var I18nCreateOpCode;
  21563. (function(I18nCreateOpCode2) {
  21564. I18nCreateOpCode2[I18nCreateOpCode2["SHIFT"] = 2] = "SHIFT";
  21565. I18nCreateOpCode2[I18nCreateOpCode2["APPEND_EAGERLY"] = 1] = "APPEND_EAGERLY";
  21566. I18nCreateOpCode2[I18nCreateOpCode2["COMMENT"] = 2] = "COMMENT";
  21567. })(I18nCreateOpCode || (I18nCreateOpCode = {}));
  21568. var LOCALE_ID$1 = DEFAULT_LOCALE_ID;
  21569. function setLocaleId(localeId) {
  21570. ngDevMode && assertDefined(localeId, `Expected localeId to be defined`);
  21571. if (typeof localeId === "string") {
  21572. LOCALE_ID$1 = localeId.toLowerCase().replace(/_/g, "-");
  21573. }
  21574. }
  21575. function getLocaleId() {
  21576. return LOCALE_ID$1;
  21577. }
  21578. var changeMask = 0;
  21579. var changeMaskCounter = 0;
  21580. function setMaskBit(hasChange) {
  21581. if (hasChange) {
  21582. changeMask = changeMask | 1 << Math.min(changeMaskCounter, 31);
  21583. }
  21584. changeMaskCounter++;
  21585. }
  21586. function applyI18n(tView, lView, index) {
  21587. if (changeMaskCounter > 0) {
  21588. ngDevMode && assertDefined(tView, `tView should be defined`);
  21589. const tI18n = tView.data[index];
  21590. const updateOpCodes = Array.isArray(tI18n) ? tI18n : tI18n.update;
  21591. const bindingsStartIndex = getBindingIndex() - changeMaskCounter - 1;
  21592. applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask);
  21593. }
  21594. changeMask = 0;
  21595. changeMaskCounter = 0;
  21596. }
  21597. function createNodeWithoutHydration(lView, textOrName, nodeType) {
  21598. const renderer = lView[RENDERER];
  21599. switch (nodeType) {
  21600. case Node.COMMENT_NODE:
  21601. return createCommentNode(renderer, textOrName);
  21602. case Node.TEXT_NODE:
  21603. return createTextNode(renderer, textOrName);
  21604. case Node.ELEMENT_NODE:
  21605. return createElementNode(renderer, textOrName, null);
  21606. }
  21607. }
  21608. var _locateOrCreateNode = (lView, index, textOrName, nodeType) => {
  21609. lastNodeWasCreated(true);
  21610. return createNodeWithoutHydration(lView, textOrName, nodeType);
  21611. };
  21612. function locateOrCreateNodeImpl(lView, index, textOrName, nodeType) {
  21613. const hydrationInfo = lView[HYDRATION];
  21614. const noOffsetIndex = index - HEADER_OFFSET;
  21615. const isNodeCreationMode = !isI18nHydrationSupportEnabled() || !hydrationInfo || isInSkipHydrationBlock$1() || isDisconnectedNode$1(hydrationInfo, noOffsetIndex);
  21616. lastNodeWasCreated(isNodeCreationMode);
  21617. if (isNodeCreationMode) {
  21618. return createNodeWithoutHydration(lView, textOrName, nodeType);
  21619. }
  21620. const native = locateI18nRNodeByIndex(hydrationInfo, noOffsetIndex);
  21621. ngDevMode && assertDefined(native, "expected native element");
  21622. ngDevMode && assertEqual(native.nodeType, nodeType, "expected matching nodeType");
  21623. ngDevMode && nodeType === Node.ELEMENT_NODE && assertEqual(native.tagName.toLowerCase(), textOrName.toLowerCase(), "expecting matching tagName");
  21624. ngDevMode && markRNodeAsClaimedByHydration(native);
  21625. return native;
  21626. }
  21627. function enableLocateOrCreateI18nNodeImpl() {
  21628. _locateOrCreateNode = locateOrCreateNodeImpl;
  21629. }
  21630. function applyCreateOpCodes(lView, createOpCodes, parentRNode, insertInFrontOf) {
  21631. const renderer = lView[RENDERER];
  21632. for (let i = 0; i < createOpCodes.length; i++) {
  21633. const opCode = createOpCodes[i++];
  21634. const text = createOpCodes[i];
  21635. const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
  21636. const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
  21637. const index = opCode >>> I18nCreateOpCode.SHIFT;
  21638. let rNode = lView[index];
  21639. let lastNodeWasCreated2 = false;
  21640. if (rNode === null) {
  21641. rNode = lView[index] = _locateOrCreateNode(lView, index, text, isComment ? Node.COMMENT_NODE : Node.TEXT_NODE);
  21642. lastNodeWasCreated2 = wasLastNodeCreated();
  21643. }
  21644. if (appendNow && parentRNode !== null && lastNodeWasCreated2) {
  21645. nativeInsertBefore(renderer, parentRNode, rNode, insertInFrontOf, false);
  21646. }
  21647. }
  21648. }
  21649. function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
  21650. ngDevMode && assertDomNode(anchorRNode);
  21651. const renderer = lView[RENDERER];
  21652. let rootIdx = null;
  21653. let rootRNode;
  21654. for (let i = 0; i < mutableOpCodes.length; i++) {
  21655. const opCode = mutableOpCodes[i];
  21656. if (typeof opCode == "string") {
  21657. const textNodeIndex = mutableOpCodes[++i];
  21658. if (lView[textNodeIndex] === null) {
  21659. ngDevMode && ngDevMode.rendererCreateTextNode++;
  21660. ngDevMode && assertIndexInRange(lView, textNodeIndex);
  21661. lView[textNodeIndex] = _locateOrCreateNode(lView, textNodeIndex, opCode, Node.TEXT_NODE);
  21662. }
  21663. } else if (typeof opCode == "number") {
  21664. switch (opCode & 1) {
  21665. case 0:
  21666. const parentIdx = getParentFromIcuCreateOpCode(opCode);
  21667. if (rootIdx === null) {
  21668. rootIdx = parentIdx;
  21669. rootRNode = renderer.parentNode(anchorRNode);
  21670. }
  21671. let insertInFrontOf;
  21672. let parentRNode;
  21673. if (parentIdx === rootIdx) {
  21674. insertInFrontOf = anchorRNode;
  21675. parentRNode = rootRNode;
  21676. } else {
  21677. insertInFrontOf = null;
  21678. parentRNode = unwrapRNode(lView[parentIdx]);
  21679. }
  21680. if (parentRNode !== null) {
  21681. ngDevMode && assertDomNode(parentRNode);
  21682. const refIdx = getRefFromIcuCreateOpCode(opCode);
  21683. ngDevMode && assertGreaterThan(refIdx, HEADER_OFFSET, "Missing ref");
  21684. const child = lView[refIdx];
  21685. ngDevMode && assertDomNode(child);
  21686. nativeInsertBefore(renderer, parentRNode, child, insertInFrontOf, false);
  21687. const tIcu = getTIcu(tView, refIdx);
  21688. if (tIcu !== null && typeof tIcu === "object") {
  21689. ngDevMode && assertTIcu(tIcu);
  21690. const caseIndex = getCurrentICUCaseIndex(tIcu, lView);
  21691. if (caseIndex !== null) {
  21692. applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, lView[tIcu.anchorIdx]);
  21693. }
  21694. }
  21695. }
  21696. break;
  21697. case 1:
  21698. const elementNodeIndex = opCode >>> 1;
  21699. const attrName = mutableOpCodes[++i];
  21700. const attrValue = mutableOpCodes[++i];
  21701. setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
  21702. break;
  21703. default:
  21704. if (ngDevMode) {
  21705. throw new RuntimeError(700, `Unable to determine the type of mutate operation for "${opCode}"`);
  21706. }
  21707. }
  21708. } else {
  21709. switch (opCode) {
  21710. case ICU_MARKER:
  21711. const commentValue = mutableOpCodes[++i];
  21712. const commentNodeIndex = mutableOpCodes[++i];
  21713. if (lView[commentNodeIndex] === null) {
  21714. ngDevMode && assertEqual(typeof commentValue, "string", `Expected "${commentValue}" to be a comment node value`);
  21715. ngDevMode && ngDevMode.rendererCreateComment++;
  21716. ngDevMode && assertIndexInExpandoRange(lView, commentNodeIndex);
  21717. const commentRNode = lView[commentNodeIndex] = _locateOrCreateNode(lView, commentNodeIndex, commentValue, Node.COMMENT_NODE);
  21718. attachPatchData(commentRNode, lView);
  21719. }
  21720. break;
  21721. case ELEMENT_MARKER:
  21722. const tagName = mutableOpCodes[++i];
  21723. const elementNodeIndex = mutableOpCodes[++i];
  21724. if (lView[elementNodeIndex] === null) {
  21725. ngDevMode && assertEqual(typeof tagName, "string", `Expected "${tagName}" to be an element node tag name`);
  21726. ngDevMode && ngDevMode.rendererCreateElement++;
  21727. ngDevMode && assertIndexInExpandoRange(lView, elementNodeIndex);
  21728. const elementRNode = lView[elementNodeIndex] = _locateOrCreateNode(lView, elementNodeIndex, tagName, Node.ELEMENT_NODE);
  21729. attachPatchData(elementRNode, lView);
  21730. }
  21731. break;
  21732. default:
  21733. ngDevMode && throwError2(`Unable to determine the type of mutate operation for "${opCode}"`);
  21734. }
  21735. }
  21736. }
  21737. }
  21738. function applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask2) {
  21739. for (let i = 0; i < updateOpCodes.length; i++) {
  21740. const checkBit = updateOpCodes[i];
  21741. const skipCodes = updateOpCodes[++i];
  21742. if (checkBit & changeMask2) {
  21743. let value = "";
  21744. for (let j = i + 1; j <= i + skipCodes; j++) {
  21745. const opCode = updateOpCodes[j];
  21746. if (typeof opCode == "string") {
  21747. value += opCode;
  21748. } else if (typeof opCode == "number") {
  21749. if (opCode < 0) {
  21750. value += renderStringify(lView[bindingsStartIndex - opCode]);
  21751. } else {
  21752. const nodeIndex = opCode >>> 2;
  21753. switch (opCode & 3) {
  21754. case 1:
  21755. const propName = updateOpCodes[++j];
  21756. const sanitizeFn = updateOpCodes[++j];
  21757. const tNodeOrTagName = tView.data[nodeIndex];
  21758. ngDevMode && assertDefined(tNodeOrTagName, "Experting TNode or string");
  21759. if (typeof tNodeOrTagName === "string") {
  21760. setElementAttribute(lView[RENDERER], lView[nodeIndex], null, tNodeOrTagName, propName, value, sanitizeFn);
  21761. } else {
  21762. elementPropertyInternal(tView, tNodeOrTagName, lView, propName, value, lView[RENDERER], sanitizeFn, false);
  21763. }
  21764. break;
  21765. case 0:
  21766. const rText = lView[nodeIndex];
  21767. rText !== null && updateTextNode(lView[RENDERER], rText, value);
  21768. break;
  21769. case 2:
  21770. applyIcuSwitchCase(tView, getTIcu(tView, nodeIndex), lView, value);
  21771. break;
  21772. case 3:
  21773. applyIcuUpdateCase(tView, getTIcu(tView, nodeIndex), bindingsStartIndex, lView);
  21774. break;
  21775. }
  21776. }
  21777. }
  21778. }
  21779. } else {
  21780. const opCode = updateOpCodes[i + 1];
  21781. if (opCode > 0 && (opCode & 3) === 3) {
  21782. const nodeIndex = opCode >>> 2;
  21783. const tIcu = getTIcu(tView, nodeIndex);
  21784. const currentIndex = lView[tIcu.currentCaseLViewIndex];
  21785. if (currentIndex < 0) {
  21786. applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView);
  21787. }
  21788. }
  21789. }
  21790. i += skipCodes;
  21791. }
  21792. }
  21793. function applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView) {
  21794. ngDevMode && assertIndexInRange(lView, tIcu.currentCaseLViewIndex);
  21795. let activeCaseIndex = lView[tIcu.currentCaseLViewIndex];
  21796. if (activeCaseIndex !== null) {
  21797. let mask = changeMask;
  21798. if (activeCaseIndex < 0) {
  21799. activeCaseIndex = lView[tIcu.currentCaseLViewIndex] = ~activeCaseIndex;
  21800. mask = -1;
  21801. }
  21802. applyUpdateOpCodes(tView, lView, tIcu.update[activeCaseIndex], bindingsStartIndex, mask);
  21803. }
  21804. }
  21805. function applyIcuSwitchCase(tView, tIcu, lView, value) {
  21806. const caseIndex = getCaseIndex(tIcu, value);
  21807. let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
  21808. if (activeCaseIndex !== caseIndex) {
  21809. applyIcuSwitchCaseRemove(tView, tIcu, lView);
  21810. lView[tIcu.currentCaseLViewIndex] = caseIndex === null ? null : ~caseIndex;
  21811. if (caseIndex !== null) {
  21812. const anchorRNode = lView[tIcu.anchorIdx];
  21813. if (anchorRNode) {
  21814. ngDevMode && assertDomNode(anchorRNode);
  21815. applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, anchorRNode);
  21816. }
  21817. claimDehydratedIcuCase(lView, tIcu.anchorIdx, caseIndex);
  21818. }
  21819. }
  21820. }
  21821. function applyIcuSwitchCaseRemove(tView, tIcu, lView) {
  21822. let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
  21823. if (activeCaseIndex !== null) {
  21824. const removeCodes = tIcu.remove[activeCaseIndex];
  21825. for (let i = 0; i < removeCodes.length; i++) {
  21826. const nodeOrIcuIndex = removeCodes[i];
  21827. if (nodeOrIcuIndex > 0) {
  21828. const rNode = getNativeByIndex(nodeOrIcuIndex, lView);
  21829. rNode !== null && nativeRemoveNode(lView[RENDERER], rNode);
  21830. } else {
  21831. applyIcuSwitchCaseRemove(tView, getTIcu(tView, ~nodeOrIcuIndex), lView);
  21832. }
  21833. }
  21834. }
  21835. }
  21836. function getCaseIndex(icuExpression, bindingValue) {
  21837. let index = icuExpression.cases.indexOf(bindingValue);
  21838. if (index === -1) {
  21839. switch (icuExpression.type) {
  21840. case 1: {
  21841. const resolvedCase = getPluralCase(bindingValue, getLocaleId());
  21842. index = icuExpression.cases.indexOf(resolvedCase);
  21843. if (index === -1 && resolvedCase !== "other") {
  21844. index = icuExpression.cases.indexOf("other");
  21845. }
  21846. break;
  21847. }
  21848. case 0: {
  21849. index = icuExpression.cases.indexOf("other");
  21850. break;
  21851. }
  21852. }
  21853. }
  21854. return index === -1 ? null : index;
  21855. }
  21856. function i18nCreateOpCodesToString(opcodes) {
  21857. const createOpCodes = opcodes || (Array.isArray(this) ? this : []);
  21858. let lines = [];
  21859. for (let i = 0; i < createOpCodes.length; i++) {
  21860. const opCode = createOpCodes[i++];
  21861. const text = createOpCodes[i];
  21862. const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
  21863. const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
  21864. const index = opCode >>> I18nCreateOpCode.SHIFT;
  21865. lines.push(`lView[${index}] = document.${isComment ? "createComment" : "createText"}(${JSON.stringify(text)});`);
  21866. if (appendNow) {
  21867. lines.push(`parent.appendChild(lView[${index}]);`);
  21868. }
  21869. }
  21870. return lines;
  21871. }
  21872. function i18nUpdateOpCodesToString(opcodes) {
  21873. const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
  21874. let lines = [];
  21875. function consumeOpCode(value) {
  21876. const ref = value >>> 2;
  21877. const opCode = value & 3;
  21878. switch (opCode) {
  21879. case 0:
  21880. return `(lView[${ref}] as Text).textContent = $$$`;
  21881. case 1:
  21882. const attrName = parser.consumeString();
  21883. const sanitizationFn = parser.consumeFunction();
  21884. const value2 = sanitizationFn ? `(${sanitizationFn})($$$)` : "$$$";
  21885. return `(lView[${ref}] as Element).setAttribute('${attrName}', ${value2})`;
  21886. case 2:
  21887. return `icuSwitchCase(${ref}, $$$)`;
  21888. case 3:
  21889. return `icuUpdateCase(${ref})`;
  21890. }
  21891. throw new Error("unexpected OpCode");
  21892. }
  21893. while (parser.hasMore()) {
  21894. let mask = parser.consumeNumber();
  21895. let size = parser.consumeNumber();
  21896. const end = parser.i + size;
  21897. const statements = [];
  21898. let statement = "";
  21899. while (parser.i < end) {
  21900. let value = parser.consumeNumberOrString();
  21901. if (typeof value === "string") {
  21902. statement += value;
  21903. } else if (value < 0) {
  21904. statement += "${lView[i" + value + "]}";
  21905. } else {
  21906. const opCodeText = consumeOpCode(value);
  21907. statements.push(opCodeText.replace("$$$", "`" + statement + "`") + ";");
  21908. statement = "";
  21909. }
  21910. }
  21911. lines.push(`if (mask & 0b${mask.toString(2)}) { ${statements.join(" ")} }`);
  21912. }
  21913. return lines;
  21914. }
  21915. function icuCreateOpCodesToString(opcodes) {
  21916. const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
  21917. let lines = [];
  21918. function consumeOpCode(opCode) {
  21919. const parent = getParentFromIcuCreateOpCode(opCode);
  21920. const ref = getRefFromIcuCreateOpCode(opCode);
  21921. switch (getInstructionFromIcuCreateOpCode(opCode)) {
  21922. case 0:
  21923. return `(lView[${parent}] as Element).appendChild(lView[${lastRef}])`;
  21924. case 1:
  21925. return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${parser.consumeString()}")`;
  21926. }
  21927. throw new Error("Unexpected OpCode: " + getInstructionFromIcuCreateOpCode(opCode));
  21928. }
  21929. let lastRef = -1;
  21930. while (parser.hasMore()) {
  21931. let value = parser.consumeNumberStringOrMarker();
  21932. if (value === ICU_MARKER) {
  21933. const text = parser.consumeString();
  21934. lastRef = parser.consumeNumber();
  21935. lines.push(`lView[${lastRef}] = document.createComment("${text}")`);
  21936. } else if (value === ELEMENT_MARKER) {
  21937. const text = parser.consumeString();
  21938. lastRef = parser.consumeNumber();
  21939. lines.push(`lView[${lastRef}] = document.createElement("${text}")`);
  21940. } else if (typeof value === "string") {
  21941. lastRef = parser.consumeNumber();
  21942. lines.push(`lView[${lastRef}] = document.createTextNode("${value}")`);
  21943. } else if (typeof value === "number") {
  21944. const line = consumeOpCode(value);
  21945. line && lines.push(line);
  21946. } else {
  21947. throw new Error("Unexpected value");
  21948. }
  21949. }
  21950. return lines;
  21951. }
  21952. function i18nRemoveOpCodesToString(opcodes) {
  21953. const removeCodes = opcodes || (Array.isArray(this) ? this : []);
  21954. let lines = [];
  21955. for (let i = 0; i < removeCodes.length; i++) {
  21956. const nodeOrIcuIndex = removeCodes[i];
  21957. if (nodeOrIcuIndex > 0) {
  21958. lines.push(`remove(lView[${nodeOrIcuIndex}])`);
  21959. } else {
  21960. lines.push(`removeNestedICU(${~nodeOrIcuIndex})`);
  21961. }
  21962. }
  21963. return lines;
  21964. }
  21965. var OpCodeParser = class {
  21966. i = 0;
  21967. codes;
  21968. constructor(codes) {
  21969. this.codes = codes;
  21970. }
  21971. hasMore() {
  21972. return this.i < this.codes.length;
  21973. }
  21974. consumeNumber() {
  21975. let value = this.codes[this.i++];
  21976. assertNumber(value, "expecting number in OpCode");
  21977. return value;
  21978. }
  21979. consumeString() {
  21980. let value = this.codes[this.i++];
  21981. assertString(value, "expecting string in OpCode");
  21982. return value;
  21983. }
  21984. consumeFunction() {
  21985. let value = this.codes[this.i++];
  21986. if (value === null || typeof value === "function") {
  21987. return value;
  21988. }
  21989. throw new Error("expecting function in OpCode");
  21990. }
  21991. consumeNumberOrString() {
  21992. let value = this.codes[this.i++];
  21993. if (typeof value === "string") {
  21994. return value;
  21995. }
  21996. assertNumber(value, "expecting number or string in OpCode");
  21997. return value;
  21998. }
  21999. consumeNumberStringOrMarker() {
  22000. let value = this.codes[this.i++];
  22001. if (typeof value === "string" || typeof value === "number" || value == ICU_MARKER || value == ELEMENT_MARKER) {
  22002. return value;
  22003. }
  22004. assertNumber(value, "expecting number, string, ICU_MARKER or ELEMENT_MARKER in OpCode");
  22005. return value;
  22006. }
  22007. };
  22008. var BINDING_REGEXP = /�(\d+):?\d*�/gi;
  22009. var ICU_REGEXP = /({\s*�\d+:?\d*�\s*,\s*\S{6}\s*,[\s\S]*})/gi;
  22010. var NESTED_ICU = /�(\d+)�/;
  22011. var ICU_BLOCK_REGEXP = /^\s*(�\d+:?\d*�)\s*,\s*(select|plural)\s*,/;
  22012. var MARKER = `�`;
  22013. var SUBTEMPLATE_REGEXP = /�\/?\*(\d+:\d+)�/gi;
  22014. var PH_REGEXP = /�(\/?[#*]\d+):?\d*�/gi;
  22015. var NGSP_UNICODE_REGEXP = /\uE500/g;
  22016. function replaceNgsp(value) {
  22017. return value.replace(NGSP_UNICODE_REGEXP, " ");
  22018. }
  22019. function attachDebugGetter(obj, debugGetter) {
  22020. if (ngDevMode) {
  22021. Object.defineProperty(obj, "debug", {
  22022. get: debugGetter,
  22023. enumerable: false
  22024. });
  22025. } else {
  22026. throw new Error("This method should be guarded with `ngDevMode` so that it can be tree shaken in production!");
  22027. }
  22028. }
  22029. function i18nStartFirstCreatePass(tView, parentTNodeIndex, lView, index, message, subTemplateIndex) {
  22030. const rootTNode = getCurrentParentTNode();
  22031. const createOpCodes = [];
  22032. const updateOpCodes = [];
  22033. const existingTNodeStack = [[]];
  22034. const astStack = [[]];
  22035. if (ngDevMode) {
  22036. attachDebugGetter(createOpCodes, i18nCreateOpCodesToString);
  22037. attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
  22038. }
  22039. message = getTranslationForTemplate(message, subTemplateIndex);
  22040. const msgParts = replaceNgsp(message).split(PH_REGEXP);
  22041. for (let i = 0; i < msgParts.length; i++) {
  22042. let value = msgParts[i];
  22043. if ((i & 1) === 0) {
  22044. const parts = i18nParseTextIntoPartsAndICU(value);
  22045. for (let j = 0; j < parts.length; j++) {
  22046. let part = parts[j];
  22047. if ((j & 1) === 0) {
  22048. const text = part;
  22049. ngDevMode && assertString(text, "Parsed ICU part should be string");
  22050. if (text !== "") {
  22051. i18nStartFirstCreatePassProcessTextNode(astStack[0], tView, rootTNode, existingTNodeStack[0], createOpCodes, updateOpCodes, lView, text);
  22052. }
  22053. } else {
  22054. const icuExpression = part;
  22055. if (typeof icuExpression !== "object") {
  22056. throw new Error(`Unable to parse ICU expression in "${message}" message.`);
  22057. }
  22058. const icuContainerTNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodeStack[0], lView, createOpCodes, ngDevMode ? `ICU ${index}:${icuExpression.mainBinding}` : "", true);
  22059. const icuNodeIndex = icuContainerTNode.index;
  22060. ngDevMode && assertGreaterThanOrEqual(icuNodeIndex, HEADER_OFFSET, "Index must be in absolute LView offset");
  22061. icuStart(astStack[0], tView, lView, updateOpCodes, parentTNodeIndex, icuExpression, icuNodeIndex);
  22062. }
  22063. }
  22064. } else {
  22065. const isClosing = value.charCodeAt(0) === 47;
  22066. const type = value.charCodeAt(isClosing ? 1 : 0);
  22067. ngDevMode && assertOneOf(
  22068. type,
  22069. 42,
  22070. 35
  22071. /* CharCode.HASH */
  22072. );
  22073. const index2 = HEADER_OFFSET + Number.parseInt(value.substring(isClosing ? 2 : 1));
  22074. if (isClosing) {
  22075. existingTNodeStack.shift();
  22076. astStack.shift();
  22077. setCurrentTNode(getCurrentParentTNode(), false);
  22078. } else {
  22079. const tNode = createTNodePlaceholder(tView, existingTNodeStack[0], index2);
  22080. existingTNodeStack.unshift([]);
  22081. setCurrentTNode(tNode, true);
  22082. const placeholderNode = {
  22083. kind: 2,
  22084. index: index2,
  22085. children: [],
  22086. type: type === 35 ? 0 : 1
  22087. /* I18nPlaceholderType.SUBTEMPLATE */
  22088. };
  22089. astStack[0].push(placeholderNode);
  22090. astStack.unshift(placeholderNode.children);
  22091. }
  22092. }
  22093. }
  22094. tView.data[index] = {
  22095. create: createOpCodes,
  22096. update: updateOpCodes,
  22097. ast: astStack[0],
  22098. parentTNodeIndex
  22099. };
  22100. }
  22101. function createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, text, isICU) {
  22102. const i18nNodeIdx = allocExpando(tView, lView, 1, null);
  22103. let opCode = i18nNodeIdx << I18nCreateOpCode.SHIFT;
  22104. let parentTNode = getCurrentParentTNode();
  22105. if (rootTNode === parentTNode) {
  22106. parentTNode = null;
  22107. }
  22108. if (parentTNode === null) {
  22109. opCode |= I18nCreateOpCode.APPEND_EAGERLY;
  22110. }
  22111. if (isICU) {
  22112. opCode |= I18nCreateOpCode.COMMENT;
  22113. ensureIcuContainerVisitorLoaded(loadIcuContainerVisitor);
  22114. }
  22115. createOpCodes.push(opCode, text === null ? "" : text);
  22116. const tNode = createTNodeAtIndex(tView, i18nNodeIdx, isICU ? 32 : 1, text === null ? ngDevMode ? "{{?}}" : "" : text, null);
  22117. addTNodeAndUpdateInsertBeforeIndex(existingTNodes, tNode);
  22118. const tNodeIdx = tNode.index;
  22119. setCurrentTNode(
  22120. tNode,
  22121. false
  22122. /* Text nodes are self closing */
  22123. );
  22124. if (parentTNode !== null && rootTNode !== parentTNode) {
  22125. setTNodeInsertBeforeIndex(parentTNode, tNodeIdx);
  22126. }
  22127. return tNode;
  22128. }
  22129. function i18nStartFirstCreatePassProcessTextNode(ast, tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {
  22130. const hasBinding = text.match(BINDING_REGEXP);
  22131. const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
  22132. const index = tNode.index;
  22133. if (hasBinding) {
  22134. generateBindingUpdateOpCodes(updateOpCodes, text, index, null, 0, null);
  22135. }
  22136. ast.push({
  22137. kind: 0,
  22138. index
  22139. });
  22140. }
  22141. function i18nAttributesFirstPass(tView, index, values) {
  22142. const previousElement = getCurrentTNode();
  22143. const previousElementIndex = previousElement.index;
  22144. const updateOpCodes = [];
  22145. if (ngDevMode) {
  22146. attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
  22147. }
  22148. if (tView.firstCreatePass && tView.data[index] === null) {
  22149. for (let i = 0; i < values.length; i += 2) {
  22150. const attrName = values[i];
  22151. const message = values[i + 1];
  22152. if (message !== "") {
  22153. if (ICU_REGEXP.test(message)) {
  22154. throw new Error(`ICU expressions are not supported in attributes. Message: "${message}".`);
  22155. }
  22156. generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
  22157. }
  22158. }
  22159. tView.data[index] = updateOpCodes;
  22160. }
  22161. }
  22162. function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
  22163. ngDevMode && assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, "Index must be in absolute LView offset");
  22164. const maskIndex = updateOpCodes.length;
  22165. const sizeIndex = maskIndex + 1;
  22166. updateOpCodes.push(null, null);
  22167. const startIndex = maskIndex + 2;
  22168. if (ngDevMode) {
  22169. attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
  22170. }
  22171. const textParts = str.split(BINDING_REGEXP);
  22172. let mask = 0;
  22173. for (let j = 0; j < textParts.length; j++) {
  22174. const textValue = textParts[j];
  22175. if (j & 1) {
  22176. const bindingIndex = bindingStart + parseInt(textValue, 10);
  22177. updateOpCodes.push(-1 - bindingIndex);
  22178. mask = mask | toMaskBit(bindingIndex);
  22179. } else if (textValue !== "") {
  22180. updateOpCodes.push(textValue);
  22181. }
  22182. }
  22183. updateOpCodes.push(destinationNode << 2 | (attrName ? 1 : 0));
  22184. if (attrName) {
  22185. updateOpCodes.push(attrName, sanitizeFn);
  22186. }
  22187. updateOpCodes[maskIndex] = mask;
  22188. updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
  22189. return mask;
  22190. }
  22191. function countBindings(opCodes) {
  22192. let count2 = 0;
  22193. for (let i = 0; i < opCodes.length; i++) {
  22194. const opCode = opCodes[i];
  22195. if (typeof opCode === "number" && opCode < 0) {
  22196. count2++;
  22197. }
  22198. }
  22199. return count2;
  22200. }
  22201. function toMaskBit(bindingIndex) {
  22202. return 1 << Math.min(bindingIndex, 31);
  22203. }
  22204. function removeInnerTemplateTranslation(message) {
  22205. let match;
  22206. let res = "";
  22207. let index = 0;
  22208. let inTemplate = false;
  22209. let tagMatched;
  22210. while ((match = SUBTEMPLATE_REGEXP.exec(message)) !== null) {
  22211. if (!inTemplate) {
  22212. res += message.substring(index, match.index + match[0].length);
  22213. tagMatched = match[1];
  22214. inTemplate = true;
  22215. } else {
  22216. if (match[0] === `${MARKER}/*${tagMatched}${MARKER}`) {
  22217. index = match.index;
  22218. inTemplate = false;
  22219. }
  22220. }
  22221. }
  22222. ngDevMode && assertEqual(inTemplate, false, `Tag mismatch: unable to find the end of the sub-template in the translation "${message}"`);
  22223. res += message.slice(index);
  22224. return res;
  22225. }
  22226. function getTranslationForTemplate(message, subTemplateIndex) {
  22227. if (isRootTemplateMessage(subTemplateIndex)) {
  22228. return removeInnerTemplateTranslation(message);
  22229. } else {
  22230. const start = message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
  22231. const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
  22232. return removeInnerTemplateTranslation(message.substring(start, end));
  22233. }
  22234. }
  22235. function icuStart(ast, tView, lView, updateOpCodes, parentIdx, icuExpression, anchorIdx) {
  22236. ngDevMode && assertDefined(icuExpression, "ICU expression must be defined");
  22237. let bindingMask = 0;
  22238. const tIcu = {
  22239. type: icuExpression.type,
  22240. currentCaseLViewIndex: allocExpando(tView, lView, 1, null),
  22241. anchorIdx,
  22242. cases: [],
  22243. create: [],
  22244. remove: [],
  22245. update: []
  22246. };
  22247. addUpdateIcuSwitch(updateOpCodes, icuExpression, anchorIdx);
  22248. setTIcu(tView, anchorIdx, tIcu);
  22249. const values = icuExpression.values;
  22250. const cases = [];
  22251. for (let i = 0; i < values.length; i++) {
  22252. const valueArr = values[i];
  22253. const nestedIcus = [];
  22254. for (let j = 0; j < valueArr.length; j++) {
  22255. const value = valueArr[j];
  22256. if (typeof value !== "string") {
  22257. const icuIndex = nestedIcus.push(value) - 1;
  22258. valueArr[j] = `<!--�${icuIndex}�-->`;
  22259. }
  22260. }
  22261. const caseAst = [];
  22262. cases.push(caseAst);
  22263. bindingMask = parseIcuCase(caseAst, tView, tIcu, lView, updateOpCodes, parentIdx, icuExpression.cases[i], valueArr.join(""), nestedIcus) | bindingMask;
  22264. }
  22265. if (bindingMask) {
  22266. addUpdateIcuUpdate(updateOpCodes, bindingMask, anchorIdx);
  22267. }
  22268. ast.push({
  22269. kind: 3,
  22270. index: anchorIdx,
  22271. cases,
  22272. currentCaseLViewIndex: tIcu.currentCaseLViewIndex
  22273. });
  22274. }
  22275. function parseICUBlock(pattern) {
  22276. const cases = [];
  22277. const values = [];
  22278. let icuType = 1;
  22279. let mainBinding = 0;
  22280. pattern = pattern.replace(ICU_BLOCK_REGEXP, function(str, binding, type) {
  22281. if (type === "select") {
  22282. icuType = 0;
  22283. } else {
  22284. icuType = 1;
  22285. }
  22286. mainBinding = parseInt(binding.slice(1), 10);
  22287. return "";
  22288. });
  22289. const parts = i18nParseTextIntoPartsAndICU(pattern);
  22290. for (let pos = 0; pos < parts.length; ) {
  22291. let key = parts[pos++].trim();
  22292. if (icuType === 1) {
  22293. key = key.replace(/\s*(?:=)?(\w+)\s*/, "$1");
  22294. }
  22295. if (key.length) {
  22296. cases.push(key);
  22297. }
  22298. const blocks = i18nParseTextIntoPartsAndICU(parts[pos++]);
  22299. if (cases.length > values.length) {
  22300. values.push(blocks);
  22301. }
  22302. }
  22303. return {
  22304. type: icuType,
  22305. mainBinding,
  22306. cases,
  22307. values
  22308. };
  22309. }
  22310. function i18nParseTextIntoPartsAndICU(pattern) {
  22311. if (!pattern) {
  22312. return [];
  22313. }
  22314. let prevPos = 0;
  22315. const braceStack = [];
  22316. const results = [];
  22317. const braces = /[{}]/g;
  22318. braces.lastIndex = 0;
  22319. let match;
  22320. while (match = braces.exec(pattern)) {
  22321. const pos = match.index;
  22322. if (match[0] == "}") {
  22323. braceStack.pop();
  22324. if (braceStack.length == 0) {
  22325. const block = pattern.substring(prevPos, pos);
  22326. if (ICU_BLOCK_REGEXP.test(block)) {
  22327. results.push(parseICUBlock(block));
  22328. } else {
  22329. results.push(block);
  22330. }
  22331. prevPos = pos + 1;
  22332. }
  22333. } else {
  22334. if (braceStack.length == 0) {
  22335. const substring2 = pattern.substring(prevPos, pos);
  22336. results.push(substring2);
  22337. prevPos = pos + 1;
  22338. }
  22339. braceStack.push("{");
  22340. }
  22341. }
  22342. const substring = pattern.substring(prevPos);
  22343. results.push(substring);
  22344. return results;
  22345. }
  22346. function parseIcuCase(ast, tView, tIcu, lView, updateOpCodes, parentIdx, caseName, unsafeCaseHtml, nestedIcus) {
  22347. const create = [];
  22348. const remove2 = [];
  22349. const update = [];
  22350. if (ngDevMode) {
  22351. attachDebugGetter(create, icuCreateOpCodesToString);
  22352. attachDebugGetter(remove2, i18nRemoveOpCodesToString);
  22353. attachDebugGetter(update, i18nUpdateOpCodesToString);
  22354. }
  22355. tIcu.cases.push(caseName);
  22356. tIcu.create.push(create);
  22357. tIcu.remove.push(remove2);
  22358. tIcu.update.push(update);
  22359. const inertBodyHelper2 = getInertBodyHelper(getDocument());
  22360. const inertBodyElement = inertBodyHelper2.getInertBodyElement(unsafeCaseHtml);
  22361. ngDevMode && assertDefined(inertBodyElement, "Unable to generate inert body element");
  22362. const inertRootNode = getTemplateContent(inertBodyElement) || inertBodyElement;
  22363. if (inertRootNode) {
  22364. return walkIcuTree(ast, tView, tIcu, lView, updateOpCodes, create, remove2, update, inertRootNode, parentIdx, nestedIcus, 0);
  22365. } else {
  22366. return 0;
  22367. }
  22368. }
  22369. function walkIcuTree(ast, tView, tIcu, lView, sharedUpdateOpCodes, create, remove2, update, parentNode, parentIdx, nestedIcus, depth) {
  22370. let bindingMask = 0;
  22371. let currentNode = parentNode.firstChild;
  22372. while (currentNode) {
  22373. const newIndex = allocExpando(tView, lView, 1, null);
  22374. switch (currentNode.nodeType) {
  22375. case Node.ELEMENT_NODE:
  22376. const element = currentNode;
  22377. const tagName = element.tagName.toLowerCase();
  22378. if (VALID_ELEMENTS.hasOwnProperty(tagName)) {
  22379. addCreateNodeAndAppend(create, ELEMENT_MARKER, tagName, parentIdx, newIndex);
  22380. tView.data[newIndex] = tagName;
  22381. const elAttrs = element.attributes;
  22382. for (let i = 0; i < elAttrs.length; i++) {
  22383. const attr = elAttrs.item(i);
  22384. const lowerAttrName = attr.name.toLowerCase();
  22385. const hasBinding2 = !!attr.value.match(BINDING_REGEXP);
  22386. if (hasBinding2) {
  22387. if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
  22388. if (URI_ATTRS[lowerAttrName]) {
  22389. generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
  22390. } else {
  22391. generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
  22392. }
  22393. } else {
  22394. ngDevMode && console.warn(`WARNING: ignoring unsafe attribute value ${lowerAttrName} on element ${tagName} (see ${XSS_SECURITY_URL})`);
  22395. }
  22396. } else {
  22397. addCreateAttribute(create, newIndex, attr);
  22398. }
  22399. }
  22400. const elementNode = {
  22401. kind: 1,
  22402. index: newIndex,
  22403. children: []
  22404. };
  22405. ast.push(elementNode);
  22406. bindingMask = walkIcuTree(elementNode.children, tView, tIcu, lView, sharedUpdateOpCodes, create, remove2, update, currentNode, newIndex, nestedIcus, depth + 1) | bindingMask;
  22407. addRemoveNode(remove2, newIndex, depth);
  22408. }
  22409. break;
  22410. case Node.TEXT_NODE:
  22411. const value = currentNode.textContent || "";
  22412. const hasBinding = value.match(BINDING_REGEXP);
  22413. addCreateNodeAndAppend(create, null, hasBinding ? "" : value, parentIdx, newIndex);
  22414. addRemoveNode(remove2, newIndex, depth);
  22415. if (hasBinding) {
  22416. bindingMask = generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
  22417. }
  22418. ast.push({
  22419. kind: 0,
  22420. index: newIndex
  22421. });
  22422. break;
  22423. case Node.COMMENT_NODE:
  22424. const isNestedIcu = NESTED_ICU.exec(currentNode.textContent || "");
  22425. if (isNestedIcu) {
  22426. const nestedIcuIndex = parseInt(isNestedIcu[1], 10);
  22427. const icuExpression = nestedIcus[nestedIcuIndex];
  22428. addCreateNodeAndAppend(create, ICU_MARKER, ngDevMode ? `nested ICU ${nestedIcuIndex}` : "", parentIdx, newIndex);
  22429. icuStart(ast, tView, lView, sharedUpdateOpCodes, parentIdx, icuExpression, newIndex);
  22430. addRemoveNestedIcu(remove2, newIndex, depth);
  22431. }
  22432. break;
  22433. }
  22434. currentNode = currentNode.nextSibling;
  22435. }
  22436. return bindingMask;
  22437. }
  22438. function addRemoveNode(remove2, index, depth) {
  22439. if (depth === 0) {
  22440. remove2.push(index);
  22441. }
  22442. }
  22443. function addRemoveNestedIcu(remove2, index, depth) {
  22444. if (depth === 0) {
  22445. remove2.push(~index);
  22446. remove2.push(index);
  22447. }
  22448. }
  22449. function addUpdateIcuSwitch(update, icuExpression, index) {
  22450. update.push(
  22451. toMaskBit(icuExpression.mainBinding),
  22452. 2,
  22453. -1 - icuExpression.mainBinding,
  22454. index << 2 | 2
  22455. /* I18nUpdateOpCode.IcuSwitch */
  22456. );
  22457. }
  22458. function addUpdateIcuUpdate(update, bindingMask, index) {
  22459. update.push(
  22460. bindingMask,
  22461. 1,
  22462. index << 2 | 3
  22463. /* I18nUpdateOpCode.IcuUpdate */
  22464. );
  22465. }
  22466. function addCreateNodeAndAppend(create, marker, text, appendToParentIdx, createAtIdx) {
  22467. if (marker !== null) {
  22468. create.push(marker);
  22469. }
  22470. create.push(text, createAtIdx, icuCreateOpCode(0, appendToParentIdx, createAtIdx));
  22471. }
  22472. function addCreateAttribute(create, newIndex, attr) {
  22473. create.push(newIndex << 1 | 1, attr.name, attr.value);
  22474. }
  22475. var ROOT_TEMPLATE_ID = 0;
  22476. var PP_MULTI_VALUE_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]/;
  22477. var PP_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]|(�\/?\*\d+:\d+�)/g;
  22478. var PP_ICU_VARS_REGEXP = /({\s*)(VAR_(PLURAL|SELECT)(_\d+)?)(\s*,)/g;
  22479. var PP_ICU_PLACEHOLDERS_REGEXP = /{([A-Z0-9_]+)}/g;
  22480. var PP_ICUS_REGEXP = /�I18N_EXP_(ICU(_\d+)?)�/g;
  22481. var PP_CLOSE_TEMPLATE_REGEXP = /\/\*/;
  22482. var PP_TEMPLATE_ID_REGEXP = /\d+\:(\d+)/;
  22483. function i18nPostprocess(message, replacements = {}) {
  22484. let result = message;
  22485. if (PP_MULTI_VALUE_PLACEHOLDERS_REGEXP.test(message)) {
  22486. const matches = {};
  22487. const templateIdsStack = [ROOT_TEMPLATE_ID];
  22488. result = result.replace(PP_PLACEHOLDERS_REGEXP, (m, phs, tmpl) => {
  22489. const content = phs || tmpl;
  22490. const placeholders = matches[content] || [];
  22491. if (!placeholders.length) {
  22492. content.split("|").forEach((placeholder2) => {
  22493. const match = placeholder2.match(PP_TEMPLATE_ID_REGEXP);
  22494. const templateId2 = match ? parseInt(match[1], 10) : ROOT_TEMPLATE_ID;
  22495. const isCloseTemplateTag2 = PP_CLOSE_TEMPLATE_REGEXP.test(placeholder2);
  22496. placeholders.push([templateId2, isCloseTemplateTag2, placeholder2]);
  22497. });
  22498. matches[content] = placeholders;
  22499. }
  22500. if (!placeholders.length) {
  22501. throw new Error(`i18n postprocess: unmatched placeholder - ${content}`);
  22502. }
  22503. const currentTemplateId = templateIdsStack[templateIdsStack.length - 1];
  22504. let idx = 0;
  22505. for (let i = 0; i < placeholders.length; i++) {
  22506. if (placeholders[i][0] === currentTemplateId) {
  22507. idx = i;
  22508. break;
  22509. }
  22510. }
  22511. const [templateId, isCloseTemplateTag, placeholder] = placeholders[idx];
  22512. if (isCloseTemplateTag) {
  22513. templateIdsStack.pop();
  22514. } else if (currentTemplateId !== templateId) {
  22515. templateIdsStack.push(templateId);
  22516. }
  22517. placeholders.splice(idx, 1);
  22518. return placeholder;
  22519. });
  22520. }
  22521. if (!Object.keys(replacements).length) {
  22522. return result;
  22523. }
  22524. result = result.replace(PP_ICU_VARS_REGEXP, (match, start, key, _type, _idx, end) => {
  22525. return replacements.hasOwnProperty(key) ? `${start}${replacements[key]}${end}` : match;
  22526. });
  22527. result = result.replace(PP_ICU_PLACEHOLDERS_REGEXP, (match, key) => {
  22528. return replacements.hasOwnProperty(key) ? replacements[key] : match;
  22529. });
  22530. result = result.replace(PP_ICUS_REGEXP, (match, key) => {
  22531. if (replacements.hasOwnProperty(key)) {
  22532. const list = replacements[key];
  22533. if (!list.length) {
  22534. throw new Error(`i18n postprocess: unmatched ICU - ${match} with key: ${key}`);
  22535. }
  22536. return list.shift();
  22537. }
  22538. return match;
  22539. });
  22540. return result;
  22541. }
  22542. function ɵɵi18nStart(index, messageIndex, subTemplateIndex = -1) {
  22543. const tView = getTView();
  22544. const lView = getLView();
  22545. const adjustedIndex = HEADER_OFFSET + index;
  22546. ngDevMode && assertDefined(tView, `tView should be defined`);
  22547. const message = getConstant(tView.consts, messageIndex);
  22548. const parentTNode = getCurrentParentTNode();
  22549. if (tView.firstCreatePass) {
  22550. i18nStartFirstCreatePass(tView, parentTNode === null ? 0 : parentTNode.index, lView, adjustedIndex, message, subTemplateIndex);
  22551. }
  22552. if (tView.type === 2) {
  22553. const componentLView = lView[DECLARATION_COMPONENT_VIEW];
  22554. componentLView[FLAGS] |= 32;
  22555. } else {
  22556. lView[FLAGS] |= 32;
  22557. }
  22558. const tI18n = tView.data[adjustedIndex];
  22559. const sameViewParentTNode = parentTNode === lView[T_HOST] ? null : parentTNode;
  22560. const parentRNode = getClosestRElement(tView, sameViewParentTNode, lView);
  22561. const insertInFrontOf = parentTNode && parentTNode.type & 8 ? lView[parentTNode.index] : null;
  22562. prepareI18nBlockForHydration(lView, adjustedIndex, parentTNode, subTemplateIndex);
  22563. applyCreateOpCodes(lView, tI18n.create, parentRNode, insertInFrontOf);
  22564. setInI18nBlock(true);
  22565. }
  22566. function ɵɵi18nEnd() {
  22567. setInI18nBlock(false);
  22568. }
  22569. function ɵɵi18n(index, messageIndex, subTemplateIndex) {
  22570. ɵɵi18nStart(index, messageIndex, subTemplateIndex);
  22571. ɵɵi18nEnd();
  22572. }
  22573. function ɵɵi18nAttributes(index, attrsIndex) {
  22574. const tView = getTView();
  22575. ngDevMode && assertDefined(tView, `tView should be defined`);
  22576. const attrs = getConstant(tView.consts, attrsIndex);
  22577. i18nAttributesFirstPass(tView, index + HEADER_OFFSET, attrs);
  22578. }
  22579. function ɵɵi18nExp(value) {
  22580. const lView = getLView();
  22581. setMaskBit(bindingUpdated(lView, nextBindingIndex(), value));
  22582. return ɵɵi18nExp;
  22583. }
  22584. function ɵɵi18nApply(index) {
  22585. applyI18n(getTView(), getLView(), index + HEADER_OFFSET);
  22586. }
  22587. function ɵɵi18nPostprocess(message, replacements = {}) {
  22588. return i18nPostprocess(message, replacements);
  22589. }
  22590. function wrapListener(tNode, lView, context2, listenerFn) {
  22591. return function wrapListenerIn_markDirtyAndPreventDefault(e) {
  22592. if (e === Function) {
  22593. return listenerFn;
  22594. }
  22595. const startView = isComponentHost(tNode) ? getComponentLViewByIndex(tNode.index, lView) : lView;
  22596. markViewDirty(
  22597. startView,
  22598. 5
  22599. /* NotificationSource.Listener */
  22600. );
  22601. let result = executeListenerWithErrorHandling(lView, context2, listenerFn, e);
  22602. let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__;
  22603. while (nextListenerFn) {
  22604. result = executeListenerWithErrorHandling(lView, context2, nextListenerFn, e) && result;
  22605. nextListenerFn = nextListenerFn.__ngNextListenerFn__;
  22606. }
  22607. return result;
  22608. };
  22609. }
  22610. function executeListenerWithErrorHandling(lView, context2, listenerFn, e) {
  22611. const prevConsumer = setActiveConsumer(null);
  22612. try {
  22613. profiler(6, context2, listenerFn);
  22614. return listenerFn(e) !== false;
  22615. } catch (error) {
  22616. handleError(lView, error);
  22617. return false;
  22618. } finally {
  22619. profiler(7, context2, listenerFn);
  22620. setActiveConsumer(prevConsumer);
  22621. }
  22622. }
  22623. function handleError(lView, error) {
  22624. const injector = lView[INJECTOR];
  22625. const errorHandler = injector ? injector.get(ErrorHandler, null) : null;
  22626. errorHandler && errorHandler.handleError(error);
  22627. }
  22628. function listenToOutput(tNode, tView, lView, index, lookupName, eventName, listenerFn, lCleanup, tCleanup) {
  22629. ngDevMode && assertIndexInRange(lView, index);
  22630. const instance = lView[index];
  22631. const def = tView.data[index];
  22632. const propertyName = def.outputs[lookupName];
  22633. const output2 = instance[propertyName];
  22634. if (ngDevMode && !isOutputSubscribable(output2)) {
  22635. throw new Error(`@Output ${propertyName} not initialized in '${instance.constructor.name}'.`);
  22636. }
  22637. const subscription = output2.subscribe(listenerFn);
  22638. const idx = lCleanup.length;
  22639. lCleanup.push(listenerFn, subscription);
  22640. tCleanup && tCleanup.push(eventName, tNode.index, idx, -(idx + 1));
  22641. }
  22642. function isOutputSubscribable(value) {
  22643. return value != null && typeof value.subscribe === "function";
  22644. }
  22645. var stashEventListener = (el, eventName, listenerFn) => {
  22646. };
  22647. function setStashFn(fn) {
  22648. stashEventListener = fn;
  22649. }
  22650. function ɵɵlistener(eventName, listenerFn, useCapture, eventTargetResolver) {
  22651. const lView = getLView();
  22652. const tView = getTView();
  22653. const tNode = getCurrentTNode();
  22654. listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, eventTargetResolver);
  22655. return ɵɵlistener;
  22656. }
  22657. function ɵɵsyntheticHostListener(eventName, listenerFn) {
  22658. const tNode = getCurrentTNode();
  22659. const lView = getLView();
  22660. const tView = getTView();
  22661. const currentDef = getCurrentDirectiveDef(tView.data);
  22662. const renderer = loadComponentRenderer(currentDef, tNode, lView);
  22663. listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn);
  22664. return ɵɵsyntheticHostListener;
  22665. }
  22666. function findExistingListener(tView, lView, eventName, tNodeIdx) {
  22667. const tCleanup = tView.cleanup;
  22668. if (tCleanup != null) {
  22669. for (let i = 0; i < tCleanup.length - 1; i += 2) {
  22670. const cleanupEventName = tCleanup[i];
  22671. if (cleanupEventName === eventName && tCleanup[i + 1] === tNodeIdx) {
  22672. const lCleanup = lView[CLEANUP];
  22673. const listenerIdxInLCleanup = tCleanup[i + 2];
  22674. return lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null;
  22675. }
  22676. if (typeof cleanupEventName === "string") {
  22677. i += 2;
  22678. }
  22679. }
  22680. }
  22681. return null;
  22682. }
  22683. function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, eventTargetResolver) {
  22684. const isTNodeDirectiveHost = isDirectiveHost(tNode);
  22685. const firstCreatePass = tView.firstCreatePass;
  22686. const tCleanup = firstCreatePass ? getOrCreateTViewCleanup(tView) : null;
  22687. const context2 = lView[CONTEXT];
  22688. const lCleanup = getOrCreateLViewCleanup(lView);
  22689. ngDevMode && assertTNodeType(
  22690. tNode,
  22691. 3 | 12
  22692. /* TNodeType.AnyContainer */
  22693. );
  22694. let processOutputs = true;
  22695. if (tNode.type & 3 || eventTargetResolver) {
  22696. const native = getNativeByTNode(tNode, lView);
  22697. const target = eventTargetResolver ? eventTargetResolver(native) : native;
  22698. const lCleanupIndex = lCleanup.length;
  22699. const idxOrTargetGetter = eventTargetResolver ? (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])) : tNode.index;
  22700. let existingListener = null;
  22701. if (!eventTargetResolver && isTNodeDirectiveHost) {
  22702. existingListener = findExistingListener(tView, lView, eventName, tNode.index);
  22703. }
  22704. if (existingListener !== null) {
  22705. const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
  22706. lastListenerFn.__ngNextListenerFn__ = listenerFn;
  22707. existingListener.__ngLastListenerFn__ = listenerFn;
  22708. processOutputs = false;
  22709. } else {
  22710. listenerFn = wrapListener(tNode, lView, context2, listenerFn);
  22711. stashEventListener(target, eventName, listenerFn);
  22712. const cleanupFn = renderer.listen(target, eventName, listenerFn);
  22713. ngDevMode && ngDevMode.rendererAddEventListener++;
  22714. lCleanup.push(listenerFn, cleanupFn);
  22715. tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
  22716. }
  22717. } else {
  22718. listenerFn = wrapListener(tNode, lView, context2, listenerFn);
  22719. }
  22720. if (processOutputs) {
  22721. const outputConfig = tNode.outputs?.[eventName];
  22722. const hostDirectiveOutputConfig = tNode.hostDirectiveOutputs?.[eventName];
  22723. if (hostDirectiveOutputConfig && hostDirectiveOutputConfig.length) {
  22724. for (let i = 0; i < hostDirectiveOutputConfig.length; i += 2) {
  22725. const index = hostDirectiveOutputConfig[i];
  22726. const lookupName = hostDirectiveOutputConfig[i + 1];
  22727. listenToOutput(tNode, tView, lView, index, lookupName, eventName, listenerFn, lCleanup, tCleanup);
  22728. }
  22729. }
  22730. if (outputConfig && outputConfig.length) {
  22731. for (const index of outputConfig) {
  22732. listenToOutput(tNode, tView, lView, index, eventName, eventName, listenerFn, lCleanup, tCleanup);
  22733. }
  22734. }
  22735. }
  22736. }
  22737. function ɵɵnextContext(level = 1) {
  22738. return nextContextImpl(level);
  22739. }
  22740. function matchingProjectionSlotIndex(tNode, projectionSlots) {
  22741. let wildcardNgContentIndex = null;
  22742. const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
  22743. for (let i = 0; i < projectionSlots.length; i++) {
  22744. const slotValue = projectionSlots[i];
  22745. if (slotValue === "*") {
  22746. wildcardNgContentIndex = i;
  22747. continue;
  22748. }
  22749. if (ngProjectAsAttrVal === null ? isNodeMatchingSelectorList(
  22750. tNode,
  22751. slotValue,
  22752. /* isProjectionMode */
  22753. true
  22754. ) : isSelectorInSelectorList(ngProjectAsAttrVal, slotValue)) {
  22755. return i;
  22756. }
  22757. }
  22758. return wildcardNgContentIndex;
  22759. }
  22760. function ɵɵprojectionDef(projectionSlots) {
  22761. const componentNode = getLView()[DECLARATION_COMPONENT_VIEW][T_HOST];
  22762. if (!componentNode.projection) {
  22763. const numProjectionSlots = projectionSlots ? projectionSlots.length : 1;
  22764. const projectionHeads = componentNode.projection = newArray(numProjectionSlots, null);
  22765. const tails = projectionHeads.slice();
  22766. let componentChild = componentNode.child;
  22767. while (componentChild !== null) {
  22768. if (componentChild.type !== 128) {
  22769. const slotIndex = projectionSlots ? matchingProjectionSlotIndex(componentChild, projectionSlots) : 0;
  22770. if (slotIndex !== null) {
  22771. if (tails[slotIndex]) {
  22772. tails[slotIndex].projectionNext = componentChild;
  22773. } else {
  22774. projectionHeads[slotIndex] = componentChild;
  22775. }
  22776. tails[slotIndex] = componentChild;
  22777. }
  22778. }
  22779. componentChild = componentChild.next;
  22780. }
  22781. }
  22782. }
  22783. function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs, fallbackTemplateFn, fallbackDecls, fallbackVars) {
  22784. const lView = getLView();
  22785. const tView = getTView();
  22786. const fallbackIndex = fallbackTemplateFn ? nodeIndex + 1 : null;
  22787. if (fallbackIndex !== null) {
  22788. declareTemplate(lView, tView, fallbackIndex, fallbackTemplateFn, fallbackDecls, fallbackVars, null, attrs);
  22789. }
  22790. const tProjectionNode = getOrCreateTNode(tView, HEADER_OFFSET + nodeIndex, 16, null, attrs || null);
  22791. if (tProjectionNode.projection === null) {
  22792. tProjectionNode.projection = selectorIndex;
  22793. }
  22794. setCurrentTNodeAsNotParent();
  22795. const hydrationInfo = lView[HYDRATION];
  22796. const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1();
  22797. const componentHostNode = lView[DECLARATION_COMPONENT_VIEW][T_HOST];
  22798. const isEmpty2 = componentHostNode.projection[tProjectionNode.projection] === null;
  22799. if (isEmpty2 && fallbackIndex !== null) {
  22800. insertFallbackContent(lView, tView, fallbackIndex);
  22801. } else if (isNodeCreationMode && !isDetachedByI18n(tProjectionNode)) {
  22802. applyProjection(tView, lView, tProjectionNode);
  22803. }
  22804. }
  22805. function insertFallbackContent(lView, tView, fallbackIndex) {
  22806. const adjustedIndex = HEADER_OFFSET + fallbackIndex;
  22807. const fallbackTNode = tView.data[adjustedIndex];
  22808. const fallbackLContainer = lView[adjustedIndex];
  22809. ngDevMode && assertTNode(fallbackTNode);
  22810. ngDevMode && assertLContainer(fallbackLContainer);
  22811. const dehydratedView = findMatchingDehydratedView(fallbackLContainer, fallbackTNode.tView.ssrId);
  22812. const fallbackLView = createAndRenderEmbeddedLView(lView, fallbackTNode, void 0, {
  22813. dehydratedView
  22814. });
  22815. addLViewToLContainer(fallbackLContainer, fallbackLView, 0, shouldAddViewToDom(fallbackTNode, dehydratedView));
  22816. }
  22817. function ɵɵpropertyInterpolate(propName, v0, sanitizer) {
  22818. ɵɵpropertyInterpolate1(propName, "", v0, "", sanitizer);
  22819. return ɵɵpropertyInterpolate;
  22820. }
  22821. function ɵɵpropertyInterpolate1(propName, prefix, v0, suffix, sanitizer) {
  22822. const lView = getLView();
  22823. const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
  22824. if (interpolatedValue !== NO_CHANGE) {
  22825. const tView = getTView();
  22826. const tNode = getSelectedTNode();
  22827. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22828. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 1, prefix, suffix);
  22829. }
  22830. return ɵɵpropertyInterpolate1;
  22831. }
  22832. function ɵɵpropertyInterpolate2(propName, prefix, v0, i0, v1, suffix, sanitizer) {
  22833. const lView = getLView();
  22834. const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
  22835. if (interpolatedValue !== NO_CHANGE) {
  22836. const tView = getTView();
  22837. const tNode = getSelectedTNode();
  22838. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22839. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 2, prefix, i0, suffix);
  22840. }
  22841. return ɵɵpropertyInterpolate2;
  22842. }
  22843. function ɵɵpropertyInterpolate3(propName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer) {
  22844. const lView = getLView();
  22845. const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
  22846. if (interpolatedValue !== NO_CHANGE) {
  22847. const tView = getTView();
  22848. const tNode = getSelectedTNode();
  22849. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22850. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 3, prefix, i0, i1, suffix);
  22851. }
  22852. return ɵɵpropertyInterpolate3;
  22853. }
  22854. function ɵɵpropertyInterpolate4(propName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer) {
  22855. const lView = getLView();
  22856. const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
  22857. if (interpolatedValue !== NO_CHANGE) {
  22858. const tView = getTView();
  22859. const tNode = getSelectedTNode();
  22860. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22861. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
  22862. }
  22863. return ɵɵpropertyInterpolate4;
  22864. }
  22865. function ɵɵpropertyInterpolate5(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer) {
  22866. const lView = getLView();
  22867. const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
  22868. if (interpolatedValue !== NO_CHANGE) {
  22869. const tView = getTView();
  22870. const tNode = getSelectedTNode();
  22871. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22872. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
  22873. }
  22874. return ɵɵpropertyInterpolate5;
  22875. }
  22876. function ɵɵpropertyInterpolate6(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer) {
  22877. const lView = getLView();
  22878. const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
  22879. if (interpolatedValue !== NO_CHANGE) {
  22880. const tView = getTView();
  22881. const tNode = getSelectedTNode();
  22882. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22883. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
  22884. }
  22885. return ɵɵpropertyInterpolate6;
  22886. }
  22887. function ɵɵpropertyInterpolate7(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer) {
  22888. const lView = getLView();
  22889. const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  22890. if (interpolatedValue !== NO_CHANGE) {
  22891. const tView = getTView();
  22892. const tNode = getSelectedTNode();
  22893. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22894. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
  22895. }
  22896. return ɵɵpropertyInterpolate7;
  22897. }
  22898. function ɵɵpropertyInterpolate8(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer) {
  22899. const lView = getLView();
  22900. const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  22901. if (interpolatedValue !== NO_CHANGE) {
  22902. const tView = getTView();
  22903. const tNode = getSelectedTNode();
  22904. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22905. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
  22906. }
  22907. return ɵɵpropertyInterpolate8;
  22908. }
  22909. function ɵɵpropertyInterpolateV(propName, values, sanitizer) {
  22910. const lView = getLView();
  22911. const interpolatedValue = interpolationV(lView, values);
  22912. if (interpolatedValue !== NO_CHANGE) {
  22913. const tView = getTView();
  22914. const tNode = getSelectedTNode();
  22915. elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
  22916. if (ngDevMode) {
  22917. const interpolationInBetween = [values[0]];
  22918. for (let i = 2; i < values.length; i += 2) {
  22919. interpolationInBetween.push(values[i]);
  22920. }
  22921. storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
  22922. }
  22923. }
  22924. return ɵɵpropertyInterpolateV;
  22925. }
  22926. function ɵɵcontentQuery(directiveIndex, predicate, flags, read) {
  22927. createContentQuery(directiveIndex, predicate, flags, read);
  22928. }
  22929. function ɵɵviewQuery(predicate, flags, read) {
  22930. createViewQuery(predicate, flags, read);
  22931. }
  22932. function ɵɵqueryRefresh(queryList) {
  22933. const lView = getLView();
  22934. const tView = getTView();
  22935. const queryIndex = getCurrentQueryIndex();
  22936. setCurrentQueryIndex(queryIndex + 1);
  22937. const tQuery = getTQuery(tView, queryIndex);
  22938. if (queryList.dirty && isCreationMode(lView) === ((tQuery.metadata.flags & 2) === 2)) {
  22939. if (tQuery.matches === null) {
  22940. queryList.reset([]);
  22941. } else {
  22942. const result = getQueryResults(lView, queryIndex);
  22943. queryList.reset(result, unwrapElementRef);
  22944. queryList.notifyOnChanges();
  22945. }
  22946. return true;
  22947. }
  22948. return false;
  22949. }
  22950. function ɵɵloadQuery() {
  22951. return loadQueryInternal(getLView(), getCurrentQueryIndex());
  22952. }
  22953. function ɵɵcontentQuerySignal(directiveIndex, target, predicate, flags, read) {
  22954. bindQueryToSignal(target, createContentQuery(directiveIndex, predicate, flags, read));
  22955. }
  22956. function ɵɵviewQuerySignal(target, predicate, flags, read) {
  22957. bindQueryToSignal(target, createViewQuery(predicate, flags, read));
  22958. }
  22959. function ɵɵqueryAdvance(indexOffset = 1) {
  22960. setCurrentQueryIndex(getCurrentQueryIndex() + indexOffset);
  22961. }
  22962. function store(tView, lView, index, value) {
  22963. if (index >= tView.data.length) {
  22964. tView.data[index] = null;
  22965. tView.blueprint[index] = null;
  22966. }
  22967. lView[index] = value;
  22968. }
  22969. function ɵɵreference(index) {
  22970. const contextLView = getContextLView();
  22971. return load(contextLView, HEADER_OFFSET + index);
  22972. }
  22973. function ɵɵstyleMapInterpolate1(prefix, v0, suffix) {
  22974. const lView = getLView();
  22975. const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
  22976. ɵɵstyleMap(interpolatedValue);
  22977. }
  22978. function ɵɵstyleMapInterpolate2(prefix, v0, i0, v1, suffix) {
  22979. const lView = getLView();
  22980. const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
  22981. ɵɵstyleMap(interpolatedValue);
  22982. }
  22983. function ɵɵstyleMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
  22984. const lView = getLView();
  22985. const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
  22986. ɵɵstyleMap(interpolatedValue);
  22987. }
  22988. function ɵɵstyleMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
  22989. const lView = getLView();
  22990. const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
  22991. ɵɵstyleMap(interpolatedValue);
  22992. }
  22993. function ɵɵstyleMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
  22994. const lView = getLView();
  22995. const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
  22996. ɵɵstyleMap(interpolatedValue);
  22997. }
  22998. function ɵɵstyleMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
  22999. const lView = getLView();
  23000. const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
  23001. ɵɵstyleMap(interpolatedValue);
  23002. }
  23003. function ɵɵstyleMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
  23004. const lView = getLView();
  23005. const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  23006. ɵɵstyleMap(interpolatedValue);
  23007. }
  23008. function ɵɵstyleMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
  23009. const lView = getLView();
  23010. const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  23011. ɵɵstyleMap(interpolatedValue);
  23012. }
  23013. function ɵɵstyleMapInterpolateV(values) {
  23014. const lView = getLView();
  23015. const interpolatedValue = interpolationV(lView, values);
  23016. ɵɵstyleMap(interpolatedValue);
  23017. }
  23018. function ɵɵstylePropInterpolate1(prop, prefix, v0, suffix, valueSuffix) {
  23019. const lView = getLView();
  23020. const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
  23021. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23022. return ɵɵstylePropInterpolate1;
  23023. }
  23024. function ɵɵstylePropInterpolate2(prop, prefix, v0, i0, v1, suffix, valueSuffix) {
  23025. const lView = getLView();
  23026. const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
  23027. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23028. return ɵɵstylePropInterpolate2;
  23029. }
  23030. function ɵɵstylePropInterpolate3(prop, prefix, v0, i0, v1, i1, v2, suffix, valueSuffix) {
  23031. const lView = getLView();
  23032. const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
  23033. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23034. return ɵɵstylePropInterpolate3;
  23035. }
  23036. function ɵɵstylePropInterpolate4(prop, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, valueSuffix) {
  23037. const lView = getLView();
  23038. const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
  23039. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23040. return ɵɵstylePropInterpolate4;
  23041. }
  23042. function ɵɵstylePropInterpolate5(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, valueSuffix) {
  23043. const lView = getLView();
  23044. const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
  23045. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23046. return ɵɵstylePropInterpolate5;
  23047. }
  23048. function ɵɵstylePropInterpolate6(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, valueSuffix) {
  23049. const lView = getLView();
  23050. const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
  23051. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23052. return ɵɵstylePropInterpolate6;
  23053. }
  23054. function ɵɵstylePropInterpolate7(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, valueSuffix) {
  23055. const lView = getLView();
  23056. const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  23057. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23058. return ɵɵstylePropInterpolate7;
  23059. }
  23060. function ɵɵstylePropInterpolate8(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, valueSuffix) {
  23061. const lView = getLView();
  23062. const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  23063. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23064. return ɵɵstylePropInterpolate8;
  23065. }
  23066. function ɵɵstylePropInterpolateV(prop, values, valueSuffix) {
  23067. const lView = getLView();
  23068. const interpolatedValue = interpolationV(lView, values);
  23069. checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
  23070. return ɵɵstylePropInterpolateV;
  23071. }
  23072. function ɵɵtext(index, value = "") {
  23073. const lView = getLView();
  23074. const tView = getTView();
  23075. const adjustedIndex = index + HEADER_OFFSET;
  23076. ngDevMode && assertEqual(getBindingIndex(), tView.bindingStartIndex, "text nodes should be created before any bindings");
  23077. ngDevMode && assertIndexInRange(lView, adjustedIndex);
  23078. const tNode = tView.firstCreatePass ? getOrCreateTNode(tView, adjustedIndex, 1, value, null) : tView.data[adjustedIndex];
  23079. const textNative = _locateOrCreateTextNode(tView, lView, tNode, value, index);
  23080. lView[adjustedIndex] = textNative;
  23081. if (wasLastNodeCreated()) {
  23082. appendChild(tView, lView, textNative, tNode);
  23083. }
  23084. setCurrentTNode(tNode, false);
  23085. }
  23086. var _locateOrCreateTextNode = (tView, lView, tNode, value, index) => {
  23087. lastNodeWasCreated(true);
  23088. return createTextNode(lView[RENDERER], value);
  23089. };
  23090. function locateOrCreateTextNodeImpl(tView, lView, tNode, value, index) {
  23091. const hydrationInfo = lView[HYDRATION];
  23092. const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDetachedByI18n(tNode) || isDisconnectedNode$1(hydrationInfo, index);
  23093. lastNodeWasCreated(isNodeCreationMode);
  23094. if (isNodeCreationMode) {
  23095. return createTextNode(lView[RENDERER], value);
  23096. }
  23097. const textNative = locateNextRNode(hydrationInfo, tView, lView, tNode);
  23098. ngDevMode && validateMatchingNode(textNative, Node.TEXT_NODE, null, lView, tNode);
  23099. ngDevMode && markRNodeAsClaimedByHydration(textNative);
  23100. return textNative;
  23101. }
  23102. function enableLocateOrCreateTextNodeImpl() {
  23103. _locateOrCreateTextNode = locateOrCreateTextNodeImpl;
  23104. }
  23105. function ɵɵtextInterpolate(v0) {
  23106. ɵɵtextInterpolate1("", v0, "");
  23107. return ɵɵtextInterpolate;
  23108. }
  23109. function ɵɵtextInterpolate1(prefix, v0, suffix) {
  23110. const lView = getLView();
  23111. const interpolated = interpolation1(lView, prefix, v0, suffix);
  23112. if (interpolated !== NO_CHANGE) {
  23113. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23114. }
  23115. return ɵɵtextInterpolate1;
  23116. }
  23117. function ɵɵtextInterpolate2(prefix, v0, i0, v1, suffix) {
  23118. const lView = getLView();
  23119. const interpolated = interpolation2(lView, prefix, v0, i0, v1, suffix);
  23120. if (interpolated !== NO_CHANGE) {
  23121. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23122. }
  23123. return ɵɵtextInterpolate2;
  23124. }
  23125. function ɵɵtextInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
  23126. const lView = getLView();
  23127. const interpolated = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
  23128. if (interpolated !== NO_CHANGE) {
  23129. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23130. }
  23131. return ɵɵtextInterpolate3;
  23132. }
  23133. function ɵɵtextInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
  23134. const lView = getLView();
  23135. const interpolated = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
  23136. if (interpolated !== NO_CHANGE) {
  23137. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23138. }
  23139. return ɵɵtextInterpolate4;
  23140. }
  23141. function ɵɵtextInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
  23142. const lView = getLView();
  23143. const interpolated = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
  23144. if (interpolated !== NO_CHANGE) {
  23145. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23146. }
  23147. return ɵɵtextInterpolate5;
  23148. }
  23149. function ɵɵtextInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
  23150. const lView = getLView();
  23151. const interpolated = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
  23152. if (interpolated !== NO_CHANGE) {
  23153. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23154. }
  23155. return ɵɵtextInterpolate6;
  23156. }
  23157. function ɵɵtextInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
  23158. const lView = getLView();
  23159. const interpolated = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  23160. if (interpolated !== NO_CHANGE) {
  23161. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23162. }
  23163. return ɵɵtextInterpolate7;
  23164. }
  23165. function ɵɵtextInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
  23166. const lView = getLView();
  23167. const interpolated = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  23168. if (interpolated !== NO_CHANGE) {
  23169. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23170. }
  23171. return ɵɵtextInterpolate8;
  23172. }
  23173. function ɵɵtextInterpolateV(values) {
  23174. const lView = getLView();
  23175. const interpolated = interpolationV(lView, values);
  23176. if (interpolated !== NO_CHANGE) {
  23177. textBindingInternal(lView, getSelectedIndex(), interpolated);
  23178. }
  23179. return ɵɵtextInterpolateV;
  23180. }
  23181. function textBindingInternal(lView, index, value) {
  23182. ngDevMode && assertString(value, "Value should be a string");
  23183. ngDevMode && assertNotSame(value, NO_CHANGE, "value should not be NO_CHANGE");
  23184. ngDevMode && assertIndexInRange(lView, index);
  23185. const element = getNativeByIndex(index, lView);
  23186. ngDevMode && assertDefined(element, "native element should exist");
  23187. updateTextNode(lView[RENDERER], element, value);
  23188. }
  23189. function ɵɵtwoWayProperty(propName, value, sanitizer) {
  23190. if (isWritableSignal(value)) {
  23191. value = value();
  23192. }
  23193. const lView = getLView();
  23194. const bindingIndex = nextBindingIndex();
  23195. if (bindingUpdated(lView, bindingIndex, value)) {
  23196. const tView = getTView();
  23197. const tNode = getSelectedTNode();
  23198. elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, false);
  23199. ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  23200. }
  23201. return ɵɵtwoWayProperty;
  23202. }
  23203. function ɵɵtwoWayBindingSet(target, value) {
  23204. const canWrite = isWritableSignal(target);
  23205. canWrite && target.set(value);
  23206. return canWrite;
  23207. }
  23208. function ɵɵtwoWayListener(eventName, listenerFn) {
  23209. const lView = getLView();
  23210. const tView = getTView();
  23211. const tNode = getCurrentTNode();
  23212. listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn);
  23213. return ɵɵtwoWayListener;
  23214. }
  23215. var UNINITIALIZED_LET = {};
  23216. function ɵɵdeclareLet(index) {
  23217. const tView = getTView();
  23218. const lView = getLView();
  23219. const adjustedIndex = index + HEADER_OFFSET;
  23220. const tNode = getOrCreateTNode(tView, adjustedIndex, 128, null, null);
  23221. setCurrentTNode(tNode, false);
  23222. store(tView, lView, adjustedIndex, UNINITIALIZED_LET);
  23223. return ɵɵdeclareLet;
  23224. }
  23225. function ɵɵstoreLet(value) {
  23226. performanceMarkFeature("NgLet");
  23227. const tView = getTView();
  23228. const lView = getLView();
  23229. const index = getSelectedIndex();
  23230. store(tView, lView, index, value);
  23231. return value;
  23232. }
  23233. function ɵɵreadContextLet(index) {
  23234. const contextLView = getContextLView();
  23235. const value = load(contextLView, HEADER_OFFSET + index);
  23236. if (value === UNINITIALIZED_LET) {
  23237. throw new RuntimeError(314, ngDevMode && "Attempting to access a @let declaration whose value is not available yet");
  23238. }
  23239. return value;
  23240. }
  23241. function ɵɵattachSourceLocations(templatePath, locations) {
  23242. const tView = getTView();
  23243. const lView = getLView();
  23244. const renderer = lView[RENDERER];
  23245. const attributeName = "data-ng-source-location";
  23246. for (const [index, offset, line, column] of locations) {
  23247. const tNode = getTNode(tView, index + HEADER_OFFSET);
  23248. ngDevMode && assertTNodeType(
  23249. tNode,
  23250. 2
  23251. /* TNodeType.Element */
  23252. );
  23253. const node = getNativeByIndex(index + HEADER_OFFSET, lView);
  23254. if (!node.hasAttribute(attributeName)) {
  23255. const attributeValue = `${templatePath}@o:${offset},l:${line},c:${column}`;
  23256. renderer.setAttribute(node, attributeName, attributeValue);
  23257. }
  23258. }
  23259. }
  23260. function providersResolver(def, providers, viewProviders) {
  23261. const tView = getTView();
  23262. if (tView.firstCreatePass) {
  23263. const isComponent2 = isComponentDef(def);
  23264. resolveProvider(viewProviders, tView.data, tView.blueprint, isComponent2, true);
  23265. resolveProvider(providers, tView.data, tView.blueprint, isComponent2, false);
  23266. }
  23267. }
  23268. function resolveProvider(provider, tInjectables, lInjectablesBlueprint, isComponent2, isViewProvider) {
  23269. provider = resolveForwardRef(provider);
  23270. if (Array.isArray(provider)) {
  23271. for (let i = 0; i < provider.length; i++) {
  23272. resolveProvider(provider[i], tInjectables, lInjectablesBlueprint, isComponent2, isViewProvider);
  23273. }
  23274. } else {
  23275. const tView = getTView();
  23276. const lView = getLView();
  23277. const tNode = getCurrentTNode();
  23278. let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
  23279. const providerFactory = providerToFactory(provider);
  23280. if (ngDevMode) {
  23281. const injector = new NodeInjector(tNode, lView);
  23282. runInInjectorProfilerContext(injector, token, () => {
  23283. emitProviderConfiguredEvent(provider, isViewProvider);
  23284. });
  23285. }
  23286. const beginIndex = tNode.providerIndexes & 1048575;
  23287. const endIndex = tNode.directiveStart;
  23288. const cptViewProvidersCount = tNode.providerIndexes >> 20;
  23289. if (isTypeProvider(provider) || !provider.multi) {
  23290. const factory = new NodeInjectorFactory(providerFactory, isViewProvider, ɵɵdirectiveInject);
  23291. const existingFactoryIndex = indexOf(token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount, endIndex);
  23292. if (existingFactoryIndex === -1) {
  23293. diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
  23294. registerDestroyHooksIfSupported(tView, provider, tInjectables.length);
  23295. tInjectables.push(token);
  23296. tNode.directiveStart++;
  23297. tNode.directiveEnd++;
  23298. if (isViewProvider) {
  23299. tNode.providerIndexes += 1048576;
  23300. }
  23301. lInjectablesBlueprint.push(factory);
  23302. lView.push(factory);
  23303. } else {
  23304. lInjectablesBlueprint[existingFactoryIndex] = factory;
  23305. lView[existingFactoryIndex] = factory;
  23306. }
  23307. } else {
  23308. const existingProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex + cptViewProvidersCount, endIndex);
  23309. const existingViewProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex, beginIndex + cptViewProvidersCount);
  23310. const doesProvidersFactoryExist = existingProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingProvidersFactoryIndex];
  23311. const doesViewProvidersFactoryExist = existingViewProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingViewProvidersFactoryIndex];
  23312. if (isViewProvider && !doesViewProvidersFactoryExist || !isViewProvider && !doesProvidersFactoryExist) {
  23313. diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
  23314. const factory = multiFactory(isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver, lInjectablesBlueprint.length, isViewProvider, isComponent2, providerFactory);
  23315. if (!isViewProvider && doesViewProvidersFactoryExist) {
  23316. lInjectablesBlueprint[existingViewProvidersFactoryIndex].providerFactory = factory;
  23317. }
  23318. registerDestroyHooksIfSupported(tView, provider, tInjectables.length, 0);
  23319. tInjectables.push(token);
  23320. tNode.directiveStart++;
  23321. tNode.directiveEnd++;
  23322. if (isViewProvider) {
  23323. tNode.providerIndexes += 1048576;
  23324. }
  23325. lInjectablesBlueprint.push(factory);
  23326. lView.push(factory);
  23327. } else {
  23328. const indexInFactory = multiFactoryAdd(lInjectablesBlueprint[isViewProvider ? existingViewProvidersFactoryIndex : existingProvidersFactoryIndex], providerFactory, !isViewProvider && isComponent2);
  23329. registerDestroyHooksIfSupported(tView, provider, existingProvidersFactoryIndex > -1 ? existingProvidersFactoryIndex : existingViewProvidersFactoryIndex, indexInFactory);
  23330. }
  23331. if (!isViewProvider && isComponent2 && doesViewProvidersFactoryExist) {
  23332. lInjectablesBlueprint[existingViewProvidersFactoryIndex].componentProviders++;
  23333. }
  23334. }
  23335. }
  23336. }
  23337. function registerDestroyHooksIfSupported(tView, provider, contextIndex, indexInFactory) {
  23338. const providerIsTypeProvider = isTypeProvider(provider);
  23339. const providerIsClassProvider = isClassProvider(provider);
  23340. if (providerIsTypeProvider || providerIsClassProvider) {
  23341. const classToken = providerIsClassProvider ? resolveForwardRef(provider.useClass) : provider;
  23342. const prototype = classToken.prototype;
  23343. const ngOnDestroy = prototype.ngOnDestroy;
  23344. if (ngOnDestroy) {
  23345. const hooks = tView.destroyHooks || (tView.destroyHooks = []);
  23346. if (!providerIsTypeProvider && provider.multi) {
  23347. ngDevMode && assertDefined(indexInFactory, "indexInFactory when registering multi factory destroy hook");
  23348. const existingCallbacksIndex = hooks.indexOf(contextIndex);
  23349. if (existingCallbacksIndex === -1) {
  23350. hooks.push(contextIndex, [indexInFactory, ngOnDestroy]);
  23351. } else {
  23352. hooks[existingCallbacksIndex + 1].push(indexInFactory, ngOnDestroy);
  23353. }
  23354. } else {
  23355. hooks.push(contextIndex, ngOnDestroy);
  23356. }
  23357. }
  23358. }
  23359. }
  23360. function multiFactoryAdd(multiFactory2, factory, isComponentProvider) {
  23361. if (isComponentProvider) {
  23362. multiFactory2.componentProviders++;
  23363. }
  23364. return multiFactory2.multi.push(factory) - 1;
  23365. }
  23366. function indexOf(item, arr, begin, end) {
  23367. for (let i = begin; i < end; i++) {
  23368. if (arr[i] === item) return i;
  23369. }
  23370. return -1;
  23371. }
  23372. function multiProvidersFactoryResolver(_, tData, lData, tNode) {
  23373. return multiResolve(this.multi, []);
  23374. }
  23375. function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
  23376. const factories = this.multi;
  23377. let result;
  23378. if (this.providerFactory) {
  23379. const componentCount = this.providerFactory.componentProviders;
  23380. const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
  23381. result = multiProviders.slice(0, componentCount);
  23382. multiResolve(factories, result);
  23383. for (let i = componentCount; i < multiProviders.length; i++) {
  23384. result.push(multiProviders[i]);
  23385. }
  23386. } else {
  23387. result = [];
  23388. multiResolve(factories, result);
  23389. }
  23390. return result;
  23391. }
  23392. function multiResolve(factories, result) {
  23393. for (let i = 0; i < factories.length; i++) {
  23394. const factory = factories[i];
  23395. result.push(factory());
  23396. }
  23397. return result;
  23398. }
  23399. function multiFactory(factoryFn, index, isViewProvider, isComponent2, f) {
  23400. const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject);
  23401. factory.multi = [];
  23402. factory.index = index;
  23403. factory.componentProviders = 0;
  23404. multiFactoryAdd(factory, f, isComponent2 && !isViewProvider);
  23405. return factory;
  23406. }
  23407. function ɵɵProvidersFeature(providers, viewProviders = []) {
  23408. return (definition) => {
  23409. definition.providersResolver = (def, processProvidersFn) => {
  23410. return providersResolver(
  23411. def,
  23412. //
  23413. processProvidersFn ? processProvidersFn(providers) : providers,
  23414. //
  23415. viewProviders
  23416. );
  23417. };
  23418. };
  23419. }
  23420. function ɵɵExternalStylesFeature(styleUrls) {
  23421. return (definition) => {
  23422. if (styleUrls.length < 1) {
  23423. return;
  23424. }
  23425. definition.getExternalStyles = (encapsulationId) => {
  23426. const urls = styleUrls.map((value) => value + "?ngcomp" + (encapsulationId ? "=" + encodeURIComponent(encapsulationId) : "") + "&e=" + definition.encapsulation);
  23427. return urls;
  23428. };
  23429. };
  23430. }
  23431. function ɵɵsetComponentScope(type, directives, pipes) {
  23432. const def = type.ɵcmp;
  23433. def.directiveDefs = extractDefListOrFactory(
  23434. directives,
  23435. /* pipeDef */
  23436. false
  23437. );
  23438. def.pipeDefs = extractDefListOrFactory(
  23439. pipes,
  23440. /* pipeDef */
  23441. true
  23442. );
  23443. }
  23444. function ɵɵsetNgModuleScope(type, scope) {
  23445. return noSideEffects(() => {
  23446. const ngModuleDef = getNgModuleDef(type, true);
  23447. ngModuleDef.declarations = convertToTypeArray(scope.declarations || EMPTY_ARRAY);
  23448. ngModuleDef.imports = convertToTypeArray(scope.imports || EMPTY_ARRAY);
  23449. ngModuleDef.exports = convertToTypeArray(scope.exports || EMPTY_ARRAY);
  23450. if (scope.bootstrap) {
  23451. ngModuleDef.bootstrap = convertToTypeArray(scope.bootstrap);
  23452. }
  23453. depsTracker.registerNgModule(type, scope);
  23454. });
  23455. }
  23456. function convertToTypeArray(values) {
  23457. if (typeof values === "function") {
  23458. return values;
  23459. }
  23460. const flattenValues = flatten(values);
  23461. if (flattenValues.some(isForwardRef)) {
  23462. return () => flattenValues.map(resolveForwardRef).map(maybeUnwrapModuleWithProviders);
  23463. } else {
  23464. return flattenValues.map(maybeUnwrapModuleWithProviders);
  23465. }
  23466. }
  23467. function maybeUnwrapModuleWithProviders(value) {
  23468. return isModuleWithProviders(value) ? value.ngModule : value;
  23469. }
  23470. function ɵɵpureFunction0(slotOffset, pureFn, thisArg) {
  23471. const bindingIndex = getBindingRoot() + slotOffset;
  23472. const lView = getLView();
  23473. return lView[bindingIndex] === NO_CHANGE ? updateBinding(lView, bindingIndex, thisArg ? pureFn.call(thisArg) : pureFn()) : getBinding(lView, bindingIndex);
  23474. }
  23475. function ɵɵpureFunction1(slotOffset, pureFn, exp, thisArg) {
  23476. return pureFunction1Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp, thisArg);
  23477. }
  23478. function ɵɵpureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) {
  23479. return pureFunction2Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, thisArg);
  23480. }
  23481. function ɵɵpureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
  23482. return pureFunction3Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, thisArg);
  23483. }
  23484. function ɵɵpureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
  23485. return pureFunction4Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg);
  23486. }
  23487. function ɵɵpureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) {
  23488. const bindingIndex = getBindingRoot() + slotOffset;
  23489. const lView = getLView();
  23490. const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  23491. return bindingUpdated(lView, bindingIndex + 4, exp5) || different ? updateBinding(lView, bindingIndex + 5, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) : pureFn(exp1, exp2, exp3, exp4, exp5)) : getBinding(lView, bindingIndex + 5);
  23492. }
  23493. function ɵɵpureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) {
  23494. const bindingIndex = getBindingRoot() + slotOffset;
  23495. const lView = getLView();
  23496. const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  23497. return bindingUpdated2(lView, bindingIndex + 4, exp5, exp6) || different ? updateBinding(lView, bindingIndex + 6, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) : getBinding(lView, bindingIndex + 6);
  23498. }
  23499. function ɵɵpureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) {
  23500. const bindingIndex = getBindingRoot() + slotOffset;
  23501. const lView = getLView();
  23502. let different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  23503. return bindingUpdated3(lView, bindingIndex + 4, exp5, exp6, exp7) || different ? updateBinding(lView, bindingIndex + 7, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) : getBinding(lView, bindingIndex + 7);
  23504. }
  23505. function ɵɵpureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) {
  23506. const bindingIndex = getBindingRoot() + slotOffset;
  23507. const lView = getLView();
  23508. const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  23509. return bindingUpdated4(lView, bindingIndex + 4, exp5, exp6, exp7, exp8) || different ? updateBinding(lView, bindingIndex + 8, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) : getBinding(lView, bindingIndex + 8);
  23510. }
  23511. function ɵɵpureFunctionV(slotOffset, pureFn, exps, thisArg) {
  23512. return pureFunctionVInternal(getLView(), getBindingRoot(), slotOffset, pureFn, exps, thisArg);
  23513. }
  23514. function getPureFunctionReturnValue(lView, returnValueIndex) {
  23515. ngDevMode && assertIndexInRange(lView, returnValueIndex);
  23516. const lastReturnValue = lView[returnValueIndex];
  23517. return lastReturnValue === NO_CHANGE ? void 0 : lastReturnValue;
  23518. }
  23519. function pureFunction1Internal(lView, bindingRoot, slotOffset, pureFn, exp, thisArg) {
  23520. const bindingIndex = bindingRoot + slotOffset;
  23521. return bindingUpdated(lView, bindingIndex, exp) ? updateBinding(lView, bindingIndex + 1, thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) : getPureFunctionReturnValue(lView, bindingIndex + 1);
  23522. }
  23523. function pureFunction2Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, thisArg) {
  23524. const bindingIndex = bindingRoot + slotOffset;
  23525. return bindingUpdated2(lView, bindingIndex, exp1, exp2) ? updateBinding(lView, bindingIndex + 2, thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) : getPureFunctionReturnValue(lView, bindingIndex + 2);
  23526. }
  23527. function pureFunction3Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
  23528. const bindingIndex = bindingRoot + slotOffset;
  23529. return bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) ? updateBinding(lView, bindingIndex + 3, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) : getPureFunctionReturnValue(lView, bindingIndex + 3);
  23530. }
  23531. function pureFunction4Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
  23532. const bindingIndex = bindingRoot + slotOffset;
  23533. return bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) ? updateBinding(lView, bindingIndex + 4, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) : getPureFunctionReturnValue(lView, bindingIndex + 4);
  23534. }
  23535. function pureFunctionVInternal(lView, bindingRoot, slotOffset, pureFn, exps, thisArg) {
  23536. let bindingIndex = bindingRoot + slotOffset;
  23537. let different = false;
  23538. for (let i = 0; i < exps.length; i++) {
  23539. bindingUpdated(lView, bindingIndex++, exps[i]) && (different = true);
  23540. }
  23541. return different ? updateBinding(lView, bindingIndex, pureFn.apply(thisArg, exps)) : getPureFunctionReturnValue(lView, bindingIndex);
  23542. }
  23543. function ɵɵpipe(index, pipeName) {
  23544. const tView = getTView();
  23545. let pipeDef;
  23546. const adjustedIndex = index + HEADER_OFFSET;
  23547. if (tView.firstCreatePass) {
  23548. pipeDef = getPipeDef(pipeName, tView.pipeRegistry);
  23549. tView.data[adjustedIndex] = pipeDef;
  23550. if (pipeDef.onDestroy) {
  23551. (tView.destroyHooks ??= []).push(adjustedIndex, pipeDef.onDestroy);
  23552. }
  23553. } else {
  23554. pipeDef = tView.data[adjustedIndex];
  23555. }
  23556. const pipeFactory = pipeDef.factory || (pipeDef.factory = getFactoryDef(pipeDef.type, true));
  23557. let previousInjectorProfilerContext;
  23558. if (ngDevMode) {
  23559. previousInjectorProfilerContext = setInjectorProfilerContext({
  23560. injector: new NodeInjector(getCurrentTNode(), getLView()),
  23561. token: pipeDef.type
  23562. });
  23563. }
  23564. const previousInjectImplementation = setInjectImplementation(ɵɵdirectiveInject);
  23565. try {
  23566. const previousIncludeViewProviders = setIncludeViewProviders(false);
  23567. const pipeInstance = pipeFactory();
  23568. setIncludeViewProviders(previousIncludeViewProviders);
  23569. store(tView, getLView(), adjustedIndex, pipeInstance);
  23570. return pipeInstance;
  23571. } finally {
  23572. setInjectImplementation(previousInjectImplementation);
  23573. ngDevMode && setInjectorProfilerContext(previousInjectorProfilerContext);
  23574. }
  23575. }
  23576. function getPipeDef(name, registry) {
  23577. if (registry) {
  23578. if (ngDevMode) {
  23579. const pipes = registry.filter((pipe2) => pipe2.name === name);
  23580. if (pipes.length > 1) {
  23581. console.warn(formatRuntimeError(313, getMultipleMatchingPipesMessage(name)));
  23582. }
  23583. }
  23584. for (let i = registry.length - 1; i >= 0; i--) {
  23585. const pipeDef = registry[i];
  23586. if (name === pipeDef.name) {
  23587. return pipeDef;
  23588. }
  23589. }
  23590. }
  23591. if (ngDevMode) {
  23592. throw new RuntimeError(-302, getPipeNotFoundErrorMessage(name));
  23593. }
  23594. return;
  23595. }
  23596. function getMultipleMatchingPipesMessage(name) {
  23597. const lView = getLView();
  23598. const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
  23599. const context2 = declarationLView[CONTEXT];
  23600. const hostIsStandalone = isHostComponentStandalone(lView);
  23601. const componentInfoMessage = context2 ? ` in the '${context2.constructor.name}' component` : "";
  23602. const verifyMessage = `check ${hostIsStandalone ? "'@Component.imports' of this component" : "the imports of this module"}`;
  23603. const errorMessage = `Multiple pipes match the name \`${name}\`${componentInfoMessage}. ${verifyMessage}`;
  23604. return errorMessage;
  23605. }
  23606. function getPipeNotFoundErrorMessage(name) {
  23607. const lView = getLView();
  23608. const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
  23609. const context2 = declarationLView[CONTEXT];
  23610. const hostIsStandalone = isHostComponentStandalone(lView);
  23611. const componentInfoMessage = context2 ? ` in the '${context2.constructor.name}' component` : "";
  23612. const verifyMessage = `Verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "declared or imported in this module"}`;
  23613. const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
  23614. return errorMessage;
  23615. }
  23616. function ɵɵpipeBind1(index, offset, v1) {
  23617. const adjustedIndex = index + HEADER_OFFSET;
  23618. const lView = getLView();
  23619. const pipeInstance = load(lView, adjustedIndex);
  23620. return isPure(lView, adjustedIndex) ? pureFunction1Internal(lView, getBindingRoot(), offset, pipeInstance.transform, v1, pipeInstance) : pipeInstance.transform(v1);
  23621. }
  23622. function ɵɵpipeBind2(index, slotOffset, v1, v2) {
  23623. const adjustedIndex = index + HEADER_OFFSET;
  23624. const lView = getLView();
  23625. const pipeInstance = load(lView, adjustedIndex);
  23626. return isPure(lView, adjustedIndex) ? pureFunction2Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, pipeInstance) : pipeInstance.transform(v1, v2);
  23627. }
  23628. function ɵɵpipeBind3(index, slotOffset, v1, v2, v3) {
  23629. const adjustedIndex = index + HEADER_OFFSET;
  23630. const lView = getLView();
  23631. const pipeInstance = load(lView, adjustedIndex);
  23632. return isPure(lView, adjustedIndex) ? pureFunction3Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) : pipeInstance.transform(v1, v2, v3);
  23633. }
  23634. function ɵɵpipeBind4(index, slotOffset, v1, v2, v3, v4) {
  23635. const adjustedIndex = index + HEADER_OFFSET;
  23636. const lView = getLView();
  23637. const pipeInstance = load(lView, adjustedIndex);
  23638. return isPure(lView, adjustedIndex) ? pureFunction4Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) : pipeInstance.transform(v1, v2, v3, v4);
  23639. }
  23640. function ɵɵpipeBindV(index, slotOffset, values) {
  23641. const adjustedIndex = index + HEADER_OFFSET;
  23642. const lView = getLView();
  23643. const pipeInstance = load(lView, adjustedIndex);
  23644. return isPure(lView, adjustedIndex) ? pureFunctionVInternal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, values, pipeInstance) : pipeInstance.transform.apply(pipeInstance, values);
  23645. }
  23646. function isPure(lView, index) {
  23647. return lView[TVIEW].data[index].pure;
  23648. }
  23649. function ɵɵtemplateRefExtractor(tNode, lView) {
  23650. return createTemplateRef(tNode, lView);
  23651. }
  23652. function ɵɵgetComponentDepsFactory(type, rawImports) {
  23653. return () => {
  23654. try {
  23655. return depsTracker.getComponentDependencies(type, rawImports).dependencies;
  23656. } catch (e) {
  23657. console.error(`Computing dependencies in local compilation mode for the component "${type.name}" failed with the exception:`, e);
  23658. throw e;
  23659. }
  23660. };
  23661. }
  23662. function ɵsetClassDebugInfo(type, debugInfo) {
  23663. const def = getComponentDef(type);
  23664. if (def !== null) {
  23665. def.debugInfo = debugInfo;
  23666. }
  23667. }
  23668. function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals, importMeta = null, id = null) {
  23669. ngDevMode && assertComponentDef(type);
  23670. const currentDef = getComponentDef(type);
  23671. applyMetadata.apply(null, [type, namespaces, ...locals]);
  23672. const {
  23673. newDef,
  23674. oldDef
  23675. } = mergeWithExistingDefinition(currentDef, getComponentDef(type));
  23676. type[NG_COMP_DEF] = newDef;
  23677. if (oldDef.tView) {
  23678. const trackedViews = getTrackedLViews().values();
  23679. for (const root of trackedViews) {
  23680. if (isRootView(root) && root[PARENT] === null) {
  23681. recreateMatchingLViews(importMeta, id, newDef, oldDef, root);
  23682. }
  23683. }
  23684. }
  23685. }
  23686. function mergeWithExistingDefinition(currentDef, newDef) {
  23687. const clone = __spreadValues({}, currentDef);
  23688. const replacement = Object.assign(currentDef, newDef, {
  23689. // We need to keep the existing directive and pipe defs, because they can get patched on
  23690. // by a call to `setComponentScope` from a module file. That call won't make it into the
  23691. // HMR replacement function, because it lives in an entirely different file.
  23692. directiveDefs: clone.directiveDefs,
  23693. pipeDefs: clone.pipeDefs,
  23694. // Preserve the old `setInput` function, because it has some state.
  23695. // This is fine, because the component instance is preserved as well.
  23696. setInput: clone.setInput,
  23697. // Externally this is redundant since we redeclare the definition using the original type.
  23698. // Internally we may receive a definition with an alternate, but identical, type so we have
  23699. // to ensure that the original one is preserved.
  23700. type: clone.type
  23701. });
  23702. ngDevMode && assertEqual(replacement, currentDef, "Expected definition to be merged in place");
  23703. return {
  23704. newDef: replacement,
  23705. oldDef: clone
  23706. };
  23707. }
  23708. function recreateMatchingLViews(importMeta, id, newDef, oldDef, rootLView) {
  23709. ngDevMode && assertDefined(oldDef.tView, "Expected a component definition that has been instantiated at least once");
  23710. const tView = rootLView[TVIEW];
  23711. if (tView === oldDef.tView) {
  23712. ngDevMode && assertComponentDef(oldDef.type);
  23713. recreateLView(importMeta, id, newDef, oldDef, rootLView);
  23714. return;
  23715. }
  23716. for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
  23717. const current = rootLView[i];
  23718. if (isLContainer(current)) {
  23719. if (isLView(current[HOST])) {
  23720. recreateMatchingLViews(importMeta, id, newDef, oldDef, current[HOST]);
  23721. }
  23722. for (let j = CONTAINER_HEADER_OFFSET; j < current.length; j++) {
  23723. recreateMatchingLViews(importMeta, id, newDef, oldDef, current[j]);
  23724. }
  23725. } else if (isLView(current)) {
  23726. recreateMatchingLViews(importMeta, id, newDef, oldDef, current);
  23727. }
  23728. }
  23729. }
  23730. function clearRendererCache(factory, def) {
  23731. factory.componentReplaced?.(def.id);
  23732. }
  23733. function recreateLView(importMeta, id, newDef, oldDef, lView) {
  23734. const instance = lView[CONTEXT];
  23735. let host = lView[HOST];
  23736. const parentLView = lView[PARENT];
  23737. ngDevMode && assertLView(parentLView);
  23738. const tNode = lView[T_HOST];
  23739. ngDevMode && assertTNodeType(
  23740. tNode,
  23741. 2
  23742. /* TNodeType.Element */
  23743. );
  23744. ngDevMode && assertNotEqual(newDef, oldDef, "Expected different component definition");
  23745. const zone = lView[INJECTOR].get(NgZone, null);
  23746. const recreate = () => {
  23747. if (oldDef.encapsulation === ViewEncapsulation.ShadowDom) {
  23748. const newHost = host.cloneNode(false);
  23749. host.replaceWith(newHost);
  23750. host = newHost;
  23751. }
  23752. const newTView = getOrCreateComponentTView(newDef);
  23753. const newLView = createLView(
  23754. parentLView,
  23755. newTView,
  23756. instance,
  23757. getInitialLViewFlagsFromDef(newDef),
  23758. host,
  23759. tNode,
  23760. null,
  23761. null,
  23762. // The renderer will be created a bit further down once the old one is destroyed.
  23763. null,
  23764. null,
  23765. null
  23766. );
  23767. replaceLViewInTree(parentLView, lView, newLView, tNode.index);
  23768. destroyLView(lView[TVIEW], lView);
  23769. const rendererFactory = lView[ENVIRONMENT].rendererFactory;
  23770. clearRendererCache(rendererFactory, oldDef);
  23771. newLView[RENDERER] = rendererFactory.createRenderer(host, newDef);
  23772. removeViewFromDOM(lView[TVIEW], lView);
  23773. resetProjectionState(tNode);
  23774. renderView(newTView, newLView, instance);
  23775. refreshView(newTView, newLView, newTView.template, instance);
  23776. };
  23777. if (zone === null) {
  23778. executeWithInvalidateFallback(importMeta, id, recreate);
  23779. } else {
  23780. zone.run(() => executeWithInvalidateFallback(importMeta, id, recreate));
  23781. }
  23782. }
  23783. function executeWithInvalidateFallback(importMeta, id, callback) {
  23784. try {
  23785. callback();
  23786. } catch (e) {
  23787. const error = e;
  23788. if (id !== null && error.message) {
  23789. const toLog = error.message + (error.stack ? "\n" + error.stack : "");
  23790. importMeta?.hot?.send?.("angular:invalidate", {
  23791. id,
  23792. message: toLog,
  23793. error: true
  23794. });
  23795. }
  23796. throw e;
  23797. }
  23798. }
  23799. function replaceLViewInTree(parentLView, oldLView, newLView, index) {
  23800. for (let i = HEADER_OFFSET; i < parentLView[TVIEW].bindingStartIndex; i++) {
  23801. const current = parentLView[i];
  23802. if ((isLView(current) || isLContainer(current)) && current[NEXT] === oldLView) {
  23803. current[NEXT] = newLView;
  23804. break;
  23805. }
  23806. }
  23807. if (parentLView[CHILD_HEAD] === oldLView) {
  23808. parentLView[CHILD_HEAD] = newLView;
  23809. }
  23810. if (parentLView[CHILD_TAIL] === oldLView) {
  23811. parentLView[CHILD_TAIL] = newLView;
  23812. }
  23813. newLView[NEXT] = oldLView[NEXT];
  23814. oldLView[NEXT] = null;
  23815. parentLView[index] = newLView;
  23816. }
  23817. function resetProjectionState(tNode) {
  23818. if (tNode.projection !== null) {
  23819. for (const current of tNode.projection) {
  23820. if (isTNodeShape(current)) {
  23821. current.projectionNext = null;
  23822. current.flags &= -3;
  23823. }
  23824. }
  23825. tNode.projection = null;
  23826. }
  23827. }
  23828. var angularCoreEnv = /* @__PURE__ */ (() => ({
  23829. "ɵɵattribute": ɵɵattribute,
  23830. "ɵɵattributeInterpolate1": ɵɵattributeInterpolate1,
  23831. "ɵɵattributeInterpolate2": ɵɵattributeInterpolate2,
  23832. "ɵɵattributeInterpolate3": ɵɵattributeInterpolate3,
  23833. "ɵɵattributeInterpolate4": ɵɵattributeInterpolate4,
  23834. "ɵɵattributeInterpolate5": ɵɵattributeInterpolate5,
  23835. "ɵɵattributeInterpolate6": ɵɵattributeInterpolate6,
  23836. "ɵɵattributeInterpolate7": ɵɵattributeInterpolate7,
  23837. "ɵɵattributeInterpolate8": ɵɵattributeInterpolate8,
  23838. "ɵɵattributeInterpolateV": ɵɵattributeInterpolateV,
  23839. "ɵɵdefineComponent": ɵɵdefineComponent,
  23840. "ɵɵdefineDirective": ɵɵdefineDirective,
  23841. "ɵɵdefineInjectable": ɵɵdefineInjectable,
  23842. "ɵɵdefineInjector": ɵɵdefineInjector,
  23843. "ɵɵdefineNgModule": ɵɵdefineNgModule,
  23844. "ɵɵdefinePipe": ɵɵdefinePipe,
  23845. "ɵɵdirectiveInject": ɵɵdirectiveInject,
  23846. "ɵɵgetInheritedFactory": ɵɵgetInheritedFactory,
  23847. "ɵɵinject": ɵɵinject,
  23848. "ɵɵinjectAttribute": ɵɵinjectAttribute,
  23849. "ɵɵinvalidFactory": ɵɵinvalidFactory,
  23850. "ɵɵinvalidFactoryDep": ɵɵinvalidFactoryDep,
  23851. "ɵɵtemplateRefExtractor": ɵɵtemplateRefExtractor,
  23852. "ɵɵresetView": ɵɵresetView,
  23853. "ɵɵHostDirectivesFeature": ɵɵHostDirectivesFeature,
  23854. "ɵɵNgOnChangesFeature": ɵɵNgOnChangesFeature,
  23855. "ɵɵProvidersFeature": ɵɵProvidersFeature,
  23856. "ɵɵCopyDefinitionFeature": ɵɵCopyDefinitionFeature,
  23857. "ɵɵInheritDefinitionFeature": ɵɵInheritDefinitionFeature,
  23858. "ɵɵExternalStylesFeature": ɵɵExternalStylesFeature,
  23859. "ɵɵnextContext": ɵɵnextContext,
  23860. "ɵɵnamespaceHTML": ɵɵnamespaceHTML,
  23861. "ɵɵnamespaceMathML": ɵɵnamespaceMathML,
  23862. "ɵɵnamespaceSVG": ɵɵnamespaceSVG,
  23863. "ɵɵenableBindings": ɵɵenableBindings,
  23864. "ɵɵdisableBindings": ɵɵdisableBindings,
  23865. "ɵɵelementStart": ɵɵelementStart,
  23866. "ɵɵelementEnd": ɵɵelementEnd,
  23867. "ɵɵelement": ɵɵelement,
  23868. "ɵɵelementContainerStart": ɵɵelementContainerStart,
  23869. "ɵɵelementContainerEnd": ɵɵelementContainerEnd,
  23870. "ɵɵelementContainer": ɵɵelementContainer,
  23871. "ɵɵpureFunction0": ɵɵpureFunction0,
  23872. "ɵɵpureFunction1": ɵɵpureFunction1,
  23873. "ɵɵpureFunction2": ɵɵpureFunction2,
  23874. "ɵɵpureFunction3": ɵɵpureFunction3,
  23875. "ɵɵpureFunction4": ɵɵpureFunction4,
  23876. "ɵɵpureFunction5": ɵɵpureFunction5,
  23877. "ɵɵpureFunction6": ɵɵpureFunction6,
  23878. "ɵɵpureFunction7": ɵɵpureFunction7,
  23879. "ɵɵpureFunction8": ɵɵpureFunction8,
  23880. "ɵɵpureFunctionV": ɵɵpureFunctionV,
  23881. "ɵɵgetCurrentView": ɵɵgetCurrentView,
  23882. "ɵɵrestoreView": ɵɵrestoreView,
  23883. "ɵɵlistener": ɵɵlistener,
  23884. "ɵɵprojection": ɵɵprojection,
  23885. "ɵɵsyntheticHostProperty": ɵɵsyntheticHostProperty,
  23886. "ɵɵsyntheticHostListener": ɵɵsyntheticHostListener,
  23887. "ɵɵpipeBind1": ɵɵpipeBind1,
  23888. "ɵɵpipeBind2": ɵɵpipeBind2,
  23889. "ɵɵpipeBind3": ɵɵpipeBind3,
  23890. "ɵɵpipeBind4": ɵɵpipeBind4,
  23891. "ɵɵpipeBindV": ɵɵpipeBindV,
  23892. "ɵɵprojectionDef": ɵɵprojectionDef,
  23893. "ɵɵhostProperty": ɵɵhostProperty,
  23894. "ɵɵproperty": ɵɵproperty,
  23895. "ɵɵpropertyInterpolate": ɵɵpropertyInterpolate,
  23896. "ɵɵpropertyInterpolate1": ɵɵpropertyInterpolate1,
  23897. "ɵɵpropertyInterpolate2": ɵɵpropertyInterpolate2,
  23898. "ɵɵpropertyInterpolate3": ɵɵpropertyInterpolate3,
  23899. "ɵɵpropertyInterpolate4": ɵɵpropertyInterpolate4,
  23900. "ɵɵpropertyInterpolate5": ɵɵpropertyInterpolate5,
  23901. "ɵɵpropertyInterpolate6": ɵɵpropertyInterpolate6,
  23902. "ɵɵpropertyInterpolate7": ɵɵpropertyInterpolate7,
  23903. "ɵɵpropertyInterpolate8": ɵɵpropertyInterpolate8,
  23904. "ɵɵpropertyInterpolateV": ɵɵpropertyInterpolateV,
  23905. "ɵɵpipe": ɵɵpipe,
  23906. "ɵɵqueryRefresh": ɵɵqueryRefresh,
  23907. "ɵɵqueryAdvance": ɵɵqueryAdvance,
  23908. "ɵɵviewQuery": ɵɵviewQuery,
  23909. "ɵɵviewQuerySignal": ɵɵviewQuerySignal,
  23910. "ɵɵloadQuery": ɵɵloadQuery,
  23911. "ɵɵcontentQuery": ɵɵcontentQuery,
  23912. "ɵɵcontentQuerySignal": ɵɵcontentQuerySignal,
  23913. "ɵɵreference": ɵɵreference,
  23914. "ɵɵclassMap": ɵɵclassMap,
  23915. "ɵɵclassMapInterpolate1": ɵɵclassMapInterpolate1,
  23916. "ɵɵclassMapInterpolate2": ɵɵclassMapInterpolate2,
  23917. "ɵɵclassMapInterpolate3": ɵɵclassMapInterpolate3,
  23918. "ɵɵclassMapInterpolate4": ɵɵclassMapInterpolate4,
  23919. "ɵɵclassMapInterpolate5": ɵɵclassMapInterpolate5,
  23920. "ɵɵclassMapInterpolate6": ɵɵclassMapInterpolate6,
  23921. "ɵɵclassMapInterpolate7": ɵɵclassMapInterpolate7,
  23922. "ɵɵclassMapInterpolate8": ɵɵclassMapInterpolate8,
  23923. "ɵɵclassMapInterpolateV": ɵɵclassMapInterpolateV,
  23924. "ɵɵstyleMap": ɵɵstyleMap,
  23925. "ɵɵstyleMapInterpolate1": ɵɵstyleMapInterpolate1,
  23926. "ɵɵstyleMapInterpolate2": ɵɵstyleMapInterpolate2,
  23927. "ɵɵstyleMapInterpolate3": ɵɵstyleMapInterpolate3,
  23928. "ɵɵstyleMapInterpolate4": ɵɵstyleMapInterpolate4,
  23929. "ɵɵstyleMapInterpolate5": ɵɵstyleMapInterpolate5,
  23930. "ɵɵstyleMapInterpolate6": ɵɵstyleMapInterpolate6,
  23931. "ɵɵstyleMapInterpolate7": ɵɵstyleMapInterpolate7,
  23932. "ɵɵstyleMapInterpolate8": ɵɵstyleMapInterpolate8,
  23933. "ɵɵstyleMapInterpolateV": ɵɵstyleMapInterpolateV,
  23934. "ɵɵstyleProp": ɵɵstyleProp,
  23935. "ɵɵstylePropInterpolate1": ɵɵstylePropInterpolate1,
  23936. "ɵɵstylePropInterpolate2": ɵɵstylePropInterpolate2,
  23937. "ɵɵstylePropInterpolate3": ɵɵstylePropInterpolate3,
  23938. "ɵɵstylePropInterpolate4": ɵɵstylePropInterpolate4,
  23939. "ɵɵstylePropInterpolate5": ɵɵstylePropInterpolate5,
  23940. "ɵɵstylePropInterpolate6": ɵɵstylePropInterpolate6,
  23941. "ɵɵstylePropInterpolate7": ɵɵstylePropInterpolate7,
  23942. "ɵɵstylePropInterpolate8": ɵɵstylePropInterpolate8,
  23943. "ɵɵstylePropInterpolateV": ɵɵstylePropInterpolateV,
  23944. "ɵɵclassProp": ɵɵclassProp,
  23945. "ɵɵadvance": ɵɵadvance,
  23946. "ɵɵtemplate": ɵɵtemplate,
  23947. "ɵɵconditional": ɵɵconditional,
  23948. "ɵɵdefer": ɵɵdefer,
  23949. "ɵɵdeferWhen": ɵɵdeferWhen,
  23950. "ɵɵdeferOnIdle": ɵɵdeferOnIdle,
  23951. "ɵɵdeferOnImmediate": ɵɵdeferOnImmediate,
  23952. "ɵɵdeferOnTimer": ɵɵdeferOnTimer,
  23953. "ɵɵdeferOnHover": ɵɵdeferOnHover,
  23954. "ɵɵdeferOnInteraction": ɵɵdeferOnInteraction,
  23955. "ɵɵdeferOnViewport": ɵɵdeferOnViewport,
  23956. "ɵɵdeferPrefetchWhen": ɵɵdeferPrefetchWhen,
  23957. "ɵɵdeferPrefetchOnIdle": ɵɵdeferPrefetchOnIdle,
  23958. "ɵɵdeferPrefetchOnImmediate": ɵɵdeferPrefetchOnImmediate,
  23959. "ɵɵdeferPrefetchOnTimer": ɵɵdeferPrefetchOnTimer,
  23960. "ɵɵdeferPrefetchOnHover": ɵɵdeferPrefetchOnHover,
  23961. "ɵɵdeferPrefetchOnInteraction": ɵɵdeferPrefetchOnInteraction,
  23962. "ɵɵdeferPrefetchOnViewport": ɵɵdeferPrefetchOnViewport,
  23963. "ɵɵdeferHydrateWhen": ɵɵdeferHydrateWhen,
  23964. "ɵɵdeferHydrateNever": ɵɵdeferHydrateNever,
  23965. "ɵɵdeferHydrateOnIdle": ɵɵdeferHydrateOnIdle,
  23966. "ɵɵdeferHydrateOnImmediate": ɵɵdeferHydrateOnImmediate,
  23967. "ɵɵdeferHydrateOnTimer": ɵɵdeferHydrateOnTimer,
  23968. "ɵɵdeferHydrateOnHover": ɵɵdeferHydrateOnHover,
  23969. "ɵɵdeferHydrateOnInteraction": ɵɵdeferHydrateOnInteraction,
  23970. "ɵɵdeferHydrateOnViewport": ɵɵdeferHydrateOnViewport,
  23971. "ɵɵdeferEnableTimerScheduling": ɵɵdeferEnableTimerScheduling,
  23972. "ɵɵrepeater": ɵɵrepeater,
  23973. "ɵɵrepeaterCreate": ɵɵrepeaterCreate,
  23974. "ɵɵrepeaterTrackByIndex": ɵɵrepeaterTrackByIndex,
  23975. "ɵɵrepeaterTrackByIdentity": ɵɵrepeaterTrackByIdentity,
  23976. "ɵɵcomponentInstance": ɵɵcomponentInstance,
  23977. "ɵɵtext": ɵɵtext,
  23978. "ɵɵtextInterpolate": ɵɵtextInterpolate,
  23979. "ɵɵtextInterpolate1": ɵɵtextInterpolate1,
  23980. "ɵɵtextInterpolate2": ɵɵtextInterpolate2,
  23981. "ɵɵtextInterpolate3": ɵɵtextInterpolate3,
  23982. "ɵɵtextInterpolate4": ɵɵtextInterpolate4,
  23983. "ɵɵtextInterpolate5": ɵɵtextInterpolate5,
  23984. "ɵɵtextInterpolate6": ɵɵtextInterpolate6,
  23985. "ɵɵtextInterpolate7": ɵɵtextInterpolate7,
  23986. "ɵɵtextInterpolate8": ɵɵtextInterpolate8,
  23987. "ɵɵtextInterpolateV": ɵɵtextInterpolateV,
  23988. "ɵɵi18n": ɵɵi18n,
  23989. "ɵɵi18nAttributes": ɵɵi18nAttributes,
  23990. "ɵɵi18nExp": ɵɵi18nExp,
  23991. "ɵɵi18nStart": ɵɵi18nStart,
  23992. "ɵɵi18nEnd": ɵɵi18nEnd,
  23993. "ɵɵi18nApply": ɵɵi18nApply,
  23994. "ɵɵi18nPostprocess": ɵɵi18nPostprocess,
  23995. "ɵɵresolveWindow": ɵɵresolveWindow,
  23996. "ɵɵresolveDocument": ɵɵresolveDocument,
  23997. "ɵɵresolveBody": ɵɵresolveBody,
  23998. "ɵɵsetComponentScope": ɵɵsetComponentScope,
  23999. "ɵɵsetNgModuleScope": ɵɵsetNgModuleScope,
  24000. "ɵɵregisterNgModuleType": registerNgModuleType,
  24001. "ɵɵgetComponentDepsFactory": ɵɵgetComponentDepsFactory,
  24002. "ɵsetClassDebugInfo": ɵsetClassDebugInfo,
  24003. "ɵɵdeclareLet": ɵɵdeclareLet,
  24004. "ɵɵstoreLet": ɵɵstoreLet,
  24005. "ɵɵreadContextLet": ɵɵreadContextLet,
  24006. "ɵɵattachSourceLocations": ɵɵattachSourceLocations,
  24007. "ɵɵsanitizeHtml": ɵɵsanitizeHtml,
  24008. "ɵɵsanitizeStyle": ɵɵsanitizeStyle,
  24009. "ɵɵsanitizeResourceUrl": ɵɵsanitizeResourceUrl,
  24010. "ɵɵsanitizeScript": ɵɵsanitizeScript,
  24011. "ɵɵsanitizeUrl": ɵɵsanitizeUrl,
  24012. "ɵɵsanitizeUrlOrResourceUrl": ɵɵsanitizeUrlOrResourceUrl,
  24013. "ɵɵtrustConstantHtml": ɵɵtrustConstantHtml,
  24014. "ɵɵtrustConstantResourceUrl": ɵɵtrustConstantResourceUrl,
  24015. "ɵɵvalidateIframeAttribute": ɵɵvalidateIframeAttribute,
  24016. "forwardRef": forwardRef,
  24017. "resolveForwardRef": resolveForwardRef,
  24018. "ɵɵtwoWayProperty": ɵɵtwoWayProperty,
  24019. "ɵɵtwoWayBindingSet": ɵɵtwoWayBindingSet,
  24020. "ɵɵtwoWayListener": ɵɵtwoWayListener,
  24021. "ɵɵreplaceMetadata": ɵɵreplaceMetadata
  24022. }))();
  24023. var jitOptions = null;
  24024. function setJitOptions(options) {
  24025. if (jitOptions !== null) {
  24026. if (options.defaultEncapsulation !== jitOptions.defaultEncapsulation) {
  24027. ngDevMode && console.error("Provided value for `defaultEncapsulation` can not be changed once it has been set.");
  24028. return;
  24029. }
  24030. if (options.preserveWhitespaces !== jitOptions.preserveWhitespaces) {
  24031. ngDevMode && console.error("Provided value for `preserveWhitespaces` can not be changed once it has been set.");
  24032. return;
  24033. }
  24034. }
  24035. jitOptions = options;
  24036. }
  24037. function getJitOptions() {
  24038. return jitOptions;
  24039. }
  24040. function resetJitOptions() {
  24041. jitOptions = null;
  24042. }
  24043. var moduleQueue = [];
  24044. function enqueueModuleForDelayedScoping(moduleType, ngModule) {
  24045. moduleQueue.push({
  24046. moduleType,
  24047. ngModule
  24048. });
  24049. }
  24050. var flushingModuleQueue = false;
  24051. function flushModuleScopingQueueAsMuchAsPossible() {
  24052. if (!flushingModuleQueue) {
  24053. flushingModuleQueue = true;
  24054. try {
  24055. for (let i = moduleQueue.length - 1; i >= 0; i--) {
  24056. const {
  24057. moduleType,
  24058. ngModule
  24059. } = moduleQueue[i];
  24060. if (ngModule.declarations && ngModule.declarations.every(isResolvedDeclaration)) {
  24061. moduleQueue.splice(i, 1);
  24062. setScopeOnDeclaredComponents(moduleType, ngModule);
  24063. }
  24064. }
  24065. } finally {
  24066. flushingModuleQueue = false;
  24067. }
  24068. }
  24069. }
  24070. function isResolvedDeclaration(declaration) {
  24071. if (Array.isArray(declaration)) {
  24072. return declaration.every(isResolvedDeclaration);
  24073. }
  24074. return !!resolveForwardRef(declaration);
  24075. }
  24076. function compileNgModule(moduleType, ngModule = {}) {
  24077. compileNgModuleDefs(moduleType, ngModule);
  24078. if (ngModule.id !== void 0) {
  24079. registerNgModuleType(moduleType, ngModule.id);
  24080. }
  24081. enqueueModuleForDelayedScoping(moduleType, ngModule);
  24082. }
  24083. function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInRoot = false) {
  24084. ngDevMode && assertDefined(moduleType, "Required value moduleType");
  24085. ngDevMode && assertDefined(ngModule, "Required value ngModule");
  24086. const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
  24087. let ngModuleDef = null;
  24088. Object.defineProperty(moduleType, NG_MOD_DEF, {
  24089. configurable: true,
  24090. get: () => {
  24091. if (ngModuleDef === null) {
  24092. if (ngDevMode && ngModule.imports && ngModule.imports.indexOf(moduleType) > -1) {
  24093. throw new Error(`'${stringifyForError(moduleType)}' module can't import itself`);
  24094. }
  24095. const compiler = getCompilerFacade({
  24096. usage: 0,
  24097. kind: "NgModule",
  24098. type: moduleType
  24099. });
  24100. ngModuleDef = compiler.compileNgModule(angularCoreEnv, `ng:///${moduleType.name}/ɵmod.js`, {
  24101. type: moduleType,
  24102. bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY).map(resolveForwardRef),
  24103. declarations: declarations.map(resolveForwardRef),
  24104. imports: flatten(ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef).map(expandModuleWithProviders),
  24105. exports: flatten(ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef).map(expandModuleWithProviders),
  24106. schemas: ngModule.schemas ? flatten(ngModule.schemas) : null,
  24107. id: ngModule.id || null
  24108. });
  24109. if (!ngModuleDef.schemas) {
  24110. ngModuleDef.schemas = [];
  24111. }
  24112. }
  24113. return ngModuleDef;
  24114. }
  24115. });
  24116. let ngFactoryDef = null;
  24117. Object.defineProperty(moduleType, NG_FACTORY_DEF, {
  24118. get: () => {
  24119. if (ngFactoryDef === null) {
  24120. const compiler = getCompilerFacade({
  24121. usage: 0,
  24122. kind: "NgModule",
  24123. type: moduleType
  24124. });
  24125. ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${moduleType.name}/ɵfac.js`, {
  24126. name: moduleType.name,
  24127. type: moduleType,
  24128. deps: reflectDependencies(moduleType),
  24129. target: compiler.FactoryTarget.NgModule,
  24130. typeArgumentCount: 0
  24131. });
  24132. }
  24133. return ngFactoryDef;
  24134. },
  24135. // Make the property configurable in dev mode to allow overriding in tests
  24136. configurable: !!ngDevMode
  24137. });
  24138. let ngInjectorDef = null;
  24139. Object.defineProperty(moduleType, NG_INJ_DEF, {
  24140. get: () => {
  24141. if (ngInjectorDef === null) {
  24142. ngDevMode && verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
  24143. const meta = {
  24144. name: moduleType.name,
  24145. type: moduleType,
  24146. providers: ngModule.providers || EMPTY_ARRAY,
  24147. imports: [(ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef), (ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef)]
  24148. };
  24149. const compiler = getCompilerFacade({
  24150. usage: 0,
  24151. kind: "NgModule",
  24152. type: moduleType
  24153. });
  24154. ngInjectorDef = compiler.compileInjector(angularCoreEnv, `ng:///${moduleType.name}/ɵinj.js`, meta);
  24155. }
  24156. return ngInjectorDef;
  24157. },
  24158. // Make the property configurable in dev mode to allow overriding in tests
  24159. configurable: !!ngDevMode
  24160. });
  24161. }
  24162. function generateStandaloneInDeclarationsError(type, location2) {
  24163. const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
  24164. const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?`;
  24165. return `${prefix} ${location2}, ${suffix}`;
  24166. }
  24167. function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
  24168. if (verifiedNgModule.get(moduleType)) return;
  24169. if (isStandalone(moduleType)) return;
  24170. verifiedNgModule.set(moduleType, true);
  24171. moduleType = resolveForwardRef(moduleType);
  24172. let ngModuleDef;
  24173. if (importingModule) {
  24174. ngModuleDef = getNgModuleDef(moduleType);
  24175. if (!ngModuleDef) {
  24176. throw new Error(`Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
  24177. }
  24178. } else {
  24179. ngModuleDef = getNgModuleDef(moduleType, true);
  24180. }
  24181. const errors = [];
  24182. const declarations = maybeUnwrapFn(ngModuleDef.declarations);
  24183. const imports = maybeUnwrapFn(ngModuleDef.imports);
  24184. flatten(imports).map(unwrapModuleWithProvidersImports).forEach((modOrStandaloneCmpt) => {
  24185. verifySemanticsOfNgModuleImport(modOrStandaloneCmpt, moduleType);
  24186. verifySemanticsOfNgModuleDef(modOrStandaloneCmpt, false, moduleType);
  24187. });
  24188. const exports = maybeUnwrapFn(ngModuleDef.exports);
  24189. declarations.forEach(verifyDeclarationsHaveDefinitions);
  24190. declarations.forEach(verifyDirectivesHaveSelector);
  24191. declarations.forEach((declarationType) => verifyNotStandalone(declarationType, moduleType));
  24192. const combinedDeclarations = [...declarations.map(resolveForwardRef), ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef)];
  24193. exports.forEach(verifyExportsAreDeclaredOrReExported);
  24194. declarations.forEach((decl) => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
  24195. const ngModule = getAnnotation(moduleType, "NgModule");
  24196. if (ngModule) {
  24197. ngModule.imports && flatten(ngModule.imports).map(unwrapModuleWithProvidersImports).forEach((mod) => {
  24198. verifySemanticsOfNgModuleImport(mod, moduleType);
  24199. verifySemanticsOfNgModuleDef(mod, false, moduleType);
  24200. });
  24201. ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyCorrectBootstrapType);
  24202. ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyComponentIsPartOfNgModule);
  24203. }
  24204. if (errors.length) {
  24205. throw new Error(errors.join("\n"));
  24206. }
  24207. function verifyDeclarationsHaveDefinitions(type) {
  24208. type = resolveForwardRef(type);
  24209. const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
  24210. if (!def) {
  24211. errors.push(`Unexpected value '${stringifyForError(type)}' declared by the module '${stringifyForError(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
  24212. }
  24213. }
  24214. function verifyDirectivesHaveSelector(type) {
  24215. type = resolveForwardRef(type);
  24216. const def = getDirectiveDef(type);
  24217. if (!getComponentDef(type) && def && def.selectors.length == 0) {
  24218. errors.push(`Directive ${stringifyForError(type)} has no selector, please add it!`);
  24219. }
  24220. }
  24221. function verifyNotStandalone(type, moduleType2) {
  24222. type = resolveForwardRef(type);
  24223. const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
  24224. if (def?.standalone) {
  24225. const location2 = `"${stringifyForError(moduleType2)}" NgModule`;
  24226. errors.push(generateStandaloneInDeclarationsError(type, location2));
  24227. }
  24228. }
  24229. function verifyExportsAreDeclaredOrReExported(type) {
  24230. type = resolveForwardRef(type);
  24231. const kind = getComponentDef(type) && "component" || getDirectiveDef(type) && "directive" || getPipeDef$1(type) && "pipe";
  24232. if (kind) {
  24233. if (combinedDeclarations.lastIndexOf(type) === -1) {
  24234. errors.push(`Can't export ${kind} ${stringifyForError(type)} from ${stringifyForError(moduleType)} as it was neither declared nor imported!`);
  24235. }
  24236. }
  24237. }
  24238. function verifyDeclarationIsUnique(type, suppressErrors) {
  24239. type = resolveForwardRef(type);
  24240. const existingModule = ownerNgModule.get(type);
  24241. if (existingModule && existingModule !== moduleType) {
  24242. if (!suppressErrors) {
  24243. const modules2 = [existingModule, moduleType].map(stringifyForError).sort();
  24244. errors.push(`Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${modules2[0]} and ${modules2[1]}! Please consider moving ${stringifyForError(type)} to a higher module that imports ${modules2[0]} and ${modules2[1]}. You can also create a new NgModule that exports and includes ${stringifyForError(type)} then import that NgModule in ${modules2[0]} and ${modules2[1]}.`);
  24245. }
  24246. } else {
  24247. ownerNgModule.set(type, moduleType);
  24248. }
  24249. }
  24250. function verifyComponentIsPartOfNgModule(type) {
  24251. type = resolveForwardRef(type);
  24252. const existingModule = ownerNgModule.get(type);
  24253. if (!existingModule && !isStandalone(type)) {
  24254. errors.push(`Component ${stringifyForError(type)} is not part of any NgModule or the module has not been imported into your module.`);
  24255. }
  24256. }
  24257. function verifyCorrectBootstrapType(type) {
  24258. type = resolveForwardRef(type);
  24259. if (!getComponentDef(type)) {
  24260. errors.push(`${stringifyForError(type)} cannot be used as an entry component.`);
  24261. }
  24262. if (isStandalone(type)) {
  24263. errors.push(`The \`${stringifyForError(type)}\` class is a standalone component, which can not be used in the \`@NgModule.bootstrap\` array. Use the \`bootstrapApplication\` function for bootstrap instead.`);
  24264. }
  24265. }
  24266. function verifySemanticsOfNgModuleImport(type, importingModule2) {
  24267. type = resolveForwardRef(type);
  24268. const directiveDef = getComponentDef(type) || getDirectiveDef(type);
  24269. if (directiveDef !== null && !directiveDef.standalone) {
  24270. throw new Error(`Unexpected directive '${type.name}' imported by the module '${importingModule2.name}'. Please add an @NgModule annotation.`);
  24271. }
  24272. const pipeDef = getPipeDef$1(type);
  24273. if (pipeDef !== null && !pipeDef.standalone) {
  24274. throw new Error(`Unexpected pipe '${type.name}' imported by the module '${importingModule2.name}'. Please add an @NgModule annotation.`);
  24275. }
  24276. }
  24277. }
  24278. function unwrapModuleWithProvidersImports(typeOrWithProviders) {
  24279. typeOrWithProviders = resolveForwardRef(typeOrWithProviders);
  24280. return typeOrWithProviders.ngModule || typeOrWithProviders;
  24281. }
  24282. function getAnnotation(type, name) {
  24283. let annotation = null;
  24284. collect(type.__annotations__);
  24285. collect(type.decorators);
  24286. return annotation;
  24287. function collect(annotations) {
  24288. if (annotations) {
  24289. annotations.forEach(readAnnotation);
  24290. }
  24291. }
  24292. function readAnnotation(decorator) {
  24293. if (!annotation) {
  24294. const proto = Object.getPrototypeOf(decorator);
  24295. if (proto.ngMetadataName == name) {
  24296. annotation = decorator;
  24297. } else if (decorator.type) {
  24298. const proto2 = Object.getPrototypeOf(decorator.type);
  24299. if (proto2.ngMetadataName == name) {
  24300. annotation = decorator.args[0];
  24301. }
  24302. }
  24303. }
  24304. }
  24305. }
  24306. var ownerNgModule = /* @__PURE__ */ new WeakMap();
  24307. var verifiedNgModule = /* @__PURE__ */ new WeakMap();
  24308. function resetCompiledComponents() {
  24309. ownerNgModule = /* @__PURE__ */ new WeakMap();
  24310. verifiedNgModule = /* @__PURE__ */ new WeakMap();
  24311. moduleQueue.length = 0;
  24312. GENERATED_COMP_IDS.clear();
  24313. }
  24314. function computeCombinedExports(type) {
  24315. type = resolveForwardRef(type);
  24316. const ngModuleDef = getNgModuleDef(type);
  24317. if (ngModuleDef === null) {
  24318. return [type];
  24319. }
  24320. return flatten(maybeUnwrapFn(ngModuleDef.exports).map((type2) => {
  24321. const ngModuleDef2 = getNgModuleDef(type2);
  24322. if (ngModuleDef2) {
  24323. verifySemanticsOfNgModuleDef(type2, false);
  24324. return computeCombinedExports(type2);
  24325. } else {
  24326. return type2;
  24327. }
  24328. }));
  24329. }
  24330. function setScopeOnDeclaredComponents(moduleType, ngModule) {
  24331. const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
  24332. const transitiveScopes = transitiveScopesFor(moduleType);
  24333. declarations.forEach((declaration) => {
  24334. declaration = resolveForwardRef(declaration);
  24335. if (declaration.hasOwnProperty(NG_COMP_DEF)) {
  24336. const component = declaration;
  24337. const componentDef = getComponentDef(component);
  24338. patchComponentDefWithScope(componentDef, transitiveScopes);
  24339. } else if (!declaration.hasOwnProperty(NG_DIR_DEF) && !declaration.hasOwnProperty(NG_PIPE_DEF)) {
  24340. declaration.ngSelectorScope = moduleType;
  24341. }
  24342. });
  24343. }
  24344. function patchComponentDefWithScope(componentDef, transitiveScopes) {
  24345. componentDef.directiveDefs = () => Array.from(transitiveScopes.compilation.directives).map((dir) => dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir) : getDirectiveDef(dir)).filter((def) => !!def);
  24346. componentDef.pipeDefs = () => Array.from(transitiveScopes.compilation.pipes).map((pipe2) => getPipeDef$1(pipe2));
  24347. componentDef.schemas = transitiveScopes.schemas;
  24348. componentDef.tView = null;
  24349. }
  24350. function transitiveScopesFor(type) {
  24351. if (isNgModule(type)) {
  24352. {
  24353. const scope = depsTracker.getNgModuleScope(type);
  24354. const def = getNgModuleDef(type, true);
  24355. return __spreadValues({
  24356. schemas: def.schemas || null
  24357. }, scope);
  24358. }
  24359. } else if (isStandalone(type)) {
  24360. const directiveDef = getComponentDef(type) || getDirectiveDef(type);
  24361. if (directiveDef !== null) {
  24362. return {
  24363. schemas: null,
  24364. compilation: {
  24365. directives: /* @__PURE__ */ new Set(),
  24366. pipes: /* @__PURE__ */ new Set()
  24367. },
  24368. exported: {
  24369. directives: /* @__PURE__ */ new Set([type]),
  24370. pipes: /* @__PURE__ */ new Set()
  24371. }
  24372. };
  24373. }
  24374. const pipeDef = getPipeDef$1(type);
  24375. if (pipeDef !== null) {
  24376. return {
  24377. schemas: null,
  24378. compilation: {
  24379. directives: /* @__PURE__ */ new Set(),
  24380. pipes: /* @__PURE__ */ new Set()
  24381. },
  24382. exported: {
  24383. directives: /* @__PURE__ */ new Set(),
  24384. pipes: /* @__PURE__ */ new Set([type])
  24385. }
  24386. };
  24387. }
  24388. }
  24389. throw new Error(`${type.name} does not have a module def (ɵmod property)`);
  24390. }
  24391. function expandModuleWithProviders(value) {
  24392. if (isModuleWithProviders(value)) {
  24393. return value.ngModule;
  24394. }
  24395. return value;
  24396. }
  24397. var compilationDepth = 0;
  24398. function compileComponent(type, metadata) {
  24399. (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode();
  24400. let ngComponentDef = null;
  24401. maybeQueueResolutionOfComponentResources(type, metadata);
  24402. addDirectiveFactoryDef(type, metadata);
  24403. Object.defineProperty(type, NG_COMP_DEF, {
  24404. get: () => {
  24405. if (ngComponentDef === null) {
  24406. const compiler = getCompilerFacade({
  24407. usage: 0,
  24408. kind: "component",
  24409. type
  24410. });
  24411. if (componentNeedsResolution(metadata)) {
  24412. const error = [`Component '${type.name}' is not resolved:`];
  24413. if (metadata.templateUrl) {
  24414. error.push(` - templateUrl: ${metadata.templateUrl}`);
  24415. }
  24416. if (metadata.styleUrls && metadata.styleUrls.length) {
  24417. error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
  24418. }
  24419. if (metadata.styleUrl) {
  24420. error.push(` - styleUrl: ${metadata.styleUrl}`);
  24421. }
  24422. error.push(`Did you run and wait for 'resolveComponentResources()'?`);
  24423. throw new Error(error.join("\n"));
  24424. }
  24425. const options = getJitOptions();
  24426. let preserveWhitespaces = metadata.preserveWhitespaces;
  24427. if (preserveWhitespaces === void 0) {
  24428. if (options !== null && options.preserveWhitespaces !== void 0) {
  24429. preserveWhitespaces = options.preserveWhitespaces;
  24430. } else {
  24431. preserveWhitespaces = false;
  24432. }
  24433. }
  24434. let encapsulation = metadata.encapsulation;
  24435. if (encapsulation === void 0) {
  24436. if (options !== null && options.defaultEncapsulation !== void 0) {
  24437. encapsulation = options.defaultEncapsulation;
  24438. } else {
  24439. encapsulation = ViewEncapsulation.Emulated;
  24440. }
  24441. }
  24442. const templateUrl = metadata.templateUrl || `ng:///${type.name}/template.html`;
  24443. const meta = __spreadProps(__spreadValues({}, directiveMetadata(type, metadata)), {
  24444. typeSourceSpan: compiler.createParseSourceSpan("Component", type.name, templateUrl),
  24445. template: metadata.template || "",
  24446. preserveWhitespaces,
  24447. styles: typeof metadata.styles === "string" ? [metadata.styles] : metadata.styles || EMPTY_ARRAY,
  24448. animations: metadata.animations,
  24449. // JIT components are always compiled against an empty set of `declarations`. Instead, the
  24450. // `directiveDefs` and `pipeDefs` are updated at a later point:
  24451. // * for NgModule-based components, they're set when the NgModule which declares the
  24452. // component resolves in the module scoping queue
  24453. // * for standalone components, they're set just below, after `compileComponent`.
  24454. declarations: [],
  24455. changeDetection: metadata.changeDetection,
  24456. encapsulation,
  24457. interpolation: metadata.interpolation,
  24458. viewProviders: metadata.viewProviders || null
  24459. });
  24460. compilationDepth++;
  24461. try {
  24462. if (meta.usesInheritance) {
  24463. addDirectiveDefToUndecoratedParents(type);
  24464. }
  24465. ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
  24466. if (meta.isStandalone) {
  24467. const imports = flatten(metadata.imports || EMPTY_ARRAY);
  24468. const {
  24469. directiveDefs,
  24470. pipeDefs
  24471. } = getStandaloneDefFunctions(type, imports);
  24472. ngComponentDef.directiveDefs = directiveDefs;
  24473. ngComponentDef.pipeDefs = pipeDefs;
  24474. ngComponentDef.dependencies = () => imports.map(resolveForwardRef);
  24475. }
  24476. } finally {
  24477. compilationDepth--;
  24478. }
  24479. if (compilationDepth === 0) {
  24480. flushModuleScopingQueueAsMuchAsPossible();
  24481. }
  24482. if (hasSelectorScope(type)) {
  24483. const scopes = transitiveScopesFor(type.ngSelectorScope);
  24484. patchComponentDefWithScope(ngComponentDef, scopes);
  24485. }
  24486. if (metadata.schemas) {
  24487. if (meta.isStandalone) {
  24488. ngComponentDef.schemas = metadata.schemas;
  24489. } else {
  24490. throw new Error(`The 'schemas' was specified for the ${stringifyForError(type)} but is only valid on a component that is standalone.`);
  24491. }
  24492. } else if (meta.isStandalone) {
  24493. ngComponentDef.schemas = [];
  24494. }
  24495. }
  24496. return ngComponentDef;
  24497. },
  24498. set: (def) => {
  24499. ngComponentDef = def;
  24500. },
  24501. // Make the property configurable in dev mode to allow overriding in tests
  24502. configurable: !!ngDevMode
  24503. });
  24504. }
  24505. function getStandaloneDefFunctions(type, imports) {
  24506. const directiveDefs = () => {
  24507. {
  24508. if (ngDevMode) {
  24509. for (const rawDep of imports) {
  24510. verifyStandaloneImport(rawDep, type);
  24511. }
  24512. }
  24513. if (!isComponent(type)) {
  24514. return [];
  24515. }
  24516. const scope = depsTracker.getStandaloneComponentScope(type, imports);
  24517. return [...scope.compilation.directives].map((p) => getComponentDef(p) || getDirectiveDef(p)).filter((d) => d !== null);
  24518. }
  24519. };
  24520. const pipeDefs = () => {
  24521. {
  24522. if (ngDevMode) {
  24523. for (const rawDep of imports) {
  24524. verifyStandaloneImport(rawDep, type);
  24525. }
  24526. }
  24527. if (!isComponent(type)) {
  24528. return [];
  24529. }
  24530. const scope = depsTracker.getStandaloneComponentScope(type, imports);
  24531. return [...scope.compilation.pipes].map((p) => getPipeDef$1(p)).filter((d) => d !== null);
  24532. }
  24533. };
  24534. return {
  24535. directiveDefs,
  24536. pipeDefs
  24537. };
  24538. }
  24539. function hasSelectorScope(component) {
  24540. return component.ngSelectorScope !== void 0;
  24541. }
  24542. function compileDirective(type, directive) {
  24543. let ngDirectiveDef = null;
  24544. addDirectiveFactoryDef(type, directive || {});
  24545. Object.defineProperty(type, NG_DIR_DEF, {
  24546. get: () => {
  24547. if (ngDirectiveDef === null) {
  24548. const meta = getDirectiveMetadata(type, directive || {});
  24549. const compiler = getCompilerFacade({
  24550. usage: 0,
  24551. kind: "directive",
  24552. type
  24553. });
  24554. ngDirectiveDef = compiler.compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
  24555. }
  24556. return ngDirectiveDef;
  24557. },
  24558. // Make the property configurable in dev mode to allow overriding in tests
  24559. configurable: !!ngDevMode
  24560. });
  24561. }
  24562. function getDirectiveMetadata(type, metadata) {
  24563. const name = type && type.name;
  24564. const sourceMapUrl = `ng:///${name}/ɵdir.js`;
  24565. const compiler = getCompilerFacade({
  24566. usage: 0,
  24567. kind: "directive",
  24568. type
  24569. });
  24570. const facade = directiveMetadata(type, metadata);
  24571. facade.typeSourceSpan = compiler.createParseSourceSpan("Directive", name, sourceMapUrl);
  24572. if (facade.usesInheritance) {
  24573. addDirectiveDefToUndecoratedParents(type);
  24574. }
  24575. return {
  24576. metadata: facade,
  24577. sourceMapUrl
  24578. };
  24579. }
  24580. function addDirectiveFactoryDef(type, metadata) {
  24581. let ngFactoryDef = null;
  24582. Object.defineProperty(type, NG_FACTORY_DEF, {
  24583. get: () => {
  24584. if (ngFactoryDef === null) {
  24585. const meta = getDirectiveMetadata(type, metadata);
  24586. const compiler = getCompilerFacade({
  24587. usage: 0,
  24588. kind: "directive",
  24589. type
  24590. });
  24591. ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${type.name}/ɵfac.js`, {
  24592. name: meta.metadata.name,
  24593. type: meta.metadata.type,
  24594. typeArgumentCount: 0,
  24595. deps: reflectDependencies(type),
  24596. target: compiler.FactoryTarget.Directive
  24597. });
  24598. }
  24599. return ngFactoryDef;
  24600. },
  24601. // Make the property configurable in dev mode to allow overriding in tests
  24602. configurable: !!ngDevMode
  24603. });
  24604. }
  24605. function extendsDirectlyFromObject(type) {
  24606. return Object.getPrototypeOf(type.prototype) === Object.prototype;
  24607. }
  24608. function directiveMetadata(type, metadata) {
  24609. const reflect = getReflect();
  24610. const propMetadata = reflect.ownPropMetadata(type);
  24611. return {
  24612. name: type.name,
  24613. type,
  24614. selector: metadata.selector !== void 0 ? metadata.selector : null,
  24615. host: metadata.host || EMPTY_OBJ,
  24616. propMetadata,
  24617. inputs: metadata.inputs || EMPTY_ARRAY,
  24618. outputs: metadata.outputs || EMPTY_ARRAY,
  24619. queries: extractQueriesMetadata(type, propMetadata, isContentQuery),
  24620. lifecycle: {
  24621. usesOnChanges: reflect.hasLifecycleHook(type, "ngOnChanges")
  24622. },
  24623. typeSourceSpan: null,
  24624. usesInheritance: !extendsDirectlyFromObject(type),
  24625. exportAs: extractExportAs(metadata.exportAs),
  24626. providers: metadata.providers || null,
  24627. viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery),
  24628. isStandalone: metadata.standalone === void 0 ? true : !!metadata.standalone,
  24629. isSignal: !!metadata.signals,
  24630. hostDirectives: metadata.hostDirectives?.map((directive) => typeof directive === "function" ? {
  24631. directive
  24632. } : directive) || null
  24633. };
  24634. }
  24635. function addDirectiveDefToUndecoratedParents(type) {
  24636. const objPrototype = Object.prototype;
  24637. let parent = Object.getPrototypeOf(type.prototype).constructor;
  24638. while (parent && parent !== objPrototype) {
  24639. if (!getDirectiveDef(parent) && !getComponentDef(parent) && shouldAddAbstractDirective(parent)) {
  24640. compileDirective(parent, null);
  24641. }
  24642. parent = Object.getPrototypeOf(parent);
  24643. }
  24644. }
  24645. function convertToR3QueryPredicate(selector) {
  24646. return typeof selector === "string" ? splitByComma(selector) : resolveForwardRef(selector);
  24647. }
  24648. function convertToR3QueryMetadata(propertyName, ann) {
  24649. return {
  24650. propertyName,
  24651. predicate: convertToR3QueryPredicate(ann.selector),
  24652. descendants: ann.descendants,
  24653. first: ann.first,
  24654. read: ann.read ? ann.read : null,
  24655. static: !!ann.static,
  24656. emitDistinctChangesOnly: !!ann.emitDistinctChangesOnly,
  24657. isSignal: !!ann.isSignal
  24658. };
  24659. }
  24660. function extractQueriesMetadata(type, propMetadata, isQueryAnn) {
  24661. const queriesMeta = [];
  24662. for (const field in propMetadata) {
  24663. if (propMetadata.hasOwnProperty(field)) {
  24664. const annotations = propMetadata[field];
  24665. annotations.forEach((ann) => {
  24666. if (isQueryAnn(ann)) {
  24667. if (!ann.selector) {
  24668. throw new Error(`Can't construct a query for the property "${field}" of "${stringifyForError(type)}" since the query selector wasn't defined.`);
  24669. }
  24670. if (annotations.some(isInputAnnotation)) {
  24671. throw new Error(`Cannot combine @Input decorators with query decorators`);
  24672. }
  24673. queriesMeta.push(convertToR3QueryMetadata(field, ann));
  24674. }
  24675. });
  24676. }
  24677. }
  24678. return queriesMeta;
  24679. }
  24680. function extractExportAs(exportAs) {
  24681. return exportAs === void 0 ? null : splitByComma(exportAs);
  24682. }
  24683. function isContentQuery(value) {
  24684. const name = value.ngMetadataName;
  24685. return name === "ContentChild" || name === "ContentChildren";
  24686. }
  24687. function isViewQuery(value) {
  24688. const name = value.ngMetadataName;
  24689. return name === "ViewChild" || name === "ViewChildren";
  24690. }
  24691. function isInputAnnotation(value) {
  24692. return value.ngMetadataName === "Input";
  24693. }
  24694. function splitByComma(value) {
  24695. return value.split(",").map((piece) => piece.trim());
  24696. }
  24697. var LIFECYCLE_HOOKS = ["ngOnChanges", "ngOnInit", "ngOnDestroy", "ngDoCheck", "ngAfterViewInit", "ngAfterViewChecked", "ngAfterContentInit", "ngAfterContentChecked"];
  24698. function shouldAddAbstractDirective(type) {
  24699. const reflect = getReflect();
  24700. if (LIFECYCLE_HOOKS.some((hookName) => reflect.hasLifecycleHook(type, hookName))) {
  24701. return true;
  24702. }
  24703. const propMetadata = reflect.propMetadata(type);
  24704. for (const field in propMetadata) {
  24705. const annotations = propMetadata[field];
  24706. for (let i = 0; i < annotations.length; i++) {
  24707. const current = annotations[i];
  24708. const metadataName = current.ngMetadataName;
  24709. if (isInputAnnotation(current) || isContentQuery(current) || isViewQuery(current) || metadataName === "Output" || metadataName === "HostBinding" || metadataName === "HostListener") {
  24710. return true;
  24711. }
  24712. }
  24713. }
  24714. return false;
  24715. }
  24716. function compilePipe(type, meta) {
  24717. let ngPipeDef = null;
  24718. let ngFactoryDef = null;
  24719. Object.defineProperty(type, NG_FACTORY_DEF, {
  24720. get: () => {
  24721. if (ngFactoryDef === null) {
  24722. const metadata = getPipeMetadata(type, meta);
  24723. const compiler = getCompilerFacade({
  24724. usage: 0,
  24725. kind: "pipe",
  24726. type: metadata.type
  24727. });
  24728. ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${metadata.name}/ɵfac.js`, {
  24729. name: metadata.name,
  24730. type: metadata.type,
  24731. typeArgumentCount: 0,
  24732. deps: reflectDependencies(type),
  24733. target: compiler.FactoryTarget.Pipe
  24734. });
  24735. }
  24736. return ngFactoryDef;
  24737. },
  24738. // Make the property configurable in dev mode to allow overriding in tests
  24739. configurable: !!ngDevMode
  24740. });
  24741. Object.defineProperty(type, NG_PIPE_DEF, {
  24742. get: () => {
  24743. if (ngPipeDef === null) {
  24744. const metadata = getPipeMetadata(type, meta);
  24745. const compiler = getCompilerFacade({
  24746. usage: 0,
  24747. kind: "pipe",
  24748. type: metadata.type
  24749. });
  24750. ngPipeDef = compiler.compilePipe(angularCoreEnv, `ng:///${metadata.name}/ɵpipe.js`, metadata);
  24751. }
  24752. return ngPipeDef;
  24753. },
  24754. // Make the property configurable in dev mode to allow overriding in tests
  24755. configurable: !!ngDevMode
  24756. });
  24757. }
  24758. function getPipeMetadata(type, meta) {
  24759. return {
  24760. type,
  24761. name: type.name,
  24762. pipeName: meta.name,
  24763. pure: meta.pure !== void 0 ? meta.pure : true,
  24764. isStandalone: meta.standalone === void 0 ? true : !!meta.standalone
  24765. };
  24766. }
  24767. var Directive = makeDecorator("Directive", (dir = {}) => dir, void 0, void 0, (type, meta) => compileDirective(type, meta));
  24768. var Component = makeDecorator("Component", (c = {}) => __spreadValues({
  24769. changeDetection: ChangeDetectionStrategy.Default
  24770. }, c), Directive, void 0, (type, meta) => compileComponent(type, meta));
  24771. var Pipe = makeDecorator("Pipe", (p) => __spreadValues({
  24772. pure: true
  24773. }, p), void 0, void 0, (type, meta) => compilePipe(type, meta));
  24774. var Input = makePropDecorator("Input", (arg) => {
  24775. if (!arg) {
  24776. return {};
  24777. }
  24778. return typeof arg === "string" ? {
  24779. alias: arg
  24780. } : arg;
  24781. });
  24782. var Output = makePropDecorator("Output", (alias) => ({
  24783. alias
  24784. }));
  24785. var HostBinding = makePropDecorator("HostBinding", (hostPropertyName) => ({
  24786. hostPropertyName
  24787. }));
  24788. var HostListener = makePropDecorator("HostListener", (eventName, args) => ({
  24789. eventName,
  24790. args
  24791. }));
  24792. var NgModule = makeDecorator(
  24793. "NgModule",
  24794. (ngModule) => ngModule,
  24795. void 0,
  24796. void 0,
  24797. /**
  24798. * Decorator that marks the following class as an NgModule, and supplies
  24799. * configuration metadata for it.
  24800. *
  24801. * * The `declarations` option configures the compiler
  24802. * with information about what belongs to the NgModule.
  24803. * * The `providers` options configures the NgModule's injector to provide
  24804. * dependencies the NgModule members.
  24805. * * The `imports` and `exports` options bring in members from other modules, and make
  24806. * this module's members available to others.
  24807. */
  24808. (type, meta) => compileNgModule(type, meta)
  24809. );
  24810. var Version = class {
  24811. full;
  24812. major;
  24813. minor;
  24814. patch;
  24815. constructor(full) {
  24816. this.full = full;
  24817. const parts = full.split(".");
  24818. this.major = parts[0];
  24819. this.minor = parts[1];
  24820. this.patch = parts.slice(2).join(".");
  24821. }
  24822. };
  24823. var VERSION = new Version("19.2.4");
  24824. var ModuleWithComponentFactories = class {
  24825. ngModuleFactory;
  24826. componentFactories;
  24827. constructor(ngModuleFactory, componentFactories) {
  24828. this.ngModuleFactory = ngModuleFactory;
  24829. this.componentFactories = componentFactories;
  24830. }
  24831. };
  24832. var Compiler = class _Compiler {
  24833. /**
  24834. * Compiles the given NgModule and all of its components. All templates of the components
  24835. * have to be inlined.
  24836. */
  24837. compileModuleSync(moduleType) {
  24838. return new NgModuleFactory2(moduleType);
  24839. }
  24840. /**
  24841. * Compiles the given NgModule and all of its components
  24842. */
  24843. compileModuleAsync(moduleType) {
  24844. return Promise.resolve(this.compileModuleSync(moduleType));
  24845. }
  24846. /**
  24847. * Same as {@link Compiler#compileModuleSync compileModuleSync} but also creates ComponentFactories for all components.
  24848. */
  24849. compileModuleAndAllComponentsSync(moduleType) {
  24850. const ngModuleFactory = this.compileModuleSync(moduleType);
  24851. const moduleDef = getNgModuleDef(moduleType);
  24852. const componentFactories = maybeUnwrapFn(moduleDef.declarations).reduce((factories, declaration) => {
  24853. const componentDef = getComponentDef(declaration);
  24854. componentDef && factories.push(new ComponentFactory2(componentDef));
  24855. return factories;
  24856. }, []);
  24857. return new ModuleWithComponentFactories(ngModuleFactory, componentFactories);
  24858. }
  24859. /**
  24860. * Same as {@link Compiler#compileModuleAsync compileModuleAsync} but also creates ComponentFactories for all components.
  24861. */
  24862. compileModuleAndAllComponentsAsync(moduleType) {
  24863. return Promise.resolve(this.compileModuleAndAllComponentsSync(moduleType));
  24864. }
  24865. /**
  24866. * Clears all caches.
  24867. */
  24868. clearCache() {
  24869. }
  24870. /**
  24871. * Clears the cache for the given component/ngModule.
  24872. */
  24873. clearCacheFor(type) {
  24874. }
  24875. /**
  24876. * Returns the id for a given NgModule, if one is defined and known to the compiler.
  24877. */
  24878. getModuleId(moduleType) {
  24879. return void 0;
  24880. }
  24881. static ɵfac = function Compiler_Factory(__ngFactoryType__) {
  24882. return new (__ngFactoryType__ || _Compiler)();
  24883. };
  24884. static ɵprov = ɵɵdefineInjectable({
  24885. token: _Compiler,
  24886. factory: _Compiler.ɵfac,
  24887. providedIn: "root"
  24888. });
  24889. };
  24890. (() => {
  24891. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Compiler, [{
  24892. type: Injectable,
  24893. args: [{
  24894. providedIn: "root"
  24895. }]
  24896. }], null, null);
  24897. })();
  24898. var COMPILER_OPTIONS = new InjectionToken(ngDevMode ? "compilerOptions" : "");
  24899. var CompilerFactory = class {
  24900. };
  24901. function compileNgModuleFactory(injector, options, moduleType) {
  24902. ngDevMode && assertNgModuleType(moduleType);
  24903. const moduleFactory = new NgModuleFactory2(moduleType);
  24904. if (typeof ngJitMode !== "undefined" && !ngJitMode) {
  24905. return Promise.resolve(moduleFactory);
  24906. }
  24907. const compilerOptions = injector.get(COMPILER_OPTIONS, []).concat(options);
  24908. setJitOptions({
  24909. defaultEncapsulation: _lastDefined(compilerOptions.map((opts) => opts.defaultEncapsulation)),
  24910. preserveWhitespaces: _lastDefined(compilerOptions.map((opts) => opts.preserveWhitespaces))
  24911. });
  24912. if (isComponentResourceResolutionQueueEmpty()) {
  24913. return Promise.resolve(moduleFactory);
  24914. }
  24915. const compilerProviders = compilerOptions.flatMap((option) => option.providers ?? []);
  24916. if (compilerProviders.length === 0) {
  24917. return Promise.resolve(moduleFactory);
  24918. }
  24919. const compiler = getCompilerFacade({
  24920. usage: 0,
  24921. kind: "NgModule",
  24922. type: moduleType
  24923. });
  24924. const compilerInjector = Injector.create({
  24925. providers: compilerProviders
  24926. });
  24927. const resourceLoader = compilerInjector.get(compiler.ResourceLoader);
  24928. return resolveComponentResources((url) => Promise.resolve(resourceLoader.get(url))).then(() => moduleFactory);
  24929. }
  24930. function _lastDefined(args) {
  24931. for (let i = args.length - 1; i >= 0; i--) {
  24932. if (args[i] !== void 0) {
  24933. return args[i];
  24934. }
  24935. }
  24936. return void 0;
  24937. }
  24938. var NgZoneChangeDetectionScheduler = class _NgZoneChangeDetectionScheduler {
  24939. zone = inject(NgZone);
  24940. changeDetectionScheduler = inject(ChangeDetectionScheduler);
  24941. applicationRef = inject(ApplicationRef);
  24942. _onMicrotaskEmptySubscription;
  24943. initialize() {
  24944. if (this._onMicrotaskEmptySubscription) {
  24945. return;
  24946. }
  24947. this._onMicrotaskEmptySubscription = this.zone.onMicrotaskEmpty.subscribe({
  24948. next: () => {
  24949. if (this.changeDetectionScheduler.runningTick) {
  24950. return;
  24951. }
  24952. this.zone.run(() => {
  24953. this.applicationRef.tick();
  24954. });
  24955. }
  24956. });
  24957. }
  24958. ngOnDestroy() {
  24959. this._onMicrotaskEmptySubscription?.unsubscribe();
  24960. }
  24961. static ɵfac = function NgZoneChangeDetectionScheduler_Factory(__ngFactoryType__) {
  24962. return new (__ngFactoryType__ || _NgZoneChangeDetectionScheduler)();
  24963. };
  24964. static ɵprov = ɵɵdefineInjectable({
  24965. token: _NgZoneChangeDetectionScheduler,
  24966. factory: _NgZoneChangeDetectionScheduler.ɵfac,
  24967. providedIn: "root"
  24968. });
  24969. };
  24970. (() => {
  24971. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgZoneChangeDetectionScheduler, [{
  24972. type: Injectable,
  24973. args: [{
  24974. providedIn: "root"
  24975. }]
  24976. }], null, null);
  24977. })();
  24978. var PROVIDED_NG_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "provideZoneChangeDetection token" : "", {
  24979. factory: () => false
  24980. });
  24981. function internalProvideZoneChangeDetection({
  24982. ngZoneFactory,
  24983. ignoreChangesOutsideZone,
  24984. scheduleInRootZone
  24985. }) {
  24986. ngZoneFactory ??= () => new NgZone(__spreadProps(__spreadValues({}, getNgZoneOptions()), {
  24987. scheduleInRootZone
  24988. }));
  24989. return [
  24990. {
  24991. provide: NgZone,
  24992. useFactory: ngZoneFactory
  24993. },
  24994. {
  24995. provide: ENVIRONMENT_INITIALIZER,
  24996. multi: true,
  24997. useFactory: () => {
  24998. const ngZoneChangeDetectionScheduler = inject(NgZoneChangeDetectionScheduler, {
  24999. optional: true
  25000. });
  25001. if ((typeof ngDevMode === "undefined" || ngDevMode) && ngZoneChangeDetectionScheduler === null) {
  25002. throw new RuntimeError(402, `A required Injectable was not found in the dependency injection tree. If you are bootstrapping an NgModule, make sure that the \`BrowserModule\` is imported.`);
  25003. }
  25004. return () => ngZoneChangeDetectionScheduler.initialize();
  25005. }
  25006. },
  25007. {
  25008. provide: ENVIRONMENT_INITIALIZER,
  25009. multi: true,
  25010. useFactory: () => {
  25011. const service = inject(ZoneStablePendingTask);
  25012. return () => {
  25013. service.initialize();
  25014. };
  25015. }
  25016. },
  25017. // Always disable scheduler whenever explicitly disabled, even if another place called
  25018. // `provideZoneChangeDetection` without the 'ignore' option.
  25019. ignoreChangesOutsideZone === true ? {
  25020. provide: ZONELESS_SCHEDULER_DISABLED,
  25021. useValue: true
  25022. } : [],
  25023. {
  25024. provide: SCHEDULE_IN_ROOT_ZONE,
  25025. useValue: scheduleInRootZone ?? SCHEDULE_IN_ROOT_ZONE_DEFAULT
  25026. }
  25027. ];
  25028. }
  25029. function provideZoneChangeDetection(options) {
  25030. const ignoreChangesOutsideZone = options?.ignoreChangesOutsideZone;
  25031. const scheduleInRootZone = options?.scheduleInRootZone;
  25032. const zoneProviders = internalProvideZoneChangeDetection({
  25033. ngZoneFactory: () => {
  25034. const ngZoneOptions = getNgZoneOptions(options);
  25035. ngZoneOptions.scheduleInRootZone = scheduleInRootZone;
  25036. if (ngZoneOptions.shouldCoalesceEventChangeDetection) {
  25037. performanceMarkFeature("NgZone_CoalesceEvent");
  25038. }
  25039. return new NgZone(ngZoneOptions);
  25040. },
  25041. ignoreChangesOutsideZone,
  25042. scheduleInRootZone
  25043. });
  25044. return makeEnvironmentProviders([{
  25045. provide: PROVIDED_NG_ZONE,
  25046. useValue: true
  25047. }, {
  25048. provide: ZONELESS_ENABLED,
  25049. useValue: false
  25050. }, zoneProviders]);
  25051. }
  25052. function getNgZoneOptions(options) {
  25053. return {
  25054. enableLongStackTrace: typeof ngDevMode === "undefined" ? false : !!ngDevMode,
  25055. shouldCoalesceEventChangeDetection: options?.eventCoalescing ?? false,
  25056. shouldCoalesceRunChangeDetection: options?.runCoalescing ?? false
  25057. };
  25058. }
  25059. var ZoneStablePendingTask = class _ZoneStablePendingTask {
  25060. subscription = new Subscription();
  25061. initialized = false;
  25062. zone = inject(NgZone);
  25063. pendingTasks = inject(PendingTasksInternal);
  25064. initialize() {
  25065. if (this.initialized) {
  25066. return;
  25067. }
  25068. this.initialized = true;
  25069. let task = null;
  25070. if (!this.zone.isStable && !this.zone.hasPendingMacrotasks && !this.zone.hasPendingMicrotasks) {
  25071. task = this.pendingTasks.add();
  25072. }
  25073. this.zone.runOutsideAngular(() => {
  25074. this.subscription.add(this.zone.onStable.subscribe(() => {
  25075. NgZone.assertNotInAngularZone();
  25076. queueMicrotask(() => {
  25077. if (task !== null && !this.zone.hasPendingMacrotasks && !this.zone.hasPendingMicrotasks) {
  25078. this.pendingTasks.remove(task);
  25079. task = null;
  25080. }
  25081. });
  25082. }));
  25083. });
  25084. this.subscription.add(this.zone.onUnstable.subscribe(() => {
  25085. NgZone.assertInAngularZone();
  25086. task ??= this.pendingTasks.add();
  25087. }));
  25088. }
  25089. ngOnDestroy() {
  25090. this.subscription.unsubscribe();
  25091. }
  25092. static ɵfac = function ZoneStablePendingTask_Factory(__ngFactoryType__) {
  25093. return new (__ngFactoryType__ || _ZoneStablePendingTask)();
  25094. };
  25095. static ɵprov = ɵɵdefineInjectable({
  25096. token: _ZoneStablePendingTask,
  25097. factory: _ZoneStablePendingTask.ɵfac,
  25098. providedIn: "root"
  25099. });
  25100. };
  25101. (() => {
  25102. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ZoneStablePendingTask, [{
  25103. type: Injectable,
  25104. args: [{
  25105. providedIn: "root"
  25106. }]
  25107. }], null, null);
  25108. })();
  25109. var CONSECUTIVE_MICROTASK_NOTIFICATION_LIMIT = 100;
  25110. var consecutiveMicrotaskNotifications = 0;
  25111. var stackFromLastFewNotifications = [];
  25112. function trackMicrotaskNotificationForDebugging() {
  25113. consecutiveMicrotaskNotifications++;
  25114. if (CONSECUTIVE_MICROTASK_NOTIFICATION_LIMIT - consecutiveMicrotaskNotifications < 5) {
  25115. const stack = new Error().stack;
  25116. if (stack) {
  25117. stackFromLastFewNotifications.push(stack);
  25118. }
  25119. }
  25120. if (consecutiveMicrotaskNotifications === CONSECUTIVE_MICROTASK_NOTIFICATION_LIMIT) {
  25121. throw new RuntimeError(103, "Angular could not stabilize because there were endless change notifications within the browser event loop. The stack from the last several notifications: \n" + stackFromLastFewNotifications.join("\n"));
  25122. }
  25123. }
  25124. var ChangeDetectionSchedulerImpl = class _ChangeDetectionSchedulerImpl {
  25125. appRef = inject(ApplicationRef);
  25126. taskService = inject(PendingTasksInternal);
  25127. ngZone = inject(NgZone);
  25128. zonelessEnabled = inject(ZONELESS_ENABLED);
  25129. tracing = inject(TracingService, {
  25130. optional: true
  25131. });
  25132. disableScheduling = inject(ZONELESS_SCHEDULER_DISABLED, {
  25133. optional: true
  25134. }) ?? false;
  25135. zoneIsDefined = typeof Zone !== "undefined" && !!Zone.root.run;
  25136. schedulerTickApplyArgs = [{
  25137. data: {
  25138. "__scheduler_tick__": true
  25139. }
  25140. }];
  25141. subscriptions = new Subscription();
  25142. angularZoneId = this.zoneIsDefined ? this.ngZone._inner?.get(angularZoneInstanceIdProperty) : null;
  25143. scheduleInRootZone = !this.zonelessEnabled && this.zoneIsDefined && (inject(SCHEDULE_IN_ROOT_ZONE, {
  25144. optional: true
  25145. }) ?? false);
  25146. cancelScheduledCallback = null;
  25147. useMicrotaskScheduler = false;
  25148. runningTick = false;
  25149. pendingRenderTaskId = null;
  25150. constructor() {
  25151. this.subscriptions.add(this.appRef.afterTick.subscribe(() => {
  25152. if (!this.runningTick) {
  25153. this.cleanup();
  25154. }
  25155. }));
  25156. this.subscriptions.add(this.ngZone.onUnstable.subscribe(() => {
  25157. if (!this.runningTick) {
  25158. this.cleanup();
  25159. }
  25160. }));
  25161. this.disableScheduling ||= !this.zonelessEnabled && // NoopNgZone without enabling zoneless means no scheduling whatsoever
  25162. (this.ngZone instanceof NoopNgZone || // The same goes for the lack of Zone without enabling zoneless scheduling
  25163. !this.zoneIsDefined);
  25164. }
  25165. notify(source) {
  25166. if (!this.zonelessEnabled && source === 5) {
  25167. return;
  25168. }
  25169. let force = false;
  25170. switch (source) {
  25171. case 0: {
  25172. this.appRef.dirtyFlags |= 2;
  25173. break;
  25174. }
  25175. case 3:
  25176. case 2:
  25177. case 4:
  25178. case 5:
  25179. case 1: {
  25180. this.appRef.dirtyFlags |= 4;
  25181. break;
  25182. }
  25183. case 6: {
  25184. this.appRef.dirtyFlags |= 2;
  25185. force = true;
  25186. break;
  25187. }
  25188. case 12: {
  25189. this.appRef.dirtyFlags |= 16;
  25190. force = true;
  25191. break;
  25192. }
  25193. case 13: {
  25194. this.appRef.dirtyFlags |= 2;
  25195. force = true;
  25196. break;
  25197. }
  25198. case 11: {
  25199. force = true;
  25200. break;
  25201. }
  25202. case 9:
  25203. case 8:
  25204. case 7:
  25205. case 10:
  25206. default: {
  25207. this.appRef.dirtyFlags |= 8;
  25208. }
  25209. }
  25210. this.appRef.tracingSnapshot = this.tracing?.snapshot(this.appRef.tracingSnapshot) ?? null;
  25211. if (!this.shouldScheduleTick(force)) {
  25212. return;
  25213. }
  25214. if (typeof ngDevMode === "undefined" || ngDevMode) {
  25215. if (this.useMicrotaskScheduler) {
  25216. trackMicrotaskNotificationForDebugging();
  25217. } else {
  25218. consecutiveMicrotaskNotifications = 0;
  25219. stackFromLastFewNotifications.length = 0;
  25220. }
  25221. }
  25222. const scheduleCallback = this.useMicrotaskScheduler ? scheduleCallbackWithMicrotask : scheduleCallbackWithRafRace;
  25223. this.pendingRenderTaskId = this.taskService.add();
  25224. if (this.scheduleInRootZone) {
  25225. this.cancelScheduledCallback = Zone.root.run(() => scheduleCallback(() => this.tick()));
  25226. } else {
  25227. this.cancelScheduledCallback = this.ngZone.runOutsideAngular(() => scheduleCallback(() => this.tick()));
  25228. }
  25229. }
  25230. shouldScheduleTick(force) {
  25231. if (this.disableScheduling && !force || this.appRef.destroyed) {
  25232. return false;
  25233. }
  25234. if (this.pendingRenderTaskId !== null || this.runningTick || this.appRef._runningTick) {
  25235. return false;
  25236. }
  25237. if (!this.zonelessEnabled && this.zoneIsDefined && Zone.current.get(angularZoneInstanceIdProperty + this.angularZoneId)) {
  25238. return false;
  25239. }
  25240. return true;
  25241. }
  25242. /**
  25243. * Calls ApplicationRef._tick inside the `NgZone`.
  25244. *
  25245. * Calling `tick` directly runs change detection and cancels any change detection that had been
  25246. * scheduled previously.
  25247. *
  25248. * @param shouldRefreshViews Passed directly to `ApplicationRef._tick` and skips straight to
  25249. * render hooks when `false`.
  25250. */
  25251. tick() {
  25252. if (this.runningTick || this.appRef.destroyed) {
  25253. return;
  25254. }
  25255. if (this.appRef.dirtyFlags === 0) {
  25256. this.cleanup();
  25257. return;
  25258. }
  25259. if (!this.zonelessEnabled && this.appRef.dirtyFlags & 7) {
  25260. this.appRef.dirtyFlags |= 1;
  25261. }
  25262. const task = this.taskService.add();
  25263. try {
  25264. this.ngZone.run(() => {
  25265. this.runningTick = true;
  25266. this.appRef._tick();
  25267. }, void 0, this.schedulerTickApplyArgs);
  25268. } catch (e) {
  25269. this.taskService.remove(task);
  25270. throw e;
  25271. } finally {
  25272. this.cleanup();
  25273. }
  25274. this.useMicrotaskScheduler = true;
  25275. scheduleCallbackWithMicrotask(() => {
  25276. this.useMicrotaskScheduler = false;
  25277. this.taskService.remove(task);
  25278. });
  25279. }
  25280. ngOnDestroy() {
  25281. this.subscriptions.unsubscribe();
  25282. this.cleanup();
  25283. }
  25284. cleanup() {
  25285. this.runningTick = false;
  25286. this.cancelScheduledCallback?.();
  25287. this.cancelScheduledCallback = null;
  25288. if (this.pendingRenderTaskId !== null) {
  25289. const taskId = this.pendingRenderTaskId;
  25290. this.pendingRenderTaskId = null;
  25291. this.taskService.remove(taskId);
  25292. }
  25293. }
  25294. static ɵfac = function ChangeDetectionSchedulerImpl_Factory(__ngFactoryType__) {
  25295. return new (__ngFactoryType__ || _ChangeDetectionSchedulerImpl)();
  25296. };
  25297. static ɵprov = ɵɵdefineInjectable({
  25298. token: _ChangeDetectionSchedulerImpl,
  25299. factory: _ChangeDetectionSchedulerImpl.ɵfac,
  25300. providedIn: "root"
  25301. });
  25302. };
  25303. (() => {
  25304. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ChangeDetectionSchedulerImpl, [{
  25305. type: Injectable,
  25306. args: [{
  25307. providedIn: "root"
  25308. }]
  25309. }], () => [], null);
  25310. })();
  25311. function provideExperimentalZonelessChangeDetection() {
  25312. performanceMarkFeature("NgZoneless");
  25313. if ((typeof ngDevMode === "undefined" || ngDevMode) && typeof Zone !== "undefined" && Zone) {
  25314. const message = formatRuntimeError(914, `The application is using zoneless change detection, but is still loading Zone.js. Consider removing Zone.js to get the full benefits of zoneless. In applications using the Angular CLI, Zone.js is typically included in the "polyfills" section of the angular.json file.`);
  25315. console.warn(message);
  25316. }
  25317. return makeEnvironmentProviders([{
  25318. provide: ChangeDetectionScheduler,
  25319. useExisting: ChangeDetectionSchedulerImpl
  25320. }, {
  25321. provide: NgZone,
  25322. useClass: NoopNgZone
  25323. }, {
  25324. provide: ZONELESS_ENABLED,
  25325. useValue: true
  25326. }, {
  25327. provide: SCHEDULE_IN_ROOT_ZONE,
  25328. useValue: false
  25329. }, typeof ngDevMode === "undefined" || ngDevMode ? [{
  25330. provide: PROVIDED_ZONELESS,
  25331. useValue: true
  25332. }] : []]);
  25333. }
  25334. function getGlobalLocale() {
  25335. if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode && typeof goog !== "undefined" && goog.LOCALE !== "en") {
  25336. return goog.LOCALE;
  25337. } else {
  25338. return typeof $localize !== "undefined" && $localize.locale || DEFAULT_LOCALE_ID;
  25339. }
  25340. }
  25341. var LOCALE_ID = new InjectionToken(ngDevMode ? "LocaleId" : "", {
  25342. providedIn: "root",
  25343. factory: () => inject(LOCALE_ID, InjectFlags.Optional | InjectFlags.SkipSelf) || getGlobalLocale()
  25344. });
  25345. var DEFAULT_CURRENCY_CODE = new InjectionToken(ngDevMode ? "DefaultCurrencyCode" : "", {
  25346. providedIn: "root",
  25347. factory: () => USD_CURRENCY_CODE
  25348. });
  25349. var TRANSLATIONS = new InjectionToken(ngDevMode ? "Translations" : "");
  25350. var TRANSLATIONS_FORMAT = new InjectionToken(ngDevMode ? "TranslationsFormat" : "");
  25351. var MissingTranslationStrategy;
  25352. (function(MissingTranslationStrategy2) {
  25353. MissingTranslationStrategy2[MissingTranslationStrategy2["Error"] = 0] = "Error";
  25354. MissingTranslationStrategy2[MissingTranslationStrategy2["Warning"] = 1] = "Warning";
  25355. MissingTranslationStrategy2[MissingTranslationStrategy2["Ignore"] = 2] = "Ignore";
  25356. })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
  25357. var SCAN_DELAY = 200;
  25358. var OVERSIZED_IMAGE_TOLERANCE = 1200;
  25359. var ImagePerformanceWarning = class _ImagePerformanceWarning {
  25360. // Map of full image URLs -> original `ngSrc` values.
  25361. window = null;
  25362. observer = null;
  25363. options = inject(IMAGE_CONFIG);
  25364. lcpImageUrl;
  25365. start() {
  25366. if (typeof PerformanceObserver === "undefined" || this.options?.disableImageSizeWarning && this.options?.disableImageLazyLoadWarning) {
  25367. return;
  25368. }
  25369. this.observer = this.initPerformanceObserver();
  25370. const doc = getDocument();
  25371. const win = doc.defaultView;
  25372. if (win) {
  25373. this.window = win;
  25374. const waitToScan = () => {
  25375. setTimeout(this.scanImages.bind(this), SCAN_DELAY);
  25376. };
  25377. const setup = () => {
  25378. if (doc.readyState === "complete") {
  25379. waitToScan();
  25380. } else {
  25381. this.window?.addEventListener("load", waitToScan, {
  25382. once: true
  25383. });
  25384. }
  25385. };
  25386. if (typeof Zone !== "undefined") {
  25387. Zone.root.run(() => setup());
  25388. } else {
  25389. setup();
  25390. }
  25391. }
  25392. }
  25393. ngOnDestroy() {
  25394. this.observer?.disconnect();
  25395. }
  25396. initPerformanceObserver() {
  25397. if (typeof PerformanceObserver === "undefined") {
  25398. return null;
  25399. }
  25400. const observer = new PerformanceObserver((entryList) => {
  25401. const entries = entryList.getEntries();
  25402. if (entries.length === 0) return;
  25403. const lcpElement = entries[entries.length - 1];
  25404. const imgSrc = lcpElement.element?.src ?? "";
  25405. if (imgSrc.startsWith("data:") || imgSrc.startsWith("blob:")) return;
  25406. this.lcpImageUrl = imgSrc;
  25407. });
  25408. observer.observe({
  25409. type: "largest-contentful-paint",
  25410. buffered: true
  25411. });
  25412. return observer;
  25413. }
  25414. scanImages() {
  25415. const images = getDocument().querySelectorAll("img");
  25416. let lcpElementFound, lcpElementLoadedCorrectly = false;
  25417. images.forEach((image) => {
  25418. if (!this.options?.disableImageSizeWarning) {
  25419. if (!image.getAttribute("ng-img") && this.isOversized(image)) {
  25420. logOversizedImageWarning(image.src);
  25421. }
  25422. }
  25423. if (!this.options?.disableImageLazyLoadWarning && this.lcpImageUrl) {
  25424. if (image.src === this.lcpImageUrl) {
  25425. lcpElementFound = true;
  25426. if (image.loading !== "lazy" || image.getAttribute("ng-img")) {
  25427. lcpElementLoadedCorrectly = true;
  25428. }
  25429. }
  25430. }
  25431. });
  25432. if (lcpElementFound && !lcpElementLoadedCorrectly && this.lcpImageUrl && !this.options?.disableImageLazyLoadWarning) {
  25433. logLazyLCPWarning(this.lcpImageUrl);
  25434. }
  25435. }
  25436. isOversized(image) {
  25437. if (!this.window) {
  25438. return false;
  25439. }
  25440. const nonOversizedImageExtentions = [
  25441. // SVG images are vector-based, which means they can scale
  25442. // to any size without losing quality.
  25443. ".svg"
  25444. ];
  25445. const imageSource = (image.src || "").toLowerCase();
  25446. if (nonOversizedImageExtentions.some((extension) => imageSource.endsWith(extension))) {
  25447. return false;
  25448. }
  25449. const computedStyle = this.window.getComputedStyle(image);
  25450. let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
  25451. let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
  25452. const boxSizing = computedStyle.getPropertyValue("box-sizing");
  25453. const objectFit = computedStyle.getPropertyValue("object-fit");
  25454. if (objectFit === `cover`) {
  25455. return false;
  25456. }
  25457. if (boxSizing === "border-box") {
  25458. const paddingTop = computedStyle.getPropertyValue("padding-top");
  25459. const paddingRight = computedStyle.getPropertyValue("padding-right");
  25460. const paddingBottom = computedStyle.getPropertyValue("padding-bottom");
  25461. const paddingLeft = computedStyle.getPropertyValue("padding-left");
  25462. renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);
  25463. renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);
  25464. }
  25465. const intrinsicWidth = image.naturalWidth;
  25466. const intrinsicHeight = image.naturalHeight;
  25467. const recommendedWidth = this.window.devicePixelRatio * renderedWidth;
  25468. const recommendedHeight = this.window.devicePixelRatio * renderedHeight;
  25469. const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE;
  25470. const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE;
  25471. return oversizedWidth || oversizedHeight;
  25472. }
  25473. static ɵfac = function ImagePerformanceWarning_Factory(__ngFactoryType__) {
  25474. return new (__ngFactoryType__ || _ImagePerformanceWarning)();
  25475. };
  25476. static ɵprov = ɵɵdefineInjectable({
  25477. token: _ImagePerformanceWarning,
  25478. factory: _ImagePerformanceWarning.ɵfac,
  25479. providedIn: "root"
  25480. });
  25481. };
  25482. (() => {
  25483. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ImagePerformanceWarning, [{
  25484. type: Injectable,
  25485. args: [{
  25486. providedIn: "root"
  25487. }]
  25488. }], null, null);
  25489. })();
  25490. function logLazyLCPWarning(src) {
  25491. console.warn(formatRuntimeError(-913, `An image with src ${src} is the Largest Contentful Paint (LCP) element but was given a "loading" value of "lazy", which can negatively impact application loading performance. This warning can be addressed by changing the loading value of the LCP image to "eager", or by using the NgOptimizedImage directive's prioritization utilities. For more information about addressing or disabling this warning, see https://angular.dev/errors/NG0913`));
  25492. }
  25493. function logOversizedImageWarning(src) {
  25494. console.warn(formatRuntimeError(-913, `An image with src ${src} has intrinsic file dimensions much larger than its rendered size. This can negatively impact application loading performance. For more information about addressing or disabling this warning, see https://angular.dev/errors/NG0913`));
  25495. }
  25496. var PLATFORM_DESTROY_LISTENERS = new InjectionToken(ngDevMode ? "PlatformDestroyListeners" : "");
  25497. var ENABLE_ROOT_COMPONENT_BOOTSTRAP = new InjectionToken(ngDevMode ? "ENABLE_ROOT_COMPONENT_BOOTSTRAP" : "");
  25498. function isApplicationBootstrapConfig(config2) {
  25499. return !config2.moduleRef;
  25500. }
  25501. function bootstrap(config2) {
  25502. const envInjector = isApplicationBootstrapConfig(config2) ? config2.r3Injector : config2.moduleRef.injector;
  25503. const ngZone = envInjector.get(NgZone);
  25504. return ngZone.run(() => {
  25505. if (isApplicationBootstrapConfig(config2)) {
  25506. config2.r3Injector.resolveInjectorInitializers();
  25507. } else {
  25508. config2.moduleRef.resolveInjectorInitializers();
  25509. }
  25510. const exceptionHandler = envInjector.get(ErrorHandler, null);
  25511. if (typeof ngDevMode === "undefined" || ngDevMode) {
  25512. if (exceptionHandler === null) {
  25513. const errorMessage = isApplicationBootstrapConfig(config2) ? "No `ErrorHandler` found in the Dependency Injection tree." : "No ErrorHandler. Is platform module (BrowserModule) included";
  25514. throw new RuntimeError(402, errorMessage);
  25515. }
  25516. if (envInjector.get(PROVIDED_ZONELESS) && envInjector.get(PROVIDED_NG_ZONE)) {
  25517. throw new RuntimeError(408, "Invalid change detection configuration: provideZoneChangeDetection and provideExperimentalZonelessChangeDetection cannot be used together.");
  25518. }
  25519. }
  25520. let onErrorSubscription;
  25521. ngZone.runOutsideAngular(() => {
  25522. onErrorSubscription = ngZone.onError.subscribe({
  25523. next: (error) => {
  25524. exceptionHandler.handleError(error);
  25525. }
  25526. });
  25527. });
  25528. if (isApplicationBootstrapConfig(config2)) {
  25529. const destroyListener = () => envInjector.destroy();
  25530. const onPlatformDestroyListeners = config2.platformInjector.get(PLATFORM_DESTROY_LISTENERS);
  25531. onPlatformDestroyListeners.add(destroyListener);
  25532. envInjector.onDestroy(() => {
  25533. onErrorSubscription.unsubscribe();
  25534. onPlatformDestroyListeners.delete(destroyListener);
  25535. });
  25536. } else {
  25537. const destroyListener = () => config2.moduleRef.destroy();
  25538. const onPlatformDestroyListeners = config2.platformInjector.get(PLATFORM_DESTROY_LISTENERS);
  25539. onPlatformDestroyListeners.add(destroyListener);
  25540. config2.moduleRef.onDestroy(() => {
  25541. remove(config2.allPlatformModules, config2.moduleRef);
  25542. onErrorSubscription.unsubscribe();
  25543. onPlatformDestroyListeners.delete(destroyListener);
  25544. });
  25545. }
  25546. return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
  25547. const initStatus = envInjector.get(ApplicationInitStatus);
  25548. initStatus.runInitializers();
  25549. return initStatus.donePromise.then(() => {
  25550. const localeId = envInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
  25551. setLocaleId(localeId || DEFAULT_LOCALE_ID);
  25552. const enableRootComponentBoostrap = envInjector.get(ENABLE_ROOT_COMPONENT_BOOTSTRAP, true);
  25553. if (!enableRootComponentBoostrap) {
  25554. if (isApplicationBootstrapConfig(config2)) {
  25555. return envInjector.get(ApplicationRef);
  25556. }
  25557. config2.allPlatformModules.push(config2.moduleRef);
  25558. return config2.moduleRef;
  25559. }
  25560. if (typeof ngDevMode === "undefined" || ngDevMode) {
  25561. const imagePerformanceService = envInjector.get(ImagePerformanceWarning);
  25562. imagePerformanceService.start();
  25563. }
  25564. if (isApplicationBootstrapConfig(config2)) {
  25565. const appRef = envInjector.get(ApplicationRef);
  25566. if (config2.rootComponent !== void 0) {
  25567. appRef.bootstrap(config2.rootComponent);
  25568. }
  25569. return appRef;
  25570. } else {
  25571. moduleDoBootstrap(config2.moduleRef, config2.allPlatformModules);
  25572. return config2.moduleRef;
  25573. }
  25574. });
  25575. });
  25576. });
  25577. }
  25578. function moduleDoBootstrap(moduleRef, allPlatformModules) {
  25579. const appRef = moduleRef.injector.get(ApplicationRef);
  25580. if (moduleRef._bootstrapComponents.length > 0) {
  25581. moduleRef._bootstrapComponents.forEach((f) => appRef.bootstrap(f));
  25582. } else if (moduleRef.instance.ngDoBootstrap) {
  25583. moduleRef.instance.ngDoBootstrap(appRef);
  25584. } else {
  25585. throw new RuntimeError(-403, ngDevMode && `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. Please define one of these.`);
  25586. }
  25587. allPlatformModules.push(moduleRef);
  25588. }
  25589. function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
  25590. try {
  25591. const result = callback();
  25592. if (isPromise2(result)) {
  25593. return result.catch((e) => {
  25594. ngZone.runOutsideAngular(() => errorHandler.handleError(e));
  25595. throw e;
  25596. });
  25597. }
  25598. return result;
  25599. } catch (e) {
  25600. ngZone.runOutsideAngular(() => errorHandler.handleError(e));
  25601. throw e;
  25602. }
  25603. }
  25604. var PlatformRef = class _PlatformRef {
  25605. _injector;
  25606. _modules = [];
  25607. _destroyListeners = [];
  25608. _destroyed = false;
  25609. /** @internal */
  25610. constructor(_injector) {
  25611. this._injector = _injector;
  25612. }
  25613. /**
  25614. * Creates an instance of an `@NgModule` for the given platform.
  25615. *
  25616. * @deprecated Passing NgModule factories as the `PlatformRef.bootstrapModuleFactory` function
  25617. * argument is deprecated. Use the `PlatformRef.bootstrapModule` API instead.
  25618. */
  25619. bootstrapModuleFactory(moduleFactory, options) {
  25620. const scheduleInRootZone = options?.scheduleInRootZone;
  25621. const ngZoneFactory = () => getNgZone(options?.ngZone, __spreadProps(__spreadValues({}, getNgZoneOptions({
  25622. eventCoalescing: options?.ngZoneEventCoalescing,
  25623. runCoalescing: options?.ngZoneRunCoalescing
  25624. })), {
  25625. scheduleInRootZone
  25626. }));
  25627. const ignoreChangesOutsideZone = options?.ignoreChangesOutsideZone;
  25628. const allAppProviders = [internalProvideZoneChangeDetection({
  25629. ngZoneFactory,
  25630. ignoreChangesOutsideZone
  25631. }), {
  25632. provide: ChangeDetectionScheduler,
  25633. useExisting: ChangeDetectionSchedulerImpl
  25634. }];
  25635. const moduleRef = createNgModuleRefWithProviders(moduleFactory.moduleType, this.injector, allAppProviders);
  25636. return bootstrap({
  25637. moduleRef,
  25638. allPlatformModules: this._modules,
  25639. platformInjector: this.injector
  25640. });
  25641. }
  25642. /**
  25643. * Creates an instance of an `@NgModule` for a given platform.
  25644. *
  25645. * @usageNotes
  25646. * ### Simple Example
  25647. *
  25648. * ```ts
  25649. * @NgModule({
  25650. * imports: [BrowserModule]
  25651. * })
  25652. * class MyModule {}
  25653. *
  25654. * let moduleRef = platformBrowser().bootstrapModule(MyModule);
  25655. * ```
  25656. *
  25657. */
  25658. bootstrapModule(moduleType, compilerOptions = []) {
  25659. const options = optionsReducer({}, compilerOptions);
  25660. return compileNgModuleFactory(this.injector, options, moduleType).then((moduleFactory) => this.bootstrapModuleFactory(moduleFactory, options));
  25661. }
  25662. /**
  25663. * Registers a listener to be called when the platform is destroyed.
  25664. */
  25665. onDestroy(callback) {
  25666. this._destroyListeners.push(callback);
  25667. }
  25668. /**
  25669. * Retrieves the platform {@link Injector}, which is the parent injector for
  25670. * every Angular application on the page and provides singleton providers.
  25671. */
  25672. get injector() {
  25673. return this._injector;
  25674. }
  25675. /**
  25676. * Destroys the current Angular platform and all Angular applications on the page.
  25677. * Destroys all modules and listeners registered with the platform.
  25678. */
  25679. destroy() {
  25680. if (this._destroyed) {
  25681. throw new RuntimeError(404, ngDevMode && "The platform has already been destroyed!");
  25682. }
  25683. this._modules.slice().forEach((module) => module.destroy());
  25684. this._destroyListeners.forEach((listener) => listener());
  25685. const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
  25686. if (destroyListeners) {
  25687. destroyListeners.forEach((listener) => listener());
  25688. destroyListeners.clear();
  25689. }
  25690. this._destroyed = true;
  25691. }
  25692. /**
  25693. * Indicates whether this instance was destroyed.
  25694. */
  25695. get destroyed() {
  25696. return this._destroyed;
  25697. }
  25698. static ɵfac = function PlatformRef_Factory(__ngFactoryType__) {
  25699. return new (__ngFactoryType__ || _PlatformRef)(ɵɵinject(Injector));
  25700. };
  25701. static ɵprov = ɵɵdefineInjectable({
  25702. token: _PlatformRef,
  25703. factory: _PlatformRef.ɵfac,
  25704. providedIn: "platform"
  25705. });
  25706. };
  25707. (() => {
  25708. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformRef, [{
  25709. type: Injectable,
  25710. args: [{
  25711. providedIn: "platform"
  25712. }]
  25713. }], () => [{
  25714. type: Injector
  25715. }], null);
  25716. })();
  25717. var _platformInjector = null;
  25718. var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken(ngDevMode ? "AllowMultipleToken" : "");
  25719. function createPlatform(injector) {
  25720. if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
  25721. throw new RuntimeError(400, ngDevMode && "There can be only one platform. Destroy the previous one to create a new one.");
  25722. }
  25723. publishDefaultGlobalUtils();
  25724. publishSignalConfiguration();
  25725. _platformInjector = injector;
  25726. const platform = injector.get(PlatformRef);
  25727. runPlatformInitializers(injector);
  25728. return platform;
  25729. }
  25730. function createPlatformFactory(parentPlatformFactory, name, providers = []) {
  25731. const desc = `Platform: ${name}`;
  25732. const marker = new InjectionToken(desc);
  25733. return (extraProviders = []) => {
  25734. let platform = getPlatform();
  25735. if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
  25736. const platformProviders = [...providers, ...extraProviders, {
  25737. provide: marker,
  25738. useValue: true
  25739. }];
  25740. if (parentPlatformFactory) {
  25741. parentPlatformFactory(platformProviders);
  25742. } else {
  25743. createPlatform(createPlatformInjector(platformProviders, desc));
  25744. }
  25745. }
  25746. return assertPlatform(marker);
  25747. };
  25748. }
  25749. function createPlatformInjector(providers = [], name) {
  25750. return Injector.create({
  25751. name,
  25752. providers: [{
  25753. provide: INJECTOR_SCOPE,
  25754. useValue: "platform"
  25755. }, {
  25756. provide: PLATFORM_DESTROY_LISTENERS,
  25757. useValue: /* @__PURE__ */ new Set([() => _platformInjector = null])
  25758. }, ...providers]
  25759. });
  25760. }
  25761. function assertPlatform(requiredToken) {
  25762. const platform = getPlatform();
  25763. if (!platform) {
  25764. throw new RuntimeError(401, ngDevMode && "No platform exists!");
  25765. }
  25766. if ((typeof ngDevMode === "undefined" || ngDevMode) && !platform.injector.get(requiredToken, null)) {
  25767. throw new RuntimeError(400, "A platform with a different configuration has been created. Please destroy it first.");
  25768. }
  25769. return platform;
  25770. }
  25771. function getPlatform() {
  25772. return _platformInjector?.get(PlatformRef) ?? null;
  25773. }
  25774. function destroyPlatform() {
  25775. getPlatform()?.destroy();
  25776. }
  25777. function createOrReusePlatformInjector(providers = []) {
  25778. if (_platformInjector) return _platformInjector;
  25779. publishDefaultGlobalUtils();
  25780. const injector = createPlatformInjector(providers);
  25781. _platformInjector = injector;
  25782. publishSignalConfiguration();
  25783. runPlatformInitializers(injector);
  25784. return injector;
  25785. }
  25786. function providePlatformInitializer(initializerFn) {
  25787. return makeEnvironmentProviders([{
  25788. provide: PLATFORM_INITIALIZER,
  25789. useValue: initializerFn,
  25790. multi: true
  25791. }]);
  25792. }
  25793. function runPlatformInitializers(injector) {
  25794. const inits = injector.get(PLATFORM_INITIALIZER, null);
  25795. runInInjectionContext(injector, () => {
  25796. inits?.forEach((init) => init());
  25797. });
  25798. }
  25799. function provideExperimentalCheckNoChangesForDebug(options) {
  25800. if (typeof ngDevMode === "undefined" || ngDevMode) {
  25801. if (options.interval === void 0 && !options.useNgZoneOnStable) {
  25802. throw new Error("Must provide one of `useNgZoneOnStable` or `interval`");
  25803. }
  25804. const checkNoChangesMode = options?.exhaustive === false ? CheckNoChangesMode.OnlyDirtyViews : CheckNoChangesMode.Exhaustive;
  25805. return makeEnvironmentProviders([options?.useNgZoneOnStable ? {
  25806. provide: NgZone,
  25807. useFactory: () => new DebugNgZoneForCheckNoChanges(checkNoChangesMode)
  25808. } : [], options?.interval !== void 0 ? exhaustiveCheckNoChangesInterval(options.interval, checkNoChangesMode) : [], {
  25809. provide: ENVIRONMENT_INITIALIZER,
  25810. multi: true,
  25811. useValue: () => {
  25812. if (options?.useNgZoneOnStable && !(inject(NgZone) instanceof DebugNgZoneForCheckNoChanges)) {
  25813. throw new Error("`provideExperimentalCheckNoChangesForDebug` with `useNgZoneOnStable` must be after any other provider for `NgZone`.");
  25814. }
  25815. }
  25816. }]);
  25817. } else {
  25818. return makeEnvironmentProviders([]);
  25819. }
  25820. }
  25821. var DebugNgZoneForCheckNoChanges = class extends NgZone {
  25822. checkNoChangesMode;
  25823. applicationRef;
  25824. scheduler;
  25825. errorHandler;
  25826. injector = inject(EnvironmentInjector);
  25827. constructor(checkNoChangesMode) {
  25828. const zonelessEnabled = inject(ZONELESS_ENABLED);
  25829. super({
  25830. shouldCoalesceEventChangeDetection: true,
  25831. shouldCoalesceRunChangeDetection: zonelessEnabled
  25832. });
  25833. this.checkNoChangesMode = checkNoChangesMode;
  25834. if (zonelessEnabled) {
  25835. this.onMicrotaskEmpty.emit = () => {
  25836. };
  25837. this.onStable.emit = () => {
  25838. this.scheduler ||= this.injector.get(ChangeDetectionSchedulerImpl);
  25839. if (this.scheduler.pendingRenderTaskId || this.scheduler.runningTick) {
  25840. return;
  25841. }
  25842. this.checkApplicationViews();
  25843. };
  25844. this.onUnstable.emit = () => {
  25845. };
  25846. } else {
  25847. this.runOutsideAngular(() => {
  25848. this.onStable.subscribe(() => {
  25849. this.checkApplicationViews();
  25850. });
  25851. });
  25852. }
  25853. }
  25854. checkApplicationViews() {
  25855. this.applicationRef ||= this.injector.get(ApplicationRef);
  25856. for (const view of this.applicationRef.allViews) {
  25857. try {
  25858. checkNoChangesInternal(view._lView, this.checkNoChangesMode, view.notifyErrorHandler);
  25859. } catch (e) {
  25860. this.errorHandler ||= this.injector.get(ErrorHandler);
  25861. this.errorHandler.handleError(e);
  25862. }
  25863. }
  25864. }
  25865. };
  25866. function exhaustiveCheckNoChangesInterval(interval2, checkNoChangesMode) {
  25867. return {
  25868. provide: ENVIRONMENT_INITIALIZER,
  25869. multi: true,
  25870. useFactory: () => {
  25871. const applicationRef = inject(ApplicationRef);
  25872. const errorHandler = inject(ErrorHandler);
  25873. const scheduler = inject(ChangeDetectionSchedulerImpl);
  25874. const ngZone = inject(NgZone);
  25875. return () => {
  25876. function scheduleCheckNoChanges() {
  25877. ngZone.runOutsideAngular(() => {
  25878. setTimeout(() => {
  25879. if (applicationRef.destroyed) {
  25880. return;
  25881. }
  25882. if (scheduler.pendingRenderTaskId || scheduler.runningTick) {
  25883. scheduleCheckNoChanges();
  25884. return;
  25885. }
  25886. for (const view of applicationRef.allViews) {
  25887. try {
  25888. checkNoChangesInternal(view._lView, checkNoChangesMode, view.notifyErrorHandler);
  25889. } catch (e) {
  25890. errorHandler.handleError(e);
  25891. }
  25892. }
  25893. scheduleCheckNoChanges();
  25894. }, interval2);
  25895. });
  25896. }
  25897. scheduleCheckNoChanges();
  25898. };
  25899. }
  25900. };
  25901. }
  25902. function isDevMode() {
  25903. return typeof ngDevMode === "undefined" || !!ngDevMode;
  25904. }
  25905. function enableProdMode() {
  25906. if (typeof ngDevMode === "undefined" || ngDevMode) {
  25907. _global["ngDevMode"] = false;
  25908. }
  25909. }
  25910. function getModuleFactory(id) {
  25911. const type = getRegisteredNgModuleType(id);
  25912. if (!type) throw noModuleError(id);
  25913. return new NgModuleFactory2(type);
  25914. }
  25915. function getNgModuleById(id) {
  25916. const type = getRegisteredNgModuleType(id);
  25917. if (!type) throw noModuleError(id);
  25918. return type;
  25919. }
  25920. function noModuleError(id) {
  25921. return new Error(`No module with ID ${id} loaded`);
  25922. }
  25923. var ChangeDetectorRef = class {
  25924. /**
  25925. * @internal
  25926. * @nocollapse
  25927. */
  25928. static __NG_ELEMENT_ID__ = injectChangeDetectorRef;
  25929. };
  25930. function injectChangeDetectorRef(flags) {
  25931. return createViewRef(
  25932. getCurrentTNode(),
  25933. getLView(),
  25934. (flags & 16) === 16
  25935. /* InternalInjectFlags.ForPipe */
  25936. );
  25937. }
  25938. function createViewRef(tNode, lView, isPipe2) {
  25939. if (isComponentHost(tNode) && !isPipe2) {
  25940. const componentView = getComponentLViewByIndex(tNode.index, lView);
  25941. return new ViewRef$1(componentView, componentView);
  25942. } else if (tNode.type & (3 | 12 | 32 | 128)) {
  25943. const hostComponentView = lView[DECLARATION_COMPONENT_VIEW];
  25944. return new ViewRef$1(hostComponentView, lView);
  25945. }
  25946. return null;
  25947. }
  25948. var ViewRef2 = class extends ChangeDetectorRef {
  25949. };
  25950. var EmbeddedViewRef = class extends ViewRef2 {
  25951. };
  25952. var DebugEventListener = class {
  25953. name;
  25954. callback;
  25955. constructor(name, callback) {
  25956. this.name = name;
  25957. this.callback = callback;
  25958. }
  25959. };
  25960. function asNativeElements(debugEls) {
  25961. return debugEls.map((el) => el.nativeElement);
  25962. }
  25963. var DebugNode = class {
  25964. /**
  25965. * The underlying DOM node.
  25966. */
  25967. nativeNode;
  25968. constructor(nativeNode) {
  25969. this.nativeNode = nativeNode;
  25970. }
  25971. /**
  25972. * The `DebugElement` parent. Will be `null` if this is the root element.
  25973. */
  25974. get parent() {
  25975. const parent = this.nativeNode.parentNode;
  25976. return parent ? new DebugElement(parent) : null;
  25977. }
  25978. /**
  25979. * The host dependency injector. For example, the root element's component instance injector.
  25980. */
  25981. get injector() {
  25982. return getInjector(this.nativeNode);
  25983. }
  25984. /**
  25985. * The element's own component instance, if it has one.
  25986. */
  25987. get componentInstance() {
  25988. const nativeElement = this.nativeNode;
  25989. return nativeElement && (getComponent(nativeElement) || getOwningComponent(nativeElement));
  25990. }
  25991. /**
  25992. * An object that provides parent context for this element. Often an ancestor component instance
  25993. * that governs this element.
  25994. *
  25995. * When an element is repeated within *ngFor, the context is an `NgForOf` whose `$implicit`
  25996. * property is the value of the row instance value. For example, the `hero` in `*ngFor="let hero
  25997. * of heroes"`.
  25998. */
  25999. get context() {
  26000. return getComponent(this.nativeNode) || getContext(this.nativeNode);
  26001. }
  26002. /**
  26003. * The callbacks attached to the component's @Output properties and/or the element's event
  26004. * properties.
  26005. */
  26006. get listeners() {
  26007. return getListeners(this.nativeNode).filter((listener) => listener.type === "dom");
  26008. }
  26009. /**
  26010. * Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local
  26011. * variable name.
  26012. */
  26013. get references() {
  26014. return getLocalRefs(this.nativeNode);
  26015. }
  26016. /**
  26017. * This component's injector lookup tokens. Includes the component itself plus the tokens that the
  26018. * component lists in its providers metadata.
  26019. */
  26020. get providerTokens() {
  26021. return getInjectionTokens(this.nativeNode);
  26022. }
  26023. };
  26024. var DebugElement = class extends DebugNode {
  26025. constructor(nativeNode) {
  26026. ngDevMode && assertDomNode(nativeNode);
  26027. super(nativeNode);
  26028. }
  26029. /**
  26030. * The underlying DOM element at the root of the component.
  26031. */
  26032. get nativeElement() {
  26033. return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
  26034. }
  26035. /**
  26036. * The element tag name, if it is an element.
  26037. */
  26038. get name() {
  26039. const context2 = getLContext(this.nativeNode);
  26040. const lView = context2 ? context2.lView : null;
  26041. if (lView !== null) {
  26042. const tData = lView[TVIEW].data;
  26043. const tNode = tData[context2.nodeIndex];
  26044. return tNode.value;
  26045. } else {
  26046. return this.nativeNode.nodeName;
  26047. }
  26048. }
  26049. /**
  26050. * Gets a map of property names to property values for an element.
  26051. *
  26052. * This map includes:
  26053. * - Regular property bindings (e.g. `[id]="id"`)
  26054. * - Host property bindings (e.g. `host: { '[id]': "id" }`)
  26055. * - Interpolated property bindings (e.g. `id="{{ value }}")
  26056. *
  26057. * It does not include:
  26058. * - input property bindings (e.g. `[myCustomInput]="value"`)
  26059. * - attribute bindings (e.g. `[attr.role]="menu"`)
  26060. */
  26061. get properties() {
  26062. const context2 = getLContext(this.nativeNode);
  26063. const lView = context2 ? context2.lView : null;
  26064. if (lView === null) {
  26065. return {};
  26066. }
  26067. const tData = lView[TVIEW].data;
  26068. const tNode = tData[context2.nodeIndex];
  26069. const properties = {};
  26070. copyDomProperties(this.nativeElement, properties);
  26071. collectPropertyBindings(properties, tNode, lView, tData);
  26072. return properties;
  26073. }
  26074. /**
  26075. * A map of attribute names to attribute values for an element.
  26076. */
  26077. // TODO: replace null by undefined in the return type
  26078. get attributes() {
  26079. const attributes = {};
  26080. const element = this.nativeElement;
  26081. if (!element) {
  26082. return attributes;
  26083. }
  26084. const context2 = getLContext(element);
  26085. const lView = context2 ? context2.lView : null;
  26086. if (lView === null) {
  26087. return {};
  26088. }
  26089. const tNodeAttrs = lView[TVIEW].data[context2.nodeIndex].attrs;
  26090. const lowercaseTNodeAttrs = [];
  26091. if (tNodeAttrs) {
  26092. let i = 0;
  26093. while (i < tNodeAttrs.length) {
  26094. const attrName = tNodeAttrs[i];
  26095. if (typeof attrName !== "string") break;
  26096. const attrValue = tNodeAttrs[i + 1];
  26097. attributes[attrName] = attrValue;
  26098. lowercaseTNodeAttrs.push(attrName.toLowerCase());
  26099. i += 2;
  26100. }
  26101. }
  26102. for (const attr of element.attributes) {
  26103. if (!lowercaseTNodeAttrs.includes(attr.name)) {
  26104. attributes[attr.name] = attr.value;
  26105. }
  26106. }
  26107. return attributes;
  26108. }
  26109. /**
  26110. * The inline styles of the DOM element.
  26111. */
  26112. // TODO: replace null by undefined in the return type
  26113. get styles() {
  26114. const element = this.nativeElement;
  26115. return element?.style ?? {};
  26116. }
  26117. /**
  26118. * A map containing the class names on the element as keys.
  26119. *
  26120. * This map is derived from the `className` property of the DOM element.
  26121. *
  26122. * Note: The values of this object will always be `true`. The class key will not appear in the KV
  26123. * object if it does not exist on the element.
  26124. *
  26125. * @see [Element.className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
  26126. */
  26127. get classes() {
  26128. const result = {};
  26129. const element = this.nativeElement;
  26130. const className = element.className;
  26131. const classes = typeof className !== "string" ? className.baseVal.split(" ") : className.split(" ");
  26132. classes.forEach((value) => result[value] = true);
  26133. return result;
  26134. }
  26135. /**
  26136. * The `childNodes` of the DOM element as a `DebugNode` array.
  26137. *
  26138. * @see [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
  26139. */
  26140. get childNodes() {
  26141. const childNodes = this.nativeNode.childNodes;
  26142. const children = [];
  26143. for (let i = 0; i < childNodes.length; i++) {
  26144. const element = childNodes[i];
  26145. children.push(getDebugNode(element));
  26146. }
  26147. return children;
  26148. }
  26149. /**
  26150. * The immediate `DebugElement` children. Walk the tree by descending through `children`.
  26151. */
  26152. get children() {
  26153. const nativeElement = this.nativeElement;
  26154. if (!nativeElement) return [];
  26155. const childNodes = nativeElement.children;
  26156. const children = [];
  26157. for (let i = 0; i < childNodes.length; i++) {
  26158. const element = childNodes[i];
  26159. children.push(getDebugNode(element));
  26160. }
  26161. return children;
  26162. }
  26163. /**
  26164. * @returns the first `DebugElement` that matches the predicate at any depth in the subtree.
  26165. */
  26166. query(predicate) {
  26167. const results = this.queryAll(predicate);
  26168. return results[0] || null;
  26169. }
  26170. /**
  26171. * @returns All `DebugElement` matches for the predicate at any depth in the subtree.
  26172. */
  26173. queryAll(predicate) {
  26174. const matches = [];
  26175. _queryAll(this, predicate, matches, true);
  26176. return matches;
  26177. }
  26178. /**
  26179. * @returns All `DebugNode` matches for the predicate at any depth in the subtree.
  26180. */
  26181. queryAllNodes(predicate) {
  26182. const matches = [];
  26183. _queryAll(this, predicate, matches, false);
  26184. return matches;
  26185. }
  26186. /**
  26187. * Triggers the event by its name if there is a corresponding listener in the element's
  26188. * `listeners` collection.
  26189. *
  26190. * If the event lacks a listener or there's some other problem, consider
  26191. * calling `nativeElement.dispatchEvent(eventObject)`.
  26192. *
  26193. * @param eventName The name of the event to trigger
  26194. * @param eventObj The _event object_ expected by the handler
  26195. *
  26196. * @see [Testing components scenarios](guide/testing/components-scenarios#trigger-event-handler)
  26197. */
  26198. triggerEventHandler(eventName, eventObj) {
  26199. const node = this.nativeNode;
  26200. const invokedListeners = [];
  26201. this.listeners.forEach((listener) => {
  26202. if (listener.name === eventName) {
  26203. const callback = listener.callback;
  26204. callback.call(node, eventObj);
  26205. invokedListeners.push(callback);
  26206. }
  26207. });
  26208. if (typeof node.eventListeners === "function") {
  26209. node.eventListeners(eventName).forEach((listener) => {
  26210. if (listener.toString().indexOf("__ngUnwrap__") !== -1) {
  26211. const unwrappedListener = listener("__ngUnwrap__");
  26212. return invokedListeners.indexOf(unwrappedListener) === -1 && unwrappedListener.call(node, eventObj);
  26213. }
  26214. });
  26215. }
  26216. }
  26217. };
  26218. function copyDomProperties(element, properties) {
  26219. if (element) {
  26220. let obj = Object.getPrototypeOf(element);
  26221. const NodePrototype = Node.prototype;
  26222. while (obj !== null && obj !== NodePrototype) {
  26223. const descriptors = Object.getOwnPropertyDescriptors(obj);
  26224. for (let key in descriptors) {
  26225. if (!key.startsWith("__") && !key.startsWith("on")) {
  26226. const value = element[key];
  26227. if (isPrimitiveValue(value)) {
  26228. properties[key] = value;
  26229. }
  26230. }
  26231. }
  26232. obj = Object.getPrototypeOf(obj);
  26233. }
  26234. }
  26235. }
  26236. function isPrimitiveValue(value) {
  26237. return typeof value === "string" || typeof value === "boolean" || typeof value === "number" || value === null;
  26238. }
  26239. function _queryAll(parentElement, predicate, matches, elementsOnly) {
  26240. const context2 = getLContext(parentElement.nativeNode);
  26241. const lView = context2 ? context2.lView : null;
  26242. if (lView !== null) {
  26243. const parentTNode = lView[TVIEW].data[context2.nodeIndex];
  26244. _queryNodeChildren(parentTNode, lView, predicate, matches, elementsOnly, parentElement.nativeNode);
  26245. } else {
  26246. _queryNativeNodeDescendants(parentElement.nativeNode, predicate, matches, elementsOnly);
  26247. }
  26248. }
  26249. function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
  26250. ngDevMode && assertTNodeForLView(tNode, lView);
  26251. const nativeNode = getNativeByTNodeOrNull(tNode, lView);
  26252. if (tNode.type & (3 | 8)) {
  26253. _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
  26254. if (isComponentHost(tNode)) {
  26255. const componentView = getComponentLViewByIndex(tNode.index, lView);
  26256. if (componentView && componentView[TVIEW].firstChild) {
  26257. _queryNodeChildren(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
  26258. }
  26259. } else {
  26260. if (tNode.child) {
  26261. _queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
  26262. }
  26263. nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
  26264. }
  26265. const nodeOrContainer = lView[tNode.index];
  26266. if (isLContainer(nodeOrContainer)) {
  26267. _queryNodeChildrenInContainer(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
  26268. }
  26269. } else if (tNode.type & 4) {
  26270. const lContainer = lView[tNode.index];
  26271. _addQueryMatch(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
  26272. _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode);
  26273. } else if (tNode.type & 16) {
  26274. const componentView = lView[DECLARATION_COMPONENT_VIEW];
  26275. const componentHost = componentView[T_HOST];
  26276. const head = componentHost.projection[tNode.projection];
  26277. if (Array.isArray(head)) {
  26278. for (let nativeNode2 of head) {
  26279. _addQueryMatch(nativeNode2, predicate, matches, elementsOnly, rootNativeNode);
  26280. }
  26281. } else if (head) {
  26282. const nextLView = componentView[PARENT];
  26283. const nextTNode = nextLView[TVIEW].data[head.index];
  26284. _queryNodeChildren(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
  26285. }
  26286. } else if (tNode.child) {
  26287. _queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
  26288. }
  26289. if (rootNativeNode !== nativeNode) {
  26290. const nextTNode = tNode.flags & 2 ? tNode.projectionNext : tNode.next;
  26291. if (nextTNode) {
  26292. _queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
  26293. }
  26294. }
  26295. }
  26296. function _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
  26297. for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
  26298. const childView = lContainer[i];
  26299. const firstChild = childView[TVIEW].firstChild;
  26300. if (firstChild) {
  26301. _queryNodeChildren(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
  26302. }
  26303. }
  26304. }
  26305. function _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
  26306. if (rootNativeNode !== nativeNode) {
  26307. const debugNode = getDebugNode(nativeNode);
  26308. if (!debugNode) {
  26309. return;
  26310. }
  26311. if (elementsOnly && debugNode instanceof DebugElement && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
  26312. matches.push(debugNode);
  26313. } else if (!elementsOnly && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
  26314. matches.push(debugNode);
  26315. }
  26316. }
  26317. }
  26318. function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnly) {
  26319. const nodes = parentNode.childNodes;
  26320. const length = nodes.length;
  26321. for (let i = 0; i < length; i++) {
  26322. const node = nodes[i];
  26323. const debugNode = getDebugNode(node);
  26324. if (debugNode) {
  26325. if (elementsOnly && debugNode instanceof DebugElement && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
  26326. matches.push(debugNode);
  26327. } else if (!elementsOnly && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
  26328. matches.push(debugNode);
  26329. }
  26330. _queryNativeNodeDescendants(node, predicate, matches, elementsOnly);
  26331. }
  26332. }
  26333. }
  26334. function collectPropertyBindings(properties, tNode, lView, tData) {
  26335. let bindingIndexes = tNode.propertyBindings;
  26336. if (bindingIndexes !== null) {
  26337. for (let i = 0; i < bindingIndexes.length; i++) {
  26338. const bindingIndex = bindingIndexes[i];
  26339. const propMetadata = tData[bindingIndex];
  26340. const metadataParts = propMetadata.split(INTERPOLATION_DELIMITER);
  26341. const propertyName = metadataParts[0];
  26342. if (metadataParts.length > 1) {
  26343. let value = metadataParts[1];
  26344. for (let j = 1; j < metadataParts.length - 1; j++) {
  26345. value += renderStringify(lView[bindingIndex + j - 1]) + metadataParts[j + 1];
  26346. }
  26347. properties[propertyName] = value;
  26348. } else {
  26349. properties[propertyName] = lView[bindingIndex];
  26350. }
  26351. }
  26352. }
  26353. }
  26354. var NG_DEBUG_PROPERTY = "__ng_debug__";
  26355. function getDebugNode(nativeNode) {
  26356. if (nativeNode instanceof Node) {
  26357. if (!nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY)) {
  26358. nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ? new DebugElement(nativeNode) : new DebugNode(nativeNode);
  26359. }
  26360. return nativeNode[NG_DEBUG_PROPERTY];
  26361. }
  26362. return null;
  26363. }
  26364. var DefaultIterableDifferFactory = class {
  26365. constructor() {
  26366. }
  26367. supports(obj) {
  26368. return isListLikeIterable(obj);
  26369. }
  26370. create(trackByFn) {
  26371. return new DefaultIterableDiffer(trackByFn);
  26372. }
  26373. };
  26374. var trackByIdentity = (index, item) => item;
  26375. var DefaultIterableDiffer = class {
  26376. length = 0;
  26377. // TODO: confirm the usage of `collection` as it's unused, readonly and on a non public API.
  26378. collection;
  26379. // Keeps track of the used records at any point in time (during & across `_check()` calls)
  26380. _linkedRecords = null;
  26381. // Keeps track of the removed records at any point in time during `_check()` calls.
  26382. _unlinkedRecords = null;
  26383. _previousItHead = null;
  26384. _itHead = null;
  26385. _itTail = null;
  26386. _additionsHead = null;
  26387. _additionsTail = null;
  26388. _movesHead = null;
  26389. _movesTail = null;
  26390. _removalsHead = null;
  26391. _removalsTail = null;
  26392. // Keeps track of records where custom track by is the same, but item identity has changed
  26393. _identityChangesHead = null;
  26394. _identityChangesTail = null;
  26395. _trackByFn;
  26396. constructor(trackByFn) {
  26397. this._trackByFn = trackByFn || trackByIdentity;
  26398. }
  26399. forEachItem(fn) {
  26400. let record;
  26401. for (record = this._itHead; record !== null; record = record._next) {
  26402. fn(record);
  26403. }
  26404. }
  26405. forEachOperation(fn) {
  26406. let nextIt = this._itHead;
  26407. let nextRemove = this._removalsHead;
  26408. let addRemoveOffset = 0;
  26409. let moveOffsets = null;
  26410. while (nextIt || nextRemove) {
  26411. const record = !nextRemove || nextIt && nextIt.currentIndex < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? nextIt : nextRemove;
  26412. const adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
  26413. const currentIndex = record.currentIndex;
  26414. if (record === nextRemove) {
  26415. addRemoveOffset--;
  26416. nextRemove = nextRemove._nextRemoved;
  26417. } else {
  26418. nextIt = nextIt._next;
  26419. if (record.previousIndex == null) {
  26420. addRemoveOffset++;
  26421. } else {
  26422. if (!moveOffsets) moveOffsets = [];
  26423. const localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
  26424. const localCurrentIndex = currentIndex - addRemoveOffset;
  26425. if (localMovePreviousIndex != localCurrentIndex) {
  26426. for (let i = 0; i < localMovePreviousIndex; i++) {
  26427. const offset = i < moveOffsets.length ? moveOffsets[i] : moveOffsets[i] = 0;
  26428. const index = offset + i;
  26429. if (localCurrentIndex <= index && index < localMovePreviousIndex) {
  26430. moveOffsets[i] = offset + 1;
  26431. }
  26432. }
  26433. const previousIndex = record.previousIndex;
  26434. moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
  26435. }
  26436. }
  26437. }
  26438. if (adjPreviousIndex !== currentIndex) {
  26439. fn(record, adjPreviousIndex, currentIndex);
  26440. }
  26441. }
  26442. }
  26443. forEachPreviousItem(fn) {
  26444. let record;
  26445. for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
  26446. fn(record);
  26447. }
  26448. }
  26449. forEachAddedItem(fn) {
  26450. let record;
  26451. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  26452. fn(record);
  26453. }
  26454. }
  26455. forEachMovedItem(fn) {
  26456. let record;
  26457. for (record = this._movesHead; record !== null; record = record._nextMoved) {
  26458. fn(record);
  26459. }
  26460. }
  26461. forEachRemovedItem(fn) {
  26462. let record;
  26463. for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
  26464. fn(record);
  26465. }
  26466. }
  26467. forEachIdentityChange(fn) {
  26468. let record;
  26469. for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
  26470. fn(record);
  26471. }
  26472. }
  26473. diff(collection) {
  26474. if (collection == null) collection = [];
  26475. if (!isListLikeIterable(collection)) {
  26476. throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
  26477. }
  26478. if (this.check(collection)) {
  26479. return this;
  26480. } else {
  26481. return null;
  26482. }
  26483. }
  26484. onDestroy() {
  26485. }
  26486. check(collection) {
  26487. this._reset();
  26488. let record = this._itHead;
  26489. let mayBeDirty = false;
  26490. let index;
  26491. let item;
  26492. let itemTrackBy;
  26493. if (Array.isArray(collection)) {
  26494. this.length = collection.length;
  26495. for (let index2 = 0; index2 < this.length; index2++) {
  26496. item = collection[index2];
  26497. itemTrackBy = this._trackByFn(index2, item);
  26498. if (record === null || !Object.is(record.trackById, itemTrackBy)) {
  26499. record = this._mismatch(record, item, itemTrackBy, index2);
  26500. mayBeDirty = true;
  26501. } else {
  26502. if (mayBeDirty) {
  26503. record = this._verifyReinsertion(record, item, itemTrackBy, index2);
  26504. }
  26505. if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
  26506. }
  26507. record = record._next;
  26508. }
  26509. } else {
  26510. index = 0;
  26511. iterateListLike(collection, (item2) => {
  26512. itemTrackBy = this._trackByFn(index, item2);
  26513. if (record === null || !Object.is(record.trackById, itemTrackBy)) {
  26514. record = this._mismatch(record, item2, itemTrackBy, index);
  26515. mayBeDirty = true;
  26516. } else {
  26517. if (mayBeDirty) {
  26518. record = this._verifyReinsertion(record, item2, itemTrackBy, index);
  26519. }
  26520. if (!Object.is(record.item, item2)) this._addIdentityChange(record, item2);
  26521. }
  26522. record = record._next;
  26523. index++;
  26524. });
  26525. this.length = index;
  26526. }
  26527. this._truncate(record);
  26528. this.collection = collection;
  26529. return this.isDirty;
  26530. }
  26531. /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
  26532. * changes.
  26533. */
  26534. get isDirty() {
  26535. return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null;
  26536. }
  26537. /**
  26538. * Reset the state of the change objects to show no changes. This means set previousKey to
  26539. * currentKey, and clear all of the queues (additions, moves, removals).
  26540. * Set the previousIndexes of moved and added items to their currentIndexes
  26541. * Reset the list of additions, moves and removals
  26542. *
  26543. * @internal
  26544. */
  26545. _reset() {
  26546. if (this.isDirty) {
  26547. let record;
  26548. for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
  26549. record._nextPrevious = record._next;
  26550. }
  26551. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  26552. record.previousIndex = record.currentIndex;
  26553. }
  26554. this._additionsHead = this._additionsTail = null;
  26555. for (record = this._movesHead; record !== null; record = record._nextMoved) {
  26556. record.previousIndex = record.currentIndex;
  26557. }
  26558. this._movesHead = this._movesTail = null;
  26559. this._removalsHead = this._removalsTail = null;
  26560. this._identityChangesHead = this._identityChangesTail = null;
  26561. }
  26562. }
  26563. /**
  26564. * This is the core function which handles differences between collections.
  26565. *
  26566. * - `record` is the record which we saw at this position last time. If null then it is a new
  26567. * item.
  26568. * - `item` is the current item in the collection
  26569. * - `index` is the position of the item in the collection
  26570. *
  26571. * @internal
  26572. */
  26573. _mismatch(record, item, itemTrackBy, index) {
  26574. let previousRecord;
  26575. if (record === null) {
  26576. previousRecord = this._itTail;
  26577. } else {
  26578. previousRecord = record._prev;
  26579. this._remove(record);
  26580. }
  26581. record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
  26582. if (record !== null) {
  26583. if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
  26584. this._reinsertAfter(record, previousRecord, index);
  26585. } else {
  26586. record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
  26587. if (record !== null) {
  26588. if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
  26589. this._moveAfter(record, previousRecord, index);
  26590. } else {
  26591. record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
  26592. }
  26593. }
  26594. return record;
  26595. }
  26596. /**
  26597. * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
  26598. *
  26599. * Use case: `[a, a]` => `[b, a, a]`
  26600. *
  26601. * If we did not have this check then the insertion of `b` would:
  26602. * 1) evict first `a`
  26603. * 2) insert `b` at `0` index.
  26604. * 3) leave `a` at index `1` as is. <-- this is wrong!
  26605. * 3) reinsert `a` at index 2. <-- this is wrong!
  26606. *
  26607. * The correct behavior is:
  26608. * 1) evict first `a`
  26609. * 2) insert `b` at `0` index.
  26610. * 3) reinsert `a` at index 1.
  26611. * 3) move `a` at from `1` to `2`.
  26612. *
  26613. *
  26614. * Double check that we have not evicted a duplicate item. We need to check if the item type may
  26615. * have already been removed:
  26616. * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
  26617. * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
  26618. * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
  26619. * at the end.
  26620. *
  26621. * @internal
  26622. */
  26623. _verifyReinsertion(record, item, itemTrackBy, index) {
  26624. let reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
  26625. if (reinsertRecord !== null) {
  26626. record = this._reinsertAfter(reinsertRecord, record._prev, index);
  26627. } else if (record.currentIndex != index) {
  26628. record.currentIndex = index;
  26629. this._addToMoves(record, index);
  26630. }
  26631. return record;
  26632. }
  26633. /**
  26634. * Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
  26635. *
  26636. * - `record` The first excess {@link IterableChangeRecord_}.
  26637. *
  26638. * @internal
  26639. */
  26640. _truncate(record) {
  26641. while (record !== null) {
  26642. const nextRecord = record._next;
  26643. this._addToRemovals(this._unlink(record));
  26644. record = nextRecord;
  26645. }
  26646. if (this._unlinkedRecords !== null) {
  26647. this._unlinkedRecords.clear();
  26648. }
  26649. if (this._additionsTail !== null) {
  26650. this._additionsTail._nextAdded = null;
  26651. }
  26652. if (this._movesTail !== null) {
  26653. this._movesTail._nextMoved = null;
  26654. }
  26655. if (this._itTail !== null) {
  26656. this._itTail._next = null;
  26657. }
  26658. if (this._removalsTail !== null) {
  26659. this._removalsTail._nextRemoved = null;
  26660. }
  26661. if (this._identityChangesTail !== null) {
  26662. this._identityChangesTail._nextIdentityChange = null;
  26663. }
  26664. }
  26665. /** @internal */
  26666. _reinsertAfter(record, prevRecord, index) {
  26667. if (this._unlinkedRecords !== null) {
  26668. this._unlinkedRecords.remove(record);
  26669. }
  26670. const prev = record._prevRemoved;
  26671. const next = record._nextRemoved;
  26672. if (prev === null) {
  26673. this._removalsHead = next;
  26674. } else {
  26675. prev._nextRemoved = next;
  26676. }
  26677. if (next === null) {
  26678. this._removalsTail = prev;
  26679. } else {
  26680. next._prevRemoved = prev;
  26681. }
  26682. this._insertAfter(record, prevRecord, index);
  26683. this._addToMoves(record, index);
  26684. return record;
  26685. }
  26686. /** @internal */
  26687. _moveAfter(record, prevRecord, index) {
  26688. this._unlink(record);
  26689. this._insertAfter(record, prevRecord, index);
  26690. this._addToMoves(record, index);
  26691. return record;
  26692. }
  26693. /** @internal */
  26694. _addAfter(record, prevRecord, index) {
  26695. this._insertAfter(record, prevRecord, index);
  26696. if (this._additionsTail === null) {
  26697. this._additionsTail = this._additionsHead = record;
  26698. } else {
  26699. this._additionsTail = this._additionsTail._nextAdded = record;
  26700. }
  26701. return record;
  26702. }
  26703. /** @internal */
  26704. _insertAfter(record, prevRecord, index) {
  26705. const next = prevRecord === null ? this._itHead : prevRecord._next;
  26706. record._next = next;
  26707. record._prev = prevRecord;
  26708. if (next === null) {
  26709. this._itTail = record;
  26710. } else {
  26711. next._prev = record;
  26712. }
  26713. if (prevRecord === null) {
  26714. this._itHead = record;
  26715. } else {
  26716. prevRecord._next = record;
  26717. }
  26718. if (this._linkedRecords === null) {
  26719. this._linkedRecords = new _DuplicateMap();
  26720. }
  26721. this._linkedRecords.put(record);
  26722. record.currentIndex = index;
  26723. return record;
  26724. }
  26725. /** @internal */
  26726. _remove(record) {
  26727. return this._addToRemovals(this._unlink(record));
  26728. }
  26729. /** @internal */
  26730. _unlink(record) {
  26731. if (this._linkedRecords !== null) {
  26732. this._linkedRecords.remove(record);
  26733. }
  26734. const prev = record._prev;
  26735. const next = record._next;
  26736. if (prev === null) {
  26737. this._itHead = next;
  26738. } else {
  26739. prev._next = next;
  26740. }
  26741. if (next === null) {
  26742. this._itTail = prev;
  26743. } else {
  26744. next._prev = prev;
  26745. }
  26746. return record;
  26747. }
  26748. /** @internal */
  26749. _addToMoves(record, toIndex) {
  26750. if (record.previousIndex === toIndex) {
  26751. return record;
  26752. }
  26753. if (this._movesTail === null) {
  26754. this._movesTail = this._movesHead = record;
  26755. } else {
  26756. this._movesTail = this._movesTail._nextMoved = record;
  26757. }
  26758. return record;
  26759. }
  26760. _addToRemovals(record) {
  26761. if (this._unlinkedRecords === null) {
  26762. this._unlinkedRecords = new _DuplicateMap();
  26763. }
  26764. this._unlinkedRecords.put(record);
  26765. record.currentIndex = null;
  26766. record._nextRemoved = null;
  26767. if (this._removalsTail === null) {
  26768. this._removalsTail = this._removalsHead = record;
  26769. record._prevRemoved = null;
  26770. } else {
  26771. record._prevRemoved = this._removalsTail;
  26772. this._removalsTail = this._removalsTail._nextRemoved = record;
  26773. }
  26774. return record;
  26775. }
  26776. /** @internal */
  26777. _addIdentityChange(record, item) {
  26778. record.item = item;
  26779. if (this._identityChangesTail === null) {
  26780. this._identityChangesTail = this._identityChangesHead = record;
  26781. } else {
  26782. this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
  26783. }
  26784. return record;
  26785. }
  26786. };
  26787. var IterableChangeRecord_ = class {
  26788. item;
  26789. trackById;
  26790. currentIndex = null;
  26791. previousIndex = null;
  26792. /** @internal */
  26793. _nextPrevious = null;
  26794. /** @internal */
  26795. _prev = null;
  26796. /** @internal */
  26797. _next = null;
  26798. /** @internal */
  26799. _prevDup = null;
  26800. /** @internal */
  26801. _nextDup = null;
  26802. /** @internal */
  26803. _prevRemoved = null;
  26804. /** @internal */
  26805. _nextRemoved = null;
  26806. /** @internal */
  26807. _nextAdded = null;
  26808. /** @internal */
  26809. _nextMoved = null;
  26810. /** @internal */
  26811. _nextIdentityChange = null;
  26812. constructor(item, trackById) {
  26813. this.item = item;
  26814. this.trackById = trackById;
  26815. }
  26816. };
  26817. var _DuplicateItemRecordList = class {
  26818. /** @internal */
  26819. _head = null;
  26820. /** @internal */
  26821. _tail = null;
  26822. /**
  26823. * Append the record to the list of duplicates.
  26824. *
  26825. * Note: by design all records in the list of duplicates hold the same value in record.item.
  26826. */
  26827. add(record) {
  26828. if (this._head === null) {
  26829. this._head = this._tail = record;
  26830. record._nextDup = null;
  26831. record._prevDup = null;
  26832. } else {
  26833. this._tail._nextDup = record;
  26834. record._prevDup = this._tail;
  26835. record._nextDup = null;
  26836. this._tail = record;
  26837. }
  26838. }
  26839. // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
  26840. // IterableChangeRecord_.currentIndex >= atOrAfterIndex
  26841. get(trackById, atOrAfterIndex) {
  26842. let record;
  26843. for (record = this._head; record !== null; record = record._nextDup) {
  26844. if ((atOrAfterIndex === null || atOrAfterIndex <= record.currentIndex) && Object.is(record.trackById, trackById)) {
  26845. return record;
  26846. }
  26847. }
  26848. return null;
  26849. }
  26850. /**
  26851. * Remove one {@link IterableChangeRecord_} from the list of duplicates.
  26852. *
  26853. * Returns whether the list of duplicates is empty.
  26854. */
  26855. remove(record) {
  26856. const prev = record._prevDup;
  26857. const next = record._nextDup;
  26858. if (prev === null) {
  26859. this._head = next;
  26860. } else {
  26861. prev._nextDup = next;
  26862. }
  26863. if (next === null) {
  26864. this._tail = prev;
  26865. } else {
  26866. next._prevDup = prev;
  26867. }
  26868. return this._head === null;
  26869. }
  26870. };
  26871. var _DuplicateMap = class {
  26872. map = /* @__PURE__ */ new Map();
  26873. put(record) {
  26874. const key = record.trackById;
  26875. let duplicates = this.map.get(key);
  26876. if (!duplicates) {
  26877. duplicates = new _DuplicateItemRecordList();
  26878. this.map.set(key, duplicates);
  26879. }
  26880. duplicates.add(record);
  26881. }
  26882. /**
  26883. * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
  26884. * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
  26885. *
  26886. * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
  26887. * have any more `a`s needs to return the second `a`.
  26888. */
  26889. get(trackById, atOrAfterIndex) {
  26890. const key = trackById;
  26891. const recordList = this.map.get(key);
  26892. return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
  26893. }
  26894. /**
  26895. * Removes a {@link IterableChangeRecord_} from the list of duplicates.
  26896. *
  26897. * The list of duplicates also is removed from the map if it gets empty.
  26898. */
  26899. remove(record) {
  26900. const key = record.trackById;
  26901. const recordList = this.map.get(key);
  26902. if (recordList.remove(record)) {
  26903. this.map.delete(key);
  26904. }
  26905. return record;
  26906. }
  26907. get isEmpty() {
  26908. return this.map.size === 0;
  26909. }
  26910. clear() {
  26911. this.map.clear();
  26912. }
  26913. };
  26914. function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
  26915. const previousIndex = item.previousIndex;
  26916. if (previousIndex === null) return previousIndex;
  26917. let moveOffset = 0;
  26918. if (moveOffsets && previousIndex < moveOffsets.length) {
  26919. moveOffset = moveOffsets[previousIndex];
  26920. }
  26921. return previousIndex + addRemoveOffset + moveOffset;
  26922. }
  26923. var DefaultKeyValueDifferFactory = class {
  26924. constructor() {
  26925. }
  26926. supports(obj) {
  26927. return obj instanceof Map || isJsObject(obj);
  26928. }
  26929. create() {
  26930. return new DefaultKeyValueDiffer();
  26931. }
  26932. };
  26933. var DefaultKeyValueDiffer = class {
  26934. _records = /* @__PURE__ */ new Map();
  26935. _mapHead = null;
  26936. // _appendAfter is used in the check loop
  26937. _appendAfter = null;
  26938. _previousMapHead = null;
  26939. _changesHead = null;
  26940. _changesTail = null;
  26941. _additionsHead = null;
  26942. _additionsTail = null;
  26943. _removalsHead = null;
  26944. _removalsTail = null;
  26945. get isDirty() {
  26946. return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null;
  26947. }
  26948. forEachItem(fn) {
  26949. let record;
  26950. for (record = this._mapHead; record !== null; record = record._next) {
  26951. fn(record);
  26952. }
  26953. }
  26954. forEachPreviousItem(fn) {
  26955. let record;
  26956. for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
  26957. fn(record);
  26958. }
  26959. }
  26960. forEachChangedItem(fn) {
  26961. let record;
  26962. for (record = this._changesHead; record !== null; record = record._nextChanged) {
  26963. fn(record);
  26964. }
  26965. }
  26966. forEachAddedItem(fn) {
  26967. let record;
  26968. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  26969. fn(record);
  26970. }
  26971. }
  26972. forEachRemovedItem(fn) {
  26973. let record;
  26974. for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
  26975. fn(record);
  26976. }
  26977. }
  26978. diff(map2) {
  26979. if (!map2) {
  26980. map2 = /* @__PURE__ */ new Map();
  26981. } else if (!(map2 instanceof Map || isJsObject(map2))) {
  26982. throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(map2)}'. Only maps and objects are allowed`);
  26983. }
  26984. return this.check(map2) ? this : null;
  26985. }
  26986. onDestroy() {
  26987. }
  26988. /**
  26989. * Check the current state of the map vs the previous.
  26990. * The algorithm is optimised for when the keys do no change.
  26991. */
  26992. check(map2) {
  26993. this._reset();
  26994. let insertBefore = this._mapHead;
  26995. this._appendAfter = null;
  26996. this._forEach(map2, (value, key) => {
  26997. if (insertBefore && insertBefore.key === key) {
  26998. this._maybeAddToChanges(insertBefore, value);
  26999. this._appendAfter = insertBefore;
  27000. insertBefore = insertBefore._next;
  27001. } else {
  27002. const record = this._getOrCreateRecordForKey(key, value);
  27003. insertBefore = this._insertBeforeOrAppend(insertBefore, record);
  27004. }
  27005. });
  27006. if (insertBefore) {
  27007. if (insertBefore._prev) {
  27008. insertBefore._prev._next = null;
  27009. }
  27010. this._removalsHead = insertBefore;
  27011. for (let record = insertBefore; record !== null; record = record._nextRemoved) {
  27012. if (record === this._mapHead) {
  27013. this._mapHead = null;
  27014. }
  27015. this._records.delete(record.key);
  27016. record._nextRemoved = record._next;
  27017. record.previousValue = record.currentValue;
  27018. record.currentValue = null;
  27019. record._prev = null;
  27020. record._next = null;
  27021. }
  27022. }
  27023. if (this._changesTail) this._changesTail._nextChanged = null;
  27024. if (this._additionsTail) this._additionsTail._nextAdded = null;
  27025. return this.isDirty;
  27026. }
  27027. /**
  27028. * Inserts a record before `before` or append at the end of the list when `before` is null.
  27029. *
  27030. * Notes:
  27031. * - This method appends at `this._appendAfter`,
  27032. * - This method updates `this._appendAfter`,
  27033. * - The return value is the new value for the insertion pointer.
  27034. */
  27035. _insertBeforeOrAppend(before, record) {
  27036. if (before) {
  27037. const prev = before._prev;
  27038. record._next = before;
  27039. record._prev = prev;
  27040. before._prev = record;
  27041. if (prev) {
  27042. prev._next = record;
  27043. }
  27044. if (before === this._mapHead) {
  27045. this._mapHead = record;
  27046. }
  27047. this._appendAfter = before;
  27048. return before;
  27049. }
  27050. if (this._appendAfter) {
  27051. this._appendAfter._next = record;
  27052. record._prev = this._appendAfter;
  27053. } else {
  27054. this._mapHead = record;
  27055. }
  27056. this._appendAfter = record;
  27057. return null;
  27058. }
  27059. _getOrCreateRecordForKey(key, value) {
  27060. if (this._records.has(key)) {
  27061. const record2 = this._records.get(key);
  27062. this._maybeAddToChanges(record2, value);
  27063. const prev = record2._prev;
  27064. const next = record2._next;
  27065. if (prev) {
  27066. prev._next = next;
  27067. }
  27068. if (next) {
  27069. next._prev = prev;
  27070. }
  27071. record2._next = null;
  27072. record2._prev = null;
  27073. return record2;
  27074. }
  27075. const record = new KeyValueChangeRecord_(key);
  27076. this._records.set(key, record);
  27077. record.currentValue = value;
  27078. this._addToAdditions(record);
  27079. return record;
  27080. }
  27081. /** @internal */
  27082. _reset() {
  27083. if (this.isDirty) {
  27084. let record;
  27085. this._previousMapHead = this._mapHead;
  27086. for (record = this._previousMapHead; record !== null; record = record._next) {
  27087. record._nextPrevious = record._next;
  27088. }
  27089. for (record = this._changesHead; record !== null; record = record._nextChanged) {
  27090. record.previousValue = record.currentValue;
  27091. }
  27092. for (record = this._additionsHead; record != null; record = record._nextAdded) {
  27093. record.previousValue = record.currentValue;
  27094. }
  27095. this._changesHead = this._changesTail = null;
  27096. this._additionsHead = this._additionsTail = null;
  27097. this._removalsHead = null;
  27098. }
  27099. }
  27100. // Add the record or a given key to the list of changes only when the value has actually changed
  27101. _maybeAddToChanges(record, newValue) {
  27102. if (!Object.is(newValue, record.currentValue)) {
  27103. record.previousValue = record.currentValue;
  27104. record.currentValue = newValue;
  27105. this._addToChanges(record);
  27106. }
  27107. }
  27108. _addToAdditions(record) {
  27109. if (this._additionsHead === null) {
  27110. this._additionsHead = this._additionsTail = record;
  27111. } else {
  27112. this._additionsTail._nextAdded = record;
  27113. this._additionsTail = record;
  27114. }
  27115. }
  27116. _addToChanges(record) {
  27117. if (this._changesHead === null) {
  27118. this._changesHead = this._changesTail = record;
  27119. } else {
  27120. this._changesTail._nextChanged = record;
  27121. this._changesTail = record;
  27122. }
  27123. }
  27124. /** @internal */
  27125. _forEach(obj, fn) {
  27126. if (obj instanceof Map) {
  27127. obj.forEach(fn);
  27128. } else {
  27129. Object.keys(obj).forEach((k) => fn(obj[k], k));
  27130. }
  27131. }
  27132. };
  27133. var KeyValueChangeRecord_ = class {
  27134. key;
  27135. previousValue = null;
  27136. currentValue = null;
  27137. /** @internal */
  27138. _nextPrevious = null;
  27139. /** @internal */
  27140. _next = null;
  27141. /** @internal */
  27142. _prev = null;
  27143. /** @internal */
  27144. _nextAdded = null;
  27145. /** @internal */
  27146. _nextRemoved = null;
  27147. /** @internal */
  27148. _nextChanged = null;
  27149. constructor(key) {
  27150. this.key = key;
  27151. }
  27152. };
  27153. function defaultIterableDiffersFactory() {
  27154. return new IterableDiffers([new DefaultIterableDifferFactory()]);
  27155. }
  27156. var IterableDiffers = class _IterableDiffers {
  27157. factories;
  27158. /** @nocollapse */
  27159. static ɵprov = (
  27160. /** @pureOrBreakMyCode */
  27161. ɵɵdefineInjectable({
  27162. token: _IterableDiffers,
  27163. providedIn: "root",
  27164. factory: defaultIterableDiffersFactory
  27165. })
  27166. );
  27167. constructor(factories) {
  27168. this.factories = factories;
  27169. }
  27170. static create(factories, parent) {
  27171. if (parent != null) {
  27172. const copied = parent.factories.slice();
  27173. factories = factories.concat(copied);
  27174. }
  27175. return new _IterableDiffers(factories);
  27176. }
  27177. /**
  27178. * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
  27179. * inherited {@link IterableDiffers} instance with the provided factories and return a new
  27180. * {@link IterableDiffers} instance.
  27181. *
  27182. * @usageNotes
  27183. * ### Example
  27184. *
  27185. * The following example shows how to extend an existing list of factories,
  27186. * which will only be applied to the injector for this component and its children.
  27187. * This step is all that's required to make a new {@link IterableDiffer} available.
  27188. *
  27189. * ```ts
  27190. * @Component({
  27191. * viewProviders: [
  27192. * IterableDiffers.extend([new ImmutableListDiffer()])
  27193. * ]
  27194. * })
  27195. * ```
  27196. */
  27197. static extend(factories) {
  27198. return {
  27199. provide: _IterableDiffers,
  27200. useFactory: (parent) => {
  27201. return _IterableDiffers.create(factories, parent || defaultIterableDiffersFactory());
  27202. },
  27203. // Dependency technically isn't optional, but we can provide a better error message this way.
  27204. deps: [[_IterableDiffers, new SkipSelf(), new Optional()]]
  27205. };
  27206. }
  27207. find(iterable) {
  27208. const factory = this.factories.find((f) => f.supports(iterable));
  27209. if (factory != null) {
  27210. return factory;
  27211. } else {
  27212. throw new RuntimeError(901, ngDevMode && `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
  27213. }
  27214. }
  27215. };
  27216. function getTypeNameForDebugging(type) {
  27217. return type["name"] || typeof type;
  27218. }
  27219. function defaultKeyValueDiffersFactory() {
  27220. return new KeyValueDiffers([new DefaultKeyValueDifferFactory()]);
  27221. }
  27222. var KeyValueDiffers = class _KeyValueDiffers {
  27223. /** @nocollapse */
  27224. static ɵprov = (
  27225. /** @pureOrBreakMyCode */
  27226. ɵɵdefineInjectable({
  27227. token: _KeyValueDiffers,
  27228. providedIn: "root",
  27229. factory: defaultKeyValueDiffersFactory
  27230. })
  27231. );
  27232. factories;
  27233. constructor(factories) {
  27234. this.factories = factories;
  27235. }
  27236. static create(factories, parent) {
  27237. if (parent) {
  27238. const copied = parent.factories.slice();
  27239. factories = factories.concat(copied);
  27240. }
  27241. return new _KeyValueDiffers(factories);
  27242. }
  27243. /**
  27244. * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
  27245. * inherited {@link KeyValueDiffers} instance with the provided factories and return a new
  27246. * {@link KeyValueDiffers} instance.
  27247. *
  27248. * @usageNotes
  27249. * ### Example
  27250. *
  27251. * The following example shows how to extend an existing list of factories,
  27252. * which will only be applied to the injector for this component and its children.
  27253. * This step is all that's required to make a new {@link KeyValueDiffer} available.
  27254. *
  27255. * ```ts
  27256. * @Component({
  27257. * viewProviders: [
  27258. * KeyValueDiffers.extend([new ImmutableMapDiffer()])
  27259. * ]
  27260. * })
  27261. * ```
  27262. */
  27263. static extend(factories) {
  27264. return {
  27265. provide: _KeyValueDiffers,
  27266. useFactory: (parent) => {
  27267. return _KeyValueDiffers.create(factories, parent || defaultKeyValueDiffersFactory());
  27268. },
  27269. // Dependency technically isn't optional, but we can provide a better error message this way.
  27270. deps: [[_KeyValueDiffers, new SkipSelf(), new Optional()]]
  27271. };
  27272. }
  27273. find(kv) {
  27274. const factory = this.factories.find((f) => f.supports(kv));
  27275. if (factory) {
  27276. return factory;
  27277. }
  27278. throw new RuntimeError(901, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
  27279. }
  27280. };
  27281. var keyValDiff = [new DefaultKeyValueDifferFactory()];
  27282. var iterableDiff = [new DefaultIterableDifferFactory()];
  27283. var defaultIterableDiffers = new IterableDiffers(iterableDiff);
  27284. var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
  27285. var platformCore = createPlatformFactory(null, "core", []);
  27286. var ApplicationModule = class _ApplicationModule {
  27287. // Inject ApplicationRef to make it eager...
  27288. constructor(appRef) {
  27289. }
  27290. static ɵfac = function ApplicationModule_Factory(__ngFactoryType__) {
  27291. return new (__ngFactoryType__ || _ApplicationModule)(ɵɵinject(ApplicationRef));
  27292. };
  27293. static ɵmod = ɵɵdefineNgModule({
  27294. type: _ApplicationModule
  27295. });
  27296. static ɵinj = ɵɵdefineInjector({});
  27297. };
  27298. (() => {
  27299. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationModule, [{
  27300. type: NgModule
  27301. }], () => [{
  27302. type: ApplicationRef
  27303. }], null);
  27304. })();
  27305. function internalCreateApplication(config2) {
  27306. profiler(
  27307. 8
  27308. /* ProfilerEvent.BootstrapApplicationStart */
  27309. );
  27310. try {
  27311. const {
  27312. rootComponent,
  27313. appProviders,
  27314. platformProviders
  27315. } = config2;
  27316. if ((typeof ngDevMode === "undefined" || ngDevMode) && rootComponent !== void 0) {
  27317. assertStandaloneComponentType(rootComponent);
  27318. }
  27319. const platformInjector = createOrReusePlatformInjector(platformProviders);
  27320. const allAppProviders = [internalProvideZoneChangeDetection({}), {
  27321. provide: ChangeDetectionScheduler,
  27322. useExisting: ChangeDetectionSchedulerImpl
  27323. }, ...appProviders || []];
  27324. const adapter = new EnvironmentNgModuleRefAdapter({
  27325. providers: allAppProviders,
  27326. parent: platformInjector,
  27327. debugName: typeof ngDevMode === "undefined" || ngDevMode ? "Environment Injector" : "",
  27328. // We skip environment initializers because we need to run them inside the NgZone, which
  27329. // happens after we get the NgZone instance from the Injector.
  27330. runEnvironmentInitializers: false
  27331. });
  27332. return bootstrap({
  27333. r3Injector: adapter.injector,
  27334. platformInjector,
  27335. rootComponent
  27336. });
  27337. } catch (e) {
  27338. return Promise.reject(e);
  27339. } finally {
  27340. profiler(
  27341. 9
  27342. /* ProfilerEvent.BootstrapApplicationEnd */
  27343. );
  27344. }
  27345. }
  27346. var appsWithEventReplay = /* @__PURE__ */ new WeakSet();
  27347. var EAGER_CONTENT_LISTENERS_KEY = "";
  27348. var blockEventQueue = [];
  27349. function shouldEnableEventReplay(injector) {
  27350. return injector.get(IS_EVENT_REPLAY_ENABLED, EVENT_REPLAY_ENABLED_DEFAULT);
  27351. }
  27352. function withEventReplay() {
  27353. const providers = [{
  27354. provide: IS_EVENT_REPLAY_ENABLED,
  27355. useFactory: () => {
  27356. let isEnabled = true;
  27357. if (true) {
  27358. const appId = inject(APP_ID);
  27359. isEnabled = !!window._ejsas?.[appId];
  27360. }
  27361. if (isEnabled) {
  27362. performanceMarkFeature("NgEventReplay");
  27363. }
  27364. return isEnabled;
  27365. }
  27366. }];
  27367. if (true) {
  27368. providers.push({
  27369. provide: ENVIRONMENT_INITIALIZER,
  27370. useValue: () => {
  27371. const appRef = inject(ApplicationRef);
  27372. const {
  27373. injector
  27374. } = appRef;
  27375. if (!appsWithEventReplay.has(appRef)) {
  27376. const jsActionMap = inject(JSACTION_BLOCK_ELEMENT_MAP);
  27377. if (shouldEnableEventReplay(injector)) {
  27378. setStashFn((rEl, eventName, listenerFn) => {
  27379. if (rEl.nodeType !== Node.ELEMENT_NODE) return;
  27380. sharedStashFunction(rEl, eventName, listenerFn);
  27381. sharedMapFunction(rEl, jsActionMap);
  27382. });
  27383. }
  27384. }
  27385. },
  27386. multi: true
  27387. }, {
  27388. provide: APP_BOOTSTRAP_LISTENER,
  27389. useFactory: () => {
  27390. const appId = inject(APP_ID);
  27391. const appRef = inject(ApplicationRef);
  27392. const {
  27393. injector
  27394. } = appRef;
  27395. return () => {
  27396. if (!shouldEnableEventReplay(injector) || appsWithEventReplay.has(appRef)) {
  27397. return;
  27398. }
  27399. appsWithEventReplay.add(appRef);
  27400. appRef.onDestroy(() => {
  27401. appsWithEventReplay.delete(appRef);
  27402. if (true) {
  27403. clearAppScopedEarlyEventContract(appId);
  27404. setStashFn(() => {
  27405. });
  27406. }
  27407. });
  27408. appRef.whenStable().then(() => {
  27409. if (appRef.destroyed) {
  27410. return;
  27411. }
  27412. const eventContractDetails = injector.get(JSACTION_EVENT_CONTRACT);
  27413. initEventReplay(eventContractDetails, injector);
  27414. const jsActionMap = injector.get(JSACTION_BLOCK_ELEMENT_MAP);
  27415. jsActionMap.get(EAGER_CONTENT_LISTENERS_KEY)?.forEach(removeListeners);
  27416. jsActionMap.delete(EAGER_CONTENT_LISTENERS_KEY);
  27417. const eventContract = eventContractDetails.instance;
  27418. if (isIncrementalHydrationEnabled(injector)) {
  27419. appRef.onDestroy(() => eventContract.cleanUp());
  27420. } else {
  27421. eventContract.cleanUp();
  27422. }
  27423. });
  27424. };
  27425. },
  27426. multi: true
  27427. });
  27428. }
  27429. return providers;
  27430. }
  27431. var initEventReplay = (eventDelegation, injector) => {
  27432. const appId = injector.get(APP_ID);
  27433. const earlyJsactionData = window._ejsas[appId];
  27434. const eventContract = eventDelegation.instance = new EventContract(new EventContractContainer(earlyJsactionData.c));
  27435. for (const et of earlyJsactionData.et) {
  27436. eventContract.addEvent(et);
  27437. }
  27438. for (const et of earlyJsactionData.etc) {
  27439. eventContract.addEvent(et);
  27440. }
  27441. const eventInfos = getAppScopedQueuedEventInfos(appId);
  27442. eventContract.replayEarlyEventInfos(eventInfos);
  27443. clearAppScopedEarlyEventContract(appId);
  27444. const dispatcher = new EventDispatcher((event) => {
  27445. invokeRegisteredReplayListeners(injector, event, event.currentTarget);
  27446. });
  27447. registerDispatcher$1(eventContract, dispatcher);
  27448. };
  27449. function collectDomEventsInfo(tView, lView, eventTypesToReplay) {
  27450. const domEventsInfo = /* @__PURE__ */ new Map();
  27451. const lCleanup = lView[CLEANUP];
  27452. const tCleanup = tView.cleanup;
  27453. if (!tCleanup || !lCleanup) {
  27454. return domEventsInfo;
  27455. }
  27456. for (let i = 0; i < tCleanup.length; ) {
  27457. const firstParam = tCleanup[i++];
  27458. const secondParam = tCleanup[i++];
  27459. if (typeof firstParam !== "string") {
  27460. continue;
  27461. }
  27462. const eventType = firstParam;
  27463. if (!isEarlyEventType(eventType)) {
  27464. continue;
  27465. }
  27466. if (isCaptureEventType(eventType)) {
  27467. eventTypesToReplay.capture.add(eventType);
  27468. } else {
  27469. eventTypesToReplay.regular.add(eventType);
  27470. }
  27471. const listenerElement = unwrapRNode(lView[secondParam]);
  27472. i++;
  27473. const useCaptureOrIndx = tCleanup[i++];
  27474. const isDomEvent = typeof useCaptureOrIndx === "boolean" || useCaptureOrIndx >= 0;
  27475. if (!isDomEvent) {
  27476. continue;
  27477. }
  27478. if (!domEventsInfo.has(listenerElement)) {
  27479. domEventsInfo.set(listenerElement, [eventType]);
  27480. } else {
  27481. domEventsInfo.get(listenerElement).push(eventType);
  27482. }
  27483. }
  27484. return domEventsInfo;
  27485. }
  27486. function invokeRegisteredReplayListeners(injector, event, currentTarget) {
  27487. const blockName = (currentTarget && currentTarget.getAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE)) ?? "";
  27488. if (/d\d+/.test(blockName)) {
  27489. hydrateAndInvokeBlockListeners(blockName, injector, event, currentTarget);
  27490. } else if (event.eventPhase === EventPhase.REPLAY) {
  27491. invokeListeners(event, currentTarget);
  27492. }
  27493. }
  27494. function hydrateAndInvokeBlockListeners(blockName, injector, event, currentTarget) {
  27495. blockEventQueue.push({
  27496. event,
  27497. currentTarget
  27498. });
  27499. triggerHydrationFromBlockName(injector, blockName, replayQueuedBlockEvents);
  27500. }
  27501. function replayQueuedBlockEvents(hydratedBlocks) {
  27502. const queue2 = [...blockEventQueue];
  27503. const hydrated = new Set(hydratedBlocks);
  27504. blockEventQueue = [];
  27505. for (let {
  27506. event,
  27507. currentTarget
  27508. } of queue2) {
  27509. const blockName = currentTarget.getAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE);
  27510. if (hydrated.has(blockName)) {
  27511. invokeListeners(event, currentTarget);
  27512. } else {
  27513. blockEventQueue.push({
  27514. event,
  27515. currentTarget
  27516. });
  27517. }
  27518. }
  27519. }
  27520. var SerializedViewCollection = class {
  27521. views = [];
  27522. indexByContent = /* @__PURE__ */ new Map();
  27523. add(serializedView) {
  27524. const viewAsString = JSON.stringify(serializedView);
  27525. if (!this.indexByContent.has(viewAsString)) {
  27526. const index = this.views.length;
  27527. this.views.push(serializedView);
  27528. this.indexByContent.set(viewAsString, index);
  27529. return index;
  27530. }
  27531. return this.indexByContent.get(viewAsString);
  27532. }
  27533. getAll() {
  27534. return this.views;
  27535. }
  27536. };
  27537. var tViewSsrId = 0;
  27538. function getSsrId(tView) {
  27539. if (!tView.ssrId) {
  27540. tView.ssrId = `t${tViewSsrId++}`;
  27541. }
  27542. return tView.ssrId;
  27543. }
  27544. function calcNumRootNodes(tView, lView, tNode) {
  27545. const rootNodes = [];
  27546. collectNativeNodes(tView, lView, tNode, rootNodes);
  27547. return rootNodes.length;
  27548. }
  27549. function calcNumRootNodesInLContainer(lContainer) {
  27550. const rootNodes = [];
  27551. collectNativeNodesInLContainer(lContainer, rootNodes);
  27552. return rootNodes.length;
  27553. }
  27554. function annotateComponentLViewForHydration(lView, context2, injector) {
  27555. const hostElement = lView[HOST];
  27556. if (hostElement && !hostElement.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
  27557. return annotateHostElementForHydration(hostElement, lView, null, context2);
  27558. }
  27559. return null;
  27560. }
  27561. function annotateLContainerForHydration(lContainer, context2, injector) {
  27562. const componentLView = unwrapLView(lContainer[HOST]);
  27563. const componentLViewNghIndex = annotateComponentLViewForHydration(componentLView, context2);
  27564. if (componentLViewNghIndex === null) {
  27565. return;
  27566. }
  27567. const hostElement = unwrapRNode(componentLView[HOST]);
  27568. const rootLView = lContainer[PARENT];
  27569. const rootLViewNghIndex = annotateHostElementForHydration(hostElement, rootLView, null, context2);
  27570. const renderer = componentLView[RENDERER];
  27571. const finalIndex = `${componentLViewNghIndex}|${rootLViewNghIndex}`;
  27572. renderer.setAttribute(hostElement, NGH_ATTR_NAME, finalIndex);
  27573. }
  27574. function annotateForHydration(appRef, doc) {
  27575. const injector = appRef.injector;
  27576. const isI18nHydrationEnabledVal = isI18nHydrationEnabled(injector);
  27577. const isIncrementalHydrationEnabledVal = isIncrementalHydrationEnabled(injector);
  27578. const serializedViewCollection = new SerializedViewCollection();
  27579. const corruptedTextNodes = /* @__PURE__ */ new Map();
  27580. const viewRefs = appRef._views;
  27581. const shouldReplayEvents = injector.get(IS_EVENT_REPLAY_ENABLED, EVENT_REPLAY_ENABLED_DEFAULT);
  27582. const eventTypesToReplay = {
  27583. regular: /* @__PURE__ */ new Set(),
  27584. capture: /* @__PURE__ */ new Set()
  27585. };
  27586. const deferBlocks = /* @__PURE__ */ new Map();
  27587. appRef.injector.get(APP_ID);
  27588. for (const viewRef of viewRefs) {
  27589. const lNode = getLNodeForHydration(viewRef);
  27590. if (lNode !== null) {
  27591. const context2 = {
  27592. serializedViewCollection,
  27593. corruptedTextNodes,
  27594. isI18nHydrationEnabled: isI18nHydrationEnabledVal,
  27595. isIncrementalHydrationEnabled: isIncrementalHydrationEnabledVal,
  27596. i18nChildren: /* @__PURE__ */ new Map(),
  27597. eventTypesToReplay,
  27598. shouldReplayEvents,
  27599. deferBlocks
  27600. };
  27601. if (isLContainer(lNode)) {
  27602. annotateLContainerForHydration(lNode, context2);
  27603. } else {
  27604. annotateComponentLViewForHydration(lNode, context2);
  27605. }
  27606. insertCorruptedTextNodeMarkers(corruptedTextNodes, doc);
  27607. }
  27608. }
  27609. const serializedViews = serializedViewCollection.getAll();
  27610. const transferState = injector.get(TransferState);
  27611. transferState.set(NGH_DATA_KEY, serializedViews);
  27612. if (deferBlocks.size > 0) {
  27613. const blocks = {};
  27614. for (const [id, info] of deferBlocks.entries()) {
  27615. blocks[id] = info;
  27616. }
  27617. transferState.set(NGH_DEFER_BLOCKS_KEY, blocks);
  27618. }
  27619. return eventTypesToReplay;
  27620. }
  27621. function serializeLContainer(lContainer, tNode, lView, parentDeferBlockId, context2) {
  27622. const views = [];
  27623. let lastViewAsString = "";
  27624. for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
  27625. let childLView = lContainer[i];
  27626. let template;
  27627. let numRootNodes;
  27628. let serializedView;
  27629. if (isRootView(childLView)) {
  27630. childLView = childLView[HEADER_OFFSET];
  27631. if (isLContainer(childLView)) {
  27632. numRootNodes = calcNumRootNodesInLContainer(childLView) + 1;
  27633. annotateLContainerForHydration(childLView, context2);
  27634. const componentLView = unwrapLView(childLView[HOST]);
  27635. serializedView = {
  27636. [TEMPLATE_ID]: componentLView[TVIEW].ssrId,
  27637. [NUM_ROOT_NODES]: numRootNodes
  27638. };
  27639. }
  27640. }
  27641. if (!serializedView) {
  27642. const childTView = childLView[TVIEW];
  27643. if (childTView.type === 1) {
  27644. template = childTView.ssrId;
  27645. numRootNodes = 1;
  27646. } else {
  27647. template = getSsrId(childTView);
  27648. numRootNodes = calcNumRootNodes(childTView, childLView, childTView.firstChild);
  27649. }
  27650. serializedView = {
  27651. [TEMPLATE_ID]: template,
  27652. [NUM_ROOT_NODES]: numRootNodes
  27653. };
  27654. let isHydrateNeverBlock = false;
  27655. if (isDeferBlock(lView[TVIEW], tNode)) {
  27656. const lDetails = getLDeferBlockDetails(lView, tNode);
  27657. const tDetails = getTDeferBlockDetails(lView[TVIEW], tNode);
  27658. if (context2.isIncrementalHydrationEnabled && tDetails.hydrateTriggers !== null) {
  27659. const deferBlockId = `d${context2.deferBlocks.size}`;
  27660. if (tDetails.hydrateTriggers.has(
  27661. 7
  27662. /* DeferBlockTrigger.Never */
  27663. )) {
  27664. isHydrateNeverBlock = true;
  27665. }
  27666. let rootNodes = [];
  27667. collectNativeNodesInLContainer(lContainer, rootNodes);
  27668. const deferBlockInfo = {
  27669. [NUM_ROOT_NODES]: rootNodes.length,
  27670. [DEFER_BLOCK_STATE$1]: lDetails[DEFER_BLOCK_STATE]
  27671. };
  27672. const serializedTriggers = serializeHydrateTriggers(tDetails.hydrateTriggers);
  27673. if (serializedTriggers.length > 0) {
  27674. deferBlockInfo[DEFER_HYDRATE_TRIGGERS] = serializedTriggers;
  27675. }
  27676. if (parentDeferBlockId !== null) {
  27677. deferBlockInfo[DEFER_PARENT_BLOCK_ID] = parentDeferBlockId;
  27678. }
  27679. context2.deferBlocks.set(deferBlockId, deferBlockInfo);
  27680. const node = unwrapRNode(lContainer);
  27681. if (node !== void 0) {
  27682. if (node.nodeType === Node.COMMENT_NODE) {
  27683. annotateDeferBlockAnchorForHydration(node, deferBlockId);
  27684. }
  27685. } else {
  27686. ngDevMode && validateNodeExists(node, childLView, tNode);
  27687. ngDevMode && validateMatchingNode(node, Node.COMMENT_NODE, null, childLView, tNode, true);
  27688. annotateDeferBlockAnchorForHydration(node, deferBlockId);
  27689. }
  27690. if (!isHydrateNeverBlock) {
  27691. annotateDeferBlockRootNodesWithJsAction(tDetails, rootNodes, deferBlockId, context2);
  27692. }
  27693. parentDeferBlockId = deferBlockId;
  27694. serializedView[DEFER_BLOCK_ID] = deferBlockId;
  27695. }
  27696. serializedView[DEFER_BLOCK_STATE$1] = lDetails[DEFER_BLOCK_STATE];
  27697. }
  27698. if (!isHydrateNeverBlock) {
  27699. Object.assign(serializedView, serializeLView(lContainer[i], parentDeferBlockId, context2));
  27700. }
  27701. }
  27702. const currentViewAsString = JSON.stringify(serializedView);
  27703. if (views.length > 0 && currentViewAsString === lastViewAsString) {
  27704. const previousView = views[views.length - 1];
  27705. previousView[MULTIPLIER] ??= 1;
  27706. previousView[MULTIPLIER]++;
  27707. } else {
  27708. lastViewAsString = currentViewAsString;
  27709. views.push(serializedView);
  27710. }
  27711. }
  27712. return views;
  27713. }
  27714. function serializeHydrateTriggers(triggerMap) {
  27715. const serializableDeferBlockTrigger = /* @__PURE__ */ new Set([
  27716. 0,
  27717. 1,
  27718. 2,
  27719. 5
  27720. /* DeferBlockTrigger.Timer */
  27721. ]);
  27722. let triggers = [];
  27723. for (let [trigger, details] of triggerMap) {
  27724. if (serializableDeferBlockTrigger.has(trigger)) {
  27725. if (details === null) {
  27726. triggers.push(trigger);
  27727. } else {
  27728. triggers.push({
  27729. trigger,
  27730. delay: details.delay
  27731. });
  27732. }
  27733. }
  27734. }
  27735. return triggers;
  27736. }
  27737. function appendSerializedNodePath(ngh, tNode, lView, excludedParentNodes) {
  27738. const noOffsetIndex = tNode.index - HEADER_OFFSET;
  27739. ngh[NODES] ??= {};
  27740. ngh[NODES][noOffsetIndex] ??= calcPathForNode(tNode, lView, excludedParentNodes);
  27741. }
  27742. function appendDisconnectedNodeIndex(ngh, tNodeOrNoOffsetIndex) {
  27743. const noOffsetIndex = typeof tNodeOrNoOffsetIndex === "number" ? tNodeOrNoOffsetIndex : tNodeOrNoOffsetIndex.index - HEADER_OFFSET;
  27744. ngh[DISCONNECTED_NODES] ??= [];
  27745. if (!ngh[DISCONNECTED_NODES].includes(noOffsetIndex)) {
  27746. ngh[DISCONNECTED_NODES].push(noOffsetIndex);
  27747. }
  27748. }
  27749. function serializeLView(lView, parentDeferBlockId = null, context2) {
  27750. const ngh = {};
  27751. const tView = lView[TVIEW];
  27752. const i18nChildren = getOrComputeI18nChildren(tView, context2);
  27753. const nativeElementsToEventTypes = context2.shouldReplayEvents ? collectDomEventsInfo(tView, lView, context2.eventTypesToReplay) : null;
  27754. for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
  27755. const tNode = tView.data[i];
  27756. const noOffsetIndex = i - HEADER_OFFSET;
  27757. const i18nData = trySerializeI18nBlock(lView, i, context2);
  27758. if (i18nData) {
  27759. ngh[I18N_DATA] ??= {};
  27760. ngh[I18N_DATA][noOffsetIndex] = i18nData.caseQueue;
  27761. for (const nodeNoOffsetIndex of i18nData.disconnectedNodes) {
  27762. appendDisconnectedNodeIndex(ngh, nodeNoOffsetIndex);
  27763. }
  27764. for (const nodeNoOffsetIndex of i18nData.disjointNodes) {
  27765. const tNode2 = tView.data[nodeNoOffsetIndex + HEADER_OFFSET];
  27766. ngDevMode && assertTNode(tNode2);
  27767. appendSerializedNodePath(ngh, tNode2, lView, i18nChildren);
  27768. }
  27769. continue;
  27770. }
  27771. if (!isTNodeShape(tNode)) {
  27772. continue;
  27773. }
  27774. if (isDetachedByI18n(tNode)) {
  27775. continue;
  27776. }
  27777. if (isDisconnectedNode(tNode, lView) && isContentProjectedNode(tNode)) {
  27778. appendDisconnectedNodeIndex(ngh, tNode);
  27779. continue;
  27780. }
  27781. if (Array.isArray(tNode.projection)) {
  27782. for (const projectionHeadTNode of tNode.projection) {
  27783. if (!projectionHeadTNode) continue;
  27784. if (!Array.isArray(projectionHeadTNode)) {
  27785. if (!isProjectionTNode(projectionHeadTNode) && !isInSkipHydrationBlock(projectionHeadTNode)) {
  27786. if (isDisconnectedNode(projectionHeadTNode, lView)) {
  27787. appendDisconnectedNodeIndex(ngh, projectionHeadTNode);
  27788. } else {
  27789. appendSerializedNodePath(ngh, projectionHeadTNode, lView, i18nChildren);
  27790. }
  27791. }
  27792. } else {
  27793. throw unsupportedProjectionOfDomNodes(unwrapRNode(lView[i]));
  27794. }
  27795. }
  27796. }
  27797. conditionallyAnnotateNodePath(ngh, tNode, lView, i18nChildren);
  27798. if (isLContainer(lView[i])) {
  27799. const embeddedTView = tNode.tView;
  27800. if (embeddedTView !== null) {
  27801. ngh[TEMPLATES] ??= {};
  27802. ngh[TEMPLATES][noOffsetIndex] = getSsrId(embeddedTView);
  27803. }
  27804. const hostNode = lView[i][HOST];
  27805. if (Array.isArray(hostNode)) {
  27806. const targetNode = unwrapRNode(hostNode);
  27807. if (!targetNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
  27808. annotateHostElementForHydration(targetNode, hostNode, parentDeferBlockId, context2);
  27809. }
  27810. }
  27811. ngh[CONTAINERS] ??= {};
  27812. ngh[CONTAINERS][noOffsetIndex] = serializeLContainer(lView[i], tNode, lView, parentDeferBlockId, context2);
  27813. } else if (Array.isArray(lView[i]) && !isLetDeclaration(tNode)) {
  27814. const targetNode = unwrapRNode(lView[i][HOST]);
  27815. if (!targetNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
  27816. annotateHostElementForHydration(targetNode, lView[i], parentDeferBlockId, context2);
  27817. }
  27818. } else {
  27819. if (tNode.type & 8) {
  27820. ngh[ELEMENT_CONTAINERS] ??= {};
  27821. ngh[ELEMENT_CONTAINERS][noOffsetIndex] = calcNumRootNodes(tView, lView, tNode.child);
  27822. } else if (tNode.type & (16 | 128)) {
  27823. let nextTNode = tNode.next;
  27824. while (nextTNode !== null && nextTNode.type & (16 | 128)) {
  27825. nextTNode = nextTNode.next;
  27826. }
  27827. if (nextTNode && !isInSkipHydrationBlock(nextTNode)) {
  27828. appendSerializedNodePath(ngh, nextTNode, lView, i18nChildren);
  27829. }
  27830. } else if (tNode.type & 1) {
  27831. const rNode = unwrapRNode(lView[i]);
  27832. processTextNodeBeforeSerialization(context2, rNode);
  27833. }
  27834. }
  27835. if (nativeElementsToEventTypes && tNode.type & 2) {
  27836. const nativeElement = unwrapRNode(lView[i]);
  27837. if (nativeElementsToEventTypes.has(nativeElement)) {
  27838. setJSActionAttributes(nativeElement, nativeElementsToEventTypes.get(nativeElement), parentDeferBlockId);
  27839. }
  27840. }
  27841. }
  27842. return ngh;
  27843. }
  27844. function conditionallyAnnotateNodePath(ngh, tNode, lView, excludedParentNodes) {
  27845. if (isProjectionTNode(tNode)) {
  27846. return;
  27847. }
  27848. if (tNode.projectionNext && tNode.projectionNext !== tNode.next && !isInSkipHydrationBlock(tNode.projectionNext)) {
  27849. appendSerializedNodePath(ngh, tNode.projectionNext, lView, excludedParentNodes);
  27850. }
  27851. if (tNode.prev === null && tNode.parent !== null && isDisconnectedNode(tNode.parent, lView) && !isDisconnectedNode(tNode, lView)) {
  27852. appendSerializedNodePath(ngh, tNode, lView, excludedParentNodes);
  27853. }
  27854. }
  27855. function componentUsesShadowDomEncapsulation(lView) {
  27856. const instance = lView[CONTEXT];
  27857. return instance?.constructor ? getComponentDef(instance.constructor)?.encapsulation === ViewEncapsulation.ShadowDom : false;
  27858. }
  27859. function annotateHostElementForHydration(element, lView, parentDeferBlockId, context2) {
  27860. const renderer = lView[RENDERER];
  27861. if (hasI18n(lView) && !isI18nHydrationSupportEnabled() || componentUsesShadowDomEncapsulation(lView)) {
  27862. renderer.setAttribute(element, SKIP_HYDRATION_ATTR_NAME, "");
  27863. return null;
  27864. } else {
  27865. const ngh = serializeLView(lView, parentDeferBlockId, context2);
  27866. const index = context2.serializedViewCollection.add(ngh);
  27867. renderer.setAttribute(element, NGH_ATTR_NAME, index.toString());
  27868. return index;
  27869. }
  27870. }
  27871. function annotateDeferBlockAnchorForHydration(comment, deferBlockId) {
  27872. comment.textContent = `ngh=${deferBlockId}`;
  27873. }
  27874. function insertCorruptedTextNodeMarkers(corruptedTextNodes, doc) {
  27875. for (const [textNode, marker] of corruptedTextNodes) {
  27876. textNode.after(doc.createComment(marker));
  27877. }
  27878. }
  27879. function isContentProjectedNode(tNode) {
  27880. let currentTNode = tNode;
  27881. while (currentTNode != null) {
  27882. if (isComponentHost(currentTNode)) {
  27883. return true;
  27884. }
  27885. currentTNode = currentTNode.parent;
  27886. }
  27887. return false;
  27888. }
  27889. function annotateDeferBlockRootNodesWithJsAction(tDetails, rootNodes, parentDeferBlockId, context2) {
  27890. const actionList = convertHydrateTriggersToJsAction(tDetails.hydrateTriggers);
  27891. for (let et of actionList) {
  27892. context2.eventTypesToReplay.regular.add(et);
  27893. }
  27894. if (actionList.length > 0) {
  27895. const elementNodes = rootNodes.filter((rn) => rn.nodeType === Node.ELEMENT_NODE);
  27896. for (let rNode of elementNodes) {
  27897. setJSActionAttributes(rNode, actionList, parentDeferBlockId);
  27898. }
  27899. }
  27900. }
  27901. var isHydrationSupportEnabled = false;
  27902. var isI18nHydrationRuntimeSupportEnabled = false;
  27903. var isIncrementalHydrationRuntimeSupportEnabled = false;
  27904. var APPLICATION_IS_STABLE_TIMEOUT = 1e4;
  27905. function enableHydrationRuntimeSupport() {
  27906. if (!isHydrationSupportEnabled) {
  27907. isHydrationSupportEnabled = true;
  27908. enableRetrieveHydrationInfoImpl();
  27909. enableLocateOrCreateElementNodeImpl();
  27910. enableLocateOrCreateTextNodeImpl();
  27911. enableLocateOrCreateElementContainerNodeImpl();
  27912. enableLocateOrCreateContainerAnchorImpl();
  27913. enableLocateOrCreateContainerRefImpl();
  27914. enableFindMatchingDehydratedViewImpl();
  27915. enableApplyRootElementTransformImpl();
  27916. }
  27917. }
  27918. function enableI18nHydrationRuntimeSupport() {
  27919. if (!isI18nHydrationRuntimeSupportEnabled) {
  27920. isI18nHydrationRuntimeSupportEnabled = true;
  27921. enableLocateOrCreateI18nNodeImpl();
  27922. enablePrepareI18nBlockForHydrationImpl();
  27923. enableClaimDehydratedIcuCaseImpl();
  27924. }
  27925. }
  27926. function enableIncrementalHydrationRuntimeSupport() {
  27927. if (!isIncrementalHydrationRuntimeSupportEnabled) {
  27928. isIncrementalHydrationRuntimeSupportEnabled = true;
  27929. enableRetrieveDeferBlockDataImpl();
  27930. }
  27931. }
  27932. function printHydrationStats(injector) {
  27933. const console2 = injector.get(Console);
  27934. const message = `Angular hydrated ${ngDevMode.hydratedComponents} component(s) and ${ngDevMode.hydratedNodes} node(s), ${ngDevMode.componentsSkippedHydration} component(s) were skipped. ` + (isIncrementalHydrationEnabled(injector) ? `${ngDevMode.deferBlocksWithIncrementalHydration} defer block(s) were configured to use incremental hydration. ` : "") + `Learn more at https://angular.dev/guide/hydration.`;
  27935. console2.log(message);
  27936. }
  27937. function whenStableWithTimeout(appRef) {
  27938. const whenStablePromise = appRef.whenStable();
  27939. if (typeof ngDevMode !== "undefined" && ngDevMode) {
  27940. const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
  27941. const console2 = appRef.injector.get(Console);
  27942. const ngZone = appRef.injector.get(NgZone);
  27943. const timeoutId = ngZone.runOutsideAngular(() => {
  27944. return setTimeout(() => logWarningOnStableTimedout(timeoutTime, console2), timeoutTime);
  27945. });
  27946. whenStablePromise.finally(() => clearTimeout(timeoutId));
  27947. }
  27948. return whenStablePromise;
  27949. }
  27950. var CLIENT_RENDER_MODE_FLAG = "ngcm";
  27951. function isClientRenderModeEnabled() {
  27952. const doc = getDocument();
  27953. return doc.body.hasAttribute(CLIENT_RENDER_MODE_FLAG);
  27954. }
  27955. function withDomHydration() {
  27956. const providers = [{
  27957. provide: IS_HYDRATION_DOM_REUSE_ENABLED,
  27958. useFactory: () => {
  27959. let isEnabled = true;
  27960. if (true) {
  27961. const transferState = inject(TransferState, {
  27962. optional: true
  27963. });
  27964. isEnabled = !!transferState?.get(NGH_DATA_KEY, null);
  27965. }
  27966. if (isEnabled) {
  27967. performanceMarkFeature("NgHydration");
  27968. }
  27969. return isEnabled;
  27970. }
  27971. }, {
  27972. provide: ENVIRONMENT_INITIALIZER,
  27973. useValue: () => {
  27974. setIsI18nHydrationSupportEnabled(false);
  27975. if (false) {
  27976. return;
  27977. }
  27978. if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
  27979. verifySsrContentsIntegrity(getDocument());
  27980. enableHydrationRuntimeSupport();
  27981. } else if (typeof ngDevMode !== "undefined" && ngDevMode && !isClientRenderModeEnabled()) {
  27982. const console2 = inject(Console);
  27983. const message = formatRuntimeError(-505, "Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration.");
  27984. console2.warn(message);
  27985. }
  27986. },
  27987. multi: true
  27988. }];
  27989. if (true) {
  27990. providers.push({
  27991. provide: PRESERVE_HOST_CONTENT,
  27992. useFactory: () => {
  27993. return inject(IS_HYDRATION_DOM_REUSE_ENABLED);
  27994. }
  27995. }, {
  27996. provide: APP_BOOTSTRAP_LISTENER,
  27997. useFactory: () => {
  27998. if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
  27999. const appRef = inject(ApplicationRef);
  28000. return () => {
  28001. whenStableWithTimeout(appRef).then(() => {
  28002. if (appRef.destroyed) {
  28003. return;
  28004. }
  28005. cleanupDehydratedViews(appRef);
  28006. if (typeof ngDevMode !== "undefined" && ngDevMode) {
  28007. countBlocksSkippedByHydration(appRef.injector);
  28008. printHydrationStats(appRef.injector);
  28009. }
  28010. });
  28011. };
  28012. }
  28013. return () => {
  28014. };
  28015. },
  28016. multi: true
  28017. });
  28018. }
  28019. return makeEnvironmentProviders(providers);
  28020. }
  28021. function withI18nSupport() {
  28022. return [{
  28023. provide: IS_I18N_HYDRATION_ENABLED,
  28024. useFactory: () => inject(IS_HYDRATION_DOM_REUSE_ENABLED)
  28025. }, {
  28026. provide: ENVIRONMENT_INITIALIZER,
  28027. useValue: () => {
  28028. if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
  28029. enableI18nHydrationRuntimeSupport();
  28030. setIsI18nHydrationSupportEnabled(true);
  28031. performanceMarkFeature("NgI18nHydration");
  28032. }
  28033. },
  28034. multi: true
  28035. }];
  28036. }
  28037. function withIncrementalHydration() {
  28038. const providers = [withEventReplay(), {
  28039. provide: IS_INCREMENTAL_HYDRATION_ENABLED,
  28040. useValue: true
  28041. }, {
  28042. provide: DEHYDRATED_BLOCK_REGISTRY,
  28043. useClass: DehydratedBlockRegistry
  28044. }, {
  28045. provide: ENVIRONMENT_INITIALIZER,
  28046. useValue: () => {
  28047. enableIncrementalHydrationRuntimeSupport();
  28048. performanceMarkFeature("NgIncrementalHydration");
  28049. },
  28050. multi: true
  28051. }];
  28052. if (true) {
  28053. providers.push({
  28054. provide: APP_BOOTSTRAP_LISTENER,
  28055. useFactory: () => {
  28056. const injector = inject(Injector);
  28057. const doc = getDocument();
  28058. return () => {
  28059. const deferBlockData = processBlockData(injector);
  28060. const commentsByBlockId = gatherDeferBlocksCommentNodes(doc, doc.body);
  28061. processAndInitTriggers(injector, deferBlockData, commentsByBlockId);
  28062. appendDeferBlocksToJSActionMap(doc, injector);
  28063. };
  28064. },
  28065. multi: true
  28066. });
  28067. }
  28068. return providers;
  28069. }
  28070. function logWarningOnStableTimedout(time, console2) {
  28071. const message = `Angular hydration expected the ApplicationRef.isStable() to emit \`true\`, but it didn't happen within ${time}ms. Angular hydration logic depends on the application becoming stable as a signal to complete hydration process.`;
  28072. console2.warn(formatRuntimeError(-506, message));
  28073. }
  28074. function booleanAttribute(value) {
  28075. return typeof value === "boolean" ? value : value != null && value !== "false";
  28076. }
  28077. function numberAttribute(value, fallbackValue = NaN) {
  28078. const isNumberValue = !isNaN(parseFloat(value)) && !isNaN(Number(value));
  28079. return isNumberValue ? Number(value) : fallbackValue;
  28080. }
  28081. var PERFORMANCE_MARK_PREFIX = "🅰️";
  28082. var enablePerfLogging = false;
  28083. function startMeasuring(label) {
  28084. if (!enablePerfLogging) {
  28085. return;
  28086. }
  28087. const {
  28088. startLabel
  28089. } = labels(label);
  28090. performance.mark(startLabel);
  28091. }
  28092. function stopMeasuring(label) {
  28093. if (!enablePerfLogging) {
  28094. return;
  28095. }
  28096. const {
  28097. startLabel,
  28098. labelName,
  28099. endLabel
  28100. } = labels(label);
  28101. performance.mark(endLabel);
  28102. performance.measure(labelName, startLabel, endLabel);
  28103. performance.clearMarks(startLabel);
  28104. performance.clearMarks(endLabel);
  28105. }
  28106. function labels(label) {
  28107. const labelName = `${PERFORMANCE_MARK_PREFIX}:${label}`;
  28108. return {
  28109. labelName,
  28110. startLabel: `start:${labelName}`,
  28111. endLabel: `end:${labelName}`
  28112. };
  28113. }
  28114. var warningLogged = false;
  28115. function enableProfiling() {
  28116. if (!warningLogged && (typeof performance === "undefined" || !performance.mark || !performance.measure)) {
  28117. warningLogged = true;
  28118. console.warn("Performance API is not supported on this platform");
  28119. return;
  28120. }
  28121. enablePerfLogging = true;
  28122. }
  28123. function disableProfiling() {
  28124. enablePerfLogging = false;
  28125. }
  28126. function untracked2(nonReactiveReadsFn) {
  28127. return untracked(nonReactiveReadsFn);
  28128. }
  28129. function computed(computation, options) {
  28130. const getter = createComputed(computation, options?.equal);
  28131. if (ngDevMode) {
  28132. getter.toString = () => `[Computed: ${getter()}]`;
  28133. getter[SIGNAL].debugName = options?.debugName;
  28134. }
  28135. return getter;
  28136. }
  28137. var MicrotaskEffectScheduler = class _MicrotaskEffectScheduler extends ZoneAwareEffectScheduler {
  28138. pendingTasks = inject(PendingTasksInternal);
  28139. taskId = null;
  28140. schedule(effect2) {
  28141. super.schedule(effect2);
  28142. if (this.taskId === null) {
  28143. this.taskId = this.pendingTasks.add();
  28144. queueMicrotask(() => this.flush());
  28145. }
  28146. }
  28147. flush() {
  28148. try {
  28149. super.flush();
  28150. } finally {
  28151. if (this.taskId !== null) {
  28152. this.pendingTasks.remove(this.taskId);
  28153. this.taskId = null;
  28154. }
  28155. }
  28156. }
  28157. /** @nocollapse */
  28158. static ɵprov = (
  28159. /** @pureOrBreakMyCode */
  28160. ɵɵdefineInjectable({
  28161. token: _MicrotaskEffectScheduler,
  28162. providedIn: "root",
  28163. factory: () => new _MicrotaskEffectScheduler()
  28164. })
  28165. );
  28166. };
  28167. var EffectHandle = class {
  28168. scheduler;
  28169. effectFn;
  28170. zone;
  28171. injector;
  28172. unregisterOnDestroy;
  28173. watcher;
  28174. constructor(scheduler, effectFn, zone, destroyRef, injector, allowSignalWrites) {
  28175. this.scheduler = scheduler;
  28176. this.effectFn = effectFn;
  28177. this.zone = zone;
  28178. this.injector = injector;
  28179. this.watcher = createWatch((onCleanup) => this.runEffect(onCleanup), () => this.schedule(), allowSignalWrites);
  28180. this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
  28181. }
  28182. runEffect(onCleanup) {
  28183. try {
  28184. this.effectFn(onCleanup);
  28185. } catch (err) {
  28186. const errorHandler = this.injector.get(ErrorHandler, null, {
  28187. optional: true
  28188. });
  28189. errorHandler?.handleError(err);
  28190. }
  28191. }
  28192. run() {
  28193. this.watcher.run();
  28194. }
  28195. schedule() {
  28196. this.scheduler.schedule(this);
  28197. }
  28198. destroy() {
  28199. this.watcher.destroy();
  28200. this.unregisterOnDestroy?.();
  28201. }
  28202. };
  28203. function effect$1() {
  28204. }
  28205. function microtaskEffect(effectFn, options) {
  28206. ngDevMode && assertNotInReactiveContext(effect$1, "Call `effect` outside of a reactive context. For example, schedule the effect inside the component constructor.");
  28207. !options?.injector && assertInInjectionContext(effect$1);
  28208. const injector = options?.injector ?? inject(Injector);
  28209. const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
  28210. const handle = new EffectHandle(injector.get(MicrotaskEffectScheduler), effectFn, typeof Zone === "undefined" ? null : Zone.current, destroyRef, injector, options?.allowSignalWrites ?? false);
  28211. const cdr = injector.get(ChangeDetectorRef, null, {
  28212. optional: true
  28213. });
  28214. if (!cdr || !(cdr._lView[FLAGS] & 8)) {
  28215. handle.watcher.notify();
  28216. } else {
  28217. (cdr._lView[EFFECTS_TO_SCHEDULE] ??= []).push(handle.watcher.notify);
  28218. }
  28219. return handle;
  28220. }
  28221. var EffectRefImpl = class {
  28222. [SIGNAL];
  28223. constructor(node) {
  28224. this[SIGNAL] = node;
  28225. }
  28226. destroy() {
  28227. this[SIGNAL].destroy();
  28228. }
  28229. };
  28230. function effect(effectFn, options) {
  28231. ngDevMode && assertNotInReactiveContext(effect, "Call `effect` outside of a reactive context. For example, schedule the effect inside the component constructor.");
  28232. !options?.injector && assertInInjectionContext(effect);
  28233. if (ngDevMode && options?.allowSignalWrites !== void 0) {
  28234. console.warn(`The 'allowSignalWrites' flag is deprecated and no longer impacts effect() (writes are always allowed)`);
  28235. }
  28236. const injector = options?.injector ?? inject(Injector);
  28237. let destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
  28238. let node;
  28239. const viewContext = injector.get(ViewContext, null, {
  28240. optional: true
  28241. });
  28242. const notifier = injector.get(ChangeDetectionScheduler);
  28243. if (viewContext !== null && !options?.forceRoot) {
  28244. node = createViewEffect(viewContext.view, notifier, effectFn);
  28245. if (destroyRef instanceof NodeInjectorDestroyRef && destroyRef._lView === viewContext.view) {
  28246. destroyRef = null;
  28247. }
  28248. } else {
  28249. node = createRootEffect(effectFn, injector.get(EffectScheduler), notifier);
  28250. }
  28251. node.injector = injector;
  28252. if (destroyRef !== null) {
  28253. node.onDestroyFn = destroyRef.onDestroy(() => node.destroy());
  28254. }
  28255. const effectRef = new EffectRefImpl(node);
  28256. if (ngDevMode) {
  28257. node.debugName = options?.debugName ?? "";
  28258. const prevInjectorProfilerContext = setInjectorProfilerContext({
  28259. injector,
  28260. token: null
  28261. });
  28262. try {
  28263. emitEffectCreatedEvent(effectRef);
  28264. } finally {
  28265. setInjectorProfilerContext(prevInjectorProfilerContext);
  28266. }
  28267. }
  28268. return effectRef;
  28269. }
  28270. new InjectionToken("", {
  28271. providedIn: "root",
  28272. factory: () => inject(EffectScheduler)
  28273. });
  28274. var BASE_EFFECT_NODE = (() => __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  28275. consumerIsAlwaysLive: true,
  28276. consumerAllowSignalWrites: true,
  28277. dirty: true,
  28278. hasRun: false,
  28279. cleanupFns: void 0,
  28280. zone: null,
  28281. kind: "effect",
  28282. onDestroyFn: noop2,
  28283. run() {
  28284. this.dirty = false;
  28285. if (ngDevMode && isInNotificationPhase()) {
  28286. throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
  28287. }
  28288. if (this.hasRun && !consumerPollProducersForChange(this)) {
  28289. return;
  28290. }
  28291. this.hasRun = true;
  28292. const registerCleanupFn = (cleanupFn) => (this.cleanupFns ??= []).push(cleanupFn);
  28293. const prevNode = consumerBeforeComputation(this);
  28294. const prevRefreshingViews = setIsRefreshingViews(false);
  28295. try {
  28296. this.maybeCleanup();
  28297. this.fn(registerCleanupFn);
  28298. } finally {
  28299. setIsRefreshingViews(prevRefreshingViews);
  28300. consumerAfterComputation(this, prevNode);
  28301. }
  28302. },
  28303. maybeCleanup() {
  28304. if (!this.cleanupFns?.length) {
  28305. return;
  28306. }
  28307. try {
  28308. while (this.cleanupFns.length) {
  28309. this.cleanupFns.pop()();
  28310. }
  28311. } finally {
  28312. this.cleanupFns = [];
  28313. }
  28314. }
  28315. }))();
  28316. var ROOT_EFFECT_NODE = (() => __spreadProps(__spreadValues({}, BASE_EFFECT_NODE), {
  28317. consumerMarkedDirty() {
  28318. this.scheduler.schedule(this);
  28319. this.notifier.notify(
  28320. 12
  28321. /* NotificationSource.RootEffect */
  28322. );
  28323. },
  28324. destroy() {
  28325. consumerDestroy(this);
  28326. this.onDestroyFn();
  28327. this.maybeCleanup();
  28328. this.scheduler.remove(this);
  28329. }
  28330. }))();
  28331. var VIEW_EFFECT_NODE = (() => __spreadProps(__spreadValues({}, BASE_EFFECT_NODE), {
  28332. consumerMarkedDirty() {
  28333. this.view[FLAGS] |= 8192;
  28334. markAncestorsForTraversal(this.view);
  28335. this.notifier.notify(
  28336. 13
  28337. /* NotificationSource.ViewEffect */
  28338. );
  28339. },
  28340. destroy() {
  28341. consumerDestroy(this);
  28342. this.onDestroyFn();
  28343. this.maybeCleanup();
  28344. this.view[EFFECTS]?.delete(this);
  28345. }
  28346. }))();
  28347. function createViewEffect(view, notifier, fn) {
  28348. const node = Object.create(VIEW_EFFECT_NODE);
  28349. node.view = view;
  28350. node.zone = typeof Zone !== "undefined" ? Zone.current : null;
  28351. node.notifier = notifier;
  28352. node.fn = fn;
  28353. view[EFFECTS] ??= /* @__PURE__ */ new Set();
  28354. view[EFFECTS].add(node);
  28355. node.consumerMarkedDirty(node);
  28356. return node;
  28357. }
  28358. function createRootEffect(fn, scheduler, notifier) {
  28359. const node = Object.create(ROOT_EFFECT_NODE);
  28360. node.fn = fn;
  28361. node.scheduler = scheduler;
  28362. node.notifier = notifier;
  28363. node.zone = typeof Zone !== "undefined" ? Zone.current : null;
  28364. node.scheduler.schedule(node);
  28365. node.notifier.notify(
  28366. 12
  28367. /* NotificationSource.RootEffect */
  28368. );
  28369. return node;
  28370. }
  28371. var ResourceStatus;
  28372. (function(ResourceStatus2) {
  28373. ResourceStatus2[ResourceStatus2["Idle"] = 0] = "Idle";
  28374. ResourceStatus2[ResourceStatus2["Error"] = 1] = "Error";
  28375. ResourceStatus2[ResourceStatus2["Loading"] = 2] = "Loading";
  28376. ResourceStatus2[ResourceStatus2["Reloading"] = 3] = "Reloading";
  28377. ResourceStatus2[ResourceStatus2["Resolved"] = 4] = "Resolved";
  28378. ResourceStatus2[ResourceStatus2["Local"] = 5] = "Local";
  28379. })(ResourceStatus || (ResourceStatus = {}));
  28380. var identityFn = (v) => v;
  28381. function linkedSignal(optionsOrComputation, options) {
  28382. if (typeof optionsOrComputation === "function") {
  28383. const getter = createLinkedSignal(optionsOrComputation, identityFn, options?.equal);
  28384. return upgradeLinkedSignalGetter(getter);
  28385. } else {
  28386. const getter = createLinkedSignal(optionsOrComputation.source, optionsOrComputation.computation, optionsOrComputation.equal);
  28387. return upgradeLinkedSignalGetter(getter);
  28388. }
  28389. }
  28390. function upgradeLinkedSignalGetter(getter) {
  28391. if (ngDevMode) {
  28392. getter.toString = () => `[LinkedSignal: ${getter()}]`;
  28393. }
  28394. const node = getter[SIGNAL];
  28395. const upgradedGetter = getter;
  28396. upgradedGetter.set = (newValue) => linkedSignalSetFn(node, newValue);
  28397. upgradedGetter.update = (updateFn) => linkedSignalUpdateFn(node, updateFn);
  28398. upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter);
  28399. return upgradedGetter;
  28400. }
  28401. function resource(options) {
  28402. options?.injector || assertInInjectionContext(resource);
  28403. const request = options.request ?? (() => null);
  28404. return new ResourceImpl(request, getLoader(options), options.defaultValue, options.equal ? wrapEqualityFn(options.equal) : void 0, options.injector ?? inject(Injector));
  28405. }
  28406. var BaseWritableResource = class {
  28407. value;
  28408. constructor(value) {
  28409. this.value = value;
  28410. this.value.set = this.set.bind(this);
  28411. this.value.update = this.update.bind(this);
  28412. this.value.asReadonly = signalAsReadonlyFn;
  28413. }
  28414. update(updateFn) {
  28415. this.set(updateFn(untracked2(this.value)));
  28416. }
  28417. isLoading = computed(() => this.status() === ResourceStatus.Loading || this.status() === ResourceStatus.Reloading);
  28418. hasValue() {
  28419. return this.value() !== void 0;
  28420. }
  28421. asReadonly() {
  28422. return this;
  28423. }
  28424. };
  28425. var ResourceImpl = class extends BaseWritableResource {
  28426. loaderFn;
  28427. defaultValue;
  28428. equal;
  28429. pendingTasks;
  28430. /**
  28431. * The current state of the resource. Status, value, and error are derived from this.
  28432. */
  28433. state;
  28434. /**
  28435. * Combines the current request with a reload counter which allows the resource to be reloaded on
  28436. * imperative command.
  28437. */
  28438. extRequest;
  28439. effectRef;
  28440. pendingController;
  28441. resolvePendingTask = void 0;
  28442. destroyed = false;
  28443. constructor(request, loaderFn, defaultValue, equal, injector) {
  28444. super(
  28445. // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a
  28446. // `WritableSignal` that delegates to `ResourceImpl.set`.
  28447. computed(() => {
  28448. const streamValue = this.state().stream?.();
  28449. return streamValue && isResolved(streamValue) ? streamValue.value : this.defaultValue;
  28450. }, {
  28451. equal
  28452. })
  28453. );
  28454. this.loaderFn = loaderFn;
  28455. this.defaultValue = defaultValue;
  28456. this.equal = equal;
  28457. this.extRequest = linkedSignal({
  28458. source: request,
  28459. computation: (request2) => ({
  28460. request: request2,
  28461. reload: 0
  28462. })
  28463. });
  28464. this.state = linkedSignal({
  28465. // Whenever the request changes,
  28466. source: this.extRequest,
  28467. // Compute the state of the resource given a change in status.
  28468. computation: (extRequest, previous) => {
  28469. const status = extRequest.request === void 0 ? ResourceStatus.Idle : ResourceStatus.Loading;
  28470. if (!previous) {
  28471. return {
  28472. extRequest,
  28473. status,
  28474. previousStatus: ResourceStatus.Idle,
  28475. stream: void 0
  28476. };
  28477. } else {
  28478. return {
  28479. extRequest,
  28480. status,
  28481. previousStatus: projectStatusOfState(previous.value),
  28482. // If the request hasn't changed, keep the previous stream.
  28483. stream: previous.value.extRequest.request === extRequest.request ? previous.value.stream : void 0
  28484. };
  28485. }
  28486. }
  28487. });
  28488. this.effectRef = effect(this.loadEffect.bind(this), {
  28489. injector,
  28490. manualCleanup: true
  28491. });
  28492. this.pendingTasks = injector.get(PendingTasks);
  28493. injector.get(DestroyRef).onDestroy(() => this.destroy());
  28494. }
  28495. status = computed(() => projectStatusOfState(this.state()));
  28496. error = computed(() => {
  28497. const stream = this.state().stream?.();
  28498. return stream && !isResolved(stream) ? stream.error : void 0;
  28499. });
  28500. /**
  28501. * Called either directly via `WritableResource.set` or via `.value.set()`.
  28502. */
  28503. set(value) {
  28504. if (this.destroyed) {
  28505. return;
  28506. }
  28507. const current = untracked2(this.value);
  28508. const state = untracked2(this.state);
  28509. if (state.status === ResourceStatus.Local && (this.equal ? this.equal(current, value) : current === value)) {
  28510. return;
  28511. }
  28512. this.state.set({
  28513. extRequest: state.extRequest,
  28514. status: ResourceStatus.Local,
  28515. previousStatus: ResourceStatus.Local,
  28516. stream: signal({
  28517. value
  28518. })
  28519. });
  28520. this.abortInProgressLoad();
  28521. }
  28522. reload() {
  28523. const {
  28524. status
  28525. } = untracked2(this.state);
  28526. if (status === ResourceStatus.Idle || status === ResourceStatus.Loading) {
  28527. return false;
  28528. }
  28529. this.extRequest.update(({
  28530. request,
  28531. reload
  28532. }) => ({
  28533. request,
  28534. reload: reload + 1
  28535. }));
  28536. return true;
  28537. }
  28538. destroy() {
  28539. this.destroyed = true;
  28540. this.effectRef.destroy();
  28541. this.abortInProgressLoad();
  28542. this.state.set({
  28543. extRequest: {
  28544. request: void 0,
  28545. reload: 0
  28546. },
  28547. status: ResourceStatus.Idle,
  28548. previousStatus: ResourceStatus.Idle,
  28549. stream: void 0
  28550. });
  28551. }
  28552. loadEffect() {
  28553. return __async(this, null, function* () {
  28554. const extRequest = this.extRequest();
  28555. const {
  28556. status: currentStatus,
  28557. previousStatus
  28558. } = untracked2(this.state);
  28559. if (extRequest.request === void 0) {
  28560. return;
  28561. } else if (currentStatus !== ResourceStatus.Loading) {
  28562. return;
  28563. }
  28564. this.abortInProgressLoad();
  28565. let resolvePendingTask = this.resolvePendingTask = this.pendingTasks.add();
  28566. const {
  28567. signal: abortSignal
  28568. } = this.pendingController = new AbortController();
  28569. try {
  28570. const stream = yield untracked2(() => {
  28571. return this.loaderFn({
  28572. request: extRequest.request,
  28573. abortSignal,
  28574. previous: {
  28575. status: previousStatus
  28576. }
  28577. });
  28578. });
  28579. if (abortSignal.aborted || untracked2(this.extRequest) !== extRequest) {
  28580. return;
  28581. }
  28582. this.state.set({
  28583. extRequest,
  28584. status: ResourceStatus.Resolved,
  28585. previousStatus: ResourceStatus.Resolved,
  28586. stream
  28587. });
  28588. } catch (err) {
  28589. if (abortSignal.aborted || untracked2(this.extRequest) !== extRequest) {
  28590. return;
  28591. }
  28592. this.state.set({
  28593. extRequest,
  28594. status: ResourceStatus.Resolved,
  28595. previousStatus: ResourceStatus.Error,
  28596. stream: signal({
  28597. error: err
  28598. })
  28599. });
  28600. } finally {
  28601. resolvePendingTask?.();
  28602. resolvePendingTask = void 0;
  28603. }
  28604. });
  28605. }
  28606. abortInProgressLoad() {
  28607. untracked2(() => this.pendingController?.abort());
  28608. this.pendingController = void 0;
  28609. this.resolvePendingTask?.();
  28610. this.resolvePendingTask = void 0;
  28611. }
  28612. };
  28613. function wrapEqualityFn(equal) {
  28614. return (a, b) => a === void 0 || b === void 0 ? a === b : equal(a, b);
  28615. }
  28616. function getLoader(options) {
  28617. if (isStreamingResourceOptions(options)) {
  28618. return options.stream;
  28619. }
  28620. return (params) => __async(this, null, function* () {
  28621. try {
  28622. return signal({
  28623. value: yield options.loader(params)
  28624. });
  28625. } catch (err) {
  28626. return signal({
  28627. error: err
  28628. });
  28629. }
  28630. });
  28631. }
  28632. function isStreamingResourceOptions(options) {
  28633. return !!options.stream;
  28634. }
  28635. function projectStatusOfState(state) {
  28636. switch (state.status) {
  28637. case ResourceStatus.Loading:
  28638. return state.extRequest.reload === 0 ? ResourceStatus.Loading : ResourceStatus.Reloading;
  28639. case ResourceStatus.Resolved:
  28640. return isResolved(untracked2(state.stream)) ? ResourceStatus.Resolved : ResourceStatus.Error;
  28641. default:
  28642. return state.status;
  28643. }
  28644. }
  28645. function isResolved(state) {
  28646. return state.error === void 0;
  28647. }
  28648. function getClosestComponentName(node) {
  28649. let currentNode = node;
  28650. while (currentNode) {
  28651. const lView = readPatchedLView(currentNode);
  28652. if (lView !== null) {
  28653. for (let i = HEADER_OFFSET; i < lView.length; i++) {
  28654. const current = lView[i];
  28655. if (!isLView(current) && !isLContainer(current) || current[HOST] !== currentNode) {
  28656. continue;
  28657. }
  28658. const tView = lView[TVIEW];
  28659. const tNode = getTNode(tView, i);
  28660. if (isComponentHost(tNode)) {
  28661. const def = tView.data[tNode.directiveStart + tNode.componentOffset];
  28662. const name = def.debugInfo?.className || def.type.name;
  28663. if (name) {
  28664. return name;
  28665. } else {
  28666. break;
  28667. }
  28668. }
  28669. }
  28670. }
  28671. currentNode = currentNode.parentNode;
  28672. }
  28673. return null;
  28674. }
  28675. function ɵɵngDeclareDirective(decl) {
  28676. const compiler = getCompilerFacade({
  28677. usage: 1,
  28678. kind: "directive",
  28679. type: decl.type
  28680. });
  28681. return compiler.compileDirectiveDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵfac.js`, decl);
  28682. }
  28683. function ɵɵngDeclareClassMetadata(decl) {
  28684. setClassMetadata(decl.type, decl.decorators, decl.ctorParameters ?? null, decl.propDecorators ?? null);
  28685. }
  28686. function ɵɵngDeclareClassMetadataAsync(decl) {
  28687. setClassMetadataAsync(decl.type, decl.resolveDeferredDeps, (...types) => {
  28688. const meta = decl.resolveMetadata(...types);
  28689. setClassMetadata(decl.type, meta.decorators, meta.ctorParameters, meta.propDecorators);
  28690. });
  28691. }
  28692. function ɵɵngDeclareComponent(decl) {
  28693. const compiler = getCompilerFacade({
  28694. usage: 1,
  28695. kind: "component",
  28696. type: decl.type
  28697. });
  28698. return compiler.compileComponentDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵcmp.js`, decl);
  28699. }
  28700. function ɵɵngDeclareFactory(decl) {
  28701. const compiler = getCompilerFacade({
  28702. usage: 1,
  28703. kind: getFactoryKind(decl.target),
  28704. type: decl.type
  28705. });
  28706. return compiler.compileFactoryDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵfac.js`, decl);
  28707. }
  28708. function getFactoryKind(target) {
  28709. switch (target) {
  28710. case FactoryTarget.Directive:
  28711. return "directive";
  28712. case FactoryTarget.Component:
  28713. return "component";
  28714. case FactoryTarget.Injectable:
  28715. return "injectable";
  28716. case FactoryTarget.Pipe:
  28717. return "pipe";
  28718. case FactoryTarget.NgModule:
  28719. return "NgModule";
  28720. }
  28721. }
  28722. function ɵɵngDeclareInjectable(decl) {
  28723. const compiler = getCompilerFacade({
  28724. usage: 1,
  28725. kind: "injectable",
  28726. type: decl.type
  28727. });
  28728. return compiler.compileInjectableDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵprov.js`, decl);
  28729. }
  28730. function ɵɵngDeclareInjector(decl) {
  28731. const compiler = getCompilerFacade({
  28732. usage: 1,
  28733. kind: "NgModule",
  28734. type: decl.type
  28735. });
  28736. return compiler.compileInjectorDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵinj.js`, decl);
  28737. }
  28738. function ɵɵngDeclareNgModule(decl) {
  28739. const compiler = getCompilerFacade({
  28740. usage: 1,
  28741. kind: "NgModule",
  28742. type: decl.type
  28743. });
  28744. return compiler.compileNgModuleDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵmod.js`, decl);
  28745. }
  28746. function ɵɵngDeclarePipe(decl) {
  28747. const compiler = getCompilerFacade({
  28748. usage: 1,
  28749. kind: "pipe",
  28750. type: decl.type
  28751. });
  28752. return compiler.compilePipeDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵpipe.js`, decl);
  28753. }
  28754. var NOT_SET = Symbol("NOT_SET");
  28755. var EMPTY_CLEANUP_SET = /* @__PURE__ */ new Set();
  28756. var AFTER_RENDER_PHASE_EFFECT_NODE = (() => __spreadProps(__spreadValues({}, SIGNAL_NODE), {
  28757. consumerIsAlwaysLive: true,
  28758. consumerAllowSignalWrites: true,
  28759. value: NOT_SET,
  28760. cleanup: null,
  28761. /** Called when the effect becomes dirty */
  28762. consumerMarkedDirty() {
  28763. if (this.sequence.impl.executing) {
  28764. if (this.sequence.lastPhase === null || this.sequence.lastPhase < this.phase) {
  28765. return;
  28766. }
  28767. this.sequence.erroredOrDestroyed = true;
  28768. }
  28769. this.sequence.scheduler.notify(
  28770. 7
  28771. /* NotificationSource.RenderHook */
  28772. );
  28773. },
  28774. phaseFn(previousValue) {
  28775. this.sequence.lastPhase = this.phase;
  28776. if (!this.dirty) {
  28777. return this.signal;
  28778. }
  28779. this.dirty = false;
  28780. if (this.value !== NOT_SET && !consumerPollProducersForChange(this)) {
  28781. return this.signal;
  28782. }
  28783. try {
  28784. for (const cleanupFn of this.cleanup ?? EMPTY_CLEANUP_SET) {
  28785. cleanupFn();
  28786. }
  28787. } finally {
  28788. this.cleanup?.clear();
  28789. }
  28790. const args = [];
  28791. if (previousValue !== void 0) {
  28792. args.push(previousValue);
  28793. }
  28794. args.push(this.registerCleanupFn);
  28795. const prevConsumer = consumerBeforeComputation(this);
  28796. let newValue;
  28797. try {
  28798. newValue = this.userFn.apply(null, args);
  28799. } finally {
  28800. consumerAfterComputation(this, prevConsumer);
  28801. }
  28802. if (this.value === NOT_SET || !this.equal(this.value, newValue)) {
  28803. this.value = newValue;
  28804. this.version++;
  28805. }
  28806. return this.signal;
  28807. }
  28808. }))();
  28809. var AfterRenderEffectSequence = class extends AfterRenderSequence {
  28810. scheduler;
  28811. /**
  28812. * While this sequence is executing, this tracks the last phase which was called by the
  28813. * `afterRender` machinery.
  28814. *
  28815. * When a phase effect is marked dirty, this is used to determine whether it's already run or not.
  28816. */
  28817. lastPhase = null;
  28818. /**
  28819. * The reactive nodes for each phase, if a phase effect is defined for that phase.
  28820. *
  28821. * These are initialized to `undefined` but set in the constructor.
  28822. */
  28823. nodes = [void 0, void 0, void 0, void 0];
  28824. constructor(impl, effectHooks, view, scheduler, destroyRef, snapshot = null) {
  28825. super(impl, [void 0, void 0, void 0, void 0], view, false, destroyRef, snapshot);
  28826. this.scheduler = scheduler;
  28827. for (const phase of AFTER_RENDER_PHASES) {
  28828. const effectHook = effectHooks[phase];
  28829. if (effectHook === void 0) {
  28830. continue;
  28831. }
  28832. const node = Object.create(AFTER_RENDER_PHASE_EFFECT_NODE);
  28833. node.sequence = this;
  28834. node.phase = phase;
  28835. node.userFn = effectHook;
  28836. node.dirty = true;
  28837. node.signal = () => {
  28838. producerAccessed(node);
  28839. return node.value;
  28840. };
  28841. node.signal[SIGNAL] = node;
  28842. node.registerCleanupFn = (fn) => (node.cleanup ??= /* @__PURE__ */ new Set()).add(fn);
  28843. this.nodes[phase] = node;
  28844. this.hooks[phase] = (value) => node.phaseFn(value);
  28845. }
  28846. }
  28847. afterRun() {
  28848. super.afterRun();
  28849. this.lastPhase = null;
  28850. }
  28851. destroy() {
  28852. super.destroy();
  28853. for (const node of this.nodes) {
  28854. for (const fn of node?.cleanup ?? EMPTY_CLEANUP_SET) {
  28855. fn();
  28856. }
  28857. }
  28858. }
  28859. };
  28860. function afterRenderEffect(callbackOrSpec, options) {
  28861. ngDevMode && assertNotInReactiveContext(afterRenderEffect, "Call `afterRenderEffect` outside of a reactive context. For example, create the render effect inside the component constructor`.");
  28862. !options?.injector && assertInInjectionContext(afterRenderEffect);
  28863. if (false) {
  28864. return NOOP_AFTER_RENDER_REF;
  28865. }
  28866. const injector = options?.injector ?? inject(Injector);
  28867. const scheduler = injector.get(ChangeDetectionScheduler);
  28868. const manager = injector.get(AfterRenderManager);
  28869. const tracing = injector.get(TracingService, null, {
  28870. optional: true
  28871. });
  28872. manager.impl ??= injector.get(AfterRenderImpl);
  28873. let spec = callbackOrSpec;
  28874. if (typeof spec === "function") {
  28875. spec = {
  28876. mixedReadWrite: callbackOrSpec
  28877. };
  28878. }
  28879. const viewContext = injector.get(ViewContext, null, {
  28880. optional: true
  28881. });
  28882. const sequence = new AfterRenderEffectSequence(manager.impl, [spec.earlyRead, spec.write, spec.mixedReadWrite, spec.read], viewContext?.view, scheduler, injector.get(DestroyRef), tracing?.snapshot(null));
  28883. manager.impl.register(sequence);
  28884. return sequence;
  28885. }
  28886. function createComponent(component, options) {
  28887. ngDevMode && assertComponentDef(component);
  28888. const componentDef = getComponentDef(component);
  28889. const elementInjector = options.elementInjector || getNullInjector();
  28890. const factory = new ComponentFactory2(componentDef);
  28891. return factory.create(elementInjector, options.projectableNodes, options.hostElement, options.environmentInjector);
  28892. }
  28893. function reflectComponentType(component) {
  28894. const componentDef = getComponentDef(component);
  28895. if (!componentDef) return null;
  28896. const factory = new ComponentFactory2(componentDef);
  28897. return {
  28898. get selector() {
  28899. return factory.selector;
  28900. },
  28901. get type() {
  28902. return factory.componentType;
  28903. },
  28904. get inputs() {
  28905. return factory.inputs;
  28906. },
  28907. get outputs() {
  28908. return factory.outputs;
  28909. },
  28910. get ngContentSelectors() {
  28911. return factory.ngContentSelectors;
  28912. },
  28913. get isStandalone() {
  28914. return componentDef.standalone;
  28915. },
  28916. get isSignal() {
  28917. return componentDef.signals;
  28918. }
  28919. };
  28920. }
  28921. function mergeApplicationConfig(...configs) {
  28922. return configs.reduce((prev, curr) => {
  28923. return Object.assign(prev, curr, {
  28924. providers: [...prev.providers, ...curr.providers]
  28925. });
  28926. }, {
  28927. providers: []
  28928. });
  28929. }
  28930. var REQUEST = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "REQUEST" : "", {
  28931. providedIn: "platform",
  28932. factory: () => null
  28933. });
  28934. var RESPONSE_INIT = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "RESPONSE_INIT" : "", {
  28935. providedIn: "platform",
  28936. factory: () => null
  28937. });
  28938. var REQUEST_CONTEXT = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "REQUEST_CONTEXT" : "", {
  28939. providedIn: "platform",
  28940. factory: () => null
  28941. });
  28942. export {
  28943. __spreadValues,
  28944. __spreadProps,
  28945. __objRest,
  28946. __async,
  28947. SIGNAL,
  28948. setAlternateWeakRefImpl,
  28949. setCurrentInjector,
  28950. Observable,
  28951. Subject,
  28952. from,
  28953. of,
  28954. map,
  28955. filter,
  28956. concatMap,
  28957. finalize,
  28958. switchMap,
  28959. tap,
  28960. XSS_SECURITY_URL,
  28961. RuntimeError,
  28962. formatRuntimeError,
  28963. ɵINPUT_SIGNAL_BRAND_WRITE_TYPE,
  28964. noSideEffects,
  28965. _global,
  28966. stringify,
  28967. truncateMiddle,
  28968. forwardRef,
  28969. resolveForwardRef,
  28970. ɵɵdefineInjectable,
  28971. defineInjectable,
  28972. ɵɵdefineInjector,
  28973. getInjectableDef,
  28974. isInjectable,
  28975. NG_PROV_DEF,
  28976. NG_INJ_DEF,
  28977. InjectionToken,
  28978. setInjectorProfilerContext,
  28979. isEnvironmentProviders,
  28980. NG_COMP_DEF,
  28981. NG_DIR_DEF,
  28982. NG_PIPE_DEF,
  28983. NG_MOD_DEF,
  28984. NG_ELEMENT_ID,
  28985. InjectFlags,
  28986. ɵɵinject,
  28987. ɵɵinvalidFactoryDep,
  28988. inject,
  28989. convertToBitFlags,
  28990. Inject,
  28991. Optional,
  28992. Self,
  28993. SkipSelf,
  28994. Host,
  28995. ENVIRONMENT_INITIALIZER,
  28996. INJECTOR$1,
  28997. isStandalone,
  28998. makeEnvironmentProviders,
  28999. provideEnvironmentInitializer,
  29000. importProvidersFrom,
  29001. INJECTOR_SCOPE,
  29002. EnvironmentInjector,
  29003. runInInjectionContext,
  29004. assertInInjectionContext,
  29005. FactoryTarget,
  29006. Type,
  29007. ReflectionCapabilities,
  29008. CONTAINER_HEADER_OFFSET,
  29009. SimpleChange,
  29010. ɵɵNgOnChangesFeature,
  29011. ɵɵenableBindings,
  29012. ɵɵdisableBindings,
  29013. ɵɵrestoreView,
  29014. ɵɵresetView,
  29015. ɵɵnamespaceSVG,
  29016. ɵɵnamespaceMathML,
  29017. ɵɵnamespaceHTML,
  29018. NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR,
  29019. ɵɵgetInheritedFactory,
  29020. ɵɵinjectAttribute,
  29021. Attribute2 as Attribute,
  29022. Injectable,
  29023. createInjector,
  29024. Injector,
  29025. HostAttributeToken,
  29026. HOST_TAG_NAME,
  29027. DestroyRef,
  29028. ChangeDetectionScheduler,
  29029. ZONELESS_ENABLED,
  29030. PendingTasksInternal,
  29031. PendingTasks,
  29032. EventEmitter,
  29033. NgZone,
  29034. NoopNgZone,
  29035. ErrorHandler,
  29036. INTERNAL_APPLICATION_ERROR_HANDLER,
  29037. OutputEmitterRef,
  29038. getOutputDestroyRef,
  29039. output,
  29040. input,
  29041. ElementRef,
  29042. isSignal,
  29043. ɵunwrapWritableSignal,
  29044. signal,
  29045. QueryList,
  29046. ChangeDetectionStrategy,
  29047. LContext,
  29048. getLContext,
  29049. getDirectives,
  29050. getHostElement,
  29051. setDocument,
  29052. APP_ID,
  29053. PLATFORM_INITIALIZER,
  29054. PLATFORM_ID,
  29055. PACKAGE_ROOT_URL,
  29056. ANIMATION_MODULE_TYPE,
  29057. CSP_NONCE,
  29058. IMAGE_CONFIG_DEFAULTS,
  29059. IMAGE_CONFIG,
  29060. makeStateKey,
  29061. TransferState,
  29062. IS_HYDRATION_DOM_REUSE_ENABLED,
  29063. IS_INCREMENTAL_HYDRATION_ENABLED,
  29064. TracingAction,
  29065. TracingService,
  29066. performanceMarkFeature,
  29067. assertNotInReactiveContext,
  29068. AfterRenderPhase,
  29069. AfterRenderManager,
  29070. afterRender,
  29071. afterNextRender,
  29072. DeferBlockState,
  29073. DeferBlockBehavior,
  29074. JSACTION_EVENT_CONTRACT,
  29075. SSR_CONTENT_INTEGRITY_MARKER,
  29076. readHydrationInfo,
  29077. ViewEncapsulation,
  29078. unwrapSafeValue,
  29079. allowSanitizationBypassAndThrow,
  29080. getSanitizationBypassType,
  29081. bypassSanitizationTrustHtml,
  29082. bypassSanitizationTrustStyle,
  29083. bypassSanitizationTrustScript,
  29084. bypassSanitizationTrustUrl,
  29085. bypassSanitizationTrustResourceUrl,
  29086. _sanitizeUrl,
  29087. _sanitizeHtml,
  29088. SecurityContext,
  29089. ɵɵsanitizeHtml,
  29090. ɵɵsanitizeStyle,
  29091. ɵɵsanitizeUrl,
  29092. ɵɵsanitizeResourceUrl,
  29093. ɵɵsanitizeScript,
  29094. ɵɵtrustConstantHtml,
  29095. ɵɵtrustConstantResourceUrl,
  29096. ɵɵsanitizeUrlOrResourceUrl,
  29097. CUSTOM_ELEMENTS_SCHEMA,
  29098. NO_ERRORS_SCHEMA,
  29099. ɵsetUnknownElementStrictMode,
  29100. ɵgetUnknownElementStrictMode,
  29101. ɵsetUnknownPropertyStrictMode,
  29102. ɵgetUnknownPropertyStrictMode,
  29103. ɵɵresolveWindow,
  29104. ɵɵresolveDocument,
  29105. ɵɵresolveBody,
  29106. NO_CHANGE,
  29107. ɵɵadvance,
  29108. RendererStyleFlags2,
  29109. ViewRef$1,
  29110. isViewDirty,
  29111. markForRefresh,
  29112. TemplateRef,
  29113. ComponentRef$1,
  29114. ComponentFactory$1,
  29115. ComponentFactoryResolver$1,
  29116. RendererFactory2,
  29117. Renderer2,
  29118. Sanitizer,
  29119. isNgModule,
  29120. USE_RUNTIME_DEPS_TRACKER_FOR_JIT,
  29121. depsTracker,
  29122. ɵɵdirectiveInject,
  29123. ɵɵinvalidFactory,
  29124. ComponentFactory2 as ComponentFactory,
  29125. ComponentRef2 as ComponentRef,
  29126. ViewContainerRef,
  29127. viewChild,
  29128. viewChildren,
  29129. contentChild,
  29130. contentChildren,
  29131. model,
  29132. Query,
  29133. ContentChildren,
  29134. ContentChild,
  29135. ViewChildren,
  29136. ViewChild,
  29137. resolveComponentResources,
  29138. isComponentDefPendingResolution,
  29139. clearResolutionOfComponentResourcesQueue,
  29140. restoreComponentResolutionQueue,
  29141. registerNgModuleType,
  29142. setAllowDuplicateNgModuleIdsForTest,
  29143. ɵɵvalidateIframeAttribute,
  29144. NgModuleRef$1,
  29145. NgModuleFactory$1,
  29146. createNgModule,
  29147. createNgModuleRef,
  29148. NgModuleRef2 as NgModuleRef,
  29149. NgModuleFactory2 as NgModuleFactory,
  29150. createEnvironmentInjector,
  29151. ɵɵdefineComponent,
  29152. ɵɵdefineNgModule,
  29153. ɵɵdefineDirective,
  29154. ɵɵdefinePipe,
  29155. ɵɵInheritDefinitionFeature,
  29156. ɵɵCopyDefinitionFeature,
  29157. ɵɵHostDirectivesFeature,
  29158. devModeEqual,
  29159. ɵɵtemplate,
  29160. DEFER_BLOCK_DEPENDENCY_INTERCEPTOR,
  29161. DEFER_BLOCK_CONFIG,
  29162. renderDeferBlockState,
  29163. ɵɵdeferEnableTimerScheduling,
  29164. getAsyncClassMetadataFn,
  29165. setClassMetadataAsync,
  29166. setClassMetadata,
  29167. Console,
  29168. getDeferBlocks$1,
  29169. publishExternalGlobalUtil,
  29170. TESTABILITY,
  29171. TESTABILITY_GETTER,
  29172. Testability,
  29173. TestabilityRegistry,
  29174. setTestabilityGetter,
  29175. EffectScheduler,
  29176. isPromise2 as isPromise,
  29177. isSubscribable,
  29178. APP_INITIALIZER,
  29179. provideAppInitializer,
  29180. ApplicationInitStatus,
  29181. APP_BOOTSTRAP_LISTENER,
  29182. isBoundToModule,
  29183. NgProbeToken,
  29184. ApplicationRef,
  29185. detectChangesInViewIfRequired,
  29186. triggerResourceLoading,
  29187. ɵɵdefer,
  29188. ɵɵdeferWhen,
  29189. ɵɵdeferPrefetchWhen,
  29190. ɵɵdeferHydrateWhen,
  29191. ɵɵdeferHydrateNever,
  29192. ɵɵdeferOnIdle,
  29193. ɵɵdeferPrefetchOnIdle,
  29194. ɵɵdeferHydrateOnIdle,
  29195. ɵɵdeferOnImmediate,
  29196. ɵɵdeferPrefetchOnImmediate,
  29197. ɵɵdeferHydrateOnImmediate,
  29198. ɵɵdeferOnTimer,
  29199. ɵɵdeferPrefetchOnTimer,
  29200. ɵɵdeferHydrateOnTimer,
  29201. ɵɵdeferOnHover,
  29202. ɵɵdeferPrefetchOnHover,
  29203. ɵɵdeferHydrateOnHover,
  29204. ɵɵdeferOnInteraction,
  29205. ɵɵdeferPrefetchOnInteraction,
  29206. ɵɵdeferHydrateOnInteraction,
  29207. ɵɵdeferOnViewport,
  29208. ɵɵdeferPrefetchOnViewport,
  29209. ɵɵdeferHydrateOnViewport,
  29210. ɵɵattribute,
  29211. ɵɵattributeInterpolate1,
  29212. ɵɵattributeInterpolate2,
  29213. ɵɵattributeInterpolate3,
  29214. ɵɵattributeInterpolate4,
  29215. ɵɵattributeInterpolate5,
  29216. ɵɵattributeInterpolate6,
  29217. ɵɵattributeInterpolate7,
  29218. ɵɵattributeInterpolate8,
  29219. ɵɵattributeInterpolateV,
  29220. ɵɵproperty,
  29221. ɵɵstyleProp,
  29222. ɵɵclassProp,
  29223. ɵɵstyleMap,
  29224. ɵɵclassMap,
  29225. ɵɵclassMapInterpolate1,
  29226. ɵɵclassMapInterpolate2,
  29227. ɵɵclassMapInterpolate3,
  29228. ɵɵclassMapInterpolate4,
  29229. ɵɵclassMapInterpolate5,
  29230. ɵɵclassMapInterpolate6,
  29231. ɵɵclassMapInterpolate7,
  29232. ɵɵclassMapInterpolate8,
  29233. ɵɵclassMapInterpolateV,
  29234. ɵɵcomponentInstance,
  29235. ɵɵconditional,
  29236. ɵɵrepeaterTrackByIndex,
  29237. ɵɵrepeaterTrackByIdentity,
  29238. ɵɵrepeaterCreate,
  29239. ɵɵrepeater,
  29240. ɵɵelementStart,
  29241. ɵɵelementEnd,
  29242. ɵɵelement,
  29243. ɵɵelementContainerStart,
  29244. ɵɵelementContainerEnd,
  29245. ɵɵelementContainer,
  29246. ɵɵgetCurrentView,
  29247. ɵɵhostProperty,
  29248. ɵɵsyntheticHostProperty,
  29249. registerLocaleData,
  29250. findLocaleData,
  29251. getLocaleCurrencyCode,
  29252. getLocalePluralCase,
  29253. unregisterAllLocaleData,
  29254. LocaleDataIndex,
  29255. DEFAULT_LOCALE_ID,
  29256. setLocaleId,
  29257. ɵɵi18nStart,
  29258. ɵɵi18nEnd,
  29259. ɵɵi18n,
  29260. ɵɵi18nAttributes,
  29261. ɵɵi18nExp,
  29262. ɵɵi18nApply,
  29263. ɵɵi18nPostprocess,
  29264. ɵɵlistener,
  29265. ɵɵsyntheticHostListener,
  29266. ɵɵnextContext,
  29267. ɵɵprojectionDef,
  29268. ɵɵprojection,
  29269. ɵɵpropertyInterpolate,
  29270. ɵɵpropertyInterpolate1,
  29271. ɵɵpropertyInterpolate2,
  29272. ɵɵpropertyInterpolate3,
  29273. ɵɵpropertyInterpolate4,
  29274. ɵɵpropertyInterpolate5,
  29275. ɵɵpropertyInterpolate6,
  29276. ɵɵpropertyInterpolate7,
  29277. ɵɵpropertyInterpolate8,
  29278. ɵɵpropertyInterpolateV,
  29279. ɵɵcontentQuery,
  29280. ɵɵviewQuery,
  29281. ɵɵqueryRefresh,
  29282. ɵɵloadQuery,
  29283. ɵɵcontentQuerySignal,
  29284. ɵɵviewQuerySignal,
  29285. ɵɵqueryAdvance,
  29286. store,
  29287. ɵɵreference,
  29288. ɵɵstyleMapInterpolate1,
  29289. ɵɵstyleMapInterpolate2,
  29290. ɵɵstyleMapInterpolate3,
  29291. ɵɵstyleMapInterpolate4,
  29292. ɵɵstyleMapInterpolate5,
  29293. ɵɵstyleMapInterpolate6,
  29294. ɵɵstyleMapInterpolate7,
  29295. ɵɵstyleMapInterpolate8,
  29296. ɵɵstyleMapInterpolateV,
  29297. ɵɵstylePropInterpolate1,
  29298. ɵɵstylePropInterpolate2,
  29299. ɵɵstylePropInterpolate3,
  29300. ɵɵstylePropInterpolate4,
  29301. ɵɵstylePropInterpolate5,
  29302. ɵɵstylePropInterpolate6,
  29303. ɵɵstylePropInterpolate7,
  29304. ɵɵstylePropInterpolate8,
  29305. ɵɵstylePropInterpolateV,
  29306. ɵɵtext,
  29307. ɵɵtextInterpolate,
  29308. ɵɵtextInterpolate1,
  29309. ɵɵtextInterpolate2,
  29310. ɵɵtextInterpolate3,
  29311. ɵɵtextInterpolate4,
  29312. ɵɵtextInterpolate5,
  29313. ɵɵtextInterpolate6,
  29314. ɵɵtextInterpolate7,
  29315. ɵɵtextInterpolate8,
  29316. ɵɵtextInterpolateV,
  29317. ɵɵtwoWayProperty,
  29318. ɵɵtwoWayBindingSet,
  29319. ɵɵtwoWayListener,
  29320. ɵɵdeclareLet,
  29321. ɵɵstoreLet,
  29322. ɵɵreadContextLet,
  29323. ɵɵattachSourceLocations,
  29324. ɵɵProvidersFeature,
  29325. ɵɵExternalStylesFeature,
  29326. ɵɵsetComponentScope,
  29327. ɵɵsetNgModuleScope,
  29328. ɵɵpureFunction0,
  29329. ɵɵpureFunction1,
  29330. ɵɵpureFunction2,
  29331. ɵɵpureFunction3,
  29332. ɵɵpureFunction4,
  29333. ɵɵpureFunction5,
  29334. ɵɵpureFunction6,
  29335. ɵɵpureFunction7,
  29336. ɵɵpureFunction8,
  29337. ɵɵpureFunctionV,
  29338. ɵɵpipe,
  29339. ɵɵpipeBind1,
  29340. ɵɵpipeBind2,
  29341. ɵɵpipeBind3,
  29342. ɵɵpipeBind4,
  29343. ɵɵpipeBindV,
  29344. ɵɵtemplateRefExtractor,
  29345. ɵɵgetComponentDepsFactory,
  29346. ɵsetClassDebugInfo,
  29347. ɵɵreplaceMetadata,
  29348. resetJitOptions,
  29349. flushModuleScopingQueueAsMuchAsPossible,
  29350. compileNgModule,
  29351. compileNgModuleDefs,
  29352. generateStandaloneInDeclarationsError,
  29353. resetCompiledComponents,
  29354. patchComponentDefWithScope,
  29355. transitiveScopesFor,
  29356. compileComponent,
  29357. compileDirective,
  29358. compilePipe,
  29359. Directive,
  29360. Component,
  29361. Pipe,
  29362. Input,
  29363. Output,
  29364. HostBinding,
  29365. HostListener,
  29366. NgModule,
  29367. Version,
  29368. VERSION,
  29369. ModuleWithComponentFactories,
  29370. Compiler,
  29371. COMPILER_OPTIONS,
  29372. CompilerFactory,
  29373. compileNgModuleFactory,
  29374. PROVIDED_NG_ZONE,
  29375. internalProvideZoneChangeDetection,
  29376. provideZoneChangeDetection,
  29377. ChangeDetectionSchedulerImpl,
  29378. provideExperimentalZonelessChangeDetection,
  29379. LOCALE_ID,
  29380. DEFAULT_CURRENCY_CODE,
  29381. TRANSLATIONS,
  29382. TRANSLATIONS_FORMAT,
  29383. MissingTranslationStrategy,
  29384. ENABLE_ROOT_COMPONENT_BOOTSTRAP,
  29385. PlatformRef,
  29386. ALLOW_MULTIPLE_PLATFORMS,
  29387. createPlatform,
  29388. createPlatformFactory,
  29389. assertPlatform,
  29390. getPlatform,
  29391. destroyPlatform,
  29392. providePlatformInitializer,
  29393. provideExperimentalCheckNoChangesForDebug,
  29394. isDevMode,
  29395. enableProdMode,
  29396. getModuleFactory,
  29397. getNgModuleById,
  29398. ChangeDetectorRef,
  29399. injectChangeDetectorRef,
  29400. ViewRef2 as ViewRef,
  29401. EmbeddedViewRef,
  29402. DebugEventListener,
  29403. asNativeElements,
  29404. DebugNode,
  29405. DebugElement,
  29406. getDebugNode,
  29407. DefaultIterableDiffer,
  29408. IterableDiffers,
  29409. KeyValueDiffers,
  29410. defaultIterableDiffers,
  29411. defaultKeyValueDiffers,
  29412. platformCore,
  29413. ApplicationModule,
  29414. internalCreateApplication,
  29415. withEventReplay,
  29416. annotateForHydration,
  29417. withDomHydration,
  29418. withI18nSupport,
  29419. withIncrementalHydration,
  29420. booleanAttribute,
  29421. numberAttribute,
  29422. PERFORMANCE_MARK_PREFIX,
  29423. startMeasuring,
  29424. stopMeasuring,
  29425. enableProfiling,
  29426. disableProfiling,
  29427. untracked2 as untracked,
  29428. computed,
  29429. MicrotaskEffectScheduler,
  29430. microtaskEffect,
  29431. effect,
  29432. ResourceStatus,
  29433. linkedSignal,
  29434. resource,
  29435. ResourceImpl,
  29436. getClosestComponentName,
  29437. ɵɵngDeclareDirective,
  29438. ɵɵngDeclareClassMetadata,
  29439. ɵɵngDeclareClassMetadataAsync,
  29440. ɵɵngDeclareComponent,
  29441. ɵɵngDeclareFactory,
  29442. ɵɵngDeclareInjectable,
  29443. ɵɵngDeclareInjector,
  29444. ɵɵngDeclareNgModule,
  29445. ɵɵngDeclarePipe,
  29446. afterRenderEffect,
  29447. createComponent,
  29448. reflectComponentType,
  29449. mergeApplicationConfig,
  29450. REQUEST,
  29451. RESPONSE_INIT,
  29452. REQUEST_CONTEXT
  29453. };
  29454. /*! Bundled license information:
  29455. @angular/core/fesm2022/untracked-CS7WUAzb.mjs:
  29456. (**
  29457. * @license Angular v19.2.4
  29458. * (c) 2010-2025 Google LLC. https://angular.io/
  29459. * License: MIT
  29460. *)
  29461. @angular/core/fesm2022/primitives/di.mjs:
  29462. (**
  29463. * @license Angular v19.2.4
  29464. * (c) 2010-2025 Google LLC. https://angular.io/
  29465. * License: MIT
  29466. *)
  29467. @angular/core/fesm2022/primitives/signals.mjs:
  29468. (**
  29469. * @license Angular v19.2.4
  29470. * (c) 2010-2025 Google LLC. https://angular.io/
  29471. * License: MIT
  29472. *)
  29473. @angular/core/fesm2022/primitives/event-dispatch.mjs:
  29474. (**
  29475. * @license Angular v19.2.4
  29476. * (c) 2010-2025 Google LLC. https://angular.io/
  29477. * License: MIT
  29478. *)
  29479. @angular/core/fesm2022/core.mjs:
  29480. (**
  29481. * @license Angular v19.2.4
  29482. * (c) 2010-2025 Google LLC. https://angular.io/
  29483. * License: MIT
  29484. *)
  29485. (*!
  29486. * @license
  29487. * Copyright Google LLC All Rights Reserved.
  29488. *
  29489. * Use of this source code is governed by an MIT-style license that can be
  29490. * found in the LICENSE file at https://angular.dev/license
  29491. *)
  29492. @angular/core/fesm2022/core.mjs:
  29493. (*!
  29494. * @license
  29495. * Copyright Google LLC All Rights Reserved.
  29496. *
  29497. * Use of this source code is governed by an MIT-style license that can be
  29498. * found in the LICENSE file at https://angular.dev/license
  29499. *)
  29500. */
  29501. //# sourceMappingURL=chunk-3XPRMCCN.js.map