vendor.bundle.js 2.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828
  1. webpackJsonp(["vendor"],{
  2. /***/ "./node_modules/@angular/common/esm5/common.js":
  3. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4. "use strict";
  5. /* unused harmony export ɵregisterLocaleData */
  6. /* unused harmony export NgLocaleLocalization */
  7. /* unused harmony export NgLocalization */
  8. /* unused harmony export registerLocaleData */
  9. /* unused harmony export Plural */
  10. /* unused harmony export NumberFormatStyle */
  11. /* unused harmony export FormStyle */
  12. /* unused harmony export TranslationWidth */
  13. /* unused harmony export FormatWidth */
  14. /* unused harmony export NumberSymbol */
  15. /* unused harmony export WeekDay */
  16. /* unused harmony export getCurrencySymbol */
  17. /* unused harmony export getLocaleDayPeriods */
  18. /* unused harmony export getLocaleDayNames */
  19. /* unused harmony export getLocaleMonthNames */
  20. /* unused harmony export getLocaleId */
  21. /* unused harmony export getLocaleEraNames */
  22. /* unused harmony export getLocaleWeekEndRange */
  23. /* unused harmony export getLocaleFirstDayOfWeek */
  24. /* unused harmony export getLocaleDateFormat */
  25. /* unused harmony export getLocaleDateTimeFormat */
  26. /* unused harmony export getLocaleExtraDayPeriodRules */
  27. /* unused harmony export getLocaleExtraDayPeriods */
  28. /* unused harmony export getLocalePluralCase */
  29. /* unused harmony export getLocaleTimeFormat */
  30. /* unused harmony export getLocaleNumberSymbol */
  31. /* unused harmony export getLocaleNumberFormat */
  32. /* unused harmony export getLocaleCurrencyName */
  33. /* unused harmony export getLocaleCurrencySymbol */
  34. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseCookieValue; });
  35. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CommonModule; });
  36. /* unused harmony export DeprecatedI18NPipesModule */
  37. /* unused harmony export NgClass */
  38. /* unused harmony export NgForOf */
  39. /* unused harmony export NgForOfContext */
  40. /* unused harmony export NgIf */
  41. /* unused harmony export NgIfContext */
  42. /* unused harmony export NgPlural */
  43. /* unused harmony export NgPluralCase */
  44. /* unused harmony export NgStyle */
  45. /* unused harmony export NgSwitch */
  46. /* unused harmony export NgSwitchCase */
  47. /* unused harmony export NgSwitchDefault */
  48. /* unused harmony export NgTemplateOutlet */
  49. /* unused harmony export NgComponentOutlet */
  50. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DOCUMENT; });
  51. /* unused harmony export AsyncPipe */
  52. /* unused harmony export DatePipe */
  53. /* unused harmony export I18nPluralPipe */
  54. /* unused harmony export I18nSelectPipe */
  55. /* unused harmony export JsonPipe */
  56. /* unused harmony export LowerCasePipe */
  57. /* unused harmony export CurrencyPipe */
  58. /* unused harmony export DecimalPipe */
  59. /* unused harmony export PercentPipe */
  60. /* unused harmony export SlicePipe */
  61. /* unused harmony export UpperCasePipe */
  62. /* unused harmony export TitleCasePipe */
  63. /* unused harmony export DeprecatedDatePipe */
  64. /* unused harmony export DeprecatedCurrencyPipe */
  65. /* unused harmony export DeprecatedDecimalPipe */
  66. /* unused harmony export DeprecatedPercentPipe */
  67. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PLATFORM_BROWSER_ID; });
  68. /* unused harmony export ɵPLATFORM_SERVER_ID */
  69. /* unused harmony export ɵPLATFORM_WORKER_APP_ID */
  70. /* unused harmony export ɵPLATFORM_WORKER_UI_ID */
  71. /* unused harmony export isPlatformBrowser */
  72. /* unused harmony export isPlatformServer */
  73. /* unused harmony export isPlatformWorkerApp */
  74. /* unused harmony export isPlatformWorkerUi */
  75. /* unused harmony export VERSION */
  76. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PlatformLocation; });
  77. /* unused harmony export LOCATION_INITIALIZED */
  78. /* unused harmony export LocationStrategy */
  79. /* unused harmony export APP_BASE_HREF */
  80. /* unused harmony export HashLocationStrategy */
  81. /* unused harmony export PathLocationStrategy */
  82. /* unused harmony export Location */
  83. /* unused harmony export ɵe */
  84. /* unused harmony export ɵd */
  85. /* unused harmony export ɵa */
  86. /* unused harmony export ɵb */
  87. /* unused harmony export ɵg */
  88. /* unused harmony export ɵf */
  89. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
  90. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
  91. /**
  92. * @license Angular v5.2.9
  93. * (c) 2010-2018 Google, Inc. https://angular.io/
  94. * License: MIT
  95. */
  96. /**
  97. * @fileoverview added by tsickle
  98. * @suppress {checkTypes} checked by tsc
  99. */
  100. /**
  101. * @license
  102. * Copyright Google Inc. All Rights Reserved.
  103. *
  104. * Use of this source code is governed by an MIT-style license that can be
  105. * found in the LICENSE file at https://angular.io/license
  106. */
  107. /**
  108. * This class should not be used directly by an application developer. Instead, use
  109. * {\@link Location}.
  110. *
  111. * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
  112. * agnostic.
  113. * This means that we can have different implementation of `PlatformLocation` for the different
  114. * platforms that angular supports. For example, `\@angular/platform-browser` provides an
  115. * implementation specific to the browser environment, while `\@angular/platform-webworker` provides
  116. * one suitable for use with web workers.
  117. *
  118. * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy}
  119. * when they need to interact with the DOM apis like pushState, popState, etc...
  120. *
  121. * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly
  122. * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link
  123. * Router} /
  124. * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
  125. * class they are all platform independent.
  126. *
  127. * \@stable
  128. * @abstract
  129. */
  130. var PlatformLocation = /** @class */ (function () {
  131. function PlatformLocation() {
  132. }
  133. return PlatformLocation;
  134. }());
  135. /**
  136. * \@whatItDoes indicates when a location is initialized
  137. * \@experimental
  138. */
  139. var LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('Location Initialized');
  140. /**
  141. * A serializable version of the event from onPopState or onHashChange
  142. *
  143. * \@experimental
  144. * @record
  145. */
  146. /**
  147. * \@experimental
  148. * @record
  149. */
  150. /**
  151. * @fileoverview added by tsickle
  152. * @suppress {checkTypes} checked by tsc
  153. */
  154. /**
  155. * @license
  156. * Copyright Google Inc. All Rights Reserved.
  157. *
  158. * Use of this source code is governed by an MIT-style license that can be
  159. * found in the LICENSE file at https://angular.io/license
  160. */
  161. /**
  162. * `LocationStrategy` is responsible for representing and reading route state
  163. * from the browser's URL. Angular provides two strategies:
  164. * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}.
  165. *
  166. * This is used under the hood of the {\@link Location} service.
  167. *
  168. * Applications should use the {\@link Router} or {\@link Location} services to
  169. * interact with application route state.
  170. *
  171. * For instance, {\@link HashLocationStrategy} produces URLs like
  172. * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces
  173. * `http://example.com/foo` as an equivalent URL.
  174. *
  175. * See these two classes for more.
  176. *
  177. * \@stable
  178. * @abstract
  179. */
  180. var LocationStrategy = /** @class */ (function () {
  181. function LocationStrategy() {
  182. }
  183. return LocationStrategy;
  184. }());
  185. /**
  186. * The `APP_BASE_HREF` token represents the base href to be used with the
  187. * {\@link PathLocationStrategy}.
  188. *
  189. * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string
  190. * representing the URL prefix that should be preserved when generating and recognizing
  191. * URLs.
  192. *
  193. * ### Example
  194. *
  195. * ```typescript
  196. * import {Component, NgModule} from '\@angular/core';
  197. * import {APP_BASE_HREF} from '\@angular/common';
  198. *
  199. * \@NgModule({
  200. * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
  201. * })
  202. * class AppModule {}
  203. * ```
  204. *
  205. * \@stable
  206. */
  207. var APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('appBaseHref');
  208. /**
  209. * @fileoverview added by tsickle
  210. * @suppress {checkTypes} checked by tsc
  211. */
  212. /**
  213. * @license
  214. * Copyright Google Inc. All Rights Reserved.
  215. *
  216. * Use of this source code is governed by an MIT-style license that can be
  217. * found in the LICENSE file at https://angular.io/license
  218. */
  219. /**
  220. * \@experimental
  221. * @record
  222. */
  223. /**
  224. * \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
  225. * \@description
  226. * Depending on which {\@link LocationStrategy} is used, `Location` will either persist
  227. * to the URL's path or the URL's hash segment.
  228. *
  229. * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use
  230. * `Location` only if you need to interact with or create normalized URLs outside of
  231. * routing.
  232. *
  233. * `Location` is responsible for normalizing the URL against the application's base href.
  234. * A normalized URL is absolute from the URL host, includes the application's base href, and has no
  235. * trailing slash:
  236. * - `/my/app/user/123` is normalized
  237. * - `my/app/user/123` **is not** normalized
  238. * - `/my/app/user/123/` **is not** normalized
  239. *
  240. * ### Example
  241. * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
  242. * \@stable
  243. */
  244. var Location = /** @class */ (function () {
  245. function Location(platformStrategy) {
  246. var _this = this;
  247. /**
  248. * \@internal
  249. */
  250. this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* EventEmitter */]();
  251. this._platformStrategy = platformStrategy;
  252. var /** @type {?} */ browserBaseHref = this._platformStrategy.getBaseHref();
  253. this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
  254. this._platformStrategy.onPopState(function (ev) {
  255. _this._subject.emit({
  256. 'url': _this.path(true),
  257. 'pop': true,
  258. 'type': ev.type,
  259. });
  260. });
  261. }
  262. /**
  263. * Returns the normalized URL path.
  264. */
  265. // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
  266. // removed.
  267. /**
  268. * Returns the normalized URL path.
  269. * @param {?=} includeHash
  270. * @return {?}
  271. */
  272. Location.prototype.path = /**
  273. * Returns the normalized URL path.
  274. * @param {?=} includeHash
  275. * @return {?}
  276. */
  277. function (includeHash) {
  278. if (includeHash === void 0) { includeHash = false; }
  279. return this.normalize(this._platformStrategy.path(includeHash));
  280. };
  281. /**
  282. * Normalizes the given path and compares to the current normalized path.
  283. */
  284. /**
  285. * Normalizes the given path and compares to the current normalized path.
  286. * @param {?} path
  287. * @param {?=} query
  288. * @return {?}
  289. */
  290. Location.prototype.isCurrentPathEqualTo = /**
  291. * Normalizes the given path and compares to the current normalized path.
  292. * @param {?} path
  293. * @param {?=} query
  294. * @return {?}
  295. */
  296. function (path, query) {
  297. if (query === void 0) { query = ''; }
  298. return this.path() == this.normalize(path + Location.normalizeQueryParams(query));
  299. };
  300. /**
  301. * Given a string representing a URL, returns the normalized URL path without leading or
  302. * trailing slashes.
  303. */
  304. /**
  305. * Given a string representing a URL, returns the normalized URL path without leading or
  306. * trailing slashes.
  307. * @param {?} url
  308. * @return {?}
  309. */
  310. Location.prototype.normalize = /**
  311. * Given a string representing a URL, returns the normalized URL path without leading or
  312. * trailing slashes.
  313. * @param {?} url
  314. * @return {?}
  315. */
  316. function (url) {
  317. return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
  318. };
  319. /**
  320. * Given a string representing a URL, returns the platform-specific external URL path.
  321. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  322. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  323. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  324. */
  325. /**
  326. * Given a string representing a URL, returns the platform-specific external URL path.
  327. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  328. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  329. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  330. * @param {?} url
  331. * @return {?}
  332. */
  333. Location.prototype.prepareExternalUrl = /**
  334. * Given a string representing a URL, returns the platform-specific external URL path.
  335. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  336. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  337. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  338. * @param {?} url
  339. * @return {?}
  340. */
  341. function (url) {
  342. if (url && url[0] !== '/') {
  343. url = '/' + url;
  344. }
  345. return this._platformStrategy.prepareExternalUrl(url);
  346. };
  347. // TODO: rename this method to pushState
  348. /**
  349. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  350. * new item onto the platform's history.
  351. */
  352. /**
  353. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  354. * new item onto the platform's history.
  355. * @param {?} path
  356. * @param {?=} query
  357. * @return {?}
  358. */
  359. Location.prototype.go = /**
  360. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  361. * new item onto the platform's history.
  362. * @param {?} path
  363. * @param {?=} query
  364. * @return {?}
  365. */
  366. function (path, query) {
  367. if (query === void 0) { query = ''; }
  368. this._platformStrategy.pushState(null, '', path, query);
  369. };
  370. /**
  371. * Changes the browsers URL to the normalized version of the given URL, and replaces
  372. * the top item on the platform's history stack.
  373. */
  374. /**
  375. * Changes the browsers URL to the normalized version of the given URL, and replaces
  376. * the top item on the platform's history stack.
  377. * @param {?} path
  378. * @param {?=} query
  379. * @return {?}
  380. */
  381. Location.prototype.replaceState = /**
  382. * Changes the browsers URL to the normalized version of the given URL, and replaces
  383. * the top item on the platform's history stack.
  384. * @param {?} path
  385. * @param {?=} query
  386. * @return {?}
  387. */
  388. function (path, query) {
  389. if (query === void 0) { query = ''; }
  390. this._platformStrategy.replaceState(null, '', path, query);
  391. };
  392. /**
  393. * Navigates forward in the platform's history.
  394. */
  395. /**
  396. * Navigates forward in the platform's history.
  397. * @return {?}
  398. */
  399. Location.prototype.forward = /**
  400. * Navigates forward in the platform's history.
  401. * @return {?}
  402. */
  403. function () { this._platformStrategy.forward(); };
  404. /**
  405. * Navigates back in the platform's history.
  406. */
  407. /**
  408. * Navigates back in the platform's history.
  409. * @return {?}
  410. */
  411. Location.prototype.back = /**
  412. * Navigates back in the platform's history.
  413. * @return {?}
  414. */
  415. function () { this._platformStrategy.back(); };
  416. /**
  417. * Subscribe to the platform's `popState` events.
  418. */
  419. /**
  420. * Subscribe to the platform's `popState` events.
  421. * @param {?} onNext
  422. * @param {?=} onThrow
  423. * @param {?=} onReturn
  424. * @return {?}
  425. */
  426. Location.prototype.subscribe = /**
  427. * Subscribe to the platform's `popState` events.
  428. * @param {?} onNext
  429. * @param {?=} onThrow
  430. * @param {?=} onReturn
  431. * @return {?}
  432. */
  433. function (onNext, onThrow, onReturn) {
  434. return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
  435. };
  436. /**
  437. * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
  438. * is.
  439. * @param {?} params
  440. * @return {?}
  441. */
  442. Location.normalizeQueryParams = /**
  443. * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
  444. * is.
  445. * @param {?} params
  446. * @return {?}
  447. */
  448. function (params) {
  449. return params && params[0] !== '?' ? '?' + params : params;
  450. };
  451. /**
  452. * Given 2 parts of a url, join them with a slash if needed.
  453. * @param {?} start
  454. * @param {?} end
  455. * @return {?}
  456. */
  457. Location.joinWithSlash = /**
  458. * Given 2 parts of a url, join them with a slash if needed.
  459. * @param {?} start
  460. * @param {?} end
  461. * @return {?}
  462. */
  463. function (start, end) {
  464. if (start.length == 0) {
  465. return end;
  466. }
  467. if (end.length == 0) {
  468. return start;
  469. }
  470. var /** @type {?} */ slashes = 0;
  471. if (start.endsWith('/')) {
  472. slashes++;
  473. }
  474. if (end.startsWith('/')) {
  475. slashes++;
  476. }
  477. if (slashes == 2) {
  478. return start + end.substring(1);
  479. }
  480. if (slashes == 1) {
  481. return start + end;
  482. }
  483. return start + '/' + end;
  484. };
  485. /**
  486. * If url has a trailing slash, remove it, otherwise return url as is. This
  487. * method looks for the first occurence of either #, ?, or the end of the
  488. * line as `/` characters after any of these should not be replaced.
  489. * @param {?} url
  490. * @return {?}
  491. */
  492. Location.stripTrailingSlash = /**
  493. * If url has a trailing slash, remove it, otherwise return url as is. This
  494. * method looks for the first occurence of either #, ?, or the end of the
  495. * line as `/` characters after any of these should not be replaced.
  496. * @param {?} url
  497. * @return {?}
  498. */
  499. function (url) {
  500. var /** @type {?} */ match = url.match(/#|\?|$/);
  501. var /** @type {?} */ pathEndIdx = match && match.index || url.length;
  502. var /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
  503. return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
  504. };
  505. Location.decorators = [
  506. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
  507. ];
  508. /** @nocollapse */
  509. Location.ctorParameters = function () { return [
  510. { type: LocationStrategy, },
  511. ]; };
  512. return Location;
  513. }());
  514. /**
  515. * @param {?} baseHref
  516. * @param {?} url
  517. * @return {?}
  518. */
  519. function _stripBaseHref(baseHref, url) {
  520. return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
  521. }
  522. /**
  523. * @param {?} url
  524. * @return {?}
  525. */
  526. function _stripIndexHtml(url) {
  527. return url.replace(/\/index.html$/, '');
  528. }
  529. /**
  530. * @fileoverview added by tsickle
  531. * @suppress {checkTypes} checked by tsc
  532. */
  533. /**
  534. * @license
  535. * Copyright Google Inc. All Rights Reserved.
  536. *
  537. * Use of this source code is governed by an MIT-style license that can be
  538. * found in the LICENSE file at https://angular.io/license
  539. */
  540. /**
  541. * \@whatItDoes Use URL hash for storing application location data.
  542. * \@description
  543. * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the
  544. * {\@link Location} service to represent its state in the
  545. * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
  546. * of the browser's URL.
  547. *
  548. * For instance, if you call `location.go('/foo')`, the browser's URL will become
  549. * `example.com#/foo`.
  550. *
  551. * ### Example
  552. *
  553. * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'}
  554. *
  555. * \@stable
  556. */
  557. var HashLocationStrategy = /** @class */ (function (_super) {
  558. Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(HashLocationStrategy, _super);
  559. function HashLocationStrategy(_platformLocation, _baseHref) {
  560. var _this = _super.call(this) || this;
  561. _this._platformLocation = _platformLocation;
  562. _this._baseHref = '';
  563. if (_baseHref != null) {
  564. _this._baseHref = _baseHref;
  565. }
  566. return _this;
  567. }
  568. /**
  569. * @param {?} fn
  570. * @return {?}
  571. */
  572. HashLocationStrategy.prototype.onPopState = /**
  573. * @param {?} fn
  574. * @return {?}
  575. */
  576. function (fn) {
  577. this._platformLocation.onPopState(fn);
  578. this._platformLocation.onHashChange(fn);
  579. };
  580. /**
  581. * @return {?}
  582. */
  583. HashLocationStrategy.prototype.getBaseHref = /**
  584. * @return {?}
  585. */
  586. function () { return this._baseHref; };
  587. /**
  588. * @param {?=} includeHash
  589. * @return {?}
  590. */
  591. HashLocationStrategy.prototype.path = /**
  592. * @param {?=} includeHash
  593. * @return {?}
  594. */
  595. function (includeHash) {
  596. if (includeHash === void 0) { includeHash = false; }
  597. // the hash value is always prefixed with a `#`
  598. // and if it is empty then it will stay empty
  599. var /** @type {?} */ path = this._platformLocation.hash;
  600. if (path == null)
  601. path = '#';
  602. return path.length > 0 ? path.substring(1) : path;
  603. };
  604. /**
  605. * @param {?} internal
  606. * @return {?}
  607. */
  608. HashLocationStrategy.prototype.prepareExternalUrl = /**
  609. * @param {?} internal
  610. * @return {?}
  611. */
  612. function (internal) {
  613. var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal);
  614. return url.length > 0 ? ('#' + url) : url;
  615. };
  616. /**
  617. * @param {?} state
  618. * @param {?} title
  619. * @param {?} path
  620. * @param {?} queryParams
  621. * @return {?}
  622. */
  623. HashLocationStrategy.prototype.pushState = /**
  624. * @param {?} state
  625. * @param {?} title
  626. * @param {?} path
  627. * @param {?} queryParams
  628. * @return {?}
  629. */
  630. function (state, title, path, queryParams) {
  631. var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
  632. if (url.length == 0) {
  633. url = this._platformLocation.pathname;
  634. }
  635. this._platformLocation.pushState(state, title, url);
  636. };
  637. /**
  638. * @param {?} state
  639. * @param {?} title
  640. * @param {?} path
  641. * @param {?} queryParams
  642. * @return {?}
  643. */
  644. HashLocationStrategy.prototype.replaceState = /**
  645. * @param {?} state
  646. * @param {?} title
  647. * @param {?} path
  648. * @param {?} queryParams
  649. * @return {?}
  650. */
  651. function (state, title, path, queryParams) {
  652. var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
  653. if (url.length == 0) {
  654. url = this._platformLocation.pathname;
  655. }
  656. this._platformLocation.replaceState(state, title, url);
  657. };
  658. /**
  659. * @return {?}
  660. */
  661. HashLocationStrategy.prototype.forward = /**
  662. * @return {?}
  663. */
  664. function () { this._platformLocation.forward(); };
  665. /**
  666. * @return {?}
  667. */
  668. HashLocationStrategy.prototype.back = /**
  669. * @return {?}
  670. */
  671. function () { this._platformLocation.back(); };
  672. HashLocationStrategy.decorators = [
  673. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
  674. ];
  675. /** @nocollapse */
  676. HashLocationStrategy.ctorParameters = function () { return [
  677. { type: PlatformLocation, },
  678. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [APP_BASE_HREF,] },] },
  679. ]; };
  680. return HashLocationStrategy;
  681. }(LocationStrategy));
  682. /**
  683. * @fileoverview added by tsickle
  684. * @suppress {checkTypes} checked by tsc
  685. */
  686. /**
  687. * @license
  688. * Copyright Google Inc. All Rights Reserved.
  689. *
  690. * Use of this source code is governed by an MIT-style license that can be
  691. * found in the LICENSE file at https://angular.io/license
  692. */
  693. /**
  694. * \@whatItDoes Use URL for storing application location data.
  695. * \@description
  696. * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the
  697. * {\@link Location} service to represent its state in the
  698. * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
  699. * browser's URL.
  700. *
  701. * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF}
  702. * or add a base element to the document. This URL prefix that will be preserved
  703. * when generating and recognizing URLs.
  704. *
  705. * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
  706. * `location.go('/foo')`, the browser's URL will become
  707. * `example.com/my/app/foo`.
  708. *
  709. * Similarly, if you add `<base href='/my/app'/>` to the document and call
  710. * `location.go('/foo')`, the browser's URL will become
  711. * `example.com/my/app/foo`.
  712. *
  713. * ### Example
  714. *
  715. * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
  716. *
  717. * \@stable
  718. */
  719. var PathLocationStrategy = /** @class */ (function (_super) {
  720. Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(PathLocationStrategy, _super);
  721. function PathLocationStrategy(_platformLocation, href) {
  722. var _this = _super.call(this) || this;
  723. _this._platformLocation = _platformLocation;
  724. if (href == null) {
  725. href = _this._platformLocation.getBaseHrefFromDOM();
  726. }
  727. if (href == null) {
  728. throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
  729. }
  730. _this._baseHref = href;
  731. return _this;
  732. }
  733. /**
  734. * @param {?} fn
  735. * @return {?}
  736. */
  737. PathLocationStrategy.prototype.onPopState = /**
  738. * @param {?} fn
  739. * @return {?}
  740. */
  741. function (fn) {
  742. this._platformLocation.onPopState(fn);
  743. this._platformLocation.onHashChange(fn);
  744. };
  745. /**
  746. * @return {?}
  747. */
  748. PathLocationStrategy.prototype.getBaseHref = /**
  749. * @return {?}
  750. */
  751. function () { return this._baseHref; };
  752. /**
  753. * @param {?} internal
  754. * @return {?}
  755. */
  756. PathLocationStrategy.prototype.prepareExternalUrl = /**
  757. * @param {?} internal
  758. * @return {?}
  759. */
  760. function (internal) {
  761. return Location.joinWithSlash(this._baseHref, internal);
  762. };
  763. /**
  764. * @param {?=} includeHash
  765. * @return {?}
  766. */
  767. PathLocationStrategy.prototype.path = /**
  768. * @param {?=} includeHash
  769. * @return {?}
  770. */
  771. function (includeHash) {
  772. if (includeHash === void 0) { includeHash = false; }
  773. var /** @type {?} */ pathname = this._platformLocation.pathname +
  774. Location.normalizeQueryParams(this._platformLocation.search);
  775. var /** @type {?} */ hash = this._platformLocation.hash;
  776. return hash && includeHash ? "" + pathname + hash : pathname;
  777. };
  778. /**
  779. * @param {?} state
  780. * @param {?} title
  781. * @param {?} url
  782. * @param {?} queryParams
  783. * @return {?}
  784. */
  785. PathLocationStrategy.prototype.pushState = /**
  786. * @param {?} state
  787. * @param {?} title
  788. * @param {?} url
  789. * @param {?} queryParams
  790. * @return {?}
  791. */
  792. function (state, title, url, queryParams) {
  793. var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
  794. this._platformLocation.pushState(state, title, externalUrl);
  795. };
  796. /**
  797. * @param {?} state
  798. * @param {?} title
  799. * @param {?} url
  800. * @param {?} queryParams
  801. * @return {?}
  802. */
  803. PathLocationStrategy.prototype.replaceState = /**
  804. * @param {?} state
  805. * @param {?} title
  806. * @param {?} url
  807. * @param {?} queryParams
  808. * @return {?}
  809. */
  810. function (state, title, url, queryParams) {
  811. var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
  812. this._platformLocation.replaceState(state, title, externalUrl);
  813. };
  814. /**
  815. * @return {?}
  816. */
  817. PathLocationStrategy.prototype.forward = /**
  818. * @return {?}
  819. */
  820. function () { this._platformLocation.forward(); };
  821. /**
  822. * @return {?}
  823. */
  824. PathLocationStrategy.prototype.back = /**
  825. * @return {?}
  826. */
  827. function () { this._platformLocation.back(); };
  828. PathLocationStrategy.decorators = [
  829. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
  830. ];
  831. /** @nocollapse */
  832. PathLocationStrategy.ctorParameters = function () { return [
  833. { type: PlatformLocation, },
  834. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [APP_BASE_HREF,] },] },
  835. ]; };
  836. return PathLocationStrategy;
  837. }(LocationStrategy));
  838. /**
  839. * @fileoverview added by tsickle
  840. * @suppress {checkTypes} checked by tsc
  841. */
  842. /**
  843. * @license
  844. * Copyright Google Inc. All Rights Reserved.
  845. *
  846. * Use of this source code is governed by an MIT-style license that can be
  847. * found in the LICENSE file at https://angular.io/license
  848. */
  849. /**
  850. * @fileoverview added by tsickle
  851. * @suppress {checkTypes} checked by tsc
  852. */
  853. /**
  854. * @license
  855. * Copyright Google Inc. All Rights Reserved.
  856. *
  857. * Use of this source code is governed by an MIT-style license that can be
  858. * found in the LICENSE file at https://angular.io/license
  859. */
  860. // THIS CODE IS GENERATED - DO NOT MODIFY
  861. // See angular/tools/gulp-tasks/cldr/extract.js
  862. /**
  863. * \@internal
  864. */
  865. var CURRENCIES = {
  866. 'AOA': [, 'Kz'],
  867. 'ARS': [, '$'],
  868. 'AUD': ['A$', '$'],
  869. 'BAM': [, 'KM'],
  870. 'BBD': [, '$'],
  871. 'BDT': [, '৳'],
  872. 'BMD': [, '$'],
  873. 'BND': [, '$'],
  874. 'BOB': [, 'Bs'],
  875. 'BRL': ['R$'],
  876. 'BSD': [, '$'],
  877. 'BWP': [, 'P'],
  878. 'BYN': [, 'р.'],
  879. 'BZD': [, '$'],
  880. 'CAD': ['CA$', '$'],
  881. 'CLP': [, '$'],
  882. 'CNY': ['CN¥', '¥'],
  883. 'COP': [, '$'],
  884. 'CRC': [, '₡'],
  885. 'CUC': [, '$'],
  886. 'CUP': [, '$'],
  887. 'CZK': [, 'Kč'],
  888. 'DKK': [, 'kr'],
  889. 'DOP': [, '$'],
  890. 'EGP': [, 'E£'],
  891. 'ESP': [, '₧'],
  892. 'EUR': ['€'],
  893. 'FJD': [, '$'],
  894. 'FKP': [, '£'],
  895. 'GBP': ['£'],
  896. 'GEL': [, '₾'],
  897. 'GIP': [, '£'],
  898. 'GNF': [, 'FG'],
  899. 'GTQ': [, 'Q'],
  900. 'GYD': [, '$'],
  901. 'HKD': ['HK$', '$'],
  902. 'HNL': [, 'L'],
  903. 'HRK': [, 'kn'],
  904. 'HUF': [, 'Ft'],
  905. 'IDR': [, 'Rp'],
  906. 'ILS': ['₪'],
  907. 'INR': ['₹'],
  908. 'ISK': [, 'kr'],
  909. 'JMD': [, '$'],
  910. 'JPY': ['¥'],
  911. 'KHR': [, '៛'],
  912. 'KMF': [, 'CF'],
  913. 'KPW': [, '₩'],
  914. 'KRW': ['₩'],
  915. 'KYD': [, '$'],
  916. 'KZT': [, '₸'],
  917. 'LAK': [, '₭'],
  918. 'LBP': [, 'L£'],
  919. 'LKR': [, 'Rs'],
  920. 'LRD': [, '$'],
  921. 'LTL': [, 'Lt'],
  922. 'LVL': [, 'Ls'],
  923. 'MGA': [, 'Ar'],
  924. 'MMK': [, 'K'],
  925. 'MNT': [, '₮'],
  926. 'MUR': [, 'Rs'],
  927. 'MXN': ['MX$', '$'],
  928. 'MYR': [, 'RM'],
  929. 'NAD': [, '$'],
  930. 'NGN': [, '₦'],
  931. 'NIO': [, 'C$'],
  932. 'NOK': [, 'kr'],
  933. 'NPR': [, 'Rs'],
  934. 'NZD': ['NZ$', '$'],
  935. 'PHP': [, '₱'],
  936. 'PKR': [, 'Rs'],
  937. 'PLN': [, 'zł'],
  938. 'PYG': [, '₲'],
  939. 'RON': [, 'lei'],
  940. 'RUB': [, '₽'],
  941. 'RUR': [, 'р.'],
  942. 'RWF': [, 'RF'],
  943. 'SBD': [, '$'],
  944. 'SEK': [, 'kr'],
  945. 'SGD': [, '$'],
  946. 'SHP': [, '£'],
  947. 'SRD': [, '$'],
  948. 'SSP': [, '£'],
  949. 'STD': [, 'Db'],
  950. 'SYP': [, '£'],
  951. 'THB': [, '฿'],
  952. 'TOP': [, 'T$'],
  953. 'TRY': [, '₺'],
  954. 'TTD': [, '$'],
  955. 'TWD': ['NT$', '$'],
  956. 'UAH': [, '₴'],
  957. 'USD': ['$'],
  958. 'UYU': [, '$'],
  959. 'VEF': [, 'Bs'],
  960. 'VND': ['₫'],
  961. 'XAF': ['FCFA'],
  962. 'XCD': ['EC$', '$'],
  963. 'XOF': ['CFA'],
  964. 'XPF': ['CFPF'],
  965. 'ZAR': [, 'R'],
  966. 'ZMW': [, 'ZK'],
  967. };
  968. /**
  969. * @fileoverview added by tsickle
  970. * @suppress {checkTypes} checked by tsc
  971. */
  972. /**
  973. * @license
  974. * Copyright Google Inc. All Rights Reserved.
  975. *
  976. * Use of this source code is governed by an MIT-style license that can be
  977. * found in the LICENSE file at https://angular.io/license
  978. */
  979. // THIS CODE IS GENERATED - DO NOT MODIFY
  980. // See angular/tools/gulp-tasks/cldr/extract.js
  981. /**
  982. * @param {?} n
  983. * @return {?}
  984. */
  985. function plural(n) {
  986. var /** @type {?} */ i = Math.floor(Math.abs(n)), /** @type {?} */ v = n.toString().replace(/^[^.]*\.?/, '').length;
  987. if (i === 1 && v === 0)
  988. return 1;
  989. return 5;
  990. }
  991. var localeEn = [
  992. 'en',
  993. [
  994. ['a', 'p'],
  995. ['AM', 'PM'],
  996. ],
  997. [
  998. ['AM', 'PM'],
  999. ,
  1000. ],
  1001. [
  1002. ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  1003. ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  1004. ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
  1005. ],
  1006. ,
  1007. [
  1008. ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  1009. ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  1010. [
  1011. 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
  1012. 'October', 'November', 'December'
  1013. ]
  1014. ],
  1015. ,
  1016. [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0],
  1017. ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
  1018. ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
  1019. [
  1020. '{1}, {0}',
  1021. ,
  1022. '{1} \'at\' {0}',
  1023. ],
  1024. ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
  1025. ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', plural
  1026. ];
  1027. /**
  1028. * @fileoverview added by tsickle
  1029. * @suppress {checkTypes} checked by tsc
  1030. */
  1031. /**
  1032. * @license
  1033. * Copyright Google Inc. All Rights Reserved.
  1034. *
  1035. * Use of this source code is governed by an MIT-style license that can be
  1036. * found in the LICENSE file at https://angular.io/license
  1037. */
  1038. /**
  1039. * \@experimental i18n support is experimental.
  1040. */
  1041. var LOCALE_DATA = {};
  1042. /**
  1043. * Register global data to be used internally by Angular. See the
  1044. * {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale data.
  1045. *
  1046. * \@experimental i18n support is experimental.
  1047. * @param {?} data
  1048. * @param {?=} localeId
  1049. * @param {?=} extraData
  1050. * @return {?}
  1051. */
  1052. function registerLocaleData(data, localeId, extraData) {
  1053. if (typeof localeId !== 'string') {
  1054. extraData = localeId;
  1055. localeId = data[0 /* LocaleId */];
  1056. }
  1057. localeId = localeId.toLowerCase().replace(/_/g, '-');
  1058. LOCALE_DATA[localeId] = data;
  1059. if (extraData) {
  1060. LOCALE_DATA[localeId][18 /* ExtraData */] = extraData;
  1061. }
  1062. }
  1063. /**
  1064. * @fileoverview added by tsickle
  1065. * @suppress {checkTypes} checked by tsc
  1066. */
  1067. /**
  1068. * @license
  1069. * Copyright Google Inc. All Rights Reserved.
  1070. *
  1071. * Use of this source code is governed by an MIT-style license that can be
  1072. * found in the LICENSE file at https://angular.io/license
  1073. */
  1074. /** @enum {number} */
  1075. var NumberFormatStyle = {
  1076. Decimal: 0,
  1077. Percent: 1,
  1078. Currency: 2,
  1079. Scientific: 3,
  1080. };
  1081. NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal";
  1082. NumberFormatStyle[NumberFormatStyle.Percent] = "Percent";
  1083. NumberFormatStyle[NumberFormatStyle.Currency] = "Currency";
  1084. NumberFormatStyle[NumberFormatStyle.Scientific] = "Scientific";
  1085. /** @enum {number} */
  1086. var Plural = {
  1087. Zero: 0,
  1088. One: 1,
  1089. Two: 2,
  1090. Few: 3,
  1091. Many: 4,
  1092. Other: 5,
  1093. };
  1094. Plural[Plural.Zero] = "Zero";
  1095. Plural[Plural.One] = "One";
  1096. Plural[Plural.Two] = "Two";
  1097. Plural[Plural.Few] = "Few";
  1098. Plural[Plural.Many] = "Many";
  1099. Plural[Plural.Other] = "Other";
  1100. /** @enum {number} */
  1101. var FormStyle = {
  1102. Format: 0,
  1103. Standalone: 1,
  1104. };
  1105. FormStyle[FormStyle.Format] = "Format";
  1106. FormStyle[FormStyle.Standalone] = "Standalone";
  1107. /** @enum {number} */
  1108. var TranslationWidth = {
  1109. Narrow: 0,
  1110. Abbreviated: 1,
  1111. Wide: 2,
  1112. Short: 3,
  1113. };
  1114. TranslationWidth[TranslationWidth.Narrow] = "Narrow";
  1115. TranslationWidth[TranslationWidth.Abbreviated] = "Abbreviated";
  1116. TranslationWidth[TranslationWidth.Wide] = "Wide";
  1117. TranslationWidth[TranslationWidth.Short] = "Short";
  1118. /** @enum {number} */
  1119. var FormatWidth = {
  1120. Short: 0,
  1121. Medium: 1,
  1122. Long: 2,
  1123. Full: 3,
  1124. };
  1125. FormatWidth[FormatWidth.Short] = "Short";
  1126. FormatWidth[FormatWidth.Medium] = "Medium";
  1127. FormatWidth[FormatWidth.Long] = "Long";
  1128. FormatWidth[FormatWidth.Full] = "Full";
  1129. /** @enum {number} */
  1130. var NumberSymbol = {
  1131. Decimal: 0,
  1132. Group: 1,
  1133. List: 2,
  1134. PercentSign: 3,
  1135. PlusSign: 4,
  1136. MinusSign: 5,
  1137. Exponential: 6,
  1138. SuperscriptingExponent: 7,
  1139. PerMille: 8,
  1140. Infinity: 9,
  1141. NaN: 10,
  1142. TimeSeparator: 11,
  1143. CurrencyDecimal: 12,
  1144. CurrencyGroup: 13,
  1145. };
  1146. NumberSymbol[NumberSymbol.Decimal] = "Decimal";
  1147. NumberSymbol[NumberSymbol.Group] = "Group";
  1148. NumberSymbol[NumberSymbol.List] = "List";
  1149. NumberSymbol[NumberSymbol.PercentSign] = "PercentSign";
  1150. NumberSymbol[NumberSymbol.PlusSign] = "PlusSign";
  1151. NumberSymbol[NumberSymbol.MinusSign] = "MinusSign";
  1152. NumberSymbol[NumberSymbol.Exponential] = "Exponential";
  1153. NumberSymbol[NumberSymbol.SuperscriptingExponent] = "SuperscriptingExponent";
  1154. NumberSymbol[NumberSymbol.PerMille] = "PerMille";
  1155. NumberSymbol[NumberSymbol.Infinity] = "Infinity";
  1156. NumberSymbol[NumberSymbol.NaN] = "NaN";
  1157. NumberSymbol[NumberSymbol.TimeSeparator] = "TimeSeparator";
  1158. NumberSymbol[NumberSymbol.CurrencyDecimal] = "CurrencyDecimal";
  1159. NumberSymbol[NumberSymbol.CurrencyGroup] = "CurrencyGroup";
  1160. /** @enum {number} */
  1161. var WeekDay = {
  1162. Sunday: 0,
  1163. Monday: 1,
  1164. Tuesday: 2,
  1165. Wednesday: 3,
  1166. Thursday: 4,
  1167. Friday: 5,
  1168. Saturday: 6,
  1169. };
  1170. WeekDay[WeekDay.Sunday] = "Sunday";
  1171. WeekDay[WeekDay.Monday] = "Monday";
  1172. WeekDay[WeekDay.Tuesday] = "Tuesday";
  1173. WeekDay[WeekDay.Wednesday] = "Wednesday";
  1174. WeekDay[WeekDay.Thursday] = "Thursday";
  1175. WeekDay[WeekDay.Friday] = "Friday";
  1176. WeekDay[WeekDay.Saturday] = "Saturday";
  1177. /**
  1178. * The locale id for the chosen locale (e.g `en-GB`).
  1179. *
  1180. * \@experimental i18n support is experimental.
  1181. * @param {?} locale
  1182. * @return {?}
  1183. */
  1184. function getLocaleId(locale) {
  1185. return findLocaleData(locale)[0 /* LocaleId */];
  1186. }
  1187. /**
  1188. * Periods of the day (e.g. `[AM, PM]` for en-US).
  1189. *
  1190. * \@experimental i18n support is experimental.
  1191. * @param {?} locale
  1192. * @param {?} formStyle
  1193. * @param {?} width
  1194. * @return {?}
  1195. */
  1196. function getLocaleDayPeriods(locale, formStyle, width) {
  1197. var /** @type {?} */ data = findLocaleData(locale);
  1198. var /** @type {?} */ amPmData = /** @type {?} */ ([data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]);
  1199. var /** @type {?} */ amPm = getLastDefinedValue(amPmData, formStyle);
  1200. return getLastDefinedValue(amPm, width);
  1201. }
  1202. /**
  1203. * Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US).
  1204. *
  1205. * \@experimental i18n support is experimental.
  1206. * @param {?} locale
  1207. * @param {?} formStyle
  1208. * @param {?} width
  1209. * @return {?}
  1210. */
  1211. function getLocaleDayNames(locale, formStyle, width) {
  1212. var /** @type {?} */ data = findLocaleData(locale);
  1213. var /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]);
  1214. var /** @type {?} */ days = getLastDefinedValue(daysData, formStyle);
  1215. return getLastDefinedValue(days, width);
  1216. }
  1217. /**
  1218. * Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US).
  1219. *
  1220. * \@experimental i18n support is experimental.
  1221. * @param {?} locale
  1222. * @param {?} formStyle
  1223. * @param {?} width
  1224. * @return {?}
  1225. */
  1226. function getLocaleMonthNames(locale, formStyle, width) {
  1227. var /** @type {?} */ data = findLocaleData(locale);
  1228. var /** @type {?} */ monthsData = /** @type {?} */ ([data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]);
  1229. var /** @type {?} */ months = getLastDefinedValue(monthsData, formStyle);
  1230. return getLastDefinedValue(months, width);
  1231. }
  1232. /**
  1233. * Eras for the Gregorian calendar (e.g. AD/BC).
  1234. *
  1235. * \@experimental i18n support is experimental.
  1236. * @param {?} locale
  1237. * @param {?} width
  1238. * @return {?}
  1239. */
  1240. function getLocaleEraNames(locale, width) {
  1241. var /** @type {?} */ data = findLocaleData(locale);
  1242. var /** @type {?} */ erasData = /** @type {?} */ (data[7 /* Eras */]);
  1243. return getLastDefinedValue(erasData, width);
  1244. }
  1245. /**
  1246. * First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...).
  1247. * For example in french the value would be 1 because the first day of the week is Monday.
  1248. *
  1249. * \@experimental i18n support is experimental.
  1250. * @param {?} locale
  1251. * @return {?}
  1252. */
  1253. function getLocaleFirstDayOfWeek(locale) {
  1254. var /** @type {?} */ data = findLocaleData(locale);
  1255. return data[8 /* FirstDayOfWeek */];
  1256. }
  1257. /**
  1258. * Range of days in the week that represent the week-end for this locale, based on english days
  1259. * (Sunday = 0, Monday = 1, ...).
  1260. * For example in english the value would be [6,0] for Saturday to Sunday.
  1261. *
  1262. * \@experimental i18n support is experimental.
  1263. * @param {?} locale
  1264. * @return {?}
  1265. */
  1266. function getLocaleWeekEndRange(locale) {
  1267. var /** @type {?} */ data = findLocaleData(locale);
  1268. return data[9 /* WeekendRange */];
  1269. }
  1270. /**
  1271. * Date format that depends on the locale.
  1272. *
  1273. * There are four basic date formats:
  1274. * - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d).
  1275. *
  1276. * For example, English uses `EEEE, MMMM d, y`, corresponding to a date like
  1277. * "Tuesday, September 14, 1999".
  1278. *
  1279. * - `long` should contain year, long-month, day.
  1280. *
  1281. * For example, `MMMM d, y`, corresponding to a date like "September 14, 1999".
  1282. *
  1283. * - `medium` should contain year, abbreviated-month (MMM), day.
  1284. *
  1285. * For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999".
  1286. * For languages that do not use abbreviated months, use the numeric month (MM/M). For example,
  1287. * `y/MM/dd`, corresponding to a date like "1999/09/14".
  1288. *
  1289. * - `short` should contain year, numeric-month (MM/M), and day.
  1290. *
  1291. * For example, `M/d/yy`, corresponding to a date like "9/14/99".
  1292. *
  1293. * \@experimental i18n support is experimental.
  1294. * @param {?} locale
  1295. * @param {?} width
  1296. * @return {?}
  1297. */
  1298. function getLocaleDateFormat(locale, width) {
  1299. var /** @type {?} */ data = findLocaleData(locale);
  1300. return getLastDefinedValue(data[10 /* DateFormat */], width);
  1301. }
  1302. /**
  1303. * Time format that depends on the locale.
  1304. *
  1305. * The standard formats include four basic time formats:
  1306. * - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz).
  1307. * - `long` should contain hour, minute, second, and zone (z)
  1308. * - `medium` should contain hour, minute, second.
  1309. * - `short` should contain hour, minute.
  1310. *
  1311. * Note: The patterns depend on whether the main country using your language uses 12-hour time or
  1312. * not:
  1313. * - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running
  1314. * 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle
  1315. * running 0 through 11 (midnight plus 1 minute is 0:01).
  1316. * - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0
  1317. * through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running
  1318. * 1 through 24 (midnight plus 1 minute is 24:01).
  1319. *
  1320. * \@experimental i18n support is experimental.
  1321. * @param {?} locale
  1322. * @param {?} width
  1323. * @return {?}
  1324. */
  1325. function getLocaleTimeFormat(locale, width) {
  1326. var /** @type {?} */ data = findLocaleData(locale);
  1327. return getLastDefinedValue(data[11 /* TimeFormat */], width);
  1328. }
  1329. /**
  1330. * Date-time format that depends on the locale.
  1331. *
  1332. * The date-time pattern shows how to combine separate patterns for date (represented by {1})
  1333. * and time (represented by {0}) into a single pattern. It usually doesn't need to be changed.
  1334. * What you want to pay attention to are:
  1335. * - possibly removing a space for languages that don't use it, such as many East Asian languages
  1336. * - possibly adding a comma, other punctuation, or a combining word
  1337. *
  1338. * For example:
  1339. * - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses
  1340. * `{1}{0}`.
  1341. * - An English formatted date-time using the combining pattern `{1}, {0}` could be
  1342. * `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time
  1343. * portion.
  1344. *
  1345. * There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use
  1346. * is normally based on the date style. For example, if the date has a full month and weekday
  1347. * name, the full combining pattern will be used to combine that with a time. If the date has
  1348. * numeric month, the short version of the combining pattern will be used to combine that with a
  1349. * time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short
  1350. * styles.
  1351. *
  1352. * \@experimental i18n support is experimental.
  1353. * @param {?} locale
  1354. * @param {?} width
  1355. * @return {?}
  1356. */
  1357. function getLocaleDateTimeFormat(locale, width) {
  1358. var /** @type {?} */ data = findLocaleData(locale);
  1359. var /** @type {?} */ dateTimeFormatData = /** @type {?} */ (data[12 /* DateTimeFormat */]);
  1360. return getLastDefinedValue(dateTimeFormatData, width);
  1361. }
  1362. /**
  1363. * Number symbol that can be used to replace placeholders in number formats.
  1364. * See {\@link NumberSymbol} for more information.
  1365. *
  1366. * \@experimental i18n support is experimental.
  1367. * @param {?} locale
  1368. * @param {?} symbol
  1369. * @return {?}
  1370. */
  1371. function getLocaleNumberSymbol(locale, symbol) {
  1372. var /** @type {?} */ data = findLocaleData(locale);
  1373. var /** @type {?} */ res = data[13 /* NumberSymbols */][symbol];
  1374. if (typeof res === 'undefined') {
  1375. if (symbol === NumberSymbol.CurrencyDecimal) {
  1376. return data[13 /* NumberSymbols */][NumberSymbol.Decimal];
  1377. }
  1378. else if (symbol === NumberSymbol.CurrencyGroup) {
  1379. return data[13 /* NumberSymbols */][NumberSymbol.Group];
  1380. }
  1381. }
  1382. return res;
  1383. }
  1384. /**
  1385. * Number format that depends on the locale.
  1386. *
  1387. * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
  1388. * when used to format the number 12345.678 could result in "12'345,67". That would happen if the
  1389. * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
  1390. *
  1391. * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders;
  1392. * they stand for the decimal separator, and so on, and are NOT real characters.
  1393. * You must NOT "translate" the placeholders; for example, don't change `.` to `,` even though in
  1394. * your language the decimal point is written with a comma. The symbols should be replaced by the
  1395. * local equivalents, using the Number Symbols for your language.
  1396. *
  1397. * Here are the special characters used in number patterns:
  1398. *
  1399. * | Symbol | Meaning |
  1400. * |--------|---------|
  1401. * | . | Replaced automatically by the character used for the decimal point. |
  1402. * | , | Replaced by the "grouping" (thousands) separator. |
  1403. * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
  1404. * | # | Replaced by a digit (or nothing if there aren't enough). |
  1405. * | ¤ | This will be replaced by a currency symbol, such as $ or USD. |
  1406. * | % | This marks a percent format. The % symbol may change position, but must be retained. |
  1407. * | E | This marks a scientific format. The E symbol may change position, but must be retained. |
  1408. * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
  1409. *
  1410. * You can find more information
  1411. * [on the CLDR website](http://cldr.unicode.org/translation/number-patterns)
  1412. *
  1413. * \@experimental i18n support is experimental.
  1414. * @param {?} locale
  1415. * @param {?} type
  1416. * @return {?}
  1417. */
  1418. function getLocaleNumberFormat(locale, type) {
  1419. var /** @type {?} */ data = findLocaleData(locale);
  1420. return data[14 /* NumberFormats */][type];
  1421. }
  1422. /**
  1423. * The symbol used to represent the currency for the main country using this locale (e.g. $ for
  1424. * the locale en-US).
  1425. * The symbol will be `null` if the main country cannot be determined.
  1426. *
  1427. * \@experimental i18n support is experimental.
  1428. * @param {?} locale
  1429. * @return {?}
  1430. */
  1431. function getLocaleCurrencySymbol(locale) {
  1432. var /** @type {?} */ data = findLocaleData(locale);
  1433. return data[15 /* CurrencySymbol */] || null;
  1434. }
  1435. /**
  1436. * The name of the currency for the main country using this locale (e.g. USD for the locale
  1437. * en-US).
  1438. * The name will be `null` if the main country cannot be determined.
  1439. *
  1440. * \@experimental i18n support is experimental.
  1441. * @param {?} locale
  1442. * @return {?}
  1443. */
  1444. function getLocaleCurrencyName(locale) {
  1445. var /** @type {?} */ data = findLocaleData(locale);
  1446. return data[16 /* CurrencyName */] || null;
  1447. }
  1448. /**
  1449. * The locale plural function used by ICU expressions to determine the plural case to use.
  1450. * See {\@link NgPlural} for more information.
  1451. *
  1452. * \@experimental i18n support is experimental.
  1453. * @param {?} locale
  1454. * @return {?}
  1455. */
  1456. function getLocalePluralCase(locale) {
  1457. var /** @type {?} */ data = findLocaleData(locale);
  1458. return data[17 /* PluralCase */];
  1459. }
  1460. /**
  1461. * @param {?} data
  1462. * @return {?}
  1463. */
  1464. function checkFullData(data) {
  1465. if (!data[18 /* ExtraData */]) {
  1466. throw new Error("Missing extra locale data for the locale \"" + data[0 /* LocaleId */] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.");
  1467. }
  1468. }
  1469. /**
  1470. * Rules used to determine which day period to use (See `dayPeriods` below).
  1471. * The rules can either be an array or a single value. If it's an array, consider it as "from"
  1472. * and "to". If it's a single value then it means that the period is only valid at this exact
  1473. * value.
  1474. * There is always the same number of rules as the number of day periods, which means that the
  1475. * first rule is applied to the first day period and so on.
  1476. * You should fallback to AM/PM when there are no rules available.
  1477. *
  1478. * Note: this is only available if you load the full locale data.
  1479. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
  1480. * data.
  1481. *
  1482. * \@experimental i18n support is experimental.
  1483. * @param {?} locale
  1484. * @return {?}
  1485. */
  1486. function getLocaleExtraDayPeriodRules(locale) {
  1487. var /** @type {?} */ data = findLocaleData(locale);
  1488. checkFullData(data);
  1489. var /** @type {?} */ rules = data[18 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || [];
  1490. return rules.map(function (rule) {
  1491. if (typeof rule === 'string') {
  1492. return extractTime(rule);
  1493. }
  1494. return [extractTime(rule[0]), extractTime(rule[1])];
  1495. });
  1496. }
  1497. /**
  1498. * Day Periods indicate roughly how the day is broken up in different languages (e.g. morning,
  1499. * noon, afternoon, midnight, ...).
  1500. * You should use the function {\@link getLocaleExtraDayPeriodRules} to determine which period to
  1501. * use.
  1502. * You should fallback to AM/PM when there are no day periods available.
  1503. *
  1504. * Note: this is only available if you load the full locale data.
  1505. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
  1506. * data.
  1507. *
  1508. * \@experimental i18n support is experimental.
  1509. * @param {?} locale
  1510. * @param {?} formStyle
  1511. * @param {?} width
  1512. * @return {?}
  1513. */
  1514. function getLocaleExtraDayPeriods(locale, formStyle, width) {
  1515. var /** @type {?} */ data = findLocaleData(locale);
  1516. checkFullData(data);
  1517. var /** @type {?} */ dayPeriodsData = /** @type {?} */ ([
  1518. data[18 /* ExtraData */][0 /* ExtraDayPeriodFormats */],
  1519. data[18 /* ExtraData */][1 /* ExtraDayPeriodStandalone */]
  1520. ]);
  1521. var /** @type {?} */ dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
  1522. return getLastDefinedValue(dayPeriods, width) || [];
  1523. }
  1524. /**
  1525. * Returns the first value that is defined in an array, going backwards.
  1526. *
  1527. * To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only
  1528. * add the first one to the locale data arrays, the other ones are only defined when different.
  1529. * We use this function to retrieve the first defined value.
  1530. *
  1531. * \@experimental i18n support is experimental.
  1532. * @template T
  1533. * @param {?} data
  1534. * @param {?} index
  1535. * @return {?}
  1536. */
  1537. function getLastDefinedValue(data, index) {
  1538. for (var /** @type {?} */ i = index; i > -1; i--) {
  1539. if (typeof data[i] !== 'undefined') {
  1540. return data[i];
  1541. }
  1542. }
  1543. throw new Error('Locale data API: locale data undefined');
  1544. }
  1545. /**
  1546. * Extract the hours and minutes from a string like "15:45"
  1547. * @param {?} time
  1548. * @return {?}
  1549. */
  1550. function extractTime(time) {
  1551. var _a = time.split(':'), h = _a[0], m = _a[1];
  1552. return { hours: +h, minutes: +m };
  1553. }
  1554. /**
  1555. * Finds the locale data for a locale id
  1556. *
  1557. * \@experimental i18n support is experimental.
  1558. * @param {?} locale
  1559. * @return {?}
  1560. */
  1561. function findLocaleData(locale) {
  1562. var /** @type {?} */ normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
  1563. var /** @type {?} */ match = LOCALE_DATA[normalizedLocale];
  1564. if (match) {
  1565. return match;
  1566. }
  1567. // let's try to find a parent locale
  1568. var /** @type {?} */ parentLocale = normalizedLocale.split('-')[0];
  1569. match = LOCALE_DATA[parentLocale];
  1570. if (match) {
  1571. return match;
  1572. }
  1573. if (parentLocale === 'en') {
  1574. return localeEn;
  1575. }
  1576. throw new Error("Missing locale data for the locale \"" + locale + "\".");
  1577. }
  1578. /**
  1579. * Return the currency symbol for a given currency code, or the code if no symbol available
  1580. * (e.g.: format narrow = $, format wide = US$, code = USD)
  1581. *
  1582. * \@experimental i18n support is experimental.
  1583. * @param {?} code
  1584. * @param {?} format
  1585. * @return {?}
  1586. */
  1587. function getCurrencySymbol(code, format) {
  1588. var /** @type {?} */ currency = CURRENCIES[code] || [];
  1589. var /** @type {?} */ symbolNarrow = currency[1];
  1590. if (format === 'narrow' && typeof symbolNarrow === 'string') {
  1591. return symbolNarrow;
  1592. }
  1593. return currency[0] || code;
  1594. }
  1595. /**
  1596. * @fileoverview added by tsickle
  1597. * @suppress {checkTypes} checked by tsc
  1598. */
  1599. /**
  1600. * @license
  1601. * Copyright Google Inc. All Rights Reserved.
  1602. *
  1603. * Use of this source code is governed by an MIT-style license that can be
  1604. * found in the LICENSE file at https://angular.io/license
  1605. */
  1606. /**
  1607. * @deprecated from v5
  1608. */
  1609. var DEPRECATED_PLURAL_FN = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('UseV4Plurals');
  1610. /**
  1611. * \@experimental
  1612. * @abstract
  1613. */
  1614. var NgLocalization = /** @class */ (function () {
  1615. function NgLocalization() {
  1616. }
  1617. return NgLocalization;
  1618. }());
  1619. /**
  1620. * Returns the plural category for a given value.
  1621. * - "=value" when the case exists,
  1622. * - the plural category otherwise
  1623. * @param {?} value
  1624. * @param {?} cases
  1625. * @param {?} ngLocalization
  1626. * @param {?=} locale
  1627. * @return {?}
  1628. */
  1629. function getPluralCategory(value, cases, ngLocalization, locale) {
  1630. var /** @type {?} */ key = "=" + value;
  1631. if (cases.indexOf(key) > -1) {
  1632. return key;
  1633. }
  1634. key = ngLocalization.getPluralCategory(value, locale);
  1635. if (cases.indexOf(key) > -1) {
  1636. return key;
  1637. }
  1638. if (cases.indexOf('other') > -1) {
  1639. return 'other';
  1640. }
  1641. throw new Error("No plural message found for value \"" + value + "\"");
  1642. }
  1643. /**
  1644. * Returns the plural case based on the locale
  1645. *
  1646. * \@experimental
  1647. */
  1648. var NgLocaleLocalization = /** @class */ (function (_super) {
  1649. Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(NgLocaleLocalization, _super);
  1650. function NgLocaleLocalization(locale, /** @deprecated from v5 */
  1651. deprecatedPluralFn) {
  1652. var _this = _super.call(this) || this;
  1653. _this.locale = locale;
  1654. _this.deprecatedPluralFn = deprecatedPluralFn;
  1655. return _this;
  1656. }
  1657. /**
  1658. * @param {?} value
  1659. * @param {?=} locale
  1660. * @return {?}
  1661. */
  1662. NgLocaleLocalization.prototype.getPluralCategory = /**
  1663. * @param {?} value
  1664. * @param {?=} locale
  1665. * @return {?}
  1666. */
  1667. function (value, locale) {
  1668. var /** @type {?} */ plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) :
  1669. getLocalePluralCase(locale || this.locale)(value);
  1670. switch (plural) {
  1671. case Plural.Zero:
  1672. return 'zero';
  1673. case Plural.One:
  1674. return 'one';
  1675. case Plural.Two:
  1676. return 'two';
  1677. case Plural.Few:
  1678. return 'few';
  1679. case Plural.Many:
  1680. return 'many';
  1681. default:
  1682. return 'other';
  1683. }
  1684. };
  1685. NgLocaleLocalization.decorators = [
  1686. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
  1687. ];
  1688. /** @nocollapse */
  1689. NgLocaleLocalization.ctorParameters = function () { return [
  1690. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  1691. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [DEPRECATED_PLURAL_FN,] },] },
  1692. ]; };
  1693. return NgLocaleLocalization;
  1694. }(NgLocalization));
  1695. /**
  1696. * Returns the plural case based on the locale
  1697. *
  1698. * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts
  1699. * \@experimental
  1700. * @param {?} locale
  1701. * @param {?} nLike
  1702. * @return {?}
  1703. */
  1704. function getPluralCase(locale, nLike) {
  1705. // TODO(vicb): lazy compute
  1706. if (typeof nLike === 'string') {
  1707. nLike = parseInt(/** @type {?} */ (nLike), 10);
  1708. }
  1709. var /** @type {?} */ n = /** @type {?} */ (nLike);
  1710. var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, '');
  1711. var /** @type {?} */ i = Math.floor(Math.abs(n));
  1712. var /** @type {?} */ v = nDecimal.length;
  1713. var /** @type {?} */ f = parseInt(nDecimal, 10);
  1714. var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
  1715. var /** @type {?} */ lang = locale.split('-')[0].toLowerCase();
  1716. switch (lang) {
  1717. case 'af':
  1718. case 'asa':
  1719. case 'az':
  1720. case 'bem':
  1721. case 'bez':
  1722. case 'bg':
  1723. case 'brx':
  1724. case 'ce':
  1725. case 'cgg':
  1726. case 'chr':
  1727. case 'ckb':
  1728. case 'ee':
  1729. case 'el':
  1730. case 'eo':
  1731. case 'es':
  1732. case 'eu':
  1733. case 'fo':
  1734. case 'fur':
  1735. case 'gsw':
  1736. case 'ha':
  1737. case 'haw':
  1738. case 'hu':
  1739. case 'jgo':
  1740. case 'jmc':
  1741. case 'ka':
  1742. case 'kk':
  1743. case 'kkj':
  1744. case 'kl':
  1745. case 'ks':
  1746. case 'ksb':
  1747. case 'ky':
  1748. case 'lb':
  1749. case 'lg':
  1750. case 'mas':
  1751. case 'mgo':
  1752. case 'ml':
  1753. case 'mn':
  1754. case 'nb':
  1755. case 'nd':
  1756. case 'ne':
  1757. case 'nn':
  1758. case 'nnh':
  1759. case 'nyn':
  1760. case 'om':
  1761. case 'or':
  1762. case 'os':
  1763. case 'ps':
  1764. case 'rm':
  1765. case 'rof':
  1766. case 'rwk':
  1767. case 'saq':
  1768. case 'seh':
  1769. case 'sn':
  1770. case 'so':
  1771. case 'sq':
  1772. case 'ta':
  1773. case 'te':
  1774. case 'teo':
  1775. case 'tk':
  1776. case 'tr':
  1777. case 'ug':
  1778. case 'uz':
  1779. case 'vo':
  1780. case 'vun':
  1781. case 'wae':
  1782. case 'xog':
  1783. if (n === 1)
  1784. return Plural.One;
  1785. return Plural.Other;
  1786. case 'ak':
  1787. case 'ln':
  1788. case 'mg':
  1789. case 'pa':
  1790. case 'ti':
  1791. if (n === Math.floor(n) && n >= 0 && n <= 1)
  1792. return Plural.One;
  1793. return Plural.Other;
  1794. case 'am':
  1795. case 'as':
  1796. case 'bn':
  1797. case 'fa':
  1798. case 'gu':
  1799. case 'hi':
  1800. case 'kn':
  1801. case 'mr':
  1802. case 'zu':
  1803. if (i === 0 || n === 1)
  1804. return Plural.One;
  1805. return Plural.Other;
  1806. case 'ar':
  1807. if (n === 0)
  1808. return Plural.Zero;
  1809. if (n === 1)
  1810. return Plural.One;
  1811. if (n === 2)
  1812. return Plural.Two;
  1813. if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
  1814. return Plural.Few;
  1815. if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
  1816. return Plural.Many;
  1817. return Plural.Other;
  1818. case 'ast':
  1819. case 'ca':
  1820. case 'de':
  1821. case 'en':
  1822. case 'et':
  1823. case 'fi':
  1824. case 'fy':
  1825. case 'gl':
  1826. case 'it':
  1827. case 'nl':
  1828. case 'sv':
  1829. case 'sw':
  1830. case 'ur':
  1831. case 'yi':
  1832. if (i === 1 && v === 0)
  1833. return Plural.One;
  1834. return Plural.Other;
  1835. case 'be':
  1836. if (n % 10 === 1 && !(n % 100 === 11))
  1837. return Plural.One;
  1838. if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
  1839. !(n % 100 >= 12 && n % 100 <= 14))
  1840. return Plural.Few;
  1841. if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
  1842. n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
  1843. return Plural.Many;
  1844. return Plural.Other;
  1845. case 'br':
  1846. if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
  1847. return Plural.One;
  1848. if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
  1849. return Plural.Two;
  1850. if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
  1851. !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
  1852. n % 100 >= 90 && n % 100 <= 99))
  1853. return Plural.Few;
  1854. if (!(n === 0) && n % 1e6 === 0)
  1855. return Plural.Many;
  1856. return Plural.Other;
  1857. case 'bs':
  1858. case 'hr':
  1859. case 'sr':
  1860. if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
  1861. return Plural.One;
  1862. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  1863. !(i % 100 >= 12 && i % 100 <= 14) ||
  1864. f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
  1865. !(f % 100 >= 12 && f % 100 <= 14))
  1866. return Plural.Few;
  1867. return Plural.Other;
  1868. case 'cs':
  1869. case 'sk':
  1870. if (i === 1 && v === 0)
  1871. return Plural.One;
  1872. if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
  1873. return Plural.Few;
  1874. if (!(v === 0))
  1875. return Plural.Many;
  1876. return Plural.Other;
  1877. case 'cy':
  1878. if (n === 0)
  1879. return Plural.Zero;
  1880. if (n === 1)
  1881. return Plural.One;
  1882. if (n === 2)
  1883. return Plural.Two;
  1884. if (n === 3)
  1885. return Plural.Few;
  1886. if (n === 6)
  1887. return Plural.Many;
  1888. return Plural.Other;
  1889. case 'da':
  1890. if (n === 1 || !(t === 0) && (i === 0 || i === 1))
  1891. return Plural.One;
  1892. return Plural.Other;
  1893. case 'dsb':
  1894. case 'hsb':
  1895. if (v === 0 && i % 100 === 1 || f % 100 === 1)
  1896. return Plural.One;
  1897. if (v === 0 && i % 100 === 2 || f % 100 === 2)
  1898. return Plural.Two;
  1899. if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
  1900. f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
  1901. return Plural.Few;
  1902. return Plural.Other;
  1903. case 'ff':
  1904. case 'fr':
  1905. case 'hy':
  1906. case 'kab':
  1907. if (i === 0 || i === 1)
  1908. return Plural.One;
  1909. return Plural.Other;
  1910. case 'fil':
  1911. if (v === 0 && (i === 1 || i === 2 || i === 3) ||
  1912. v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
  1913. !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
  1914. return Plural.One;
  1915. return Plural.Other;
  1916. case 'ga':
  1917. if (n === 1)
  1918. return Plural.One;
  1919. if (n === 2)
  1920. return Plural.Two;
  1921. if (n === Math.floor(n) && n >= 3 && n <= 6)
  1922. return Plural.Few;
  1923. if (n === Math.floor(n) && n >= 7 && n <= 10)
  1924. return Plural.Many;
  1925. return Plural.Other;
  1926. case 'gd':
  1927. if (n === 1 || n === 11)
  1928. return Plural.One;
  1929. if (n === 2 || n === 12)
  1930. return Plural.Two;
  1931. if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
  1932. return Plural.Few;
  1933. return Plural.Other;
  1934. case 'gv':
  1935. if (v === 0 && i % 10 === 1)
  1936. return Plural.One;
  1937. if (v === 0 && i % 10 === 2)
  1938. return Plural.Two;
  1939. if (v === 0 &&
  1940. (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
  1941. return Plural.Few;
  1942. if (!(v === 0))
  1943. return Plural.Many;
  1944. return Plural.Other;
  1945. case 'he':
  1946. if (i === 1 && v === 0)
  1947. return Plural.One;
  1948. if (i === 2 && v === 0)
  1949. return Plural.Two;
  1950. if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
  1951. return Plural.Many;
  1952. return Plural.Other;
  1953. case 'is':
  1954. if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
  1955. return Plural.One;
  1956. return Plural.Other;
  1957. case 'ksh':
  1958. if (n === 0)
  1959. return Plural.Zero;
  1960. if (n === 1)
  1961. return Plural.One;
  1962. return Plural.Other;
  1963. case 'kw':
  1964. case 'naq':
  1965. case 'se':
  1966. case 'smn':
  1967. if (n === 1)
  1968. return Plural.One;
  1969. if (n === 2)
  1970. return Plural.Two;
  1971. return Plural.Other;
  1972. case 'lag':
  1973. if (n === 0)
  1974. return Plural.Zero;
  1975. if ((i === 0 || i === 1) && !(n === 0))
  1976. return Plural.One;
  1977. return Plural.Other;
  1978. case 'lt':
  1979. if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
  1980. return Plural.One;
  1981. if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
  1982. !(n % 100 >= 11 && n % 100 <= 19))
  1983. return Plural.Few;
  1984. if (!(f === 0))
  1985. return Plural.Many;
  1986. return Plural.Other;
  1987. case 'lv':
  1988. case 'prg':
  1989. if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
  1990. v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
  1991. return Plural.Zero;
  1992. if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
  1993. !(v === 2) && f % 10 === 1)
  1994. return Plural.One;
  1995. return Plural.Other;
  1996. case 'mk':
  1997. if (v === 0 && i % 10 === 1 || f % 10 === 1)
  1998. return Plural.One;
  1999. return Plural.Other;
  2000. case 'mt':
  2001. if (n === 1)
  2002. return Plural.One;
  2003. if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
  2004. return Plural.Few;
  2005. if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
  2006. return Plural.Many;
  2007. return Plural.Other;
  2008. case 'pl':
  2009. if (i === 1 && v === 0)
  2010. return Plural.One;
  2011. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  2012. !(i % 100 >= 12 && i % 100 <= 14))
  2013. return Plural.Few;
  2014. if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
  2015. v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
  2016. v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
  2017. return Plural.Many;
  2018. return Plural.Other;
  2019. case 'pt':
  2020. if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
  2021. return Plural.One;
  2022. return Plural.Other;
  2023. case 'ro':
  2024. if (i === 1 && v === 0)
  2025. return Plural.One;
  2026. if (!(v === 0) || n === 0 ||
  2027. !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
  2028. return Plural.Few;
  2029. return Plural.Other;
  2030. case 'ru':
  2031. case 'uk':
  2032. if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
  2033. return Plural.One;
  2034. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  2035. !(i % 100 >= 12 && i % 100 <= 14))
  2036. return Plural.Few;
  2037. if (v === 0 && i % 10 === 0 ||
  2038. v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
  2039. v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
  2040. return Plural.Many;
  2041. return Plural.Other;
  2042. case 'shi':
  2043. if (i === 0 || n === 1)
  2044. return Plural.One;
  2045. if (n === Math.floor(n) && n >= 2 && n <= 10)
  2046. return Plural.Few;
  2047. return Plural.Other;
  2048. case 'si':
  2049. if (n === 0 || n === 1 || i === 0 && f === 1)
  2050. return Plural.One;
  2051. return Plural.Other;
  2052. case 'sl':
  2053. if (v === 0 && i % 100 === 1)
  2054. return Plural.One;
  2055. if (v === 0 && i % 100 === 2)
  2056. return Plural.Two;
  2057. if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
  2058. return Plural.Few;
  2059. return Plural.Other;
  2060. case 'tzm':
  2061. if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
  2062. return Plural.One;
  2063. return Plural.Other;
  2064. // When there is no specification, the default is always "other"
  2065. // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules
  2066. // > other (required—general plural form — also used if the language only has a single form)
  2067. default:
  2068. return Plural.Other;
  2069. }
  2070. }
  2071. /**
  2072. * @fileoverview added by tsickle
  2073. * @suppress {checkTypes} checked by tsc
  2074. */
  2075. /**
  2076. * @license
  2077. * Copyright Google Inc. All Rights Reserved.
  2078. *
  2079. * Use of this source code is governed by an MIT-style license that can be
  2080. * found in the LICENSE file at https://angular.io/license
  2081. */
  2082. /**
  2083. * @param {?} cookieStr
  2084. * @param {?} name
  2085. * @return {?}
  2086. */
  2087. function parseCookieValue(cookieStr, name) {
  2088. name = encodeURIComponent(name);
  2089. for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) {
  2090. var cookie = _a[_i];
  2091. var /** @type {?} */ eqIndex = cookie.indexOf('=');
  2092. var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1];
  2093. if (cookieName.trim() === name) {
  2094. return decodeURIComponent(cookieValue);
  2095. }
  2096. }
  2097. return null;
  2098. }
  2099. /**
  2100. * @fileoverview added by tsickle
  2101. * @suppress {checkTypes} checked by tsc
  2102. */
  2103. /**
  2104. * @license
  2105. * Copyright Google Inc. All Rights Reserved.
  2106. *
  2107. * Use of this source code is governed by an MIT-style license that can be
  2108. * found in the LICENSE file at https://angular.io/license
  2109. */
  2110. /**
  2111. * \@ngModule CommonModule
  2112. *
  2113. * \@whatItDoes Adds and removes CSS classes on an HTML element.
  2114. *
  2115. * \@howToUse
  2116. * ```
  2117. * <some-element [ngClass]="'first second'">...</some-element>
  2118. *
  2119. * <some-element [ngClass]="['first', 'second']">...</some-element>
  2120. *
  2121. * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
  2122. *
  2123. * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
  2124. *
  2125. * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
  2126. * ```
  2127. *
  2128. * \@description
  2129. *
  2130. * The CSS classes are updated as follows, depending on the type of the expression evaluation:
  2131. * - `string` - the CSS classes listed in the string (space delimited) are added,
  2132. * - `Array` - the CSS classes declared as Array elements are added,
  2133. * - `Object` - keys are CSS classes that get added when the expression given in the value
  2134. * evaluates to a truthy value, otherwise they are removed.
  2135. *
  2136. * \@stable
  2137. */
  2138. var NgClass = /** @class */ (function () {
  2139. function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
  2140. this._iterableDiffers = _iterableDiffers;
  2141. this._keyValueDiffers = _keyValueDiffers;
  2142. this._ngEl = _ngEl;
  2143. this._renderer = _renderer;
  2144. this._initialClasses = [];
  2145. }
  2146. Object.defineProperty(NgClass.prototype, "klass", {
  2147. set: /**
  2148. * @param {?} v
  2149. * @return {?}
  2150. */
  2151. function (v) {
  2152. this._applyInitialClasses(true);
  2153. this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : [];
  2154. this._applyInitialClasses(false);
  2155. this._applyClasses(this._rawClass, false);
  2156. },
  2157. enumerable: true,
  2158. configurable: true
  2159. });
  2160. Object.defineProperty(NgClass.prototype, "ngClass", {
  2161. set: /**
  2162. * @param {?} v
  2163. * @return {?}
  2164. */
  2165. function (v) {
  2166. this._cleanupClasses(this._rawClass);
  2167. this._iterableDiffer = null;
  2168. this._keyValueDiffer = null;
  2169. this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v;
  2170. if (this._rawClass) {
  2171. if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_25" /* ɵisListLikeIterable */])(this._rawClass)) {
  2172. this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
  2173. }
  2174. else {
  2175. this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
  2176. }
  2177. }
  2178. },
  2179. enumerable: true,
  2180. configurable: true
  2181. });
  2182. /**
  2183. * @return {?}
  2184. */
  2185. NgClass.prototype.ngDoCheck = /**
  2186. * @return {?}
  2187. */
  2188. function () {
  2189. if (this._iterableDiffer) {
  2190. var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass));
  2191. if (iterableChanges) {
  2192. this._applyIterableChanges(iterableChanges);
  2193. }
  2194. }
  2195. else if (this._keyValueDiffer) {
  2196. var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass));
  2197. if (keyValueChanges) {
  2198. this._applyKeyValueChanges(keyValueChanges);
  2199. }
  2200. }
  2201. };
  2202. /**
  2203. * @param {?} rawClassVal
  2204. * @return {?}
  2205. */
  2206. NgClass.prototype._cleanupClasses = /**
  2207. * @param {?} rawClassVal
  2208. * @return {?}
  2209. */
  2210. function (rawClassVal) {
  2211. this._applyClasses(rawClassVal, true);
  2212. this._applyInitialClasses(false);
  2213. };
  2214. /**
  2215. * @param {?} changes
  2216. * @return {?}
  2217. */
  2218. NgClass.prototype._applyKeyValueChanges = /**
  2219. * @param {?} changes
  2220. * @return {?}
  2221. */
  2222. function (changes) {
  2223. var _this = this;
  2224. changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
  2225. changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
  2226. changes.forEachRemovedItem(function (record) {
  2227. if (record.previousValue) {
  2228. _this._toggleClass(record.key, false);
  2229. }
  2230. });
  2231. };
  2232. /**
  2233. * @param {?} changes
  2234. * @return {?}
  2235. */
  2236. NgClass.prototype._applyIterableChanges = /**
  2237. * @param {?} changes
  2238. * @return {?}
  2239. */
  2240. function (changes) {
  2241. var _this = this;
  2242. changes.forEachAddedItem(function (record) {
  2243. if (typeof record.item === 'string') {
  2244. _this._toggleClass(record.item, true);
  2245. }
  2246. else {
  2247. throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_39" /* ɵstringify */])(record.item));
  2248. }
  2249. });
  2250. changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
  2251. };
  2252. /**
  2253. * @param {?} isCleanup
  2254. * @return {?}
  2255. */
  2256. NgClass.prototype._applyInitialClasses = /**
  2257. * @param {?} isCleanup
  2258. * @return {?}
  2259. */
  2260. function (isCleanup) {
  2261. var _this = this;
  2262. this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
  2263. };
  2264. /**
  2265. * @param {?} rawClassVal
  2266. * @param {?} isCleanup
  2267. * @return {?}
  2268. */
  2269. NgClass.prototype._applyClasses = /**
  2270. * @param {?} rawClassVal
  2271. * @param {?} isCleanup
  2272. * @return {?}
  2273. */
  2274. function (rawClassVal, isCleanup) {
  2275. var _this = this;
  2276. if (rawClassVal) {
  2277. if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
  2278. (/** @type {?} */ (rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
  2279. }
  2280. else {
  2281. Object.keys(rawClassVal).forEach(function (klass) {
  2282. if (rawClassVal[klass] != null)
  2283. _this._toggleClass(klass, !isCleanup);
  2284. });
  2285. }
  2286. }
  2287. };
  2288. /**
  2289. * @param {?} klass
  2290. * @param {?} enabled
  2291. * @return {?}
  2292. */
  2293. NgClass.prototype._toggleClass = /**
  2294. * @param {?} klass
  2295. * @param {?} enabled
  2296. * @return {?}
  2297. */
  2298. function (klass, enabled) {
  2299. var _this = this;
  2300. klass = klass.trim();
  2301. if (klass) {
  2302. klass.split(/\s+/g).forEach(function (klass) {
  2303. if (enabled) {
  2304. _this._renderer.addClass(_this._ngEl.nativeElement, klass);
  2305. }
  2306. else {
  2307. _this._renderer.removeClass(_this._ngEl.nativeElement, klass);
  2308. }
  2309. });
  2310. }
  2311. };
  2312. NgClass.decorators = [
  2313. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngClass]' },] },
  2314. ];
  2315. /** @nocollapse */
  2316. NgClass.ctorParameters = function () { return [
  2317. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* IterableDiffers */], },
  2318. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* KeyValueDiffers */], },
  2319. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ElementRef */], },
  2320. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["R" /* Renderer2 */], },
  2321. ]; };
  2322. NgClass.propDecorators = {
  2323. "klass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */], args: ['class',] },],
  2324. "ngClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2325. };
  2326. return NgClass;
  2327. }());
  2328. /**
  2329. * @fileoverview added by tsickle
  2330. * @suppress {checkTypes} checked by tsc
  2331. */
  2332. /**
  2333. * @license
  2334. * Copyright Google Inc. All Rights Reserved.
  2335. *
  2336. * Use of this source code is governed by an MIT-style license that can be
  2337. * found in the LICENSE file at https://angular.io/license
  2338. */
  2339. /**
  2340. * Instantiates a single {\@link Component} type and inserts its Host View into current View.
  2341. * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
  2342. *
  2343. * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
  2344. * any existing component will get destroyed.
  2345. *
  2346. * ### Fine tune control
  2347. *
  2348. * You can control the component creation process by using the following optional attributes:
  2349. *
  2350. * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for
  2351. * the Component. Defaults to the injector of the current view container.
  2352. *
  2353. * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
  2354. * section of the component, if exists.
  2355. *
  2356. * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
  2357. * module, then load a component from that module.
  2358. *
  2359. * ### Syntax
  2360. *
  2361. * Simple
  2362. * ```
  2363. * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
  2364. * ```
  2365. *
  2366. * Customized injector/content
  2367. * ```
  2368. * <ng-container *ngComponentOutlet="componentTypeExpression;
  2369. * injector: injectorExpression;
  2370. * content: contentNodesExpression;">
  2371. * </ng-container>
  2372. * ```
  2373. *
  2374. * Customized ngModuleFactory
  2375. * ```
  2376. * <ng-container *ngComponentOutlet="componentTypeExpression;
  2377. * ngModuleFactory: moduleFactory;">
  2378. * </ng-container>
  2379. * ```
  2380. * ## Example
  2381. *
  2382. * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
  2383. *
  2384. * A more complete example with additional options:
  2385. *
  2386. * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
  2387. * A more complete example with ngModuleFactory:
  2388. *
  2389. * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
  2390. *
  2391. * \@experimental
  2392. */
  2393. var NgComponentOutlet = /** @class */ (function () {
  2394. function NgComponentOutlet(_viewContainerRef) {
  2395. this._viewContainerRef = _viewContainerRef;
  2396. this._componentRef = null;
  2397. this._moduleRef = null;
  2398. }
  2399. /**
  2400. * @param {?} changes
  2401. * @return {?}
  2402. */
  2403. NgComponentOutlet.prototype.ngOnChanges = /**
  2404. * @param {?} changes
  2405. * @return {?}
  2406. */
  2407. function (changes) {
  2408. this._viewContainerRef.clear();
  2409. this._componentRef = null;
  2410. if (this.ngComponentOutlet) {
  2411. var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
  2412. if (changes['ngComponentOutletNgModuleFactory']) {
  2413. if (this._moduleRef)
  2414. this._moduleRef.destroy();
  2415. if (this.ngComponentOutletNgModuleFactory) {
  2416. var /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["H" /* NgModuleRef */]);
  2417. this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
  2418. }
  2419. else {
  2420. this._moduleRef = null;
  2421. }
  2422. }
  2423. var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
  2424. elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */]);
  2425. var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
  2426. this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
  2427. }
  2428. };
  2429. /**
  2430. * @return {?}
  2431. */
  2432. NgComponentOutlet.prototype.ngOnDestroy = /**
  2433. * @return {?}
  2434. */
  2435. function () {
  2436. if (this._moduleRef)
  2437. this._moduleRef.destroy();
  2438. };
  2439. NgComponentOutlet.decorators = [
  2440. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngComponentOutlet]' },] },
  2441. ];
  2442. /** @nocollapse */
  2443. NgComponentOutlet.ctorParameters = function () { return [
  2444. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  2445. ]; };
  2446. NgComponentOutlet.propDecorators = {
  2447. "ngComponentOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2448. "ngComponentOutletInjector": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2449. "ngComponentOutletContent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2450. "ngComponentOutletNgModuleFactory": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2451. };
  2452. return NgComponentOutlet;
  2453. }());
  2454. /**
  2455. * @fileoverview added by tsickle
  2456. * @suppress {checkTypes} checked by tsc
  2457. */
  2458. /**
  2459. * @license
  2460. * Copyright Google Inc. All Rights Reserved.
  2461. *
  2462. * Use of this source code is governed by an MIT-style license that can be
  2463. * found in the LICENSE file at https://angular.io/license
  2464. */
  2465. /**
  2466. * \@stable
  2467. */
  2468. var NgForOfContext = /** @class */ (function () {
  2469. function NgForOfContext($implicit, ngForOf, index, count) {
  2470. this.$implicit = $implicit;
  2471. this.ngForOf = ngForOf;
  2472. this.index = index;
  2473. this.count = count;
  2474. }
  2475. Object.defineProperty(NgForOfContext.prototype, "first", {
  2476. get: /**
  2477. * @return {?}
  2478. */
  2479. function () { return this.index === 0; },
  2480. enumerable: true,
  2481. configurable: true
  2482. });
  2483. Object.defineProperty(NgForOfContext.prototype, "last", {
  2484. get: /**
  2485. * @return {?}
  2486. */
  2487. function () { return this.index === this.count - 1; },
  2488. enumerable: true,
  2489. configurable: true
  2490. });
  2491. Object.defineProperty(NgForOfContext.prototype, "even", {
  2492. get: /**
  2493. * @return {?}
  2494. */
  2495. function () { return this.index % 2 === 0; },
  2496. enumerable: true,
  2497. configurable: true
  2498. });
  2499. Object.defineProperty(NgForOfContext.prototype, "odd", {
  2500. get: /**
  2501. * @return {?}
  2502. */
  2503. function () { return !this.even; },
  2504. enumerable: true,
  2505. configurable: true
  2506. });
  2507. return NgForOfContext;
  2508. }());
  2509. /**
  2510. * The `NgForOf` directive instantiates a template once per item from an iterable. The context
  2511. * for each instantiated template inherits from the outer context with the given loop variable
  2512. * set to the current item from the iterable.
  2513. *
  2514. * ### Local Variables
  2515. *
  2516. * `NgForOf` provides several exported values that can be aliased to local variables:
  2517. *
  2518. * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
  2519. * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
  2520. * more complex then a property access, for example when using the async pipe (`userStreams |
  2521. * async`).
  2522. * - `index: number`: The index of the current item in the iterable.
  2523. * - `first: boolean`: True when the item is the first item in the iterable.
  2524. * - `last: boolean`: True when the item is the last item in the iterable.
  2525. * - `even: boolean`: True when the item has an even index in the iterable.
  2526. * - `odd: boolean`: True when the item has an odd index in the iterable.
  2527. *
  2528. * ```
  2529. * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
  2530. * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
  2531. * </li>
  2532. * ```
  2533. *
  2534. * ### Change Propagation
  2535. *
  2536. * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
  2537. *
  2538. * * When an item is added, a new instance of the template is added to the DOM.
  2539. * * When an item is removed, its template instance is removed from the DOM.
  2540. * * When items are reordered, their respective templates are reordered in the DOM.
  2541. * * Otherwise, the DOM element for that item will remain the same.
  2542. *
  2543. * Angular uses object identity to track insertions and deletions within the iterator and reproduce
  2544. * those changes in the DOM. This has important implications for animations and any stateful
  2545. * controls (such as `<input>` elements which accept user input) that are present. Inserted rows can
  2546. * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
  2547. * such as user input.
  2548. *
  2549. * It is possible for the identities of elements in the iterator to change while the data does not.
  2550. * This can happen, for example, if the iterator produced from an RPC to the server, and that
  2551. * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
  2552. * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
  2553. * elements were deleted and all new elements inserted). This is an expensive operation and should
  2554. * be avoided if possible.
  2555. *
  2556. * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option.
  2557. * `trackBy` takes a function which has two arguments: `index` and `item`.
  2558. * If `trackBy` is given, Angular tracks changes by the return value of the function.
  2559. *
  2560. * ### Syntax
  2561. *
  2562. * - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
  2563. *
  2564. * With `<ng-template>` element:
  2565. *
  2566. * ```
  2567. * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
  2568. * <li>...</li>
  2569. * </ng-template>
  2570. * ```
  2571. *
  2572. * ### Example
  2573. *
  2574. * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
  2575. * example.
  2576. *
  2577. * \@stable
  2578. */
  2579. var NgForOf = /** @class */ (function () {
  2580. function NgForOf(_viewContainer, _template, _differs) {
  2581. this._viewContainer = _viewContainer;
  2582. this._template = _template;
  2583. this._differs = _differs;
  2584. this._differ = null;
  2585. }
  2586. Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
  2587. get: /**
  2588. * @return {?}
  2589. */
  2590. function () { return this._trackByFn; },
  2591. set: /**
  2592. * @param {?} fn
  2593. * @return {?}
  2594. */
  2595. function (fn) {
  2596. if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* isDevMode */])() && fn != null && typeof fn !== 'function') {
  2597. // TODO(vicb): use a log service once there is a public one available
  2598. if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
  2599. console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
  2600. "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
  2601. }
  2602. }
  2603. this._trackByFn = fn;
  2604. },
  2605. enumerable: true,
  2606. configurable: true
  2607. });
  2608. Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
  2609. set: /**
  2610. * @param {?} value
  2611. * @return {?}
  2612. */
  2613. function (value) {
  2614. // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
  2615. // The current type is too restrictive; a template that just uses index, for example,
  2616. // should be acceptable.
  2617. if (value) {
  2618. this._template = value;
  2619. }
  2620. },
  2621. enumerable: true,
  2622. configurable: true
  2623. });
  2624. /**
  2625. * @param {?} changes
  2626. * @return {?}
  2627. */
  2628. NgForOf.prototype.ngOnChanges = /**
  2629. * @param {?} changes
  2630. * @return {?}
  2631. */
  2632. function (changes) {
  2633. if ('ngForOf' in changes) {
  2634. // React on ngForOf changes only once all inputs have been initialized
  2635. var /** @type {?} */ value = changes['ngForOf'].currentValue;
  2636. if (!this._differ && value) {
  2637. try {
  2638. this._differ = this._differs.find(value).create(this.ngForTrackBy);
  2639. }
  2640. catch (/** @type {?} */ e) {
  2641. throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
  2642. }
  2643. }
  2644. }
  2645. };
  2646. /**
  2647. * @return {?}
  2648. */
  2649. NgForOf.prototype.ngDoCheck = /**
  2650. * @return {?}
  2651. */
  2652. function () {
  2653. if (this._differ) {
  2654. var /** @type {?} */ changes = this._differ.diff(this.ngForOf);
  2655. if (changes)
  2656. this._applyChanges(changes);
  2657. }
  2658. };
  2659. /**
  2660. * @param {?} changes
  2661. * @return {?}
  2662. */
  2663. NgForOf.prototype._applyChanges = /**
  2664. * @param {?} changes
  2665. * @return {?}
  2666. */
  2667. function (changes) {
  2668. var _this = this;
  2669. var /** @type {?} */ insertTuples = [];
  2670. changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
  2671. if (item.previousIndex == null) {
  2672. var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex);
  2673. var /** @type {?} */ tuple = new RecordViewTuple(item, view);
  2674. insertTuples.push(tuple);
  2675. }
  2676. else if (currentIndex == null) {
  2677. _this._viewContainer.remove(adjustedPreviousIndex);
  2678. }
  2679. else {
  2680. var /** @type {?} */ view = /** @type {?} */ ((_this._viewContainer.get(adjustedPreviousIndex)));
  2681. _this._viewContainer.move(view, currentIndex);
  2682. var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view));
  2683. insertTuples.push(tuple);
  2684. }
  2685. });
  2686. for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) {
  2687. this._perViewChange(insertTuples[i].view, insertTuples[i].record);
  2688. }
  2689. for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) {
  2690. var /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(i));
  2691. viewRef.context.index = i;
  2692. viewRef.context.count = ilen;
  2693. }
  2694. changes.forEachIdentityChange(function (record) {
  2695. var /** @type {?} */ viewRef = /** @type {?} */ (_this._viewContainer.get(record.currentIndex));
  2696. viewRef.context.$implicit = record.item;
  2697. });
  2698. };
  2699. /**
  2700. * @param {?} view
  2701. * @param {?} record
  2702. * @return {?}
  2703. */
  2704. NgForOf.prototype._perViewChange = /**
  2705. * @param {?} view
  2706. * @param {?} record
  2707. * @return {?}
  2708. */
  2709. function (view, record) {
  2710. view.context.$implicit = record.item;
  2711. };
  2712. NgForOf.decorators = [
  2713. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngFor][ngForOf]' },] },
  2714. ];
  2715. /** @nocollapse */
  2716. NgForOf.ctorParameters = function () { return [
  2717. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  2718. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
  2719. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* IterableDiffers */], },
  2720. ]; };
  2721. NgForOf.propDecorators = {
  2722. "ngForOf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2723. "ngForTrackBy": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2724. "ngForTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2725. };
  2726. return NgForOf;
  2727. }());
  2728. var RecordViewTuple = /** @class */ (function () {
  2729. function RecordViewTuple(record, view) {
  2730. this.record = record;
  2731. this.view = view;
  2732. }
  2733. return RecordViewTuple;
  2734. }());
  2735. /**
  2736. * @param {?} type
  2737. * @return {?}
  2738. */
  2739. function getTypeNameForDebugging(type) {
  2740. return type['name'] || typeof type;
  2741. }
  2742. /**
  2743. * @fileoverview added by tsickle
  2744. * @suppress {checkTypes} checked by tsc
  2745. */
  2746. /**
  2747. * @license
  2748. * Copyright Google Inc. All Rights Reserved.
  2749. *
  2750. * Use of this source code is governed by an MIT-style license that can be
  2751. * found in the LICENSE file at https://angular.io/license
  2752. */
  2753. /**
  2754. * Conditionally includes a template based on the value of an `expression`.
  2755. *
  2756. * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place
  2757. * when expression is truthy or falsy respectively. Typically the:
  2758. * - `then` template is the inline template of `ngIf` unless bound to a different value.
  2759. * - `else` template is blank unless it is bound.
  2760. *
  2761. * ## Most common usage
  2762. *
  2763. * The most common usage of the `ngIf` directive is to conditionally show the inline template as
  2764. * seen in this example:
  2765. * {\@example common/ngIf/ts/module.ts region='NgIfSimple'}
  2766. *
  2767. * ## Showing an alternative template using `else`
  2768. *
  2769. * If it is necessary to display a template when the `expression` is falsy use the `else` template
  2770. * binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
  2771. * The template can be defined anywhere in the component view but is typically placed right after
  2772. * `ngIf` for readability.
  2773. *
  2774. * {\@example common/ngIf/ts/module.ts region='NgIfElse'}
  2775. *
  2776. * ## Using non-inlined `then` template
  2777. *
  2778. * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
  2779. * a binding (just like `else`). Because `then` and `else` are bindings, the template references can
  2780. * change at runtime as shown in this example.
  2781. *
  2782. * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'}
  2783. *
  2784. * ## Storing conditional result in a variable
  2785. *
  2786. * A common pattern is that we need to show a set of properties from the same object. If the
  2787. * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
  2788. * dereferencing a `null` value. This is especially the case when waiting on async data such as
  2789. * when using the `async` pipe as shown in following example:
  2790. *
  2791. * ```
  2792. * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}!
  2793. * ```
  2794. *
  2795. * There are several inefficiencies in the above example:
  2796. * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the
  2797. * example above.
  2798. * - We cannot display an alternative screen while waiting for the data to arrive asynchronously.
  2799. * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome.
  2800. * - We have to place the `async` pipe in parenthesis.
  2801. *
  2802. * A better way to do this is to use `ngIf` and store the result of the condition in a local
  2803. * variable as shown in the the example below:
  2804. *
  2805. * {\@example common/ngIf/ts/module.ts region='NgIfAs'}
  2806. *
  2807. * Notice that:
  2808. * - We use only one `async` pipe and hence only one subscription gets created.
  2809. * - `ngIf` stores the result of the `userStream|async` in the local variable `user`.
  2810. * - The local `user` can then be bound repeatedly in a more efficient way.
  2811. * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only
  2812. * display the data if `userStream` returns a value.
  2813. * - We can display an alternative template while waiting for the data.
  2814. *
  2815. * ### Syntax
  2816. *
  2817. * Simple form:
  2818. * - `<div *ngIf="condition">...</div>`
  2819. * - `<ng-template [ngIf]="condition"><div>...</div></ng-template>`
  2820. *
  2821. * Form with an else block:
  2822. * ```
  2823. * <div *ngIf="condition; else elseBlock">...</div>
  2824. * <ng-template #elseBlock>...</ng-template>
  2825. * ```
  2826. *
  2827. * Form with a `then` and `else` block:
  2828. * ```
  2829. * <div *ngIf="condition; then thenBlock else elseBlock"></div>
  2830. * <ng-template #thenBlock>...</ng-template>
  2831. * <ng-template #elseBlock>...</ng-template>
  2832. * ```
  2833. *
  2834. * Form with storing the value locally:
  2835. * ```
  2836. * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
  2837. * <ng-template #elseBlock>...</ng-template>
  2838. * ```
  2839. *
  2840. * \@stable
  2841. */
  2842. var NgIf = /** @class */ (function () {
  2843. function NgIf(_viewContainer, templateRef) {
  2844. this._viewContainer = _viewContainer;
  2845. this._context = new NgIfContext();
  2846. this._thenTemplateRef = null;
  2847. this._elseTemplateRef = null;
  2848. this._thenViewRef = null;
  2849. this._elseViewRef = null;
  2850. this._thenTemplateRef = templateRef;
  2851. }
  2852. Object.defineProperty(NgIf.prototype, "ngIf", {
  2853. set: /**
  2854. * @param {?} condition
  2855. * @return {?}
  2856. */
  2857. function (condition) {
  2858. this._context.$implicit = this._context.ngIf = condition;
  2859. this._updateView();
  2860. },
  2861. enumerable: true,
  2862. configurable: true
  2863. });
  2864. Object.defineProperty(NgIf.prototype, "ngIfThen", {
  2865. set: /**
  2866. * @param {?} templateRef
  2867. * @return {?}
  2868. */
  2869. function (templateRef) {
  2870. this._thenTemplateRef = templateRef;
  2871. this._thenViewRef = null; // clear previous view if any.
  2872. this._updateView();
  2873. },
  2874. enumerable: true,
  2875. configurable: true
  2876. });
  2877. Object.defineProperty(NgIf.prototype, "ngIfElse", {
  2878. set: /**
  2879. * @param {?} templateRef
  2880. * @return {?}
  2881. */
  2882. function (templateRef) {
  2883. this._elseTemplateRef = templateRef;
  2884. this._elseViewRef = null; // clear previous view if any.
  2885. this._updateView();
  2886. },
  2887. enumerable: true,
  2888. configurable: true
  2889. });
  2890. /**
  2891. * @return {?}
  2892. */
  2893. NgIf.prototype._updateView = /**
  2894. * @return {?}
  2895. */
  2896. function () {
  2897. if (this._context.$implicit) {
  2898. if (!this._thenViewRef) {
  2899. this._viewContainer.clear();
  2900. this._elseViewRef = null;
  2901. if (this._thenTemplateRef) {
  2902. this._thenViewRef =
  2903. this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
  2904. }
  2905. }
  2906. }
  2907. else {
  2908. if (!this._elseViewRef) {
  2909. this._viewContainer.clear();
  2910. this._thenViewRef = null;
  2911. if (this._elseTemplateRef) {
  2912. this._elseViewRef =
  2913. this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
  2914. }
  2915. }
  2916. }
  2917. };
  2918. NgIf.decorators = [
  2919. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngIf]' },] },
  2920. ];
  2921. /** @nocollapse */
  2922. NgIf.ctorParameters = function () { return [
  2923. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  2924. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
  2925. ]; };
  2926. NgIf.propDecorators = {
  2927. "ngIf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2928. "ngIfThen": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2929. "ngIfElse": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  2930. };
  2931. return NgIf;
  2932. }());
  2933. /**
  2934. * \@stable
  2935. */
  2936. var NgIfContext = /** @class */ (function () {
  2937. function NgIfContext() {
  2938. this.$implicit = null;
  2939. this.ngIf = null;
  2940. }
  2941. return NgIfContext;
  2942. }());
  2943. /**
  2944. * @fileoverview added by tsickle
  2945. * @suppress {checkTypes} checked by tsc
  2946. */
  2947. /**
  2948. * @license
  2949. * Copyright Google Inc. All Rights Reserved.
  2950. *
  2951. * Use of this source code is governed by an MIT-style license that can be
  2952. * found in the LICENSE file at https://angular.io/license
  2953. */
  2954. var SwitchView = /** @class */ (function () {
  2955. function SwitchView(_viewContainerRef, _templateRef) {
  2956. this._viewContainerRef = _viewContainerRef;
  2957. this._templateRef = _templateRef;
  2958. this._created = false;
  2959. }
  2960. /**
  2961. * @return {?}
  2962. */
  2963. SwitchView.prototype.create = /**
  2964. * @return {?}
  2965. */
  2966. function () {
  2967. this._created = true;
  2968. this._viewContainerRef.createEmbeddedView(this._templateRef);
  2969. };
  2970. /**
  2971. * @return {?}
  2972. */
  2973. SwitchView.prototype.destroy = /**
  2974. * @return {?}
  2975. */
  2976. function () {
  2977. this._created = false;
  2978. this._viewContainerRef.clear();
  2979. };
  2980. /**
  2981. * @param {?} created
  2982. * @return {?}
  2983. */
  2984. SwitchView.prototype.enforceState = /**
  2985. * @param {?} created
  2986. * @return {?}
  2987. */
  2988. function (created) {
  2989. if (created && !this._created) {
  2990. this.create();
  2991. }
  2992. else if (!created && this._created) {
  2993. this.destroy();
  2994. }
  2995. };
  2996. return SwitchView;
  2997. }());
  2998. /**
  2999. * \@ngModule CommonModule
  3000. *
  3001. * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch
  3002. * expression.
  3003. *
  3004. * \@howToUse
  3005. * ```
  3006. * <container-element [ngSwitch]="switch_expression">
  3007. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3008. * <some-element *ngSwitchCase="match_expression_2">...</some-element>
  3009. * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
  3010. * <ng-container *ngSwitchCase="match_expression_3">
  3011. * <!-- use a ng-container to group multiple root nodes -->
  3012. * <inner-element></inner-element>
  3013. * <inner-other-element></inner-other-element>
  3014. * </ng-container>
  3015. * <some-element *ngSwitchDefault>...</some-element>
  3016. * </container-element>
  3017. * ```
  3018. * \@description
  3019. *
  3020. * `NgSwitch` stamps out nested views when their match expression value matches the value of the
  3021. * switch expression.
  3022. *
  3023. * In other words:
  3024. * - you define a container element (where you place the directive with a switch expression on the
  3025. * `[ngSwitch]="..."` attribute)
  3026. * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
  3027. * root elements.
  3028. *
  3029. * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
  3030. * be preserved at the location.
  3031. *
  3032. * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
  3033. * expression is evaluated.
  3034. * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
  3035. * stamped out.
  3036. *
  3037. * \@stable
  3038. */
  3039. var NgSwitch = /** @class */ (function () {
  3040. function NgSwitch() {
  3041. this._defaultUsed = false;
  3042. this._caseCount = 0;
  3043. this._lastCaseCheckIndex = 0;
  3044. this._lastCasesMatched = false;
  3045. }
  3046. Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
  3047. set: /**
  3048. * @param {?} newValue
  3049. * @return {?}
  3050. */
  3051. function (newValue) {
  3052. this._ngSwitch = newValue;
  3053. if (this._caseCount === 0) {
  3054. this._updateDefaultCases(true);
  3055. }
  3056. },
  3057. enumerable: true,
  3058. configurable: true
  3059. });
  3060. /** @internal */
  3061. /**
  3062. * \@internal
  3063. * @return {?}
  3064. */
  3065. NgSwitch.prototype._addCase = /**
  3066. * \@internal
  3067. * @return {?}
  3068. */
  3069. function () { return this._caseCount++; };
  3070. /** @internal */
  3071. /**
  3072. * \@internal
  3073. * @param {?} view
  3074. * @return {?}
  3075. */
  3076. NgSwitch.prototype._addDefault = /**
  3077. * \@internal
  3078. * @param {?} view
  3079. * @return {?}
  3080. */
  3081. function (view) {
  3082. if (!this._defaultViews) {
  3083. this._defaultViews = [];
  3084. }
  3085. this._defaultViews.push(view);
  3086. };
  3087. /** @internal */
  3088. /**
  3089. * \@internal
  3090. * @param {?} value
  3091. * @return {?}
  3092. */
  3093. NgSwitch.prototype._matchCase = /**
  3094. * \@internal
  3095. * @param {?} value
  3096. * @return {?}
  3097. */
  3098. function (value) {
  3099. var /** @type {?} */ matched = value == this._ngSwitch;
  3100. this._lastCasesMatched = this._lastCasesMatched || matched;
  3101. this._lastCaseCheckIndex++;
  3102. if (this._lastCaseCheckIndex === this._caseCount) {
  3103. this._updateDefaultCases(!this._lastCasesMatched);
  3104. this._lastCaseCheckIndex = 0;
  3105. this._lastCasesMatched = false;
  3106. }
  3107. return matched;
  3108. };
  3109. /**
  3110. * @param {?} useDefault
  3111. * @return {?}
  3112. */
  3113. NgSwitch.prototype._updateDefaultCases = /**
  3114. * @param {?} useDefault
  3115. * @return {?}
  3116. */
  3117. function (useDefault) {
  3118. if (this._defaultViews && useDefault !== this._defaultUsed) {
  3119. this._defaultUsed = useDefault;
  3120. for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) {
  3121. var /** @type {?} */ defaultView = this._defaultViews[i];
  3122. defaultView.enforceState(useDefault);
  3123. }
  3124. }
  3125. };
  3126. NgSwitch.decorators = [
  3127. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngSwitch]' },] },
  3128. ];
  3129. /** @nocollapse */
  3130. NgSwitch.ctorParameters = function () { return []; };
  3131. NgSwitch.propDecorators = {
  3132. "ngSwitch": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  3133. };
  3134. return NgSwitch;
  3135. }());
  3136. /**
  3137. * \@ngModule CommonModule
  3138. *
  3139. * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the
  3140. * given expression evaluate to respectively the same/different value as the switch
  3141. * expression.
  3142. *
  3143. * \@howToUse
  3144. * ```
  3145. * <container-element [ngSwitch]="switch_expression">
  3146. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3147. * </container-element>
  3148. * ```
  3149. * \@description
  3150. *
  3151. * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
  3152. * expression.
  3153. *
  3154. * If multiple match expressions match the switch expression value, all of them are displayed.
  3155. *
  3156. * See {\@link NgSwitch} for more details and example.
  3157. *
  3158. * \@stable
  3159. */
  3160. var NgSwitchCase = /** @class */ (function () {
  3161. function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
  3162. this.ngSwitch = ngSwitch;
  3163. ngSwitch._addCase();
  3164. this._view = new SwitchView(viewContainer, templateRef);
  3165. }
  3166. /**
  3167. * @return {?}
  3168. */
  3169. NgSwitchCase.prototype.ngDoCheck = /**
  3170. * @return {?}
  3171. */
  3172. function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
  3173. NgSwitchCase.decorators = [
  3174. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngSwitchCase]' },] },
  3175. ];
  3176. /** @nocollapse */
  3177. NgSwitchCase.ctorParameters = function () { return [
  3178. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  3179. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
  3180. { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* Host */] },] },
  3181. ]; };
  3182. NgSwitchCase.propDecorators = {
  3183. "ngSwitchCase": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  3184. };
  3185. return NgSwitchCase;
  3186. }());
  3187. /**
  3188. * \@ngModule CommonModule
  3189. * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions
  3190. * match the
  3191. * switch expression.
  3192. *
  3193. * \@howToUse
  3194. * ```
  3195. * <container-element [ngSwitch]="switch_expression">
  3196. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3197. * <some-other-element *ngSwitchDefault>...</some-other-element>
  3198. * </container-element>
  3199. * ```
  3200. *
  3201. * \@description
  3202. *
  3203. * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
  3204. * expression.
  3205. *
  3206. * See {\@link NgSwitch} for more details and example.
  3207. *
  3208. * \@stable
  3209. */
  3210. var NgSwitchDefault = /** @class */ (function () {
  3211. function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
  3212. ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
  3213. }
  3214. NgSwitchDefault.decorators = [
  3215. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngSwitchDefault]' },] },
  3216. ];
  3217. /** @nocollapse */
  3218. NgSwitchDefault.ctorParameters = function () { return [
  3219. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  3220. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
  3221. { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* Host */] },] },
  3222. ]; };
  3223. return NgSwitchDefault;
  3224. }());
  3225. /**
  3226. * @fileoverview added by tsickle
  3227. * @suppress {checkTypes} checked by tsc
  3228. */
  3229. /**
  3230. * @license
  3231. * Copyright Google Inc. All Rights Reserved.
  3232. *
  3233. * Use of this source code is governed by an MIT-style license that can be
  3234. * found in the LICENSE file at https://angular.io/license
  3235. */
  3236. /**
  3237. * \@ngModule CommonModule
  3238. *
  3239. * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
  3240. *
  3241. * \@howToUse
  3242. * ```
  3243. * <some-element [ngPlural]="value">
  3244. * <ng-template ngPluralCase="=0">there is nothing</ng-template>
  3245. * <ng-template ngPluralCase="=1">there is one</ng-template>
  3246. * <ng-template ngPluralCase="few">there are a few</ng-template>
  3247. * </some-element>
  3248. * ```
  3249. *
  3250. * \@description
  3251. *
  3252. * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
  3253. * that match the switch expression's pluralization category.
  3254. *
  3255. * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
  3256. * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
  3257. * expression:
  3258. * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
  3259. * matches the switch expression exactly,
  3260. * - otherwise, the view will be treated as a "category match", and will only display if exact
  3261. * value matches aren't found and the value maps to its category for the defined locale.
  3262. *
  3263. * See http://cldr.unicode.org/index/cldr-spec/plural-rules
  3264. *
  3265. * \@experimental
  3266. */
  3267. var NgPlural = /** @class */ (function () {
  3268. function NgPlural(_localization) {
  3269. this._localization = _localization;
  3270. this._caseViews = {};
  3271. }
  3272. Object.defineProperty(NgPlural.prototype, "ngPlural", {
  3273. set: /**
  3274. * @param {?} value
  3275. * @return {?}
  3276. */
  3277. function (value) {
  3278. this._switchValue = value;
  3279. this._updateView();
  3280. },
  3281. enumerable: true,
  3282. configurable: true
  3283. });
  3284. /**
  3285. * @param {?} value
  3286. * @param {?} switchView
  3287. * @return {?}
  3288. */
  3289. NgPlural.prototype.addCase = /**
  3290. * @param {?} value
  3291. * @param {?} switchView
  3292. * @return {?}
  3293. */
  3294. function (value, switchView) { this._caseViews[value] = switchView; };
  3295. /**
  3296. * @return {?}
  3297. */
  3298. NgPlural.prototype._updateView = /**
  3299. * @return {?}
  3300. */
  3301. function () {
  3302. this._clearViews();
  3303. var /** @type {?} */ cases = Object.keys(this._caseViews);
  3304. var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization);
  3305. this._activateView(this._caseViews[key]);
  3306. };
  3307. /**
  3308. * @return {?}
  3309. */
  3310. NgPlural.prototype._clearViews = /**
  3311. * @return {?}
  3312. */
  3313. function () {
  3314. if (this._activeView)
  3315. this._activeView.destroy();
  3316. };
  3317. /**
  3318. * @param {?} view
  3319. * @return {?}
  3320. */
  3321. NgPlural.prototype._activateView = /**
  3322. * @param {?} view
  3323. * @return {?}
  3324. */
  3325. function (view) {
  3326. if (view) {
  3327. this._activeView = view;
  3328. this._activeView.create();
  3329. }
  3330. };
  3331. NgPlural.decorators = [
  3332. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngPlural]' },] },
  3333. ];
  3334. /** @nocollapse */
  3335. NgPlural.ctorParameters = function () { return [
  3336. { type: NgLocalization, },
  3337. ]; };
  3338. NgPlural.propDecorators = {
  3339. "ngPlural": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  3340. };
  3341. return NgPlural;
  3342. }());
  3343. /**
  3344. * \@ngModule CommonModule
  3345. *
  3346. * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the
  3347. * given expression matches the plural expression according to CLDR rules.
  3348. *
  3349. * \@howToUse
  3350. * ```
  3351. * <some-element [ngPlural]="value">
  3352. * <ng-template ngPluralCase="=0">...</ng-template>
  3353. * <ng-template ngPluralCase="other">...</ng-template>
  3354. * </some-element>
  3355. * ```
  3356. *
  3357. * See {\@link NgPlural} for more details and example.
  3358. *
  3359. * \@experimental
  3360. */
  3361. var NgPluralCase = /** @class */ (function () {
  3362. function NgPluralCase(value, template, viewContainer, ngPlural) {
  3363. this.value = value;
  3364. var /** @type {?} */ isANumber = !isNaN(Number(value));
  3365. ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
  3366. }
  3367. NgPluralCase.decorators = [
  3368. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngPluralCase]' },] },
  3369. ];
  3370. /** @nocollapse */
  3371. NgPluralCase.ctorParameters = function () { return [
  3372. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['ngPluralCase',] },] },
  3373. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
  3374. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  3375. { type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* Host */] },] },
  3376. ]; };
  3377. return NgPluralCase;
  3378. }());
  3379. /**
  3380. * @fileoverview added by tsickle
  3381. * @suppress {checkTypes} checked by tsc
  3382. */
  3383. /**
  3384. * @license
  3385. * Copyright Google Inc. All Rights Reserved.
  3386. *
  3387. * Use of this source code is governed by an MIT-style license that can be
  3388. * found in the LICENSE file at https://angular.io/license
  3389. */
  3390. /**
  3391. * \@ngModule CommonModule
  3392. *
  3393. * \@whatItDoes Update an HTML element styles.
  3394. *
  3395. * \@howToUse
  3396. * ```
  3397. * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
  3398. *
  3399. * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
  3400. *
  3401. * <some-element [ngStyle]="objExp">...</some-element>
  3402. * ```
  3403. *
  3404. * \@description
  3405. *
  3406. * The styles are updated according to the value of the expression evaluation:
  3407. * - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'),
  3408. * - values are the values assigned to those properties (expressed in the given unit).
  3409. *
  3410. * \@stable
  3411. */
  3412. var NgStyle = /** @class */ (function () {
  3413. function NgStyle(_differs, _ngEl, _renderer) {
  3414. this._differs = _differs;
  3415. this._ngEl = _ngEl;
  3416. this._renderer = _renderer;
  3417. }
  3418. Object.defineProperty(NgStyle.prototype, "ngStyle", {
  3419. set: /**
  3420. * @param {?} v
  3421. * @return {?}
  3422. */
  3423. function (v) {
  3424. this._ngStyle = v;
  3425. if (!this._differ && v) {
  3426. this._differ = this._differs.find(v).create();
  3427. }
  3428. },
  3429. enumerable: true,
  3430. configurable: true
  3431. });
  3432. /**
  3433. * @return {?}
  3434. */
  3435. NgStyle.prototype.ngDoCheck = /**
  3436. * @return {?}
  3437. */
  3438. function () {
  3439. if (this._differ) {
  3440. var /** @type {?} */ changes = this._differ.diff(this._ngStyle);
  3441. if (changes) {
  3442. this._applyChanges(changes);
  3443. }
  3444. }
  3445. };
  3446. /**
  3447. * @param {?} changes
  3448. * @return {?}
  3449. */
  3450. NgStyle.prototype._applyChanges = /**
  3451. * @param {?} changes
  3452. * @return {?}
  3453. */
  3454. function (changes) {
  3455. var _this = this;
  3456. changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
  3457. changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
  3458. changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
  3459. };
  3460. /**
  3461. * @param {?} nameAndUnit
  3462. * @param {?} value
  3463. * @return {?}
  3464. */
  3465. NgStyle.prototype._setStyle = /**
  3466. * @param {?} nameAndUnit
  3467. * @param {?} value
  3468. * @return {?}
  3469. */
  3470. function (nameAndUnit, value) {
  3471. var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1];
  3472. value = value != null && unit ? "" + value + unit : value;
  3473. if (value != null) {
  3474. this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value));
  3475. }
  3476. else {
  3477. this._renderer.removeStyle(this._ngEl.nativeElement, name);
  3478. }
  3479. };
  3480. NgStyle.decorators = [
  3481. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngStyle]' },] },
  3482. ];
  3483. /** @nocollapse */
  3484. NgStyle.ctorParameters = function () { return [
  3485. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* KeyValueDiffers */], },
  3486. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ElementRef */], },
  3487. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["R" /* Renderer2 */], },
  3488. ]; };
  3489. NgStyle.propDecorators = {
  3490. "ngStyle": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  3491. };
  3492. return NgStyle;
  3493. }());
  3494. /**
  3495. * @fileoverview added by tsickle
  3496. * @suppress {checkTypes} checked by tsc
  3497. */
  3498. /**
  3499. * @license
  3500. * Copyright Google Inc. All Rights Reserved.
  3501. *
  3502. * Use of this source code is governed by an MIT-style license that can be
  3503. * found in the LICENSE file at https://angular.io/license
  3504. */
  3505. /**
  3506. * \@ngModule CommonModule
  3507. *
  3508. * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef`
  3509. *
  3510. * \@howToUse
  3511. * ```
  3512. * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
  3513. * ```
  3514. *
  3515. * \@description
  3516. *
  3517. * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
  3518. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
  3519. * by the local template `let` declarations.
  3520. *
  3521. * Note: using the key `$implicit` in the context object will set its value as default.
  3522. *
  3523. * ## Example
  3524. *
  3525. * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
  3526. *
  3527. * \@stable
  3528. */
  3529. var NgTemplateOutlet = /** @class */ (function () {
  3530. function NgTemplateOutlet(_viewContainerRef) {
  3531. this._viewContainerRef = _viewContainerRef;
  3532. }
  3533. /**
  3534. * @param {?} changes
  3535. * @return {?}
  3536. */
  3537. NgTemplateOutlet.prototype.ngOnChanges = /**
  3538. * @param {?} changes
  3539. * @return {?}
  3540. */
  3541. function (changes) {
  3542. var /** @type {?} */ recreateView = this._shouldRecreateView(changes);
  3543. if (recreateView) {
  3544. if (this._viewRef) {
  3545. this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
  3546. }
  3547. if (this.ngTemplateOutlet) {
  3548. this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
  3549. }
  3550. }
  3551. else {
  3552. if (this._viewRef && this.ngTemplateOutletContext) {
  3553. this._updateExistingContext(this.ngTemplateOutletContext);
  3554. }
  3555. }
  3556. };
  3557. /**
  3558. * We need to re-create existing embedded view if:
  3559. * - templateRef has changed
  3560. * - context has changes
  3561. *
  3562. * We mark context object as changed when the corresponding object
  3563. * shape changes (new properties are added or existing properties are removed).
  3564. * In other words we consider context with the same properties as "the same" even
  3565. * if object reference changes (see https://github.com/angular/angular/issues/13407).
  3566. * @param {?} changes
  3567. * @return {?}
  3568. */
  3569. NgTemplateOutlet.prototype._shouldRecreateView = /**
  3570. * We need to re-create existing embedded view if:
  3571. * - templateRef has changed
  3572. * - context has changes
  3573. *
  3574. * We mark context object as changed when the corresponding object
  3575. * shape changes (new properties are added or existing properties are removed).
  3576. * In other words we consider context with the same properties as "the same" even
  3577. * if object reference changes (see https://github.com/angular/angular/issues/13407).
  3578. * @param {?} changes
  3579. * @return {?}
  3580. */
  3581. function (changes) {
  3582. var /** @type {?} */ ctxChange = changes['ngTemplateOutletContext'];
  3583. return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
  3584. };
  3585. /**
  3586. * @param {?} ctxChange
  3587. * @return {?}
  3588. */
  3589. NgTemplateOutlet.prototype._hasContextShapeChanged = /**
  3590. * @param {?} ctxChange
  3591. * @return {?}
  3592. */
  3593. function (ctxChange) {
  3594. var /** @type {?} */ prevCtxKeys = Object.keys(ctxChange.previousValue || {});
  3595. var /** @type {?} */ currCtxKeys = Object.keys(ctxChange.currentValue || {});
  3596. if (prevCtxKeys.length === currCtxKeys.length) {
  3597. for (var _i = 0, currCtxKeys_1 = currCtxKeys; _i < currCtxKeys_1.length; _i++) {
  3598. var propName = currCtxKeys_1[_i];
  3599. if (prevCtxKeys.indexOf(propName) === -1) {
  3600. return true;
  3601. }
  3602. }
  3603. return false;
  3604. }
  3605. else {
  3606. return true;
  3607. }
  3608. };
  3609. /**
  3610. * @param {?} ctx
  3611. * @return {?}
  3612. */
  3613. NgTemplateOutlet.prototype._updateExistingContext = /**
  3614. * @param {?} ctx
  3615. * @return {?}
  3616. */
  3617. function (ctx) {
  3618. for (var _i = 0, _a = Object.keys(ctx); _i < _a.length; _i++) {
  3619. var propName = _a[_i];
  3620. (/** @type {?} */ (this._viewRef.context))[propName] = (/** @type {?} */ (this.ngTemplateOutletContext))[propName];
  3621. }
  3622. };
  3623. NgTemplateOutlet.decorators = [
  3624. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngTemplateOutlet]' },] },
  3625. ];
  3626. /** @nocollapse */
  3627. NgTemplateOutlet.ctorParameters = function () { return [
  3628. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
  3629. ]; };
  3630. NgTemplateOutlet.propDecorators = {
  3631. "ngTemplateOutletContext": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  3632. "ngTemplateOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
  3633. };
  3634. return NgTemplateOutlet;
  3635. }());
  3636. /**
  3637. * @fileoverview added by tsickle
  3638. * @suppress {checkTypes} checked by tsc
  3639. */
  3640. /**
  3641. * @license
  3642. * Copyright Google Inc. All Rights Reserved.
  3643. *
  3644. * Use of this source code is governed by an MIT-style license that can be
  3645. * found in the LICENSE file at https://angular.io/license
  3646. */
  3647. /**
  3648. * A collection of Angular directives that are likely to be used in each and every Angular
  3649. * application.
  3650. */
  3651. var COMMON_DIRECTIVES = [
  3652. NgClass,
  3653. NgComponentOutlet,
  3654. NgForOf,
  3655. NgIf,
  3656. NgTemplateOutlet,
  3657. NgStyle,
  3658. NgSwitch,
  3659. NgSwitchCase,
  3660. NgSwitchDefault,
  3661. NgPlural,
  3662. NgPluralCase,
  3663. ];
  3664. /**
  3665. * @fileoverview added by tsickle
  3666. * @suppress {checkTypes} checked by tsc
  3667. */
  3668. /**
  3669. * @license
  3670. * Copyright Google Inc. All Rights Reserved.
  3671. *
  3672. * Use of this source code is governed by an MIT-style license that can be
  3673. * found in the LICENSE file at https://angular.io/license
  3674. */
  3675. var NAMED_FORMATS = {};
  3676. var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
  3677. /** @enum {number} */
  3678. var ZoneWidth = {
  3679. Short: 0,
  3680. ShortGMT: 1,
  3681. Long: 2,
  3682. Extended: 3,
  3683. };
  3684. ZoneWidth[ZoneWidth.Short] = "Short";
  3685. ZoneWidth[ZoneWidth.ShortGMT] = "ShortGMT";
  3686. ZoneWidth[ZoneWidth.Long] = "Long";
  3687. ZoneWidth[ZoneWidth.Extended] = "Extended";
  3688. /** @enum {number} */
  3689. var DateType = {
  3690. FullYear: 0,
  3691. Month: 1,
  3692. Date: 2,
  3693. Hours: 3,
  3694. Minutes: 4,
  3695. Seconds: 5,
  3696. Milliseconds: 6,
  3697. Day: 7,
  3698. };
  3699. DateType[DateType.FullYear] = "FullYear";
  3700. DateType[DateType.Month] = "Month";
  3701. DateType[DateType.Date] = "Date";
  3702. DateType[DateType.Hours] = "Hours";
  3703. DateType[DateType.Minutes] = "Minutes";
  3704. DateType[DateType.Seconds] = "Seconds";
  3705. DateType[DateType.Milliseconds] = "Milliseconds";
  3706. DateType[DateType.Day] = "Day";
  3707. /** @enum {number} */
  3708. var TranslationType = {
  3709. DayPeriods: 0,
  3710. Days: 1,
  3711. Months: 2,
  3712. Eras: 3,
  3713. };
  3714. TranslationType[TranslationType.DayPeriods] = "DayPeriods";
  3715. TranslationType[TranslationType.Days] = "Days";
  3716. TranslationType[TranslationType.Months] = "Months";
  3717. TranslationType[TranslationType.Eras] = "Eras";
  3718. /**
  3719. * Transforms a date to a locale string based on a pattern and a timezone
  3720. *
  3721. * \@internal
  3722. * @param {?} date
  3723. * @param {?} format
  3724. * @param {?} locale
  3725. * @param {?=} timezone
  3726. * @return {?}
  3727. */
  3728. function formatDate(date, format, locale, timezone) {
  3729. var /** @type {?} */ namedFormat = getNamedFormat(locale, format);
  3730. format = namedFormat || format;
  3731. var /** @type {?} */ parts = [];
  3732. var /** @type {?} */ match;
  3733. while (format) {
  3734. match = DATE_FORMATS_SPLIT.exec(format);
  3735. if (match) {
  3736. parts = parts.concat(match.slice(1));
  3737. var /** @type {?} */ part = parts.pop();
  3738. if (!part) {
  3739. break;
  3740. }
  3741. format = part;
  3742. }
  3743. else {
  3744. parts.push(format);
  3745. break;
  3746. }
  3747. }
  3748. var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
  3749. if (timezone) {
  3750. dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  3751. date = convertTimezoneToLocal(date, timezone, true);
  3752. }
  3753. var /** @type {?} */ text = '';
  3754. parts.forEach(function (value) {
  3755. var /** @type {?} */ dateFormatter = getDateFormatter(value);
  3756. text += dateFormatter ?
  3757. dateFormatter(date, locale, dateTimezoneOffset) :
  3758. value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
  3759. });
  3760. return text;
  3761. }
  3762. /**
  3763. * @param {?} locale
  3764. * @param {?} format
  3765. * @return {?}
  3766. */
  3767. function getNamedFormat(locale, format) {
  3768. var /** @type {?} */ localeId = getLocaleId(locale);
  3769. NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
  3770. if (NAMED_FORMATS[localeId][format]) {
  3771. return NAMED_FORMATS[localeId][format];
  3772. }
  3773. var /** @type {?} */ formatValue = '';
  3774. switch (format) {
  3775. case 'shortDate':
  3776. formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
  3777. break;
  3778. case 'mediumDate':
  3779. formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
  3780. break;
  3781. case 'longDate':
  3782. formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
  3783. break;
  3784. case 'fullDate':
  3785. formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
  3786. break;
  3787. case 'shortTime':
  3788. formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
  3789. break;
  3790. case 'mediumTime':
  3791. formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
  3792. break;
  3793. case 'longTime':
  3794. formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
  3795. break;
  3796. case 'fullTime':
  3797. formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
  3798. break;
  3799. case 'short':
  3800. var /** @type {?} */ shortTime = getNamedFormat(locale, 'shortTime');
  3801. var /** @type {?} */ shortDate = getNamedFormat(locale, 'shortDate');
  3802. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
  3803. break;
  3804. case 'medium':
  3805. var /** @type {?} */ mediumTime = getNamedFormat(locale, 'mediumTime');
  3806. var /** @type {?} */ mediumDate = getNamedFormat(locale, 'mediumDate');
  3807. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
  3808. break;
  3809. case 'long':
  3810. var /** @type {?} */ longTime = getNamedFormat(locale, 'longTime');
  3811. var /** @type {?} */ longDate = getNamedFormat(locale, 'longDate');
  3812. formatValue =
  3813. formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
  3814. break;
  3815. case 'full':
  3816. var /** @type {?} */ fullTime = getNamedFormat(locale, 'fullTime');
  3817. var /** @type {?} */ fullDate = getNamedFormat(locale, 'fullDate');
  3818. formatValue =
  3819. formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
  3820. break;
  3821. }
  3822. if (formatValue) {
  3823. NAMED_FORMATS[localeId][format] = formatValue;
  3824. }
  3825. return formatValue;
  3826. }
  3827. /**
  3828. * @param {?} str
  3829. * @param {?} opt_values
  3830. * @return {?}
  3831. */
  3832. function formatDateTime(str, opt_values) {
  3833. if (opt_values) {
  3834. str = str.replace(/\{([^}]+)}/g, function (match, key) {
  3835. return (opt_values != null && key in opt_values) ? opt_values[key] : match;
  3836. });
  3837. }
  3838. return str;
  3839. }
  3840. /**
  3841. * @param {?} num
  3842. * @param {?} digits
  3843. * @param {?=} minusSign
  3844. * @param {?=} trim
  3845. * @param {?=} negWrap
  3846. * @return {?}
  3847. */
  3848. function padNumber(num, digits, minusSign, trim, negWrap) {
  3849. if (minusSign === void 0) { minusSign = '-'; }
  3850. var /** @type {?} */ neg = '';
  3851. if (num < 0 || (negWrap && num <= 0)) {
  3852. if (negWrap) {
  3853. num = -num + 1;
  3854. }
  3855. else {
  3856. num = -num;
  3857. neg = minusSign;
  3858. }
  3859. }
  3860. var /** @type {?} */ strNum = '' + num;
  3861. while (strNum.length < digits)
  3862. strNum = '0' + strNum;
  3863. if (trim) {
  3864. strNum = strNum.substr(strNum.length - digits);
  3865. }
  3866. return neg + strNum;
  3867. }
  3868. /**
  3869. * Returns a date formatter that transforms a date into its locale digit representation
  3870. * @param {?} name
  3871. * @param {?} size
  3872. * @param {?=} offset
  3873. * @param {?=} trim
  3874. * @param {?=} negWrap
  3875. * @return {?}
  3876. */
  3877. function dateGetter(name, size, offset, trim, negWrap) {
  3878. if (offset === void 0) { offset = 0; }
  3879. if (trim === void 0) { trim = false; }
  3880. if (negWrap === void 0) { negWrap = false; }
  3881. return function (date, locale) {
  3882. var /** @type {?} */ part = getDatePart(name, date, size);
  3883. if (offset > 0 || part > -offset) {
  3884. part += offset;
  3885. }
  3886. if (name === DateType.Hours && part === 0 && offset === -12) {
  3887. part = 12;
  3888. }
  3889. return padNumber(part, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim, negWrap);
  3890. };
  3891. }
  3892. /**
  3893. * @param {?} name
  3894. * @param {?} date
  3895. * @param {?} size
  3896. * @return {?}
  3897. */
  3898. function getDatePart(name, date, size) {
  3899. switch (name) {
  3900. case DateType.FullYear:
  3901. return date.getFullYear();
  3902. case DateType.Month:
  3903. return date.getMonth();
  3904. case DateType.Date:
  3905. return date.getDate();
  3906. case DateType.Hours:
  3907. return date.getHours();
  3908. case DateType.Minutes:
  3909. return date.getMinutes();
  3910. case DateType.Seconds:
  3911. return date.getSeconds();
  3912. case DateType.Milliseconds:
  3913. var /** @type {?} */ div = size === 1 ? 100 : (size === 2 ? 10 : 1);
  3914. return Math.round(date.getMilliseconds() / div);
  3915. case DateType.Day:
  3916. return date.getDay();
  3917. default:
  3918. throw new Error("Unknown DateType value \"" + name + "\".");
  3919. }
  3920. }
  3921. /**
  3922. * Returns a date formatter that transforms a date into its locale string representation
  3923. * @param {?} name
  3924. * @param {?} width
  3925. * @param {?=} form
  3926. * @param {?=} extended
  3927. * @return {?}
  3928. */
  3929. function dateStrGetter(name, width, form, extended) {
  3930. if (form === void 0) { form = FormStyle.Format; }
  3931. if (extended === void 0) { extended = false; }
  3932. return function (date, locale) {
  3933. return getDateTranslation(date, locale, name, width, form, extended);
  3934. };
  3935. }
  3936. /**
  3937. * Returns the locale translation of a date for a given form, type and width
  3938. * @param {?} date
  3939. * @param {?} locale
  3940. * @param {?} name
  3941. * @param {?} width
  3942. * @param {?} form
  3943. * @param {?} extended
  3944. * @return {?}
  3945. */
  3946. function getDateTranslation(date, locale, name, width, form, extended) {
  3947. switch (name) {
  3948. case TranslationType.Months:
  3949. return getLocaleMonthNames(locale, form, width)[date.getMonth()];
  3950. case TranslationType.Days:
  3951. return getLocaleDayNames(locale, form, width)[date.getDay()];
  3952. case TranslationType.DayPeriods:
  3953. var /** @type {?} */ currentHours_1 = date.getHours();
  3954. var /** @type {?} */ currentMinutes_1 = date.getMinutes();
  3955. if (extended) {
  3956. var /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale);
  3957. var /** @type {?} */ dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
  3958. var /** @type {?} */ result_1;
  3959. rules.forEach(function (rule, index) {
  3960. if (Array.isArray(rule)) {
  3961. // morning, afternoon, evening, night
  3962. var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
  3963. var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
  3964. if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
  3965. (currentHours_1 < hoursTo ||
  3966. (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
  3967. result_1 = dayPeriods_1[index];
  3968. }
  3969. }
  3970. else {
  3971. // noon or midnight
  3972. var hours = rule.hours, minutes = rule.minutes;
  3973. if (hours === currentHours_1 && minutes === currentMinutes_1) {
  3974. result_1 = dayPeriods_1[index];
  3975. }
  3976. }
  3977. });
  3978. if (result_1) {
  3979. return result_1;
  3980. }
  3981. }
  3982. // if no rules for the day periods, we use am/pm by default
  3983. return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours_1 < 12 ? 0 : 1];
  3984. case TranslationType.Eras:
  3985. return getLocaleEraNames(locale, /** @type {?} */ (width))[date.getFullYear() <= 0 ? 0 : 1];
  3986. default:
  3987. // This default case is not needed by TypeScript compiler, as the switch is exhaustive.
  3988. // However Closure Compiler does not understand that and reports an error in typed mode.
  3989. // The `throw new Error` below works around the problem, and the unexpected: never variable
  3990. // makes sure tsc still checks this code is unreachable.
  3991. var /** @type {?} */ unexpected = name;
  3992. throw new Error("unexpected translation type " + unexpected);
  3993. }
  3994. }
  3995. /**
  3996. * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
  3997. * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
  3998. * extended = +04:30)
  3999. * @param {?} width
  4000. * @return {?}
  4001. */
  4002. function timeZoneGetter(width) {
  4003. return function (date, locale, offset) {
  4004. var /** @type {?} */ zone = -1 * offset;
  4005. var /** @type {?} */ minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
  4006. var /** @type {?} */ hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
  4007. switch (width) {
  4008. case ZoneWidth.Short:
  4009. return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
  4010. padNumber(Math.abs(zone % 60), 2, minusSign);
  4011. case ZoneWidth.ShortGMT:
  4012. return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
  4013. case ZoneWidth.Long:
  4014. return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
  4015. padNumber(Math.abs(zone % 60), 2, minusSign);
  4016. case ZoneWidth.Extended:
  4017. if (offset === 0) {
  4018. return 'Z';
  4019. }
  4020. else {
  4021. return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
  4022. padNumber(Math.abs(zone % 60), 2, minusSign);
  4023. }
  4024. default:
  4025. throw new Error("Unknown zone width \"" + width + "\"");
  4026. }
  4027. };
  4028. }
  4029. var JANUARY = 0;
  4030. var THURSDAY = 4;
  4031. /**
  4032. * @param {?} year
  4033. * @return {?}
  4034. */
  4035. function getFirstThursdayOfYear(year) {
  4036. var /** @type {?} */ firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
  4037. return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
  4038. }
  4039. /**
  4040. * @param {?} datetime
  4041. * @return {?}
  4042. */
  4043. function getThursdayThisWeek(datetime) {
  4044. return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
  4045. }
  4046. /**
  4047. * @param {?} size
  4048. * @param {?=} monthBased
  4049. * @return {?}
  4050. */
  4051. function weekGetter(size, monthBased) {
  4052. if (monthBased === void 0) { monthBased = false; }
  4053. return function (date, locale) {
  4054. var /** @type {?} */ result;
  4055. if (monthBased) {
  4056. var /** @type {?} */ nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
  4057. var /** @type {?} */ today = date.getDate();
  4058. result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
  4059. }
  4060. else {
  4061. var /** @type {?} */ firstThurs = getFirstThursdayOfYear(date.getFullYear());
  4062. var /** @type {?} */ thisThurs = getThursdayThisWeek(date);
  4063. var /** @type {?} */ diff = thisThurs.getTime() - firstThurs.getTime();
  4064. result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
  4065. }
  4066. return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  4067. };
  4068. }
  4069. var DATE_FORMATS = {};
  4070. /**
  4071. * @param {?} format
  4072. * @return {?}
  4073. */
  4074. function getDateFormatter(format) {
  4075. if (DATE_FORMATS[format]) {
  4076. return DATE_FORMATS[format];
  4077. }
  4078. var /** @type {?} */ formatter;
  4079. switch (format) {
  4080. // Era name (AD/BC)
  4081. case 'G':
  4082. case 'GG':
  4083. case 'GGG':
  4084. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
  4085. break;
  4086. case 'GGGG':
  4087. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
  4088. break;
  4089. case 'GGGGG':
  4090. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
  4091. break;
  4092. // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
  4093. case 'y':
  4094. formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
  4095. break;
  4096. // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
  4097. case 'yy':
  4098. formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
  4099. break;
  4100. // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
  4101. case 'yyy':
  4102. formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
  4103. break;
  4104. // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
  4105. case 'yyyy':
  4106. formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
  4107. break;
  4108. // Month of the year (1-12), numeric
  4109. case 'M':
  4110. case 'L':
  4111. formatter = dateGetter(DateType.Month, 1, 1);
  4112. break;
  4113. case 'MM':
  4114. case 'LL':
  4115. formatter = dateGetter(DateType.Month, 2, 1);
  4116. break;
  4117. // Month of the year (January, ...), string, format
  4118. case 'MMM':
  4119. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
  4120. break;
  4121. case 'MMMM':
  4122. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
  4123. break;
  4124. case 'MMMMM':
  4125. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
  4126. break;
  4127. // Month of the year (January, ...), string, standalone
  4128. case 'LLL':
  4129. formatter =
  4130. dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
  4131. break;
  4132. case 'LLLL':
  4133. formatter =
  4134. dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
  4135. break;
  4136. case 'LLLLL':
  4137. formatter =
  4138. dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
  4139. break;
  4140. // Week of the year (1, ... 52)
  4141. case 'w':
  4142. formatter = weekGetter(1);
  4143. break;
  4144. case 'ww':
  4145. formatter = weekGetter(2);
  4146. break;
  4147. // Week of the month (1, ...)
  4148. case 'W':
  4149. formatter = weekGetter(1, true);
  4150. break;
  4151. // Day of the month (1-31)
  4152. case 'd':
  4153. formatter = dateGetter(DateType.Date, 1);
  4154. break;
  4155. case 'dd':
  4156. formatter = dateGetter(DateType.Date, 2);
  4157. break;
  4158. // Day of the Week
  4159. case 'E':
  4160. case 'EE':
  4161. case 'EEE':
  4162. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
  4163. break;
  4164. case 'EEEE':
  4165. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
  4166. break;
  4167. case 'EEEEE':
  4168. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
  4169. break;
  4170. case 'EEEEEE':
  4171. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
  4172. break;
  4173. // Generic period of the day (am-pm)
  4174. case 'a':
  4175. case 'aa':
  4176. case 'aaa':
  4177. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
  4178. break;
  4179. case 'aaaa':
  4180. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
  4181. break;
  4182. case 'aaaaa':
  4183. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
  4184. break;
  4185. // Extended period of the day (midnight, at night, ...), standalone
  4186. case 'b':
  4187. case 'bb':
  4188. case 'bbb':
  4189. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
  4190. break;
  4191. case 'bbbb':
  4192. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
  4193. break;
  4194. case 'bbbbb':
  4195. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
  4196. break;
  4197. // Extended period of the day (midnight, night, ...), standalone
  4198. case 'B':
  4199. case 'BB':
  4200. case 'BBB':
  4201. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
  4202. break;
  4203. case 'BBBB':
  4204. formatter =
  4205. dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
  4206. break;
  4207. case 'BBBBB':
  4208. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
  4209. break;
  4210. // Hour in AM/PM, (1-12)
  4211. case 'h':
  4212. formatter = dateGetter(DateType.Hours, 1, -12);
  4213. break;
  4214. case 'hh':
  4215. formatter = dateGetter(DateType.Hours, 2, -12);
  4216. break;
  4217. // Hour of the day (0-23)
  4218. case 'H':
  4219. formatter = dateGetter(DateType.Hours, 1);
  4220. break;
  4221. // Hour in day, padded (00-23)
  4222. case 'HH':
  4223. formatter = dateGetter(DateType.Hours, 2);
  4224. break;
  4225. // Minute of the hour (0-59)
  4226. case 'm':
  4227. formatter = dateGetter(DateType.Minutes, 1);
  4228. break;
  4229. case 'mm':
  4230. formatter = dateGetter(DateType.Minutes, 2);
  4231. break;
  4232. // Second of the minute (0-59)
  4233. case 's':
  4234. formatter = dateGetter(DateType.Seconds, 1);
  4235. break;
  4236. case 'ss':
  4237. formatter = dateGetter(DateType.Seconds, 2);
  4238. break;
  4239. // Fractional second padded (0-9)
  4240. case 'S':
  4241. formatter = dateGetter(DateType.Milliseconds, 1);
  4242. break;
  4243. case 'SS':
  4244. formatter = dateGetter(DateType.Milliseconds, 2);
  4245. break;
  4246. // = millisecond
  4247. case 'SSS':
  4248. formatter = dateGetter(DateType.Milliseconds, 3);
  4249. break;
  4250. // Timezone ISO8601 short format (-0430)
  4251. case 'Z':
  4252. case 'ZZ':
  4253. case 'ZZZ':
  4254. formatter = timeZoneGetter(ZoneWidth.Short);
  4255. break;
  4256. // Timezone ISO8601 extended format (-04:30)
  4257. case 'ZZZZZ':
  4258. formatter = timeZoneGetter(ZoneWidth.Extended);
  4259. break;
  4260. // Timezone GMT short format (GMT+4)
  4261. case 'O':
  4262. case 'OO':
  4263. case 'OOO':
  4264. // Should be location, but fallback to format O instead because we don't have the data yet
  4265. case 'z':
  4266. case 'zz':
  4267. case 'zzz':
  4268. formatter = timeZoneGetter(ZoneWidth.ShortGMT);
  4269. break;
  4270. // Timezone GMT long format (GMT+0430)
  4271. case 'OOOO':
  4272. case 'ZZZZ':
  4273. // Should be location, but fallback to format O instead because we don't have the data yet
  4274. case 'zzzz':
  4275. formatter = timeZoneGetter(ZoneWidth.Long);
  4276. break;
  4277. default:
  4278. return null;
  4279. }
  4280. DATE_FORMATS[format] = formatter;
  4281. return formatter;
  4282. }
  4283. /**
  4284. * @param {?} timezone
  4285. * @param {?} fallback
  4286. * @return {?}
  4287. */
  4288. function timezoneToOffset(timezone, fallback) {
  4289. // Support: IE 9-11 only, Edge 13-15+
  4290. // IE/Edge do not "understand" colon (`:`) in timezone
  4291. timezone = timezone.replace(/:/g, '');
  4292. var /** @type {?} */ requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
  4293. return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
  4294. }
  4295. /**
  4296. * @param {?} date
  4297. * @param {?} minutes
  4298. * @return {?}
  4299. */
  4300. function addDateMinutes(date, minutes) {
  4301. date = new Date(date.getTime());
  4302. date.setMinutes(date.getMinutes() + minutes);
  4303. return date;
  4304. }
  4305. /**
  4306. * @param {?} date
  4307. * @param {?} timezone
  4308. * @param {?} reverse
  4309. * @return {?}
  4310. */
  4311. function convertTimezoneToLocal(date, timezone, reverse) {
  4312. var /** @type {?} */ reverseValue = reverse ? -1 : 1;
  4313. var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
  4314. var /** @type {?} */ timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  4315. return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
  4316. }
  4317. /**
  4318. * @fileoverview added by tsickle
  4319. * @suppress {checkTypes} checked by tsc
  4320. */
  4321. /**
  4322. * @license
  4323. * Copyright Google Inc. All Rights Reserved.
  4324. *
  4325. * Use of this source code is governed by an MIT-style license that can be
  4326. * found in the LICENSE file at https://angular.io/license
  4327. */
  4328. /**
  4329. * @param {?} type
  4330. * @param {?} value
  4331. * @return {?}
  4332. */
  4333. function invalidPipeArgumentError(type, value) {
  4334. return Error("InvalidPipeArgument: '" + value + "' for pipe '" + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_39" /* ɵstringify */])(type) + "'");
  4335. }
  4336. /**
  4337. * @fileoverview added by tsickle
  4338. * @suppress {checkTypes} checked by tsc
  4339. */
  4340. /**
  4341. * @license
  4342. * Copyright Google Inc. All Rights Reserved.
  4343. *
  4344. * Use of this source code is governed by an MIT-style license that can be
  4345. * found in the LICENSE file at https://angular.io/license
  4346. */
  4347. var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
  4348. /**
  4349. * \@ngModule CommonModule
  4350. * \@whatItDoes Formats a date according to locale rules.
  4351. * \@howToUse `date_expression | date[:format[:timezone[:locale]]]`
  4352. * \@description
  4353. *
  4354. * Where:
  4355. * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
  4356. * (https://www.w3.org/TR/NOTE-datetime).
  4357. * - `format` indicates which date/time components to include. The format can be predefined as
  4358. * shown below (all examples are given for `en-US`) or custom as shown in the table.
  4359. * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`)
  4360. * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`)
  4361. * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`)
  4362. * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at
  4363. * 9:03:01 AM GMT+01:00`)
  4364. * - `'shortDate'`: equivalent to `'M/d/yy'` (e.g. `6/15/15`)
  4365. * - `'mediumDate'`: equivalent to `'MMM d, y'` (e.g. `Jun 15, 2015`)
  4366. * - `'longDate'`: equivalent to `'MMMM d, y'` (e.g. `June 15, 2015`)
  4367. * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (e.g. `Monday, June 15, 2015`)
  4368. * - `'shortTime'`: equivalent to `'h:mm a'` (e.g. `9:03 AM`)
  4369. * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (e.g. `9:03:01 AM`)
  4370. * - `'longTime'`: equivalent to `'h:mm:ss a z'` (e.g. `9:03:01 AM GMT+1`)
  4371. * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (e.g. `9:03:01 AM GMT+01:00`)
  4372. * - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone
  4373. * abbreviations, but for general use, use a time zone offset, for example,
  4374. * `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
  4375. * If not specified, the local system timezone of the end-user's browser will be used.
  4376. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  4377. * default)
  4378. *
  4379. *
  4380. * | Field Type | Format | Description | Example Value |
  4381. * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
  4382. * | Era | G, GG & GGG | Abbreviated | AD |
  4383. * | | GGGG | Wide | Anno Domini |
  4384. * | | GGGGG | Narrow | A |
  4385. * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
  4386. * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
  4387. * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
  4388. * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
  4389. * | Month | M | Numeric: 1 digit | 9, 12 |
  4390. * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
  4391. * | | MMM | Abbreviated | Sep |
  4392. * | | MMMM | Wide | September |
  4393. * | | MMMMM | Narrow | S |
  4394. * | Month standalone | L | Numeric: 1 digit | 9, 12 |
  4395. * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
  4396. * | | LLL | Abbreviated | Sep |
  4397. * | | LLLL | Wide | September |
  4398. * | | LLLLL | Narrow | S |
  4399. * | Week of year | w | Numeric: minimum digits | 1... 53 |
  4400. * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
  4401. * | Week of month | W | Numeric: 1 digit | 1... 5 |
  4402. * | Day of month | d | Numeric: minimum digits | 1 |
  4403. * | | dd | Numeric: 2 digits + zero padded | 01 |
  4404. * | Week day | E, EE & EEE | Abbreviated | Tue |
  4405. * | | EEEE | Wide | Tuesday |
  4406. * | | EEEEE | Narrow | T |
  4407. * | | EEEEEE | Short | Tu |
  4408. * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
  4409. * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
  4410. * | | aaaaa | Narrow | a/p |
  4411. * | Period* | B, BB & BBB | Abbreviated | mid. |
  4412. * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  4413. * | | BBBBB | Narrow | md |
  4414. * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
  4415. * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  4416. * | | bbbbb | Narrow | md |
  4417. * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
  4418. * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
  4419. * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
  4420. * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
  4421. * | Minute | m | Numeric: minimum digits | 8, 59 |
  4422. * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
  4423. * | Second | s | Numeric: minimum digits | 0... 59 |
  4424. * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
  4425. * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
  4426. * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
  4427. * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
  4428. * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
  4429. * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
  4430. * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
  4431. * | | ZZZZ | Long localized GMT format | GMT-8:00 |
  4432. * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
  4433. * | | O, OO & OOO | Short localized GMT format | GMT-8 |
  4434. * | | OOOO | Long localized GMT format | GMT-08:00 |
  4435. *
  4436. *
  4437. * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
  4438. * applied and the formatted text will have the same day, month and year of the expression.
  4439. *
  4440. * WARNINGS:
  4441. * - this pipe has only access to en-US locale data by default. If you want to localize the dates
  4442. * in another language, you will have to import data for other locales.
  4443. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
  4444. * data.
  4445. * - Fields suffixed with * are only available in the extra dataset.
  4446. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import extra locale
  4447. * data.
  4448. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
  4449. * Instead users should treat the date as an immutable object and change the reference when the
  4450. * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
  4451. * which would be an expensive operation).
  4452. *
  4453. * ### Examples
  4454. *
  4455. * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11)
  4456. * in the _local_ time and locale is 'en-US':
  4457. *
  4458. * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'}
  4459. *
  4460. * \@stable
  4461. */
  4462. var DatePipe = /** @class */ (function () {
  4463. function DatePipe(locale) {
  4464. this.locale = locale;
  4465. }
  4466. /**
  4467. * @param {?} value
  4468. * @param {?=} format
  4469. * @param {?=} timezone
  4470. * @param {?=} locale
  4471. * @return {?}
  4472. */
  4473. DatePipe.prototype.transform = /**
  4474. * @param {?} value
  4475. * @param {?=} format
  4476. * @param {?=} timezone
  4477. * @param {?=} locale
  4478. * @return {?}
  4479. */
  4480. function (value, format, timezone, locale) {
  4481. if (format === void 0) { format = 'mediumDate'; }
  4482. if (value == null || value === '' || value !== value)
  4483. return null;
  4484. if (typeof value === 'string') {
  4485. value = value.trim();
  4486. }
  4487. var /** @type {?} */ date;
  4488. var /** @type {?} */ match;
  4489. if (isDate$1(value)) {
  4490. date = value;
  4491. }
  4492. else if (!isNaN(value - parseFloat(value))) {
  4493. date = new Date(parseFloat(value));
  4494. }
  4495. else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
  4496. /**
  4497. * For ISO Strings without time the day, month and year must be extracted from the ISO String
  4498. * before Date creation to avoid time offset and errors in the new Date.
  4499. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
  4500. * date, some browsers (e.g. IE 9) will throw an invalid Date error
  4501. * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
  4502. * is applied
  4503. * Note: ISO months are 0 for January, 1 for February, ...
  4504. */
  4505. var _a = value.split('-').map(function (val) { return +val; }), y = _a[0], m = _a[1], d = _a[2];
  4506. date = new Date(y, m - 1, d);
  4507. }
  4508. else if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
  4509. date = isoStringToDate(match);
  4510. }
  4511. else {
  4512. date = new Date(value);
  4513. }
  4514. if (!isDate$1(date)) {
  4515. throw invalidPipeArgumentError(DatePipe, value);
  4516. }
  4517. return formatDate(date, format, locale || this.locale, timezone);
  4518. };
  4519. DatePipe.decorators = [
  4520. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'date', pure: true },] },
  4521. ];
  4522. /** @nocollapse */
  4523. DatePipe.ctorParameters = function () { return [
  4524. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  4525. ]; };
  4526. return DatePipe;
  4527. }());
  4528. /**
  4529. * \@internal
  4530. * @param {?} match
  4531. * @return {?}
  4532. */
  4533. function isoStringToDate(match) {
  4534. var /** @type {?} */ date = new Date(0);
  4535. var /** @type {?} */ tzHour = 0;
  4536. var /** @type {?} */ tzMin = 0;
  4537. // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
  4538. var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
  4539. var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours;
  4540. // if there is a timezone defined like "+01:00" or "+0100"
  4541. if (match[9]) {
  4542. tzHour = +(match[9] + match[10]);
  4543. tzMin = +(match[9] + match[11]);
  4544. }
  4545. dateSetter.call(date, +(match[1]), +(match[2]) - 1, +(match[3]));
  4546. var /** @type {?} */ h = +(match[4] || '0') - tzHour;
  4547. var /** @type {?} */ m = +(match[5] || '0') - tzMin;
  4548. var /** @type {?} */ s = +(match[6] || '0');
  4549. var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
  4550. timeSetter.call(date, h, m, s, ms);
  4551. return date;
  4552. }
  4553. /**
  4554. * @param {?} value
  4555. * @return {?}
  4556. */
  4557. function isDate$1(value) {
  4558. return value instanceof Date && !isNaN(value.valueOf());
  4559. }
  4560. /**
  4561. * @fileoverview added by tsickle
  4562. * @suppress {checkTypes} checked by tsc
  4563. */
  4564. var NumberFormatter = /** @class */ (function () {
  4565. function NumberFormatter() {
  4566. }
  4567. /**
  4568. * @param {?} num
  4569. * @param {?} locale
  4570. * @param {?} style
  4571. * @param {?=} opts
  4572. * @return {?}
  4573. */
  4574. NumberFormatter.format = /**
  4575. * @param {?} num
  4576. * @param {?} locale
  4577. * @param {?} style
  4578. * @param {?=} opts
  4579. * @return {?}
  4580. */
  4581. function (num, locale, style, opts) {
  4582. if (opts === void 0) { opts = {}; }
  4583. var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
  4584. var /** @type {?} */ options = {
  4585. minimumIntegerDigits: minimumIntegerDigits,
  4586. minimumFractionDigits: minimumFractionDigits,
  4587. maximumFractionDigits: maximumFractionDigits,
  4588. style: NumberFormatStyle[style].toLowerCase()
  4589. };
  4590. if (style == NumberFormatStyle.Currency) {
  4591. options.currency = typeof currency == 'string' ? currency : undefined;
  4592. options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
  4593. }
  4594. return new Intl.NumberFormat(locale, options).format(num);
  4595. };
  4596. return NumberFormatter;
  4597. }());
  4598. var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
  4599. var PATTERN_ALIASES = {
  4600. // Keys are quoted so they do not get renamed during closure compilation.
  4601. 'yMMMdjms': datePartGetterFactory(combine([
  4602. digitCondition('year', 1),
  4603. nameCondition('month', 3),
  4604. digitCondition('day', 1),
  4605. digitCondition('hour', 1),
  4606. digitCondition('minute', 1),
  4607. digitCondition('second', 1),
  4608. ])),
  4609. 'yMdjm': datePartGetterFactory(combine([
  4610. digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
  4611. digitCondition('hour', 1), digitCondition('minute', 1)
  4612. ])),
  4613. 'yMMMMEEEEd': datePartGetterFactory(combine([
  4614. digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
  4615. digitCondition('day', 1)
  4616. ])),
  4617. 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
  4618. 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
  4619. 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
  4620. 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
  4621. 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
  4622. };
  4623. var DATE_FORMATS$1 = {
  4624. // Keys are quoted so they do not get renamed.
  4625. 'yyyy': datePartGetterFactory(digitCondition('year', 4)),
  4626. 'yy': datePartGetterFactory(digitCondition('year', 2)),
  4627. 'y': datePartGetterFactory(digitCondition('year', 1)),
  4628. 'MMMM': datePartGetterFactory(nameCondition('month', 4)),
  4629. 'MMM': datePartGetterFactory(nameCondition('month', 3)),
  4630. 'MM': datePartGetterFactory(digitCondition('month', 2)),
  4631. 'M': datePartGetterFactory(digitCondition('month', 1)),
  4632. 'LLLL': datePartGetterFactory(nameCondition('month', 4)),
  4633. 'L': datePartGetterFactory(nameCondition('month', 1)),
  4634. 'dd': datePartGetterFactory(digitCondition('day', 2)),
  4635. 'd': datePartGetterFactory(digitCondition('day', 1)),
  4636. 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
  4637. 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
  4638. 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
  4639. 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
  4640. 'jj': datePartGetterFactory(digitCondition('hour', 2)),
  4641. 'j': datePartGetterFactory(digitCondition('hour', 1)),
  4642. 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
  4643. 'm': datePartGetterFactory(digitCondition('minute', 1)),
  4644. 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
  4645. 's': datePartGetterFactory(digitCondition('second', 1)),
  4646. // while ISO 8601 requires fractions to be prefixed with `.` or `,`
  4647. // we can be just safely rely on using `sss` since we currently don't support single or two digit
  4648. // fractions
  4649. 'sss': datePartGetterFactory(digitCondition('second', 3)),
  4650. 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
  4651. 'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
  4652. 'EE': datePartGetterFactory(nameCondition('weekday', 2)),
  4653. 'E': datePartGetterFactory(nameCondition('weekday', 1)),
  4654. 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
  4655. 'Z': timeZoneGetter$1('short'),
  4656. 'z': timeZoneGetter$1('long'),
  4657. 'ww': datePartGetterFactory({}),
  4658. // Week of year, padded (00-53). Week 01 is the week with the
  4659. // first Thursday of the year. not support ?
  4660. 'w': datePartGetterFactory({}),
  4661. // Week of year (0-53). Week 1 is the week with the first Thursday
  4662. // of the year not support ?
  4663. 'G': datePartGetterFactory(nameCondition('era', 1)),
  4664. 'GG': datePartGetterFactory(nameCondition('era', 2)),
  4665. 'GGG': datePartGetterFactory(nameCondition('era', 3)),
  4666. 'GGGG': datePartGetterFactory(nameCondition('era', 4))
  4667. };
  4668. /**
  4669. * @param {?} inner
  4670. * @return {?}
  4671. */
  4672. function digitModifier(inner) {
  4673. return function (date, locale) {
  4674. var /** @type {?} */ result = inner(date, locale);
  4675. return result.length == 1 ? '0' + result : result;
  4676. };
  4677. }
  4678. /**
  4679. * @param {?} inner
  4680. * @return {?}
  4681. */
  4682. function hourClockExtractor(inner) {
  4683. return function (date, locale) { return inner(date, locale).split(' ')[1]; };
  4684. }
  4685. /**
  4686. * @param {?} inner
  4687. * @return {?}
  4688. */
  4689. function hourExtractor(inner) {
  4690. return function (date, locale) { return inner(date, locale).split(' ')[0]; };
  4691. }
  4692. /**
  4693. * @param {?} date
  4694. * @param {?} locale
  4695. * @param {?} options
  4696. * @return {?}
  4697. */
  4698. function intlDateFormat(date, locale, options) {
  4699. return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
  4700. }
  4701. /**
  4702. * @param {?} timezone
  4703. * @return {?}
  4704. */
  4705. function timeZoneGetter$1(timezone) {
  4706. // To workaround `Intl` API restriction for single timezone let format with 24 hours
  4707. var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
  4708. return function (date, locale) {
  4709. var /** @type {?} */ result = intlDateFormat(date, locale, options);
  4710. // Then extract first 3 letters that related to hours
  4711. return result ? result.substring(3) : '';
  4712. };
  4713. }
  4714. /**
  4715. * @param {?} options
  4716. * @param {?} value
  4717. * @return {?}
  4718. */
  4719. function hour12Modify(options, value) {
  4720. options.hour12 = value;
  4721. return options;
  4722. }
  4723. /**
  4724. * @param {?} prop
  4725. * @param {?} len
  4726. * @return {?}
  4727. */
  4728. function digitCondition(prop, len) {
  4729. var /** @type {?} */ result = {};
  4730. result[prop] = len === 2 ? '2-digit' : 'numeric';
  4731. return result;
  4732. }
  4733. /**
  4734. * @param {?} prop
  4735. * @param {?} len
  4736. * @return {?}
  4737. */
  4738. function nameCondition(prop, len) {
  4739. var /** @type {?} */ result = {};
  4740. if (len < 4) {
  4741. result[prop] = len > 1 ? 'short' : 'narrow';
  4742. }
  4743. else {
  4744. result[prop] = 'long';
  4745. }
  4746. return result;
  4747. }
  4748. /**
  4749. * @param {?} options
  4750. * @return {?}
  4751. */
  4752. function combine(options) {
  4753. return options.reduce(function (merged, opt) { return (Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, merged, opt)); }, {});
  4754. }
  4755. /**
  4756. * @param {?} ret
  4757. * @return {?}
  4758. */
  4759. function datePartGetterFactory(ret) {
  4760. return function (date, locale) { return intlDateFormat(date, locale, ret); };
  4761. }
  4762. var DATE_FORMATTER_CACHE = new Map();
  4763. /**
  4764. * @param {?} format
  4765. * @param {?} date
  4766. * @param {?} locale
  4767. * @return {?}
  4768. */
  4769. function dateFormatter(format, date, locale) {
  4770. var /** @type {?} */ fn = PATTERN_ALIASES[format];
  4771. if (fn)
  4772. return fn(date, locale);
  4773. var /** @type {?} */ cacheKey = format;
  4774. var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey);
  4775. if (!parts) {
  4776. parts = [];
  4777. var /** @type {?} */ match = void 0;
  4778. DATE_FORMATS_SPLIT$1.exec(format);
  4779. var /** @type {?} */ _format = format;
  4780. while (_format) {
  4781. match = DATE_FORMATS_SPLIT$1.exec(_format);
  4782. if (match) {
  4783. parts = parts.concat(match.slice(1));
  4784. _format = /** @type {?} */ ((parts.pop()));
  4785. }
  4786. else {
  4787. parts.push(_format);
  4788. _format = null;
  4789. }
  4790. }
  4791. DATE_FORMATTER_CACHE.set(cacheKey, parts);
  4792. }
  4793. return parts.reduce(function (text, part) {
  4794. var /** @type {?} */ fn = DATE_FORMATS$1[part];
  4795. return text + (fn ? fn(date, locale) : partToTime(part));
  4796. }, '');
  4797. }
  4798. /**
  4799. * @param {?} part
  4800. * @return {?}
  4801. */
  4802. function partToTime(part) {
  4803. return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
  4804. }
  4805. var DateFormatter = /** @class */ (function () {
  4806. function DateFormatter() {
  4807. }
  4808. /**
  4809. * @param {?} date
  4810. * @param {?} locale
  4811. * @param {?} pattern
  4812. * @return {?}
  4813. */
  4814. DateFormatter.format = /**
  4815. * @param {?} date
  4816. * @param {?} locale
  4817. * @param {?} pattern
  4818. * @return {?}
  4819. */
  4820. function (date, locale, pattern) {
  4821. return dateFormatter(pattern, date, locale);
  4822. };
  4823. return DateFormatter;
  4824. }());
  4825. /**
  4826. * @fileoverview added by tsickle
  4827. * @suppress {checkTypes} checked by tsc
  4828. */
  4829. /**
  4830. * @license
  4831. * Copyright Google Inc. All Rights Reserved.
  4832. *
  4833. * Use of this source code is governed by an MIT-style license that can be
  4834. * found in the LICENSE file at https://angular.io/license
  4835. */
  4836. /**
  4837. * \@ngModule CommonModule
  4838. * \@whatItDoes Formats a date according to locale rules.
  4839. * \@howToUse `date_expression | date[:format]`
  4840. * \@description
  4841. *
  4842. * Where:
  4843. * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
  4844. * (https://www.w3.org/TR/NOTE-datetime).
  4845. * - `format` indicates which date/time components to include. The format can be predefined as
  4846. * shown below or custom as shown in the table.
  4847. * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`)
  4848. * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`)
  4849. * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`)
  4850. * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`)
  4851. * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`)
  4852. * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`)
  4853. * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`)
  4854. * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`)
  4855. *
  4856. *
  4857. * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit |
  4858. * |-----------|:------:|--------|--------------|-------------------|-----------|-----------|
  4859. * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - |
  4860. * | year | y | - | - | - | y (2015) | yy (15) |
  4861. * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) |
  4862. * | day | d | - | - | - | d (3) | dd (03) |
  4863. * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - |
  4864. * | hour | j | - | - | - | j (13) | jj (13) |
  4865. * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)|
  4866. * | hour24 | H | - | - | - | H (13) | HH (13) |
  4867. * | minute | m | - | - | - | m (5) | mm (05) |
  4868. * | second | s | - | - | - | s (9) | ss (09) |
  4869. * | timezone | z | - | - | z (Pacific Standard Time)| - | - |
  4870. * | timezone | Z | - | Z (GMT-8:00) | - | - | - |
  4871. * | timezone | a | - | a (PM) | - | - | - |
  4872. *
  4873. * In javascript, only the components specified will be respected (not the ordering,
  4874. * punctuations, ...) and details of the formatting will be dependent on the locale.
  4875. *
  4876. * Timezone of the formatted text will be the local system timezone of the end-user's machine.
  4877. *
  4878. * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
  4879. * applied and the formatted text will have the same day, month and year of the expression.
  4880. *
  4881. * WARNINGS:
  4882. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
  4883. * Instead users should treat the date as an immutable object and change the reference when the
  4884. * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
  4885. * which would be an expensive operation).
  4886. * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
  4887. * browsers.
  4888. *
  4889. * ### Examples
  4890. *
  4891. * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
  4892. * in the _local_ time and locale is 'en-US':
  4893. *
  4894. * {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'}
  4895. *
  4896. * \@stable
  4897. */
  4898. var DeprecatedDatePipe = /** @class */ (function () {
  4899. function DeprecatedDatePipe(_locale) {
  4900. this._locale = _locale;
  4901. }
  4902. /**
  4903. * @param {?} value
  4904. * @param {?=} pattern
  4905. * @return {?}
  4906. */
  4907. DeprecatedDatePipe.prototype.transform = /**
  4908. * @param {?} value
  4909. * @param {?=} pattern
  4910. * @return {?}
  4911. */
  4912. function (value, pattern) {
  4913. if (pattern === void 0) { pattern = 'mediumDate'; }
  4914. if (value == null || value === '' || value !== value)
  4915. return null;
  4916. var /** @type {?} */ date;
  4917. if (typeof value === 'string') {
  4918. value = value.trim();
  4919. }
  4920. if (isDate(value)) {
  4921. date = value;
  4922. }
  4923. else if (!isNaN(value - parseFloat(value))) {
  4924. date = new Date(parseFloat(value));
  4925. }
  4926. else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
  4927. /**
  4928. * For ISO Strings without time the day, month and year must be extracted from the ISO String
  4929. * before Date creation to avoid time offset and errors in the new Date.
  4930. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
  4931. * date, some browsers (e.g. IE 9) will throw an invalid Date error
  4932. * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the
  4933. * timeoffset
  4934. * is applied
  4935. * Note: ISO months are 0 for January, 1 for February, ...
  4936. */
  4937. var _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2];
  4938. date = new Date(y, m - 1, d);
  4939. }
  4940. else {
  4941. date = new Date(value);
  4942. }
  4943. if (!isDate(date)) {
  4944. var /** @type {?} */ match = void 0;
  4945. if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
  4946. date = isoStringToDate(match);
  4947. }
  4948. else {
  4949. throw invalidPipeArgumentError(DeprecatedDatePipe, value);
  4950. }
  4951. }
  4952. return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern);
  4953. };
  4954. /**
  4955. * \@internal
  4956. */
  4957. DeprecatedDatePipe._ALIASES = {
  4958. 'medium': 'yMMMdjms',
  4959. 'short': 'yMdjm',
  4960. 'fullDate': 'yMMMMEEEEd',
  4961. 'longDate': 'yMMMMd',
  4962. 'mediumDate': 'yMMMd',
  4963. 'shortDate': 'yMd',
  4964. 'mediumTime': 'jms',
  4965. 'shortTime': 'jm'
  4966. };
  4967. DeprecatedDatePipe.decorators = [
  4968. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'date', pure: true },] },
  4969. ];
  4970. /** @nocollapse */
  4971. DeprecatedDatePipe.ctorParameters = function () { return [
  4972. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  4973. ]; };
  4974. return DeprecatedDatePipe;
  4975. }());
  4976. /**
  4977. * @param {?} value
  4978. * @return {?}
  4979. */
  4980. function isDate(value) {
  4981. return value instanceof Date && !isNaN(value.valueOf());
  4982. }
  4983. /**
  4984. * @fileoverview added by tsickle
  4985. * @suppress {checkTypes} checked by tsc
  4986. */
  4987. /**
  4988. * @license
  4989. * Copyright Google Inc. All Rights Reserved.
  4990. *
  4991. * Use of this source code is governed by an MIT-style license that can be
  4992. * found in the LICENSE file at https://angular.io/license
  4993. */
  4994. var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
  4995. var MAX_DIGITS = 22;
  4996. var DECIMAL_SEP = '.';
  4997. var ZERO_CHAR = '0';
  4998. var PATTERN_SEP = ';';
  4999. var GROUP_SEP = ',';
  5000. var DIGIT_CHAR = '#';
  5001. var CURRENCY_CHAR = '¤';
  5002. var PERCENT_CHAR = '%';
  5003. /**
  5004. * Transform a number to a locale string based on a style and a format
  5005. *
  5006. * \@internal
  5007. * @param {?} value
  5008. * @param {?} locale
  5009. * @param {?} style
  5010. * @param {?=} digitsInfo
  5011. * @param {?=} currency
  5012. * @return {?}
  5013. */
  5014. function formatNumber$1(value, locale, style, digitsInfo, currency) {
  5015. if (currency === void 0) { currency = null; }
  5016. var /** @type {?} */ res = { str: null };
  5017. var /** @type {?} */ format = getLocaleNumberFormat(locale, style);
  5018. var /** @type {?} */ num;
  5019. // Convert strings to numbers
  5020. if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) {
  5021. num = +value;
  5022. }
  5023. else if (typeof value !== 'number') {
  5024. res.error = value + " is not a number";
  5025. return res;
  5026. }
  5027. else {
  5028. num = value;
  5029. }
  5030. var /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  5031. var /** @type {?} */ formattedText = '';
  5032. var /** @type {?} */ isZero = false;
  5033. if (!isFinite(num)) {
  5034. formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
  5035. }
  5036. else {
  5037. var /** @type {?} */ parsedNumber = parseNumber(num);
  5038. if (style === NumberFormatStyle.Percent) {
  5039. parsedNumber = toPercent(parsedNumber);
  5040. }
  5041. var /** @type {?} */ minInt = pattern.minInt;
  5042. var /** @type {?} */ minFraction = pattern.minFrac;
  5043. var /** @type {?} */ maxFraction = pattern.maxFrac;
  5044. if (digitsInfo) {
  5045. var /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
  5046. if (parts === null) {
  5047. res.error = digitsInfo + " is not a valid digit info";
  5048. return res;
  5049. }
  5050. var /** @type {?} */ minIntPart = parts[1];
  5051. var /** @type {?} */ minFractionPart = parts[3];
  5052. var /** @type {?} */ maxFractionPart = parts[5];
  5053. if (minIntPart != null) {
  5054. minInt = parseIntAutoRadix(minIntPart);
  5055. }
  5056. if (minFractionPart != null) {
  5057. minFraction = parseIntAutoRadix(minFractionPart);
  5058. }
  5059. if (maxFractionPart != null) {
  5060. maxFraction = parseIntAutoRadix(maxFractionPart);
  5061. }
  5062. else if (minFractionPart != null && minFraction > maxFraction) {
  5063. maxFraction = minFraction;
  5064. }
  5065. }
  5066. roundNumber(parsedNumber, minFraction, maxFraction);
  5067. var /** @type {?} */ digits = parsedNumber.digits;
  5068. var /** @type {?} */ integerLen = parsedNumber.integerLen;
  5069. var /** @type {?} */ exponent = parsedNumber.exponent;
  5070. var /** @type {?} */ decimals = [];
  5071. isZero = digits.every(function (d) { return !d; });
  5072. // pad zeros for small numbers
  5073. for (; integerLen < minInt; integerLen++) {
  5074. digits.unshift(0);
  5075. }
  5076. // pad zeros for small numbers
  5077. for (; integerLen < 0; integerLen++) {
  5078. digits.unshift(0);
  5079. }
  5080. // extract decimals digits
  5081. if (integerLen > 0) {
  5082. decimals = digits.splice(integerLen, digits.length);
  5083. }
  5084. else {
  5085. decimals = digits;
  5086. digits = [0];
  5087. }
  5088. // format the integer digits with grouping separators
  5089. var /** @type {?} */ groups = [];
  5090. if (digits.length >= pattern.lgSize) {
  5091. groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
  5092. }
  5093. while (digits.length > pattern.gSize) {
  5094. groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
  5095. }
  5096. if (digits.length) {
  5097. groups.unshift(digits.join(''));
  5098. }
  5099. var /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group;
  5100. formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
  5101. // append the decimal digits
  5102. if (decimals.length) {
  5103. var /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal;
  5104. formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
  5105. }
  5106. if (exponent) {
  5107. formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
  5108. }
  5109. }
  5110. if (num < 0 && !isZero) {
  5111. formattedText = pattern.negPre + formattedText + pattern.negSuf;
  5112. }
  5113. else {
  5114. formattedText = pattern.posPre + formattedText + pattern.posSuf;
  5115. }
  5116. if (style === NumberFormatStyle.Currency && currency !== null) {
  5117. res.str = formattedText
  5118. .replace(CURRENCY_CHAR, currency)
  5119. .replace(CURRENCY_CHAR, '');
  5120. return res;
  5121. }
  5122. if (style === NumberFormatStyle.Percent) {
  5123. res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
  5124. return res;
  5125. }
  5126. res.str = formattedText;
  5127. return res;
  5128. }
  5129. /**
  5130. * @param {?} format
  5131. * @param {?=} minusSign
  5132. * @return {?}
  5133. */
  5134. function parseNumberFormat(format, minusSign) {
  5135. if (minusSign === void 0) { minusSign = '-'; }
  5136. var /** @type {?} */ p = {
  5137. minInt: 1,
  5138. minFrac: 0,
  5139. maxFrac: 0,
  5140. posPre: '',
  5141. posSuf: '',
  5142. negPre: '',
  5143. negSuf: '',
  5144. gSize: 0,
  5145. lgSize: 0
  5146. };
  5147. var /** @type {?} */ patternParts = format.split(PATTERN_SEP);
  5148. var /** @type {?} */ positive = patternParts[0];
  5149. var /** @type {?} */ negative = patternParts[1];
  5150. var /** @type {?} */ positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
  5151. positive.split(DECIMAL_SEP) :
  5152. [
  5153. positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
  5154. positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
  5155. ], /** @type {?} */
  5156. integer = positiveParts[0], /** @type {?} */ fraction = positiveParts[1] || '';
  5157. p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
  5158. for (var /** @type {?} */ i = 0; i < fraction.length; i++) {
  5159. var /** @type {?} */ ch = fraction.charAt(i);
  5160. if (ch === ZERO_CHAR) {
  5161. p.minFrac = p.maxFrac = i + 1;
  5162. }
  5163. else if (ch === DIGIT_CHAR) {
  5164. p.maxFrac = i + 1;
  5165. }
  5166. else {
  5167. p.posSuf += ch;
  5168. }
  5169. }
  5170. var /** @type {?} */ groups = integer.split(GROUP_SEP);
  5171. p.gSize = groups[1] ? groups[1].length : 0;
  5172. p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
  5173. if (negative) {
  5174. var /** @type {?} */ trunkLen = positive.length - p.posPre.length - p.posSuf.length, /** @type {?} */
  5175. pos = negative.indexOf(DIGIT_CHAR);
  5176. p.negPre = negative.substr(0, pos).replace(/'/g, '');
  5177. p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
  5178. }
  5179. else {
  5180. p.negPre = minusSign + p.posPre;
  5181. p.negSuf = p.posSuf;
  5182. }
  5183. return p;
  5184. }
  5185. /**
  5186. * @param {?} parsedNumber
  5187. * @return {?}
  5188. */
  5189. function toPercent(parsedNumber) {
  5190. // if the number is 0, don't do anything
  5191. if (parsedNumber.digits[0] === 0) {
  5192. return parsedNumber;
  5193. }
  5194. // Getting the current number of decimals
  5195. var /** @type {?} */ fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
  5196. if (parsedNumber.exponent) {
  5197. parsedNumber.exponent += 2;
  5198. }
  5199. else {
  5200. if (fractionLen === 0) {
  5201. parsedNumber.digits.push(0, 0);
  5202. }
  5203. else if (fractionLen === 1) {
  5204. parsedNumber.digits.push(0);
  5205. }
  5206. parsedNumber.integerLen += 2;
  5207. }
  5208. return parsedNumber;
  5209. }
  5210. /**
  5211. * Parses a number.
  5212. * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
  5213. * @param {?} num
  5214. * @return {?}
  5215. */
  5216. function parseNumber(num) {
  5217. var /** @type {?} */ numStr = Math.abs(num) + '';
  5218. var /** @type {?} */ exponent = 0, /** @type {?} */ digits, /** @type {?} */ integerLen;
  5219. var /** @type {?} */ i, /** @type {?} */ j, /** @type {?} */ zeros;
  5220. // Decimal point?
  5221. if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
  5222. numStr = numStr.replace(DECIMAL_SEP, '');
  5223. }
  5224. // Exponential form?
  5225. if ((i = numStr.search(/e/i)) > 0) {
  5226. // Work out the exponent.
  5227. if (integerLen < 0)
  5228. integerLen = i;
  5229. integerLen += +numStr.slice(i + 1);
  5230. numStr = numStr.substring(0, i);
  5231. }
  5232. else if (integerLen < 0) {
  5233. // There was no decimal point or exponent so it is an integer.
  5234. integerLen = numStr.length;
  5235. }
  5236. // Count the number of leading zeros.
  5237. for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
  5238. /* empty */
  5239. }
  5240. if (i === (zeros = numStr.length)) {
  5241. // The digits are all zero.
  5242. digits = [0];
  5243. integerLen = 1;
  5244. }
  5245. else {
  5246. // Count the number of trailing zeros
  5247. zeros--;
  5248. while (numStr.charAt(zeros) === ZERO_CHAR)
  5249. zeros--;
  5250. // Trailing zeros are insignificant so ignore them
  5251. integerLen -= i;
  5252. digits = [];
  5253. // Convert string to array of digits without leading/trailing zeros.
  5254. for (j = 0; i <= zeros; i++, j++) {
  5255. digits[j] = +numStr.charAt(i);
  5256. }
  5257. }
  5258. // If the number overflows the maximum allowed digits then use an exponent.
  5259. if (integerLen > MAX_DIGITS) {
  5260. digits = digits.splice(0, MAX_DIGITS - 1);
  5261. exponent = integerLen - 1;
  5262. integerLen = 1;
  5263. }
  5264. return { digits: digits, exponent: exponent, integerLen: integerLen };
  5265. }
  5266. /**
  5267. * Round the parsed number to the specified number of decimal places
  5268. * This function changes the parsedNumber in-place
  5269. * @param {?} parsedNumber
  5270. * @param {?} minFrac
  5271. * @param {?} maxFrac
  5272. * @return {?}
  5273. */
  5274. function roundNumber(parsedNumber, minFrac, maxFrac) {
  5275. if (minFrac > maxFrac) {
  5276. throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
  5277. }
  5278. var /** @type {?} */ digits = parsedNumber.digits;
  5279. var /** @type {?} */ fractionLen = digits.length - parsedNumber.integerLen;
  5280. var /** @type {?} */ fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
  5281. // The index of the digit to where rounding is to occur
  5282. var /** @type {?} */ roundAt = fractionSize + parsedNumber.integerLen;
  5283. var /** @type {?} */ digit = digits[roundAt];
  5284. if (roundAt > 0) {
  5285. // Drop fractional digits beyond `roundAt`
  5286. digits.splice(Math.max(parsedNumber.integerLen, roundAt));
  5287. // Set non-fractional digits beyond `roundAt` to 0
  5288. for (var /** @type {?} */ j = roundAt; j < digits.length; j++) {
  5289. digits[j] = 0;
  5290. }
  5291. }
  5292. else {
  5293. // We rounded to zero so reset the parsedNumber
  5294. fractionLen = Math.max(0, fractionLen);
  5295. parsedNumber.integerLen = 1;
  5296. digits.length = Math.max(1, roundAt = fractionSize + 1);
  5297. digits[0] = 0;
  5298. for (var /** @type {?} */ i = 1; i < roundAt; i++)
  5299. digits[i] = 0;
  5300. }
  5301. if (digit >= 5) {
  5302. if (roundAt - 1 < 0) {
  5303. for (var /** @type {?} */ k = 0; k > roundAt; k--) {
  5304. digits.unshift(0);
  5305. parsedNumber.integerLen++;
  5306. }
  5307. digits.unshift(1);
  5308. parsedNumber.integerLen++;
  5309. }
  5310. else {
  5311. digits[roundAt - 1]++;
  5312. }
  5313. }
  5314. // Pad out with zeros to get the required fraction length
  5315. for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
  5316. digits.push(0);
  5317. var /** @type {?} */ dropTrailingZeros = fractionSize !== 0;
  5318. // Minimal length = nb of decimals required + current nb of integers
  5319. // Any number besides that is optional and can be removed if it's a trailing 0
  5320. var /** @type {?} */ minLen = minFrac + parsedNumber.integerLen;
  5321. // Do any carrying, e.g. a digit was rounded up to 10
  5322. var /** @type {?} */ carry = digits.reduceRight(function (carry, d, i, digits) {
  5323. d = d + carry;
  5324. digits[i] = d < 10 ? d : d - 10; // d % 10
  5325. if (dropTrailingZeros) {
  5326. // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)
  5327. if (digits[i] === 0 && i >= minLen) {
  5328. digits.pop();
  5329. }
  5330. else {
  5331. dropTrailingZeros = false;
  5332. }
  5333. }
  5334. return d >= 10 ? 1 : 0; // Math.floor(d / 10);
  5335. }, 0);
  5336. if (carry) {
  5337. digits.unshift(carry);
  5338. parsedNumber.integerLen++;
  5339. }
  5340. }
  5341. /**
  5342. * \@internal
  5343. * @param {?} text
  5344. * @return {?}
  5345. */
  5346. function parseIntAutoRadix(text) {
  5347. var /** @type {?} */ result = parseInt(text);
  5348. if (isNaN(result)) {
  5349. throw new Error('Invalid integer literal when parsing ' + text);
  5350. }
  5351. return result;
  5352. }
  5353. /**
  5354. * @fileoverview added by tsickle
  5355. * @suppress {checkTypes} checked by tsc
  5356. */
  5357. /**
  5358. * @license
  5359. * Copyright Google Inc. All Rights Reserved.
  5360. *
  5361. * Use of this source code is governed by an MIT-style license that can be
  5362. * found in the LICENSE file at https://angular.io/license
  5363. */
  5364. /**
  5365. * @param {?} pipe
  5366. * @param {?} locale
  5367. * @param {?} value
  5368. * @param {?} style
  5369. * @param {?=} digits
  5370. * @param {?=} currency
  5371. * @param {?=} currencyAsSymbol
  5372. * @return {?}
  5373. */
  5374. function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
  5375. if (currency === void 0) { currency = null; }
  5376. if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
  5377. if (value == null)
  5378. return null;
  5379. // Convert strings to numbers
  5380. value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
  5381. if (typeof value !== 'number') {
  5382. throw invalidPipeArgumentError(pipe, value);
  5383. }
  5384. var /** @type {?} */ minInt;
  5385. var /** @type {?} */ minFraction;
  5386. var /** @type {?} */ maxFraction;
  5387. if (style !== NumberFormatStyle.Currency) {
  5388. // rely on Intl default for currency
  5389. minInt = 1;
  5390. minFraction = 0;
  5391. maxFraction = 3;
  5392. }
  5393. if (digits) {
  5394. var /** @type {?} */ parts = digits.match(NUMBER_FORMAT_REGEXP);
  5395. if (parts === null) {
  5396. throw new Error(digits + " is not a valid digit info for number pipes");
  5397. }
  5398. if (parts[1] != null) {
  5399. // min integer digits
  5400. minInt = parseIntAutoRadix(parts[1]);
  5401. }
  5402. if (parts[3] != null) {
  5403. // min fraction digits
  5404. minFraction = parseIntAutoRadix(parts[3]);
  5405. }
  5406. if (parts[5] != null) {
  5407. // max fraction digits
  5408. maxFraction = parseIntAutoRadix(parts[5]);
  5409. }
  5410. }
  5411. return NumberFormatter.format(/** @type {?} */ (value), locale, style, {
  5412. minimumIntegerDigits: minInt,
  5413. minimumFractionDigits: minFraction,
  5414. maximumFractionDigits: maxFraction,
  5415. currency: currency,
  5416. currencyAsSymbol: currencyAsSymbol,
  5417. });
  5418. }
  5419. /**
  5420. * \@ngModule CommonModule
  5421. * \@whatItDoes Formats a number according to locale rules.
  5422. * \@howToUse `number_expression | number[:digitInfo]`
  5423. *
  5424. * Formats a number as text. Group sizing and separator and other locale-specific
  5425. * configurations are based on the active locale.
  5426. *
  5427. * where `expression` is a number:
  5428. * - `digitInfo` is a `string` which has a following format: <br>
  5429. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
  5430. * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
  5431. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
  5432. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
  5433. *
  5434. * For more information on the acceptable range for each of these numbers and other
  5435. * details see your native internationalization library.
  5436. *
  5437. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  5438. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  5439. *
  5440. * ### Example
  5441. *
  5442. * {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
  5443. *
  5444. * \@stable
  5445. */
  5446. var DeprecatedDecimalPipe = /** @class */ (function () {
  5447. function DeprecatedDecimalPipe(_locale) {
  5448. this._locale = _locale;
  5449. }
  5450. /**
  5451. * @param {?} value
  5452. * @param {?=} digits
  5453. * @return {?}
  5454. */
  5455. DeprecatedDecimalPipe.prototype.transform = /**
  5456. * @param {?} value
  5457. * @param {?=} digits
  5458. * @return {?}
  5459. */
  5460. function (value, digits) {
  5461. return formatNumber(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
  5462. };
  5463. DeprecatedDecimalPipe.decorators = [
  5464. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'number' },] },
  5465. ];
  5466. /** @nocollapse */
  5467. DeprecatedDecimalPipe.ctorParameters = function () { return [
  5468. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  5469. ]; };
  5470. return DeprecatedDecimalPipe;
  5471. }());
  5472. /**
  5473. * \@ngModule CommonModule
  5474. * \@whatItDoes Formats a number as a percentage according to locale rules.
  5475. * \@howToUse `number_expression | percent[:digitInfo]`
  5476. *
  5477. * \@description
  5478. *
  5479. * Formats a number as percentage.
  5480. *
  5481. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  5482. *
  5483. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  5484. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  5485. *
  5486. * ### Example
  5487. *
  5488. * {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
  5489. *
  5490. * \@stable
  5491. */
  5492. var DeprecatedPercentPipe = /** @class */ (function () {
  5493. function DeprecatedPercentPipe(_locale) {
  5494. this._locale = _locale;
  5495. }
  5496. /**
  5497. * @param {?} value
  5498. * @param {?=} digits
  5499. * @return {?}
  5500. */
  5501. DeprecatedPercentPipe.prototype.transform = /**
  5502. * @param {?} value
  5503. * @param {?=} digits
  5504. * @return {?}
  5505. */
  5506. function (value, digits) {
  5507. return formatNumber(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
  5508. };
  5509. DeprecatedPercentPipe.decorators = [
  5510. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'percent' },] },
  5511. ];
  5512. /** @nocollapse */
  5513. DeprecatedPercentPipe.ctorParameters = function () { return [
  5514. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  5515. ]; };
  5516. return DeprecatedPercentPipe;
  5517. }());
  5518. /**
  5519. * \@ngModule CommonModule
  5520. * \@whatItDoes Formats a number as currency using locale rules.
  5521. * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]`
  5522. * \@description
  5523. *
  5524. * Use `currency` to format a number as currency.
  5525. *
  5526. * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
  5527. * as `USD` for the US dollar and `EUR` for the euro.
  5528. * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
  5529. * - `true`: use symbol (e.g. `$`).
  5530. * - `false`(default): use code (e.g. `USD`).
  5531. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  5532. *
  5533. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  5534. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  5535. *
  5536. * ### Example
  5537. *
  5538. * {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
  5539. *
  5540. * \@stable
  5541. */
  5542. var DeprecatedCurrencyPipe = /** @class */ (function () {
  5543. function DeprecatedCurrencyPipe(_locale) {
  5544. this._locale = _locale;
  5545. }
  5546. /**
  5547. * @param {?} value
  5548. * @param {?=} currencyCode
  5549. * @param {?=} symbolDisplay
  5550. * @param {?=} digits
  5551. * @return {?}
  5552. */
  5553. DeprecatedCurrencyPipe.prototype.transform = /**
  5554. * @param {?} value
  5555. * @param {?=} currencyCode
  5556. * @param {?=} symbolDisplay
  5557. * @param {?=} digits
  5558. * @return {?}
  5559. */
  5560. function (value, currencyCode, symbolDisplay, digits) {
  5561. if (currencyCode === void 0) { currencyCode = 'USD'; }
  5562. if (symbolDisplay === void 0) { symbolDisplay = false; }
  5563. return formatNumber(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
  5564. };
  5565. DeprecatedCurrencyPipe.decorators = [
  5566. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'currency' },] },
  5567. ];
  5568. /** @nocollapse */
  5569. DeprecatedCurrencyPipe.ctorParameters = function () { return [
  5570. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  5571. ]; };
  5572. return DeprecatedCurrencyPipe;
  5573. }());
  5574. /**
  5575. * @fileoverview added by tsickle
  5576. * @suppress {checkTypes} checked by tsc
  5577. */
  5578. /**
  5579. * @license
  5580. * Copyright Google Inc. All Rights Reserved.
  5581. *
  5582. * Use of this source code is governed by an MIT-style license that can be
  5583. * found in the LICENSE file at https://angular.io/license
  5584. */
  5585. /**
  5586. * A collection of deprecated i18n pipes that require intl api
  5587. *
  5588. * @deprecated from v5
  5589. */
  5590. var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe];
  5591. /**
  5592. * @fileoverview added by tsickle
  5593. * @suppress {checkTypes} checked by tsc
  5594. */
  5595. /**
  5596. * @license
  5597. * Copyright Google Inc. All Rights Reserved.
  5598. *
  5599. * Use of this source code is governed by an MIT-style license that can be
  5600. * found in the LICENSE file at https://angular.io/license
  5601. */
  5602. var ObservableStrategy = /** @class */ (function () {
  5603. function ObservableStrategy() {
  5604. }
  5605. /**
  5606. * @param {?} async
  5607. * @param {?} updateLatestValue
  5608. * @return {?}
  5609. */
  5610. ObservableStrategy.prototype.createSubscription = /**
  5611. * @param {?} async
  5612. * @param {?} updateLatestValue
  5613. * @return {?}
  5614. */
  5615. function (async, updateLatestValue) {
  5616. return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
  5617. };
  5618. /**
  5619. * @param {?} subscription
  5620. * @return {?}
  5621. */
  5622. ObservableStrategy.prototype.dispose = /**
  5623. * @param {?} subscription
  5624. * @return {?}
  5625. */
  5626. function (subscription) { subscription.unsubscribe(); };
  5627. /**
  5628. * @param {?} subscription
  5629. * @return {?}
  5630. */
  5631. ObservableStrategy.prototype.onDestroy = /**
  5632. * @param {?} subscription
  5633. * @return {?}
  5634. */
  5635. function (subscription) { subscription.unsubscribe(); };
  5636. return ObservableStrategy;
  5637. }());
  5638. var PromiseStrategy = /** @class */ (function () {
  5639. function PromiseStrategy() {
  5640. }
  5641. /**
  5642. * @param {?} async
  5643. * @param {?} updateLatestValue
  5644. * @return {?}
  5645. */
  5646. PromiseStrategy.prototype.createSubscription = /**
  5647. * @param {?} async
  5648. * @param {?} updateLatestValue
  5649. * @return {?}
  5650. */
  5651. function (async, updateLatestValue) {
  5652. return async.then(updateLatestValue, function (e) { throw e; });
  5653. };
  5654. /**
  5655. * @param {?} subscription
  5656. * @return {?}
  5657. */
  5658. PromiseStrategy.prototype.dispose = /**
  5659. * @param {?} subscription
  5660. * @return {?}
  5661. */
  5662. function (subscription) { };
  5663. /**
  5664. * @param {?} subscription
  5665. * @return {?}
  5666. */
  5667. PromiseStrategy.prototype.onDestroy = /**
  5668. * @param {?} subscription
  5669. * @return {?}
  5670. */
  5671. function (subscription) { };
  5672. return PromiseStrategy;
  5673. }());
  5674. var _promiseStrategy = new PromiseStrategy();
  5675. var _observableStrategy = new ObservableStrategy();
  5676. /**
  5677. * \@ngModule CommonModule
  5678. * \@whatItDoes Unwraps a value from an asynchronous primitive.
  5679. * \@howToUse `observable_or_promise_expression | async`
  5680. * \@description
  5681. * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
  5682. * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
  5683. * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
  5684. * potential memory leaks.
  5685. *
  5686. *
  5687. * ## Examples
  5688. *
  5689. * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
  5690. * promise.
  5691. *
  5692. * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
  5693. *
  5694. * It's also possible to use `async` with Observables. The example below binds the `time` Observable
  5695. * to the view. The Observable continuously updates the view with the current time.
  5696. *
  5697. * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
  5698. *
  5699. * \@stable
  5700. */
  5701. var AsyncPipe = /** @class */ (function () {
  5702. function AsyncPipe(_ref) {
  5703. this._ref = _ref;
  5704. this._latestValue = null;
  5705. this._latestReturnedValue = null;
  5706. this._subscription = null;
  5707. this._obj = null;
  5708. this._strategy = /** @type {?} */ ((null));
  5709. }
  5710. /**
  5711. * @return {?}
  5712. */
  5713. AsyncPipe.prototype.ngOnDestroy = /**
  5714. * @return {?}
  5715. */
  5716. function () {
  5717. if (this._subscription) {
  5718. this._dispose();
  5719. }
  5720. };
  5721. /**
  5722. * @param {?} obj
  5723. * @return {?}
  5724. */
  5725. AsyncPipe.prototype.transform = /**
  5726. * @param {?} obj
  5727. * @return {?}
  5728. */
  5729. function (obj) {
  5730. if (!this._obj) {
  5731. if (obj) {
  5732. this._subscribe(obj);
  5733. }
  5734. this._latestReturnedValue = this._latestValue;
  5735. return this._latestValue;
  5736. }
  5737. if (obj !== this._obj) {
  5738. this._dispose();
  5739. return this.transform(/** @type {?} */ (obj));
  5740. }
  5741. if (this._latestValue === this._latestReturnedValue) {
  5742. return this._latestReturnedValue;
  5743. }
  5744. this._latestReturnedValue = this._latestValue;
  5745. return __WEBPACK_IMPORTED_MODULE_0__angular_core__["_4" /* WrappedValue */].wrap(this._latestValue);
  5746. };
  5747. /**
  5748. * @param {?} obj
  5749. * @return {?}
  5750. */
  5751. AsyncPipe.prototype._subscribe = /**
  5752. * @param {?} obj
  5753. * @return {?}
  5754. */
  5755. function (obj) {
  5756. var _this = this;
  5757. this._obj = obj;
  5758. this._strategy = this._selectStrategy(obj);
  5759. this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
  5760. };
  5761. /**
  5762. * @param {?} obj
  5763. * @return {?}
  5764. */
  5765. AsyncPipe.prototype._selectStrategy = /**
  5766. * @param {?} obj
  5767. * @return {?}
  5768. */
  5769. function (obj) {
  5770. if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_27" /* ɵisPromise */])(obj)) {
  5771. return _promiseStrategy;
  5772. }
  5773. if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_26" /* ɵisObservable */])(obj)) {
  5774. return _observableStrategy;
  5775. }
  5776. throw invalidPipeArgumentError(AsyncPipe, obj);
  5777. };
  5778. /**
  5779. * @return {?}
  5780. */
  5781. AsyncPipe.prototype._dispose = /**
  5782. * @return {?}
  5783. */
  5784. function () {
  5785. this._strategy.dispose(/** @type {?} */ ((this._subscription)));
  5786. this._latestValue = null;
  5787. this._latestReturnedValue = null;
  5788. this._subscription = null;
  5789. this._obj = null;
  5790. };
  5791. /**
  5792. * @param {?} async
  5793. * @param {?} value
  5794. * @return {?}
  5795. */
  5796. AsyncPipe.prototype._updateLatestValue = /**
  5797. * @param {?} async
  5798. * @param {?} value
  5799. * @return {?}
  5800. */
  5801. function (async, value) {
  5802. if (async === this._obj) {
  5803. this._latestValue = value;
  5804. this._ref.markForCheck();
  5805. }
  5806. };
  5807. AsyncPipe.decorators = [
  5808. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'async', pure: false },] },
  5809. ];
  5810. /** @nocollapse */
  5811. AsyncPipe.ctorParameters = function () { return [
  5812. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
  5813. ]; };
  5814. return AsyncPipe;
  5815. }());
  5816. /**
  5817. * @fileoverview added by tsickle
  5818. * @suppress {checkTypes} checked by tsc
  5819. */
  5820. /**
  5821. * @license
  5822. * Copyright Google Inc. All Rights Reserved.
  5823. *
  5824. * Use of this source code is governed by an MIT-style license that can be
  5825. * found in the LICENSE file at https://angular.io/license
  5826. */
  5827. /**
  5828. * Transforms text to lowercase.
  5829. *
  5830. * {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' }
  5831. *
  5832. * \@stable
  5833. */
  5834. var LowerCasePipe = /** @class */ (function () {
  5835. function LowerCasePipe() {
  5836. }
  5837. /**
  5838. * @param {?} value
  5839. * @return {?}
  5840. */
  5841. LowerCasePipe.prototype.transform = /**
  5842. * @param {?} value
  5843. * @return {?}
  5844. */
  5845. function (value) {
  5846. if (!value)
  5847. return value;
  5848. if (typeof value !== 'string') {
  5849. throw invalidPipeArgumentError(LowerCasePipe, value);
  5850. }
  5851. return value.toLowerCase();
  5852. };
  5853. LowerCasePipe.decorators = [
  5854. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'lowercase' },] },
  5855. ];
  5856. /** @nocollapse */
  5857. LowerCasePipe.ctorParameters = function () { return []; };
  5858. return LowerCasePipe;
  5859. }());
  5860. /**
  5861. * Helper method to transform a single word to titlecase.
  5862. *
  5863. * \@stable
  5864. * @param {?} word
  5865. * @return {?}
  5866. */
  5867. function titleCaseWord(word) {
  5868. if (!word)
  5869. return word;
  5870. return word[0].toUpperCase() + word.substr(1).toLowerCase();
  5871. }
  5872. /**
  5873. * Transforms text to titlecase.
  5874. *
  5875. * \@stable
  5876. */
  5877. var TitleCasePipe = /** @class */ (function () {
  5878. function TitleCasePipe() {
  5879. }
  5880. /**
  5881. * @param {?} value
  5882. * @return {?}
  5883. */
  5884. TitleCasePipe.prototype.transform = /**
  5885. * @param {?} value
  5886. * @return {?}
  5887. */
  5888. function (value) {
  5889. if (!value)
  5890. return value;
  5891. if (typeof value !== 'string') {
  5892. throw invalidPipeArgumentError(TitleCasePipe, value);
  5893. }
  5894. return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join('');
  5895. };
  5896. TitleCasePipe.decorators = [
  5897. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'titlecase' },] },
  5898. ];
  5899. /** @nocollapse */
  5900. TitleCasePipe.ctorParameters = function () { return []; };
  5901. return TitleCasePipe;
  5902. }());
  5903. /**
  5904. * Transforms text to uppercase.
  5905. *
  5906. * \@stable
  5907. */
  5908. var UpperCasePipe = /** @class */ (function () {
  5909. function UpperCasePipe() {
  5910. }
  5911. /**
  5912. * @param {?} value
  5913. * @return {?}
  5914. */
  5915. UpperCasePipe.prototype.transform = /**
  5916. * @param {?} value
  5917. * @return {?}
  5918. */
  5919. function (value) {
  5920. if (!value)
  5921. return value;
  5922. if (typeof value !== 'string') {
  5923. throw invalidPipeArgumentError(UpperCasePipe, value);
  5924. }
  5925. return value.toUpperCase();
  5926. };
  5927. UpperCasePipe.decorators = [
  5928. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'uppercase' },] },
  5929. ];
  5930. /** @nocollapse */
  5931. UpperCasePipe.ctorParameters = function () { return []; };
  5932. return UpperCasePipe;
  5933. }());
  5934. /**
  5935. * @fileoverview added by tsickle
  5936. * @suppress {checkTypes} checked by tsc
  5937. */
  5938. /**
  5939. * @license
  5940. * Copyright Google Inc. All Rights Reserved.
  5941. *
  5942. * Use of this source code is governed by an MIT-style license that can be
  5943. * found in the LICENSE file at https://angular.io/license
  5944. */
  5945. var _INTERPOLATION_REGEXP = /#/g;
  5946. /**
  5947. * \@ngModule CommonModule
  5948. * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules.
  5949. * \@howToUse `expression | i18nPlural:mapping[:locale]`
  5950. * \@description
  5951. *
  5952. * Where:
  5953. * - `expression` is a number.
  5954. * - `mapping` is an object that mimics the ICU format, see
  5955. * http://userguide.icu-project.org/formatparse/messages
  5956. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  5957. * default)
  5958. *
  5959. * ## Example
  5960. *
  5961. * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
  5962. *
  5963. * \@experimental
  5964. */
  5965. var I18nPluralPipe = /** @class */ (function () {
  5966. function I18nPluralPipe(_localization) {
  5967. this._localization = _localization;
  5968. }
  5969. /**
  5970. * @param {?} value
  5971. * @param {?} pluralMap
  5972. * @param {?=} locale
  5973. * @return {?}
  5974. */
  5975. I18nPluralPipe.prototype.transform = /**
  5976. * @param {?} value
  5977. * @param {?} pluralMap
  5978. * @param {?=} locale
  5979. * @return {?}
  5980. */
  5981. function (value, pluralMap, locale) {
  5982. if (value == null)
  5983. return '';
  5984. if (typeof pluralMap !== 'object' || pluralMap === null) {
  5985. throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);
  5986. }
  5987. var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
  5988. return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
  5989. };
  5990. I18nPluralPipe.decorators = [
  5991. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'i18nPlural', pure: true },] },
  5992. ];
  5993. /** @nocollapse */
  5994. I18nPluralPipe.ctorParameters = function () { return [
  5995. { type: NgLocalization, },
  5996. ]; };
  5997. return I18nPluralPipe;
  5998. }());
  5999. /**
  6000. * @fileoverview added by tsickle
  6001. * @suppress {checkTypes} checked by tsc
  6002. */
  6003. /**
  6004. * @license
  6005. * Copyright Google Inc. All Rights Reserved.
  6006. *
  6007. * Use of this source code is governed by an MIT-style license that can be
  6008. * found in the LICENSE file at https://angular.io/license
  6009. */
  6010. /**
  6011. * \@ngModule CommonModule
  6012. * \@whatItDoes Generic selector that displays the string that matches the current value.
  6013. * \@howToUse `expression | i18nSelect:mapping`
  6014. * \@description
  6015. *
  6016. * Where `mapping` is an object that indicates the text that should be displayed
  6017. * for different values of the provided `expression`.
  6018. * If none of the keys of the mapping match the value of the `expression`, then the content
  6019. * of the `other` key is returned when present, otherwise an empty string is returned.
  6020. *
  6021. * ## Example
  6022. *
  6023. * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
  6024. *
  6025. * \@experimental
  6026. */
  6027. var I18nSelectPipe = /** @class */ (function () {
  6028. function I18nSelectPipe() {
  6029. }
  6030. /**
  6031. * @param {?} value
  6032. * @param {?} mapping
  6033. * @return {?}
  6034. */
  6035. I18nSelectPipe.prototype.transform = /**
  6036. * @param {?} value
  6037. * @param {?} mapping
  6038. * @return {?}
  6039. */
  6040. function (value, mapping) {
  6041. if (value == null)
  6042. return '';
  6043. if (typeof mapping !== 'object' || typeof value !== 'string') {
  6044. throw invalidPipeArgumentError(I18nSelectPipe, mapping);
  6045. }
  6046. if (mapping.hasOwnProperty(value)) {
  6047. return mapping[value];
  6048. }
  6049. if (mapping.hasOwnProperty('other')) {
  6050. return mapping['other'];
  6051. }
  6052. return '';
  6053. };
  6054. I18nSelectPipe.decorators = [
  6055. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'i18nSelect', pure: true },] },
  6056. ];
  6057. /** @nocollapse */
  6058. I18nSelectPipe.ctorParameters = function () { return []; };
  6059. return I18nSelectPipe;
  6060. }());
  6061. /**
  6062. * @fileoverview added by tsickle
  6063. * @suppress {checkTypes} checked by tsc
  6064. */
  6065. /**
  6066. * @license
  6067. * Copyright Google Inc. All Rights Reserved.
  6068. *
  6069. * Use of this source code is governed by an MIT-style license that can be
  6070. * found in the LICENSE file at https://angular.io/license
  6071. */
  6072. /**
  6073. * \@ngModule CommonModule
  6074. * \@whatItDoes Converts value into JSON string.
  6075. * \@howToUse `expression | json`
  6076. * \@description
  6077. *
  6078. * Converts value into string using `JSON.stringify`. Useful for debugging.
  6079. *
  6080. * ### Example
  6081. * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
  6082. *
  6083. * \@stable
  6084. */
  6085. var JsonPipe = /** @class */ (function () {
  6086. function JsonPipe() {
  6087. }
  6088. /**
  6089. * @param {?} value
  6090. * @return {?}
  6091. */
  6092. JsonPipe.prototype.transform = /**
  6093. * @param {?} value
  6094. * @return {?}
  6095. */
  6096. function (value) { return JSON.stringify(value, null, 2); };
  6097. JsonPipe.decorators = [
  6098. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'json', pure: false },] },
  6099. ];
  6100. /** @nocollapse */
  6101. JsonPipe.ctorParameters = function () { return []; };
  6102. return JsonPipe;
  6103. }());
  6104. /**
  6105. * @fileoverview added by tsickle
  6106. * @suppress {checkTypes} checked by tsc
  6107. */
  6108. /**
  6109. * @license
  6110. * Copyright Google Inc. All Rights Reserved.
  6111. *
  6112. * Use of this source code is governed by an MIT-style license that can be
  6113. * found in the LICENSE file at https://angular.io/license
  6114. */
  6115. /**
  6116. * \@ngModule CommonModule
  6117. * \@whatItDoes Formats a number according to locale rules.
  6118. * \@howToUse `number_expression | number[:digitInfo[:locale]]`
  6119. *
  6120. * Formats a number as text. Group sizing and separator and other locale-specific
  6121. * configurations are based on the active locale.
  6122. *
  6123. * where `expression` is a number:
  6124. * - `digitInfo` is a `string` which has a following format: <br>
  6125. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
  6126. * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
  6127. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
  6128. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
  6129. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  6130. * default)
  6131. *
  6132. * For more information on the acceptable range for each of these numbers and other
  6133. * details see your native internationalization library.
  6134. *
  6135. * ### Example
  6136. *
  6137. * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
  6138. *
  6139. * \@stable
  6140. */
  6141. var DecimalPipe = /** @class */ (function () {
  6142. function DecimalPipe(_locale) {
  6143. this._locale = _locale;
  6144. }
  6145. /**
  6146. * @param {?} value
  6147. * @param {?=} digits
  6148. * @param {?=} locale
  6149. * @return {?}
  6150. */
  6151. DecimalPipe.prototype.transform = /**
  6152. * @param {?} value
  6153. * @param {?=} digits
  6154. * @param {?=} locale
  6155. * @return {?}
  6156. */
  6157. function (value, digits, locale) {
  6158. if (isEmpty(value))
  6159. return null;
  6160. locale = locale || this._locale;
  6161. var _a = formatNumber$1(value, locale, NumberFormatStyle.Decimal, digits), str = _a.str, error = _a.error;
  6162. if (error) {
  6163. throw invalidPipeArgumentError(DecimalPipe, error);
  6164. }
  6165. return str;
  6166. };
  6167. DecimalPipe.decorators = [
  6168. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'number' },] },
  6169. ];
  6170. /** @nocollapse */
  6171. DecimalPipe.ctorParameters = function () { return [
  6172. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  6173. ]; };
  6174. return DecimalPipe;
  6175. }());
  6176. /**
  6177. * \@ngModule CommonModule
  6178. * \@whatItDoes Formats a number as a percentage according to locale rules.
  6179. * \@howToUse `number_expression | percent[:digitInfo[:locale]]`
  6180. *
  6181. * \@description
  6182. *
  6183. * Formats a number as percentage.
  6184. *
  6185. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  6186. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  6187. * default)
  6188. *
  6189. * ### Example
  6190. *
  6191. * {\@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
  6192. *
  6193. * \@stable
  6194. */
  6195. var PercentPipe = /** @class */ (function () {
  6196. function PercentPipe(_locale) {
  6197. this._locale = _locale;
  6198. }
  6199. /**
  6200. * @param {?} value
  6201. * @param {?=} digits
  6202. * @param {?=} locale
  6203. * @return {?}
  6204. */
  6205. PercentPipe.prototype.transform = /**
  6206. * @param {?} value
  6207. * @param {?=} digits
  6208. * @param {?=} locale
  6209. * @return {?}
  6210. */
  6211. function (value, digits, locale) {
  6212. if (isEmpty(value))
  6213. return null;
  6214. locale = locale || this._locale;
  6215. var _a = formatNumber$1(value, locale, NumberFormatStyle.Percent, digits), str = _a.str, error = _a.error;
  6216. if (error) {
  6217. throw invalidPipeArgumentError(PercentPipe, error);
  6218. }
  6219. return str;
  6220. };
  6221. PercentPipe.decorators = [
  6222. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'percent' },] },
  6223. ];
  6224. /** @nocollapse */
  6225. PercentPipe.ctorParameters = function () { return [
  6226. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  6227. ]; };
  6228. return PercentPipe;
  6229. }());
  6230. /**
  6231. * \@ngModule CommonModule
  6232. * \@whatItDoes Formats a number as currency using locale rules.
  6233. * \@howToUse `number_expression | currency[:currencyCode[:display[:digitInfo[:locale]]]]`
  6234. * \@description
  6235. *
  6236. * Use `currency` to format a number as currency.
  6237. *
  6238. * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
  6239. * as `USD` for the US dollar and `EUR` for the euro.
  6240. * - `display` indicates whether to show the currency symbol or the code.
  6241. * - `code`: use code (e.g. `USD`).
  6242. * - `symbol`(default): use symbol (e.g. `$`).
  6243. * - `symbol-narrow`: some countries have two symbols for their currency, one regular and one
  6244. * narrow (e.g. the canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`).
  6245. * - boolean (deprecated from v5): `true` for symbol and false for `code`
  6246. * If there is no narrow symbol for the chosen currency, the regular symbol will be used.
  6247. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  6248. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  6249. * default)
  6250. *
  6251. * ### Example
  6252. *
  6253. * {\@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
  6254. *
  6255. * \@stable
  6256. */
  6257. var CurrencyPipe = /** @class */ (function () {
  6258. function CurrencyPipe(_locale) {
  6259. this._locale = _locale;
  6260. }
  6261. /**
  6262. * @param {?} value
  6263. * @param {?=} currencyCode
  6264. * @param {?=} display
  6265. * @param {?=} digits
  6266. * @param {?=} locale
  6267. * @return {?}
  6268. */
  6269. CurrencyPipe.prototype.transform = /**
  6270. * @param {?} value
  6271. * @param {?=} currencyCode
  6272. * @param {?=} display
  6273. * @param {?=} digits
  6274. * @param {?=} locale
  6275. * @return {?}
  6276. */
  6277. function (value, currencyCode, display, digits, locale) {
  6278. if (display === void 0) { display = 'symbol'; }
  6279. if (isEmpty(value))
  6280. return null;
  6281. locale = locale || this._locale;
  6282. if (typeof display === 'boolean') {
  6283. if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
  6284. console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\".");
  6285. }
  6286. display = display ? 'symbol' : 'code';
  6287. }
  6288. var /** @type {?} */ currency = currencyCode || 'USD';
  6289. if (display !== 'code') {
  6290. currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow');
  6291. }
  6292. var _a = formatNumber$1(value, locale, NumberFormatStyle.Currency, digits, currency), str = _a.str, error = _a.error;
  6293. if (error) {
  6294. throw invalidPipeArgumentError(CurrencyPipe, error);
  6295. }
  6296. return str;
  6297. };
  6298. CurrencyPipe.decorators = [
  6299. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'currency' },] },
  6300. ];
  6301. /** @nocollapse */
  6302. CurrencyPipe.ctorParameters = function () { return [
  6303. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
  6304. ]; };
  6305. return CurrencyPipe;
  6306. }());
  6307. /**
  6308. * @param {?} value
  6309. * @return {?}
  6310. */
  6311. function isEmpty(value) {
  6312. return value == null || value === '' || value !== value;
  6313. }
  6314. /**
  6315. * @fileoverview added by tsickle
  6316. * @suppress {checkTypes} checked by tsc
  6317. */
  6318. /**
  6319. * @license
  6320. * Copyright Google Inc. All Rights Reserved.
  6321. *
  6322. * Use of this source code is governed by an MIT-style license that can be
  6323. * found in the LICENSE file at https://angular.io/license
  6324. */
  6325. /**
  6326. * \@ngModule CommonModule
  6327. * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements.
  6328. * \@howToUse `array_or_string_expression | slice:start[:end]`
  6329. * \@description
  6330. *
  6331. * Where the input expression is a `List` or `String`, and:
  6332. * - `start`: The starting index of the subset to return.
  6333. * - **a positive integer**: return the item at `start` index and all items after
  6334. * in the list or string expression.
  6335. * - **a negative integer**: return the item at `start` index from the end and all items after
  6336. * in the list or string expression.
  6337. * - **if positive and greater than the size of the expression**: return an empty list or string.
  6338. * - **if negative and greater than the size of the expression**: return entire list or string.
  6339. * - `end`: The ending index of the subset to return.
  6340. * - **omitted**: return all items until the end.
  6341. * - **if positive**: return all items before `end` index of the list or string.
  6342. * - **if negative**: return all items before `end` index from the end of the list or string.
  6343. *
  6344. * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
  6345. * and `String.prototype.slice()`.
  6346. *
  6347. * When operating on a [List], the returned list is always a copy even when all
  6348. * the elements are being returned.
  6349. *
  6350. * When operating on a blank value, the pipe returns the blank value.
  6351. *
  6352. * ## List Example
  6353. *
  6354. * This `ngFor` example:
  6355. *
  6356. * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
  6357. *
  6358. * produces the following:
  6359. *
  6360. * <li>b</li>
  6361. * <li>c</li>
  6362. *
  6363. * ## String Examples
  6364. *
  6365. * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
  6366. *
  6367. * \@stable
  6368. */
  6369. var SlicePipe = /** @class */ (function () {
  6370. function SlicePipe() {
  6371. }
  6372. /**
  6373. * @param {?} value
  6374. * @param {?} start
  6375. * @param {?=} end
  6376. * @return {?}
  6377. */
  6378. SlicePipe.prototype.transform = /**
  6379. * @param {?} value
  6380. * @param {?} start
  6381. * @param {?=} end
  6382. * @return {?}
  6383. */
  6384. function (value, start, end) {
  6385. if (value == null)
  6386. return value;
  6387. if (!this.supports(value)) {
  6388. throw invalidPipeArgumentError(SlicePipe, value);
  6389. }
  6390. return value.slice(start, end);
  6391. };
  6392. /**
  6393. * @param {?} obj
  6394. * @return {?}
  6395. */
  6396. SlicePipe.prototype.supports = /**
  6397. * @param {?} obj
  6398. * @return {?}
  6399. */
  6400. function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
  6401. SlicePipe.decorators = [
  6402. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'slice', pure: false },] },
  6403. ];
  6404. /** @nocollapse */
  6405. SlicePipe.ctorParameters = function () { return []; };
  6406. return SlicePipe;
  6407. }());
  6408. /**
  6409. * @fileoverview added by tsickle
  6410. * @suppress {checkTypes} checked by tsc
  6411. */
  6412. /**
  6413. * @license
  6414. * Copyright Google Inc. All Rights Reserved.
  6415. *
  6416. * Use of this source code is governed by an MIT-style license that can be
  6417. * found in the LICENSE file at https://angular.io/license
  6418. */
  6419. /**
  6420. * A collection of Angular pipes that are likely to be used in each and every application.
  6421. */
  6422. var COMMON_PIPES = [
  6423. AsyncPipe,
  6424. UpperCasePipe,
  6425. LowerCasePipe,
  6426. JsonPipe,
  6427. SlicePipe,
  6428. DecimalPipe,
  6429. PercentPipe,
  6430. TitleCasePipe,
  6431. CurrencyPipe,
  6432. DatePipe,
  6433. I18nPluralPipe,
  6434. I18nSelectPipe,
  6435. ];
  6436. /**
  6437. * @fileoverview added by tsickle
  6438. * @suppress {checkTypes} checked by tsc
  6439. */
  6440. /**
  6441. * @license
  6442. * Copyright Google Inc. All Rights Reserved.
  6443. *
  6444. * Use of this source code is governed by an MIT-style license that can be
  6445. * found in the LICENSE file at https://angular.io/license
  6446. */
  6447. /**
  6448. * The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ...
  6449. *
  6450. * \@stable
  6451. */
  6452. var CommonModule = /** @class */ (function () {
  6453. function CommonModule() {
  6454. }
  6455. CommonModule.decorators = [
  6456. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["F" /* NgModule */], args: [{
  6457. declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
  6458. exports: [COMMON_DIRECTIVES, COMMON_PIPES],
  6459. providers: [
  6460. { provide: NgLocalization, useClass: NgLocaleLocalization },
  6461. ],
  6462. },] },
  6463. ];
  6464. /** @nocollapse */
  6465. CommonModule.ctorParameters = function () { return []; };
  6466. return CommonModule;
  6467. }());
  6468. var ɵ0 = getPluralCase;
  6469. /**
  6470. * A module that contains the deprecated i18n pipes.
  6471. *
  6472. * @deprecated from v5
  6473. */
  6474. var DeprecatedI18NPipesModule = /** @class */ (function () {
  6475. function DeprecatedI18NPipesModule() {
  6476. }
  6477. DeprecatedI18NPipesModule.decorators = [
  6478. { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["F" /* NgModule */], args: [{
  6479. declarations: [COMMON_DEPRECATED_I18N_PIPES],
  6480. exports: [COMMON_DEPRECATED_I18N_PIPES],
  6481. providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }],
  6482. },] },
  6483. ];
  6484. /** @nocollapse */
  6485. DeprecatedI18NPipesModule.ctorParameters = function () { return []; };
  6486. return DeprecatedI18NPipesModule;
  6487. }());
  6488. /**
  6489. * @fileoverview added by tsickle
  6490. * @suppress {checkTypes} checked by tsc
  6491. */
  6492. /**
  6493. * @license
  6494. * Copyright Google Inc. All Rights Reserved.
  6495. *
  6496. * Use of this source code is governed by an MIT-style license that can be
  6497. * found in the LICENSE file at https://angular.io/license
  6498. */
  6499. /**
  6500. * A DI Token representing the main rendering context. In a browser this is the DOM Document.
  6501. *
  6502. * Note: Document might not be available in the Application Context when Application and Rendering
  6503. * Contexts are not the same (e.g. when running the application into a Web Worker).
  6504. *
  6505. * \@stable
  6506. */
  6507. var DOCUMENT = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('DocumentToken');
  6508. /**
  6509. * @fileoverview added by tsickle
  6510. * @suppress {checkTypes} checked by tsc
  6511. */
  6512. /**
  6513. * @license
  6514. * Copyright Google Inc. All Rights Reserved.
  6515. *
  6516. * Use of this source code is governed by an MIT-style license that can be
  6517. * found in the LICENSE file at https://angular.io/license
  6518. */
  6519. var PLATFORM_BROWSER_ID = 'browser';
  6520. var PLATFORM_SERVER_ID = 'server';
  6521. var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
  6522. var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
  6523. /**
  6524. * Returns whether a platform id represents a browser platform.
  6525. * \@experimental
  6526. * @param {?} platformId
  6527. * @return {?}
  6528. */
  6529. function isPlatformBrowser(platformId) {
  6530. return platformId === PLATFORM_BROWSER_ID;
  6531. }
  6532. /**
  6533. * Returns whether a platform id represents a server platform.
  6534. * \@experimental
  6535. * @param {?} platformId
  6536. * @return {?}
  6537. */
  6538. function isPlatformServer(platformId) {
  6539. return platformId === PLATFORM_SERVER_ID;
  6540. }
  6541. /**
  6542. * Returns whether a platform id represents a web worker app platform.
  6543. * \@experimental
  6544. * @param {?} platformId
  6545. * @return {?}
  6546. */
  6547. function isPlatformWorkerApp(platformId) {
  6548. return platformId === PLATFORM_WORKER_APP_ID;
  6549. }
  6550. /**
  6551. * Returns whether a platform id represents a web worker UI platform.
  6552. * \@experimental
  6553. * @param {?} platformId
  6554. * @return {?}
  6555. */
  6556. function isPlatformWorkerUi(platformId) {
  6557. return platformId === PLATFORM_WORKER_UI_ID;
  6558. }
  6559. /**
  6560. * @fileoverview added by tsickle
  6561. * @suppress {checkTypes} checked by tsc
  6562. */
  6563. /**
  6564. * @license
  6565. * Copyright Google Inc. All Rights Reserved.
  6566. *
  6567. * Use of this source code is governed by an MIT-style license that can be
  6568. * found in the LICENSE file at https://angular.io/license
  6569. */
  6570. /**
  6571. * \@stable
  6572. */
  6573. var VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["_1" /* Version */]('5.2.9');
  6574. /**
  6575. * @fileoverview added by tsickle
  6576. * @suppress {checkTypes} checked by tsc
  6577. */
  6578. /**
  6579. * @license
  6580. * Copyright Google Inc. All Rights Reserved.
  6581. *
  6582. * Use of this source code is governed by an MIT-style license that can be
  6583. * found in the LICENSE file at https://angular.io/license
  6584. */
  6585. /**
  6586. * @module
  6587. * @description
  6588. * Entry point for all public APIs of the common package.
  6589. */
  6590. /**
  6591. * @fileoverview added by tsickle
  6592. * @suppress {checkTypes} checked by tsc
  6593. */
  6594. /**
  6595. * @license
  6596. * Copyright Google Inc. All Rights Reserved.
  6597. *
  6598. * Use of this source code is governed by an MIT-style license that can be
  6599. * found in the LICENSE file at https://angular.io/license
  6600. */
  6601. /**
  6602. * @module
  6603. * @description
  6604. * Entry point for all public APIs of this package.
  6605. */
  6606. // This file only reexports content of the `src` folder. Keep it that way.
  6607. /**
  6608. * @fileoverview added by tsickle
  6609. * @suppress {checkTypes} checked by tsc
  6610. */
  6611. /**
  6612. * Generated bundle index. Do not edit.
  6613. */
  6614. //# sourceMappingURL=common.js.map
  6615. /***/ }),
  6616. /***/ "./node_modules/@angular/compiler/esm5/compiler.js":
  6617. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6618. "use strict";
  6619. /* unused harmony export core */
  6620. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CompilerConfig; });
  6621. /* unused harmony export preserveWhitespacesDefault */
  6622. /* unused harmony export isLoweredSymbol */
  6623. /* unused harmony export createLoweredSymbol */
  6624. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return Identifiers; });
  6625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return JitCompiler; });
  6626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return DirectiveResolver; });
  6627. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return PipeResolver; });
  6628. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return NgModuleResolver; });
  6629. /* unused harmony export DEFAULT_INTERPOLATION_CONFIG */
  6630. /* unused harmony export InterpolationConfig */
  6631. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return NgModuleCompiler; });
  6632. /* unused harmony export AssertNotNull */
  6633. /* unused harmony export BinaryOperator */
  6634. /* unused harmony export BinaryOperatorExpr */
  6635. /* unused harmony export BuiltinMethod */
  6636. /* unused harmony export BuiltinVar */
  6637. /* unused harmony export CastExpr */
  6638. /* unused harmony export ClassStmt */
  6639. /* unused harmony export CommaExpr */
  6640. /* unused harmony export CommentStmt */
  6641. /* unused harmony export ConditionalExpr */
  6642. /* unused harmony export DeclareFunctionStmt */
  6643. /* unused harmony export DeclareVarStmt */
  6644. /* unused harmony export ExpressionStatement */
  6645. /* unused harmony export ExternalExpr */
  6646. /* unused harmony export ExternalReference */
  6647. /* unused harmony export FunctionExpr */
  6648. /* unused harmony export IfStmt */
  6649. /* unused harmony export InstantiateExpr */
  6650. /* unused harmony export InvokeFunctionExpr */
  6651. /* unused harmony export InvokeMethodExpr */
  6652. /* unused harmony export LiteralArrayExpr */
  6653. /* unused harmony export LiteralExpr */
  6654. /* unused harmony export LiteralMapExpr */
  6655. /* unused harmony export NotExpr */
  6656. /* unused harmony export ReadKeyExpr */
  6657. /* unused harmony export ReadPropExpr */
  6658. /* unused harmony export ReadVarExpr */
  6659. /* unused harmony export ReturnStatement */
  6660. /* unused harmony export ThrowStmt */
  6661. /* unused harmony export TryCatchStmt */
  6662. /* unused harmony export WriteKeyExpr */
  6663. /* unused harmony export WritePropExpr */
  6664. /* unused harmony export WriteVarExpr */
  6665. /* unused harmony export StmtModifier */
  6666. /* unused harmony export Statement */
  6667. /* unused harmony export collectExternalReferences */
  6668. /* unused harmony export EmitterVisitorContext */
  6669. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return ViewCompiler; });
  6670. /* unused harmony export getParseErrors */
  6671. /* unused harmony export isSyntaxError */
  6672. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return syntaxError; });
  6673. /* unused harmony export Version */
  6674. /* unused harmony export VERSION */
  6675. /* unused harmony export TextAst */
  6676. /* unused harmony export BoundTextAst */
  6677. /* unused harmony export AttrAst */
  6678. /* unused harmony export BoundElementPropertyAst */
  6679. /* unused harmony export BoundEventAst */
  6680. /* unused harmony export ReferenceAst */
  6681. /* unused harmony export VariableAst */
  6682. /* unused harmony export ElementAst */
  6683. /* unused harmony export EmbeddedTemplateAst */
  6684. /* unused harmony export BoundDirectivePropertyAst */
  6685. /* unused harmony export DirectiveAst */
  6686. /* unused harmony export ProviderAst */
  6687. /* unused harmony export ProviderAstType */
  6688. /* unused harmony export NgContentAst */
  6689. /* unused harmony export PropertyBindingType */
  6690. /* unused harmony export NullTemplateVisitor */
  6691. /* unused harmony export RecursiveTemplateAstVisitor */
  6692. /* unused harmony export templateVisitAll */
  6693. /* unused harmony export identifierName */
  6694. /* unused harmony export identifierModuleUrl */
  6695. /* unused harmony export viewClassName */
  6696. /* unused harmony export rendererTypeName */
  6697. /* unused harmony export hostViewClassName */
  6698. /* unused harmony export componentFactoryName */
  6699. /* unused harmony export CompileSummaryKind */
  6700. /* unused harmony export tokenName */
  6701. /* unused harmony export tokenReference */
  6702. /* unused harmony export CompileStylesheetMetadata */
  6703. /* unused harmony export CompileTemplateMetadata */
  6704. /* unused harmony export CompileDirectiveMetadata */
  6705. /* unused harmony export CompilePipeMetadata */
  6706. /* unused harmony export CompileNgModuleMetadata */
  6707. /* unused harmony export TransitiveCompileNgModuleMetadata */
  6708. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ProviderMeta; });
  6709. /* unused harmony export flatten */
  6710. /* unused harmony export templateSourceUrl */
  6711. /* unused harmony export sharedStylesheetJitUrl */
  6712. /* unused harmony export ngModuleJitUrl */
  6713. /* unused harmony export templateJitUrl */
  6714. /* unused harmony export createAotUrlResolver */
  6715. /* unused harmony export createAotCompiler */
  6716. /* unused harmony export AotCompiler */
  6717. /* unused harmony export analyzeNgModules */
  6718. /* unused harmony export analyzeAndValidateNgModules */
  6719. /* unused harmony export analyzeFile */
  6720. /* unused harmony export mergeAnalyzedFiles */
  6721. /* unused harmony export GeneratedFile */
  6722. /* unused harmony export toTypeScript */
  6723. /* unused harmony export formattedError */
  6724. /* unused harmony export isFormattedError */
  6725. /* unused harmony export StaticReflector */
  6726. /* unused harmony export StaticSymbol */
  6727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return StaticSymbolCache; });
  6728. /* unused harmony export ResolvedStaticSymbol */
  6729. /* unused harmony export StaticSymbolResolver */
  6730. /* unused harmony export unescapeIdentifier */
  6731. /* unused harmony export unwrapResolvedMetadata */
  6732. /* unused harmony export AotSummaryResolver */
  6733. /* unused harmony export AstPath */
  6734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SummaryResolver; });
  6735. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return JitSummaryResolver; });
  6736. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CompileReflector; });
  6737. /* unused harmony export createUrlResolverWithoutPackagePrefix */
  6738. /* unused harmony export createOfflineCompileUrlResolver */
  6739. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return UrlResolver; });
  6740. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return getUrlScheme; });
  6741. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return ResourceLoader; });
  6742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return ElementSchemaRegistry; });
  6743. /* unused harmony export Extractor */
  6744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return I18NHtmlParser; });
  6745. /* unused harmony export MessageBundle */
  6746. /* unused harmony export Serializer */
  6747. /* unused harmony export Xliff */
  6748. /* unused harmony export Xliff2 */
  6749. /* unused harmony export Xmb */
  6750. /* unused harmony export Xtb */
  6751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return DirectiveNormalizer; });
  6752. /* unused harmony export ParserError */
  6753. /* unused harmony export ParseSpan */
  6754. /* unused harmony export AST */
  6755. /* unused harmony export Quote */
  6756. /* unused harmony export EmptyExpr */
  6757. /* unused harmony export ImplicitReceiver */
  6758. /* unused harmony export Chain */
  6759. /* unused harmony export Conditional */
  6760. /* unused harmony export PropertyRead */
  6761. /* unused harmony export PropertyWrite */
  6762. /* unused harmony export SafePropertyRead */
  6763. /* unused harmony export KeyedRead */
  6764. /* unused harmony export KeyedWrite */
  6765. /* unused harmony export BindingPipe */
  6766. /* unused harmony export LiteralPrimitive */
  6767. /* unused harmony export LiteralArray */
  6768. /* unused harmony export LiteralMap */
  6769. /* unused harmony export Interpolation */
  6770. /* unused harmony export Binary */
  6771. /* unused harmony export PrefixNot */
  6772. /* unused harmony export NonNullAssert */
  6773. /* unused harmony export MethodCall */
  6774. /* unused harmony export SafeMethodCall */
  6775. /* unused harmony export FunctionCall */
  6776. /* unused harmony export ASTWithSource */
  6777. /* unused harmony export TemplateBinding */
  6778. /* unused harmony export NullAstVisitor */
  6779. /* unused harmony export RecursiveAstVisitor */
  6780. /* unused harmony export AstTransformer */
  6781. /* unused harmony export visitAstChildren */
  6782. /* unused harmony export TokenType */
  6783. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Lexer; });
  6784. /* unused harmony export Token */
  6785. /* unused harmony export EOF */
  6786. /* unused harmony export isIdentifier */
  6787. /* unused harmony export isQuote */
  6788. /* unused harmony export SplitInterpolation */
  6789. /* unused harmony export TemplateBindingParseResult */
  6790. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return Parser; });
  6791. /* unused harmony export _ParseAST */
  6792. /* unused harmony export ERROR_COMPONENT_TYPE */
  6793. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CompileMetadataResolver; });
  6794. /* unused harmony export Text */
  6795. /* unused harmony export Expansion */
  6796. /* unused harmony export ExpansionCase */
  6797. /* unused harmony export Attribute */
  6798. /* unused harmony export Element */
  6799. /* unused harmony export Comment */
  6800. /* unused harmony export visitAll */
  6801. /* unused harmony export RecursiveVisitor */
  6802. /* unused harmony export findNode */
  6803. /* unused harmony export ParseTreeResult */
  6804. /* unused harmony export TreeError */
  6805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return HtmlParser; });
  6806. /* unused harmony export HtmlTagDefinition */
  6807. /* unused harmony export getHtmlTagDefinition */
  6808. /* unused harmony export TagContentType */
  6809. /* unused harmony export splitNsName */
  6810. /* unused harmony export isNgContainer */
  6811. /* unused harmony export isNgContent */
  6812. /* unused harmony export isNgTemplate */
  6813. /* unused harmony export getNsPrefix */
  6814. /* unused harmony export mergeNsAndName */
  6815. /* unused harmony export NAMED_ENTITIES */
  6816. /* unused harmony export NGSP_UNICODE */
  6817. /* unused harmony export debugOutputAstAsTypeScript */
  6818. /* unused harmony export TypeScriptEmitter */
  6819. /* unused harmony export ParseLocation */
  6820. /* unused harmony export ParseSourceFile */
  6821. /* unused harmony export ParseSourceSpan */
  6822. /* unused harmony export ParseErrorLevel */
  6823. /* unused harmony export ParseError */
  6824. /* unused harmony export typeSourceSpan */
  6825. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return DomElementSchemaRegistry; });
  6826. /* unused harmony export CssSelector */
  6827. /* unused harmony export SelectorMatcher */
  6828. /* unused harmony export SelectorListContext */
  6829. /* unused harmony export SelectorContext */
  6830. /* unused harmony export StylesCompileDependency */
  6831. /* unused harmony export CompiledStylesheet */
  6832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return StyleCompiler; });
  6833. /* unused harmony export TemplateParseError */
  6834. /* unused harmony export TemplateParseResult */
  6835. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return TemplateParser; });
  6836. /* unused harmony export splitClasses */
  6837. /* unused harmony export createElementCssSelector */
  6838. /* unused harmony export removeSummaryDuplicates */
  6839. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
  6840. /**
  6841. * @license Angular v5.2.9
  6842. * (c) 2010-2018 Google, Inc. https://angular.io/
  6843. * License: MIT
  6844. */
  6845. /**
  6846. * @fileoverview added by tsickle
  6847. * @suppress {checkTypes} checked by tsc
  6848. */
  6849. /**
  6850. * @license
  6851. * Copyright Google Inc. All Rights Reserved.
  6852. *
  6853. * Use of this source code is governed by an MIT-style license that can be
  6854. * found in the LICENSE file at https://angular.io/license
  6855. */
  6856. // Attention:
  6857. // This file duplicates types and values from @angular/core
  6858. // so that we are able to make @angular/compiler independent of @angular/core.
  6859. // This is important to prevent a build cycle, as @angular/core needs to
  6860. // be compiled with the compiler.
  6861. /**
  6862. * @record
  6863. */
  6864. function Inject() { }
  6865. var createInject = makeMetadataFactory('Inject', function (token) { return ({ token: token }); });
  6866. var createInjectionToken = makeMetadataFactory('InjectionToken', function (desc) { return ({ _desc: desc }); });
  6867. /**
  6868. * @record
  6869. */
  6870. function Attribute() { }
  6871. var createAttribute = makeMetadataFactory('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
  6872. /**
  6873. * @record
  6874. */
  6875. function Query() { }
  6876. var createContentChildren = makeMetadataFactory('ContentChildren', function (selector, data) {
  6877. if (data === void 0) { data = {}; }
  6878. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
  6879. });
  6880. var createContentChild = makeMetadataFactory('ContentChild', function (selector, data) {
  6881. if (data === void 0) { data = {}; }
  6882. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
  6883. });
  6884. var createViewChildren = makeMetadataFactory('ViewChildren', function (selector, data) {
  6885. if (data === void 0) { data = {}; }
  6886. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
  6887. });
  6888. var createViewChild = makeMetadataFactory('ViewChild', function (selector, data) {
  6889. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
  6890. });
  6891. /**
  6892. * @record
  6893. */
  6894. function Directive() { }
  6895. var createDirective = makeMetadataFactory('Directive', function (dir) {
  6896. if (dir === void 0) { dir = {}; }
  6897. return dir;
  6898. });
  6899. /**
  6900. * @record
  6901. */
  6902. function Component() { }
  6903. /** @enum {number} */
  6904. var ViewEncapsulation = {
  6905. Emulated: 0,
  6906. Native: 1,
  6907. None: 2,
  6908. };
  6909. ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
  6910. ViewEncapsulation[ViewEncapsulation.Native] = "Native";
  6911. ViewEncapsulation[ViewEncapsulation.None] = "None";
  6912. /** @enum {number} */
  6913. var ChangeDetectionStrategy = {
  6914. OnPush: 0,
  6915. Default: 1,
  6916. };
  6917. ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
  6918. ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
  6919. var createComponent = makeMetadataFactory('Component', function (c) {
  6920. if (c === void 0) { c = {}; }
  6921. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ changeDetection: ChangeDetectionStrategy.Default }, c));
  6922. });
  6923. /**
  6924. * @record
  6925. */
  6926. function Pipe() { }
  6927. var createPipe = makeMetadataFactory('Pipe', function (p) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ pure: true }, p)); });
  6928. /**
  6929. * @record
  6930. */
  6931. function Input() { }
  6932. var createInput = makeMetadataFactory('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  6933. /**
  6934. * @record
  6935. */
  6936. function Output() { }
  6937. var createOutput = makeMetadataFactory('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  6938. /**
  6939. * @record
  6940. */
  6941. function HostBinding() { }
  6942. var createHostBinding = makeMetadataFactory('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
  6943. /**
  6944. * @record
  6945. */
  6946. function HostListener() { }
  6947. var createHostListener = makeMetadataFactory('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
  6948. /**
  6949. * @record
  6950. */
  6951. function NgModule() { }
  6952. var createNgModule = makeMetadataFactory('NgModule', function (ngModule) { return ngModule; });
  6953. /**
  6954. * @record
  6955. */
  6956. function ModuleWithProviders() { }
  6957. /**
  6958. * @record
  6959. */
  6960. function SchemaMetadata() { }
  6961. var CUSTOM_ELEMENTS_SCHEMA = {
  6962. name: 'custom-elements'
  6963. };
  6964. var NO_ERRORS_SCHEMA = {
  6965. name: 'no-errors-schema'
  6966. };
  6967. var createOptional = makeMetadataFactory('Optional');
  6968. var createInjectable = makeMetadataFactory('Injectable');
  6969. var createSelf = makeMetadataFactory('Self');
  6970. var createSkipSelf = makeMetadataFactory('SkipSelf');
  6971. var createHost = makeMetadataFactory('Host');
  6972. var Type = Function;
  6973. /** @enum {number} */
  6974. var SecurityContext = {
  6975. NONE: 0,
  6976. HTML: 1,
  6977. STYLE: 2,
  6978. SCRIPT: 3,
  6979. URL: 4,
  6980. RESOURCE_URL: 5,
  6981. };
  6982. SecurityContext[SecurityContext.NONE] = "NONE";
  6983. SecurityContext[SecurityContext.HTML] = "HTML";
  6984. SecurityContext[SecurityContext.STYLE] = "STYLE";
  6985. SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
  6986. SecurityContext[SecurityContext.URL] = "URL";
  6987. SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
  6988. /** @enum {number} */
  6989. var NodeFlags = {
  6990. None: 0,
  6991. TypeElement: 1,
  6992. TypeText: 2,
  6993. ProjectedTemplate: 4,
  6994. CatRenderNode: 3,
  6995. TypeNgContent: 8,
  6996. TypePipe: 16,
  6997. TypePureArray: 32,
  6998. TypePureObject: 64,
  6999. TypePurePipe: 128,
  7000. CatPureExpression: 224,
  7001. TypeValueProvider: 256,
  7002. TypeClassProvider: 512,
  7003. TypeFactoryProvider: 1024,
  7004. TypeUseExistingProvider: 2048,
  7005. LazyProvider: 4096,
  7006. PrivateProvider: 8192,
  7007. TypeDirective: 16384,
  7008. Component: 32768,
  7009. CatProviderNoDirective: 3840,
  7010. CatProvider: 20224,
  7011. OnInit: 65536,
  7012. OnDestroy: 131072,
  7013. DoCheck: 262144,
  7014. OnChanges: 524288,
  7015. AfterContentInit: 1048576,
  7016. AfterContentChecked: 2097152,
  7017. AfterViewInit: 4194304,
  7018. AfterViewChecked: 8388608,
  7019. EmbeddedViews: 16777216,
  7020. ComponentView: 33554432,
  7021. TypeContentQuery: 67108864,
  7022. TypeViewQuery: 134217728,
  7023. StaticQuery: 268435456,
  7024. DynamicQuery: 536870912,
  7025. CatQuery: 201326592,
  7026. // mutually exclusive values...
  7027. Types: 201347067,
  7028. };
  7029. /** @enum {number} */
  7030. var DepFlags = {
  7031. None: 0,
  7032. SkipSelf: 1,
  7033. Optional: 2,
  7034. Value: 8,
  7035. };
  7036. /** @enum {number} */
  7037. var ArgumentType = { Inline: 0, Dynamic: 1, };
  7038. /** @enum {number} */
  7039. var BindingFlags = {
  7040. TypeElementAttribute: 1,
  7041. TypeElementClass: 2,
  7042. TypeElementStyle: 4,
  7043. TypeProperty: 8,
  7044. SyntheticProperty: 16,
  7045. SyntheticHostProperty: 32,
  7046. CatSyntheticProperty: 48,
  7047. // mutually exclusive values...
  7048. Types: 15,
  7049. };
  7050. /** @enum {number} */
  7051. var QueryBindingType = { First: 0, All: 1, };
  7052. /** @enum {number} */
  7053. var QueryValueType = {
  7054. ElementRef: 0,
  7055. RenderElement: 1,
  7056. TemplateRef: 2,
  7057. ViewContainerRef: 3,
  7058. Provider: 4,
  7059. };
  7060. /** @enum {number} */
  7061. var ViewFlags = {
  7062. None: 0,
  7063. OnPush: 2,
  7064. };
  7065. /** @enum {number} */
  7066. var MissingTranslationStrategy = {
  7067. Error: 0,
  7068. Warning: 1,
  7069. Ignore: 2,
  7070. };
  7071. MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
  7072. MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
  7073. MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
  7074. /**
  7075. * @record
  7076. */
  7077. function MetadataFactory() { }
  7078. /**
  7079. * @template T
  7080. * @param {?} name
  7081. * @param {?=} props
  7082. * @return {?}
  7083. */
  7084. function makeMetadataFactory(name, props) {
  7085. var /** @type {?} */ factory = function () {
  7086. var args = [];
  7087. for (var _i = 0; _i < arguments.length; _i++) {
  7088. args[_i] = arguments[_i];
  7089. }
  7090. var /** @type {?} */ values = props ? props.apply(void 0, args) : {};
  7091. return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ ngMetadataName: name }, values);
  7092. };
  7093. factory.isTypeOf = function (obj) { return obj && obj.ngMetadataName === name; };
  7094. factory.ngMetadataName = name;
  7095. return factory;
  7096. }
  7097. /**
  7098. * @record
  7099. */
  7100. function Route() { }
  7101. var core = Object.freeze({
  7102. Inject: Inject,
  7103. createInject: createInject,
  7104. createInjectionToken: createInjectionToken,
  7105. Attribute: Attribute,
  7106. createAttribute: createAttribute,
  7107. Query: Query,
  7108. createContentChildren: createContentChildren,
  7109. createContentChild: createContentChild,
  7110. createViewChildren: createViewChildren,
  7111. createViewChild: createViewChild,
  7112. Directive: Directive,
  7113. createDirective: createDirective,
  7114. Component: Component,
  7115. ViewEncapsulation: ViewEncapsulation,
  7116. ChangeDetectionStrategy: ChangeDetectionStrategy,
  7117. createComponent: createComponent,
  7118. Pipe: Pipe,
  7119. createPipe: createPipe,
  7120. Input: Input,
  7121. createInput: createInput,
  7122. Output: Output,
  7123. createOutput: createOutput,
  7124. HostBinding: HostBinding,
  7125. createHostBinding: createHostBinding,
  7126. HostListener: HostListener,
  7127. createHostListener: createHostListener,
  7128. NgModule: NgModule,
  7129. createNgModule: createNgModule,
  7130. ModuleWithProviders: ModuleWithProviders,
  7131. SchemaMetadata: SchemaMetadata,
  7132. CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
  7133. NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
  7134. createOptional: createOptional,
  7135. createInjectable: createInjectable,
  7136. createSelf: createSelf,
  7137. createSkipSelf: createSkipSelf,
  7138. createHost: createHost,
  7139. Type: Type,
  7140. SecurityContext: SecurityContext,
  7141. NodeFlags: NodeFlags,
  7142. DepFlags: DepFlags,
  7143. ArgumentType: ArgumentType,
  7144. BindingFlags: BindingFlags,
  7145. QueryBindingType: QueryBindingType,
  7146. QueryValueType: QueryValueType,
  7147. ViewFlags: ViewFlags,
  7148. MissingTranslationStrategy: MissingTranslationStrategy,
  7149. MetadataFactory: MetadataFactory,
  7150. Route: Route
  7151. });
  7152. /**
  7153. * @fileoverview added by tsickle
  7154. * @suppress {checkTypes} checked by tsc
  7155. */
  7156. /**
  7157. * @license
  7158. * Copyright Google Inc. All Rights Reserved.
  7159. *
  7160. * Use of this source code is governed by an MIT-style license that can be
  7161. * found in the LICENSE file at https://angular.io/license
  7162. */
  7163. var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
  7164. /**
  7165. * @param {?} input
  7166. * @return {?}
  7167. */
  7168. function dashCaseToCamelCase(input) {
  7169. return input.replace(DASH_CASE_REGEXP, function () {
  7170. var m = [];
  7171. for (var _i = 0; _i < arguments.length; _i++) {
  7172. m[_i] = arguments[_i];
  7173. }
  7174. return m[1].toUpperCase();
  7175. });
  7176. }
  7177. /**
  7178. * @param {?} input
  7179. * @param {?} defaultValues
  7180. * @return {?}
  7181. */
  7182. function splitAtColon(input, defaultValues) {
  7183. return _splitAt(input, ':', defaultValues);
  7184. }
  7185. /**
  7186. * @param {?} input
  7187. * @param {?} defaultValues
  7188. * @return {?}
  7189. */
  7190. function splitAtPeriod(input, defaultValues) {
  7191. return _splitAt(input, '.', defaultValues);
  7192. }
  7193. /**
  7194. * @param {?} input
  7195. * @param {?} character
  7196. * @param {?} defaultValues
  7197. * @return {?}
  7198. */
  7199. function _splitAt(input, character, defaultValues) {
  7200. var /** @type {?} */ characterIndex = input.indexOf(character);
  7201. if (characterIndex == -1)
  7202. return defaultValues;
  7203. return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
  7204. }
  7205. /**
  7206. * @param {?} value
  7207. * @param {?} visitor
  7208. * @param {?} context
  7209. * @return {?}
  7210. */
  7211. function visitValue(value, visitor, context) {
  7212. if (Array.isArray(value)) {
  7213. return visitor.visitArray(/** @type {?} */ (value), context);
  7214. }
  7215. if (isStrictStringMap(value)) {
  7216. return visitor.visitStringMap(/** @type {?} */ (value), context);
  7217. }
  7218. if (value == null || typeof value == 'string' || typeof value == 'number' ||
  7219. typeof value == 'boolean') {
  7220. return visitor.visitPrimitive(value, context);
  7221. }
  7222. return visitor.visitOther(value, context);
  7223. }
  7224. /**
  7225. * @param {?} val
  7226. * @return {?}
  7227. */
  7228. function isDefined(val) {
  7229. return val !== null && val !== undefined;
  7230. }
  7231. /**
  7232. * @template T
  7233. * @param {?} val
  7234. * @return {?}
  7235. */
  7236. function noUndefined(val) {
  7237. return val === undefined ? /** @type {?} */ ((null)) : val;
  7238. }
  7239. /**
  7240. * @record
  7241. */
  7242. var ValueTransformer = /** @class */ (function () {
  7243. function ValueTransformer() {
  7244. }
  7245. /**
  7246. * @param {?} arr
  7247. * @param {?} context
  7248. * @return {?}
  7249. */
  7250. ValueTransformer.prototype.visitArray = /**
  7251. * @param {?} arr
  7252. * @param {?} context
  7253. * @return {?}
  7254. */
  7255. function (arr, context) {
  7256. var _this = this;
  7257. return arr.map(function (value) { return visitValue(value, _this, context); });
  7258. };
  7259. /**
  7260. * @param {?} map
  7261. * @param {?} context
  7262. * @return {?}
  7263. */
  7264. ValueTransformer.prototype.visitStringMap = /**
  7265. * @param {?} map
  7266. * @param {?} context
  7267. * @return {?}
  7268. */
  7269. function (map, context) {
  7270. var _this = this;
  7271. var /** @type {?} */ result = {};
  7272. Object.keys(map).forEach(function (key) { result[key] = visitValue(map[key], _this, context); });
  7273. return result;
  7274. };
  7275. /**
  7276. * @param {?} value
  7277. * @param {?} context
  7278. * @return {?}
  7279. */
  7280. ValueTransformer.prototype.visitPrimitive = /**
  7281. * @param {?} value
  7282. * @param {?} context
  7283. * @return {?}
  7284. */
  7285. function (value, context) { return value; };
  7286. /**
  7287. * @param {?} value
  7288. * @param {?} context
  7289. * @return {?}
  7290. */
  7291. ValueTransformer.prototype.visitOther = /**
  7292. * @param {?} value
  7293. * @param {?} context
  7294. * @return {?}
  7295. */
  7296. function (value, context) { return value; };
  7297. return ValueTransformer;
  7298. }());
  7299. var SyncAsync = {
  7300. assertSync: function (value) {
  7301. if (isPromise(value)) {
  7302. throw new Error("Illegal state: value cannot be a promise");
  7303. }
  7304. return value;
  7305. },
  7306. then: function (value, cb) { return isPromise(value) ? value.then(cb) : cb(value); },
  7307. all: function (syncAsyncValues) {
  7308. return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : /** @type {?} */ (syncAsyncValues);
  7309. }
  7310. };
  7311. /**
  7312. * @param {?} msg
  7313. * @param {?=} parseErrors
  7314. * @return {?}
  7315. */
  7316. function syntaxError(msg, parseErrors) {
  7317. var /** @type {?} */ error = Error(msg);
  7318. (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR] = true;
  7319. if (parseErrors)
  7320. (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] = parseErrors;
  7321. return error;
  7322. }
  7323. var ERROR_SYNTAX_ERROR = 'ngSyntaxError';
  7324. var ERROR_PARSE_ERRORS = 'ngParseErrors';
  7325. /**
  7326. * @param {?} error
  7327. * @return {?}
  7328. */
  7329. function isSyntaxError(error) {
  7330. return (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR];
  7331. }
  7332. /**
  7333. * @param {?} error
  7334. * @return {?}
  7335. */
  7336. function getParseErrors(error) {
  7337. return (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] || [];
  7338. }
  7339. /**
  7340. * @param {?} s
  7341. * @return {?}
  7342. */
  7343. function escapeRegExp(s) {
  7344. return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
  7345. }
  7346. var STRING_MAP_PROTO = Object.getPrototypeOf({});
  7347. /**
  7348. * @param {?} obj
  7349. * @return {?}
  7350. */
  7351. function isStrictStringMap(obj) {
  7352. return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
  7353. }
  7354. /**
  7355. * @param {?} str
  7356. * @return {?}
  7357. */
  7358. function utf8Encode(str) {
  7359. var /** @type {?} */ encoded = '';
  7360. for (var /** @type {?} */ index = 0; index < str.length; index++) {
  7361. var /** @type {?} */ codePoint = str.charCodeAt(index);
  7362. // decode surrogate
  7363. // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  7364. if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
  7365. var /** @type {?} */ low = str.charCodeAt(index + 1);
  7366. if (low >= 0xdc00 && low <= 0xdfff) {
  7367. index++;
  7368. codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
  7369. }
  7370. }
  7371. if (codePoint <= 0x7f) {
  7372. encoded += String.fromCharCode(codePoint);
  7373. }
  7374. else if (codePoint <= 0x7ff) {
  7375. encoded += String.fromCharCode(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
  7376. }
  7377. else if (codePoint <= 0xffff) {
  7378. encoded += String.fromCharCode((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
  7379. }
  7380. else if (codePoint <= 0x1fffff) {
  7381. encoded += String.fromCharCode(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
  7382. }
  7383. }
  7384. return encoded;
  7385. }
  7386. /**
  7387. * @record
  7388. */
  7389. /**
  7390. * @param {?} token
  7391. * @return {?}
  7392. */
  7393. function stringify(token) {
  7394. if (typeof token === 'string') {
  7395. return token;
  7396. }
  7397. if (token instanceof Array) {
  7398. return '[' + token.map(stringify).join(', ') + ']';
  7399. }
  7400. if (token == null) {
  7401. return '' + token;
  7402. }
  7403. if (token.overriddenName) {
  7404. return "" + token.overriddenName;
  7405. }
  7406. if (token.name) {
  7407. return "" + token.name;
  7408. }
  7409. var /** @type {?} */ res = token.toString();
  7410. if (res == null) {
  7411. return '' + res;
  7412. }
  7413. var /** @type {?} */ newLineIndex = res.indexOf('\n');
  7414. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  7415. }
  7416. /**
  7417. * Lazily retrieves the reference value from a forwardRef.
  7418. * @param {?} type
  7419. * @return {?}
  7420. */
  7421. function resolveForwardRef(type) {
  7422. if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
  7423. return type();
  7424. }
  7425. else {
  7426. return type;
  7427. }
  7428. }
  7429. /**
  7430. * Determine if the argument is shaped like a Promise
  7431. * @param {?} obj
  7432. * @return {?}
  7433. */
  7434. function isPromise(obj) {
  7435. // allow any Promise/A+ compliant thenable.
  7436. // It's up to the caller to ensure that obj.then conforms to the spec
  7437. return !!obj && typeof obj.then === 'function';
  7438. }
  7439. var Version = /** @class */ (function () {
  7440. function Version(full) {
  7441. this.full = full;
  7442. var /** @type {?} */ splits = full.split('.');
  7443. this.major = splits[0];
  7444. this.minor = splits[1];
  7445. this.patch = splits.slice(2).join('.');
  7446. }
  7447. return Version;
  7448. }());
  7449. /**
  7450. * @record
  7451. */
  7452. /**
  7453. * @fileoverview added by tsickle
  7454. * @suppress {checkTypes} checked by tsc
  7455. */
  7456. /**
  7457. * @license
  7458. * Copyright Google Inc. All Rights Reserved.
  7459. *
  7460. * Use of this source code is governed by an MIT-style license that can be
  7461. * found in the LICENSE file at https://angular.io/license
  7462. */
  7463. /**
  7464. * \@stable
  7465. */
  7466. var VERSION = new Version('5.2.9');
  7467. /**
  7468. * @fileoverview added by tsickle
  7469. * @suppress {checkTypes} checked by tsc
  7470. */
  7471. /**
  7472. * @license
  7473. * Copyright Google Inc. All Rights Reserved.
  7474. *
  7475. * Use of this source code is governed by an MIT-style license that can be
  7476. * found in the LICENSE file at https://angular.io/license
  7477. */
  7478. /**
  7479. * An Abstract Syntax Tree node representing part of a parsed Angular template.
  7480. * @record
  7481. */
  7482. /**
  7483. * A segment of text within the template.
  7484. */
  7485. var TextAst = /** @class */ (function () {
  7486. function TextAst(value, ngContentIndex, sourceSpan) {
  7487. this.value = value;
  7488. this.ngContentIndex = ngContentIndex;
  7489. this.sourceSpan = sourceSpan;
  7490. }
  7491. /**
  7492. * @param {?} visitor
  7493. * @param {?} context
  7494. * @return {?}
  7495. */
  7496. TextAst.prototype.visit = /**
  7497. * @param {?} visitor
  7498. * @param {?} context
  7499. * @return {?}
  7500. */
  7501. function (visitor, context) { return visitor.visitText(this, context); };
  7502. return TextAst;
  7503. }());
  7504. /**
  7505. * A bound expression within the text of a template.
  7506. */
  7507. var BoundTextAst = /** @class */ (function () {
  7508. function BoundTextAst(value, ngContentIndex, sourceSpan) {
  7509. this.value = value;
  7510. this.ngContentIndex = ngContentIndex;
  7511. this.sourceSpan = sourceSpan;
  7512. }
  7513. /**
  7514. * @param {?} visitor
  7515. * @param {?} context
  7516. * @return {?}
  7517. */
  7518. BoundTextAst.prototype.visit = /**
  7519. * @param {?} visitor
  7520. * @param {?} context
  7521. * @return {?}
  7522. */
  7523. function (visitor, context) {
  7524. return visitor.visitBoundText(this, context);
  7525. };
  7526. return BoundTextAst;
  7527. }());
  7528. /**
  7529. * A plain attribute on an element.
  7530. */
  7531. var AttrAst = /** @class */ (function () {
  7532. function AttrAst(name, value, sourceSpan) {
  7533. this.name = name;
  7534. this.value = value;
  7535. this.sourceSpan = sourceSpan;
  7536. }
  7537. /**
  7538. * @param {?} visitor
  7539. * @param {?} context
  7540. * @return {?}
  7541. */
  7542. AttrAst.prototype.visit = /**
  7543. * @param {?} visitor
  7544. * @param {?} context
  7545. * @return {?}
  7546. */
  7547. function (visitor, context) { return visitor.visitAttr(this, context); };
  7548. return AttrAst;
  7549. }());
  7550. /**
  7551. * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g.
  7552. * `[\@trigger]="stateExp"`)
  7553. */
  7554. var BoundElementPropertyAst = /** @class */ (function () {
  7555. function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) {
  7556. this.name = name;
  7557. this.type = type;
  7558. this.securityContext = securityContext;
  7559. this.value = value;
  7560. this.unit = unit;
  7561. this.sourceSpan = sourceSpan;
  7562. this.isAnimation = this.type === PropertyBindingType.Animation;
  7563. }
  7564. /**
  7565. * @param {?} visitor
  7566. * @param {?} context
  7567. * @return {?}
  7568. */
  7569. BoundElementPropertyAst.prototype.visit = /**
  7570. * @param {?} visitor
  7571. * @param {?} context
  7572. * @return {?}
  7573. */
  7574. function (visitor, context) {
  7575. return visitor.visitElementProperty(this, context);
  7576. };
  7577. return BoundElementPropertyAst;
  7578. }());
  7579. /**
  7580. * A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g.
  7581. * `(\@trigger.phase)="callback($event)"`).
  7582. */
  7583. var BoundEventAst = /** @class */ (function () {
  7584. function BoundEventAst(name, target, phase, handler, sourceSpan) {
  7585. this.name = name;
  7586. this.target = target;
  7587. this.phase = phase;
  7588. this.handler = handler;
  7589. this.sourceSpan = sourceSpan;
  7590. this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase);
  7591. this.isAnimation = !!this.phase;
  7592. }
  7593. /**
  7594. * @param {?} name
  7595. * @param {?} target
  7596. * @param {?} phase
  7597. * @return {?}
  7598. */
  7599. BoundEventAst.calcFullName = /**
  7600. * @param {?} name
  7601. * @param {?} target
  7602. * @param {?} phase
  7603. * @return {?}
  7604. */
  7605. function (name, target, phase) {
  7606. if (target) {
  7607. return target + ":" + name;
  7608. }
  7609. else if (phase) {
  7610. return "@" + name + "." + phase;
  7611. }
  7612. else {
  7613. return name;
  7614. }
  7615. };
  7616. /**
  7617. * @param {?} visitor
  7618. * @param {?} context
  7619. * @return {?}
  7620. */
  7621. BoundEventAst.prototype.visit = /**
  7622. * @param {?} visitor
  7623. * @param {?} context
  7624. * @return {?}
  7625. */
  7626. function (visitor, context) {
  7627. return visitor.visitEvent(this, context);
  7628. };
  7629. return BoundEventAst;
  7630. }());
  7631. /**
  7632. * A reference declaration on an element (e.g. `let someName="expression"`).
  7633. */
  7634. var ReferenceAst = /** @class */ (function () {
  7635. function ReferenceAst(name, value, sourceSpan) {
  7636. this.name = name;
  7637. this.value = value;
  7638. this.sourceSpan = sourceSpan;
  7639. }
  7640. /**
  7641. * @param {?} visitor
  7642. * @param {?} context
  7643. * @return {?}
  7644. */
  7645. ReferenceAst.prototype.visit = /**
  7646. * @param {?} visitor
  7647. * @param {?} context
  7648. * @return {?}
  7649. */
  7650. function (visitor, context) {
  7651. return visitor.visitReference(this, context);
  7652. };
  7653. return ReferenceAst;
  7654. }());
  7655. /**
  7656. * A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`).
  7657. */
  7658. var VariableAst = /** @class */ (function () {
  7659. function VariableAst(name, value, sourceSpan) {
  7660. this.name = name;
  7661. this.value = value;
  7662. this.sourceSpan = sourceSpan;
  7663. }
  7664. /**
  7665. * @param {?} visitor
  7666. * @param {?} context
  7667. * @return {?}
  7668. */
  7669. VariableAst.prototype.visit = /**
  7670. * @param {?} visitor
  7671. * @param {?} context
  7672. * @return {?}
  7673. */
  7674. function (visitor, context) {
  7675. return visitor.visitVariable(this, context);
  7676. };
  7677. return VariableAst;
  7678. }());
  7679. /**
  7680. * An element declaration in a template.
  7681. */
  7682. var ElementAst = /** @class */ (function () {
  7683. function ElementAst(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) {
  7684. this.name = name;
  7685. this.attrs = attrs;
  7686. this.inputs = inputs;
  7687. this.outputs = outputs;
  7688. this.references = references;
  7689. this.directives = directives;
  7690. this.providers = providers;
  7691. this.hasViewContainer = hasViewContainer;
  7692. this.queryMatches = queryMatches;
  7693. this.children = children;
  7694. this.ngContentIndex = ngContentIndex;
  7695. this.sourceSpan = sourceSpan;
  7696. this.endSourceSpan = endSourceSpan;
  7697. }
  7698. /**
  7699. * @param {?} visitor
  7700. * @param {?} context
  7701. * @return {?}
  7702. */
  7703. ElementAst.prototype.visit = /**
  7704. * @param {?} visitor
  7705. * @param {?} context
  7706. * @return {?}
  7707. */
  7708. function (visitor, context) {
  7709. return visitor.visitElement(this, context);
  7710. };
  7711. return ElementAst;
  7712. }());
  7713. /**
  7714. * A `<ng-template>` element included in an Angular template.
  7715. */
  7716. var EmbeddedTemplateAst = /** @class */ (function () {
  7717. function EmbeddedTemplateAst(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) {
  7718. this.attrs = attrs;
  7719. this.outputs = outputs;
  7720. this.references = references;
  7721. this.variables = variables;
  7722. this.directives = directives;
  7723. this.providers = providers;
  7724. this.hasViewContainer = hasViewContainer;
  7725. this.queryMatches = queryMatches;
  7726. this.children = children;
  7727. this.ngContentIndex = ngContentIndex;
  7728. this.sourceSpan = sourceSpan;
  7729. }
  7730. /**
  7731. * @param {?} visitor
  7732. * @param {?} context
  7733. * @return {?}
  7734. */
  7735. EmbeddedTemplateAst.prototype.visit = /**
  7736. * @param {?} visitor
  7737. * @param {?} context
  7738. * @return {?}
  7739. */
  7740. function (visitor, context) {
  7741. return visitor.visitEmbeddedTemplate(this, context);
  7742. };
  7743. return EmbeddedTemplateAst;
  7744. }());
  7745. /**
  7746. * A directive property with a bound value (e.g. `*ngIf="condition").
  7747. */
  7748. var BoundDirectivePropertyAst = /** @class */ (function () {
  7749. function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) {
  7750. this.directiveName = directiveName;
  7751. this.templateName = templateName;
  7752. this.value = value;
  7753. this.sourceSpan = sourceSpan;
  7754. }
  7755. /**
  7756. * @param {?} visitor
  7757. * @param {?} context
  7758. * @return {?}
  7759. */
  7760. BoundDirectivePropertyAst.prototype.visit = /**
  7761. * @param {?} visitor
  7762. * @param {?} context
  7763. * @return {?}
  7764. */
  7765. function (visitor, context) {
  7766. return visitor.visitDirectiveProperty(this, context);
  7767. };
  7768. return BoundDirectivePropertyAst;
  7769. }());
  7770. /**
  7771. * A directive declared on an element.
  7772. */
  7773. var DirectiveAst = /** @class */ (function () {
  7774. function DirectiveAst(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) {
  7775. this.directive = directive;
  7776. this.inputs = inputs;
  7777. this.hostProperties = hostProperties;
  7778. this.hostEvents = hostEvents;
  7779. this.contentQueryStartId = contentQueryStartId;
  7780. this.sourceSpan = sourceSpan;
  7781. }
  7782. /**
  7783. * @param {?} visitor
  7784. * @param {?} context
  7785. * @return {?}
  7786. */
  7787. DirectiveAst.prototype.visit = /**
  7788. * @param {?} visitor
  7789. * @param {?} context
  7790. * @return {?}
  7791. */
  7792. function (visitor, context) {
  7793. return visitor.visitDirective(this, context);
  7794. };
  7795. return DirectiveAst;
  7796. }());
  7797. /**
  7798. * A provider declared on an element
  7799. */
  7800. var ProviderAst = /** @class */ (function () {
  7801. function ProviderAst(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan) {
  7802. this.token = token;
  7803. this.multiProvider = multiProvider;
  7804. this.eager = eager;
  7805. this.providers = providers;
  7806. this.providerType = providerType;
  7807. this.lifecycleHooks = lifecycleHooks;
  7808. this.sourceSpan = sourceSpan;
  7809. }
  7810. /**
  7811. * @param {?} visitor
  7812. * @param {?} context
  7813. * @return {?}
  7814. */
  7815. ProviderAst.prototype.visit = /**
  7816. * @param {?} visitor
  7817. * @param {?} context
  7818. * @return {?}
  7819. */
  7820. function (visitor, context) {
  7821. // No visit method in the visitor for now...
  7822. return null;
  7823. };
  7824. return ProviderAst;
  7825. }());
  7826. /** @enum {number} */
  7827. var ProviderAstType = {
  7828. PublicService: 0,
  7829. PrivateService: 1,
  7830. Component: 2,
  7831. Directive: 3,
  7832. Builtin: 4,
  7833. };
  7834. ProviderAstType[ProviderAstType.PublicService] = "PublicService";
  7835. ProviderAstType[ProviderAstType.PrivateService] = "PrivateService";
  7836. ProviderAstType[ProviderAstType.Component] = "Component";
  7837. ProviderAstType[ProviderAstType.Directive] = "Directive";
  7838. ProviderAstType[ProviderAstType.Builtin] = "Builtin";
  7839. /**
  7840. * Position where content is to be projected (instance of `<ng-content>` in a template).
  7841. */
  7842. var NgContentAst = /** @class */ (function () {
  7843. function NgContentAst(index, ngContentIndex, sourceSpan) {
  7844. this.index = index;
  7845. this.ngContentIndex = ngContentIndex;
  7846. this.sourceSpan = sourceSpan;
  7847. }
  7848. /**
  7849. * @param {?} visitor
  7850. * @param {?} context
  7851. * @return {?}
  7852. */
  7853. NgContentAst.prototype.visit = /**
  7854. * @param {?} visitor
  7855. * @param {?} context
  7856. * @return {?}
  7857. */
  7858. function (visitor, context) {
  7859. return visitor.visitNgContent(this, context);
  7860. };
  7861. return NgContentAst;
  7862. }());
  7863. /** @enum {number} */
  7864. var PropertyBindingType = {
  7865. /**
  7866. * A normal binding to a property (e.g. `[property]="expression"`).
  7867. */
  7868. Property: 0,
  7869. /**
  7870. * A binding to an element attribute (e.g. `[attr.name]="expression"`).
  7871. */
  7872. Attribute: 1,
  7873. /**
  7874. * A binding to a CSS class (e.g. `[class.name]="condition"`).
  7875. */
  7876. Class: 2,
  7877. /**
  7878. * A binding to a style rule (e.g. `[style.rule]="expression"`).
  7879. */
  7880. Style: 3,
  7881. /**
  7882. * A binding to an animation reference (e.g. `[animate.key]="expression"`).
  7883. */
  7884. Animation: 4,
  7885. };
  7886. PropertyBindingType[PropertyBindingType.Property] = "Property";
  7887. PropertyBindingType[PropertyBindingType.Attribute] = "Attribute";
  7888. PropertyBindingType[PropertyBindingType.Class] = "Class";
  7889. PropertyBindingType[PropertyBindingType.Style] = "Style";
  7890. PropertyBindingType[PropertyBindingType.Animation] = "Animation";
  7891. /**
  7892. * @record
  7893. */
  7894. /**
  7895. * A visitor for {\@link TemplateAst} trees that will process each node.
  7896. * @record
  7897. */
  7898. /**
  7899. * A visitor that accepts each node but doesn't do anything. It is intended to be used
  7900. * as the base class for a visitor that is only interested in a subset of the node types.
  7901. */
  7902. var NullTemplateVisitor = /** @class */ (function () {
  7903. function NullTemplateVisitor() {
  7904. }
  7905. /**
  7906. * @param {?} ast
  7907. * @param {?} context
  7908. * @return {?}
  7909. */
  7910. NullTemplateVisitor.prototype.visitNgContent = /**
  7911. * @param {?} ast
  7912. * @param {?} context
  7913. * @return {?}
  7914. */
  7915. function (ast, context) { };
  7916. /**
  7917. * @param {?} ast
  7918. * @param {?} context
  7919. * @return {?}
  7920. */
  7921. NullTemplateVisitor.prototype.visitEmbeddedTemplate = /**
  7922. * @param {?} ast
  7923. * @param {?} context
  7924. * @return {?}
  7925. */
  7926. function (ast, context) { };
  7927. /**
  7928. * @param {?} ast
  7929. * @param {?} context
  7930. * @return {?}
  7931. */
  7932. NullTemplateVisitor.prototype.visitElement = /**
  7933. * @param {?} ast
  7934. * @param {?} context
  7935. * @return {?}
  7936. */
  7937. function (ast, context) { };
  7938. /**
  7939. * @param {?} ast
  7940. * @param {?} context
  7941. * @return {?}
  7942. */
  7943. NullTemplateVisitor.prototype.visitReference = /**
  7944. * @param {?} ast
  7945. * @param {?} context
  7946. * @return {?}
  7947. */
  7948. function (ast, context) { };
  7949. /**
  7950. * @param {?} ast
  7951. * @param {?} context
  7952. * @return {?}
  7953. */
  7954. NullTemplateVisitor.prototype.visitVariable = /**
  7955. * @param {?} ast
  7956. * @param {?} context
  7957. * @return {?}
  7958. */
  7959. function (ast, context) { };
  7960. /**
  7961. * @param {?} ast
  7962. * @param {?} context
  7963. * @return {?}
  7964. */
  7965. NullTemplateVisitor.prototype.visitEvent = /**
  7966. * @param {?} ast
  7967. * @param {?} context
  7968. * @return {?}
  7969. */
  7970. function (ast, context) { };
  7971. /**
  7972. * @param {?} ast
  7973. * @param {?} context
  7974. * @return {?}
  7975. */
  7976. NullTemplateVisitor.prototype.visitElementProperty = /**
  7977. * @param {?} ast
  7978. * @param {?} context
  7979. * @return {?}
  7980. */
  7981. function (ast, context) { };
  7982. /**
  7983. * @param {?} ast
  7984. * @param {?} context
  7985. * @return {?}
  7986. */
  7987. NullTemplateVisitor.prototype.visitAttr = /**
  7988. * @param {?} ast
  7989. * @param {?} context
  7990. * @return {?}
  7991. */
  7992. function (ast, context) { };
  7993. /**
  7994. * @param {?} ast
  7995. * @param {?} context
  7996. * @return {?}
  7997. */
  7998. NullTemplateVisitor.prototype.visitBoundText = /**
  7999. * @param {?} ast
  8000. * @param {?} context
  8001. * @return {?}
  8002. */
  8003. function (ast, context) { };
  8004. /**
  8005. * @param {?} ast
  8006. * @param {?} context
  8007. * @return {?}
  8008. */
  8009. NullTemplateVisitor.prototype.visitText = /**
  8010. * @param {?} ast
  8011. * @param {?} context
  8012. * @return {?}
  8013. */
  8014. function (ast, context) { };
  8015. /**
  8016. * @param {?} ast
  8017. * @param {?} context
  8018. * @return {?}
  8019. */
  8020. NullTemplateVisitor.prototype.visitDirective = /**
  8021. * @param {?} ast
  8022. * @param {?} context
  8023. * @return {?}
  8024. */
  8025. function (ast, context) { };
  8026. /**
  8027. * @param {?} ast
  8028. * @param {?} context
  8029. * @return {?}
  8030. */
  8031. NullTemplateVisitor.prototype.visitDirectiveProperty = /**
  8032. * @param {?} ast
  8033. * @param {?} context
  8034. * @return {?}
  8035. */
  8036. function (ast, context) { };
  8037. return NullTemplateVisitor;
  8038. }());
  8039. /**
  8040. * Base class that can be used to build a visitor that visits each node
  8041. * in an template ast recursively.
  8042. */
  8043. var RecursiveTemplateAstVisitor = /** @class */ (function (_super) {
  8044. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(RecursiveTemplateAstVisitor, _super);
  8045. function RecursiveTemplateAstVisitor() {
  8046. return _super.call(this) || this;
  8047. }
  8048. // Nodes with children
  8049. /**
  8050. * @param {?} ast
  8051. * @param {?} context
  8052. * @return {?}
  8053. */
  8054. RecursiveTemplateAstVisitor.prototype.visitEmbeddedTemplate = /**
  8055. * @param {?} ast
  8056. * @param {?} context
  8057. * @return {?}
  8058. */
  8059. function (ast, context) {
  8060. return this.visitChildren(context, function (visit) {
  8061. visit(ast.attrs);
  8062. visit(ast.references);
  8063. visit(ast.variables);
  8064. visit(ast.directives);
  8065. visit(ast.providers);
  8066. visit(ast.children);
  8067. });
  8068. };
  8069. /**
  8070. * @param {?} ast
  8071. * @param {?} context
  8072. * @return {?}
  8073. */
  8074. RecursiveTemplateAstVisitor.prototype.visitElement = /**
  8075. * @param {?} ast
  8076. * @param {?} context
  8077. * @return {?}
  8078. */
  8079. function (ast, context) {
  8080. return this.visitChildren(context, function (visit) {
  8081. visit(ast.attrs);
  8082. visit(ast.inputs);
  8083. visit(ast.outputs);
  8084. visit(ast.references);
  8085. visit(ast.directives);
  8086. visit(ast.providers);
  8087. visit(ast.children);
  8088. });
  8089. };
  8090. /**
  8091. * @param {?} ast
  8092. * @param {?} context
  8093. * @return {?}
  8094. */
  8095. RecursiveTemplateAstVisitor.prototype.visitDirective = /**
  8096. * @param {?} ast
  8097. * @param {?} context
  8098. * @return {?}
  8099. */
  8100. function (ast, context) {
  8101. return this.visitChildren(context, function (visit) {
  8102. visit(ast.inputs);
  8103. visit(ast.hostProperties);
  8104. visit(ast.hostEvents);
  8105. });
  8106. };
  8107. /**
  8108. * @template T
  8109. * @param {?} context
  8110. * @param {?} cb
  8111. * @return {?}
  8112. */
  8113. RecursiveTemplateAstVisitor.prototype.visitChildren = /**
  8114. * @template T
  8115. * @param {?} context
  8116. * @param {?} cb
  8117. * @return {?}
  8118. */
  8119. function (context, cb) {
  8120. var /** @type {?} */ results = [];
  8121. var /** @type {?} */ t = this;
  8122. /**
  8123. * @template T
  8124. * @param {?} children
  8125. * @return {?}
  8126. */
  8127. function visit(children) {
  8128. if (children && children.length)
  8129. results.push(templateVisitAll(t, children, context));
  8130. }
  8131. cb(visit);
  8132. return [].concat.apply([], results);
  8133. };
  8134. return RecursiveTemplateAstVisitor;
  8135. }(NullTemplateVisitor));
  8136. /**
  8137. * Visit every node in a list of {\@link TemplateAst}s with the given {\@link TemplateAstVisitor}.
  8138. * @param {?} visitor
  8139. * @param {?} asts
  8140. * @param {?=} context
  8141. * @return {?}
  8142. */
  8143. function templateVisitAll(visitor, asts, context) {
  8144. if (context === void 0) { context = null; }
  8145. var /** @type {?} */ result = [];
  8146. var /** @type {?} */ visit = visitor.visit ?
  8147. function (ast) { return ((visitor.visit))(ast, context) || ast.visit(visitor, context); } :
  8148. function (ast) { return ast.visit(visitor, context); };
  8149. asts.forEach(function (ast) {
  8150. var /** @type {?} */ astResult = visit(ast);
  8151. if (astResult) {
  8152. result.push(astResult);
  8153. }
  8154. });
  8155. return result;
  8156. }
  8157. /**
  8158. * @fileoverview added by tsickle
  8159. * @suppress {checkTypes} checked by tsc
  8160. */
  8161. /**
  8162. * @license
  8163. * Copyright Google Inc. All Rights Reserved.
  8164. *
  8165. * Use of this source code is governed by an MIT-style license that can be
  8166. * found in the LICENSE file at https://angular.io/license
  8167. */
  8168. var CompilerConfig = /** @class */ (function () {
  8169. function CompilerConfig(_a) {
  8170. var _b = _a === void 0 ? {} : _a, _c = _b.defaultEncapsulation, defaultEncapsulation = _c === void 0 ? ViewEncapsulation.Emulated : _c, _d = _b.useJit, useJit = _d === void 0 ? true : _d, _e = _b.jitDevMode, jitDevMode = _e === void 0 ? false : _e, _f = _b.missingTranslation, missingTranslation = _f === void 0 ? null : _f, enableLegacyTemplate = _b.enableLegacyTemplate, preserveWhitespaces = _b.preserveWhitespaces, strictInjectionParameters = _b.strictInjectionParameters;
  8171. this.defaultEncapsulation = defaultEncapsulation;
  8172. this.useJit = !!useJit;
  8173. this.jitDevMode = !!jitDevMode;
  8174. this.missingTranslation = missingTranslation;
  8175. this.enableLegacyTemplate = enableLegacyTemplate === true;
  8176. this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
  8177. this.strictInjectionParameters = strictInjectionParameters === true;
  8178. }
  8179. return CompilerConfig;
  8180. }());
  8181. /**
  8182. * @param {?} preserveWhitespacesOption
  8183. * @param {?=} defaultSetting
  8184. * @return {?}
  8185. */
  8186. function preserveWhitespacesDefault(preserveWhitespacesOption, defaultSetting) {
  8187. if (defaultSetting === void 0) { defaultSetting = true; }
  8188. return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption;
  8189. }
  8190. /**
  8191. * @fileoverview added by tsickle
  8192. * @suppress {checkTypes} checked by tsc
  8193. */
  8194. /**
  8195. * @license
  8196. * Copyright Google Inc. All Rights Reserved.
  8197. *
  8198. * Use of this source code is governed by an MIT-style license that can be
  8199. * found in the LICENSE file at https://angular.io/license
  8200. */
  8201. /**
  8202. * A token representing the a reference to a static type.
  8203. *
  8204. * This token is unique for a filePath and name and can be used as a hash table key.
  8205. */
  8206. var StaticSymbol = /** @class */ (function () {
  8207. function StaticSymbol(filePath, name, members) {
  8208. this.filePath = filePath;
  8209. this.name = name;
  8210. this.members = members;
  8211. }
  8212. /**
  8213. * @return {?}
  8214. */
  8215. StaticSymbol.prototype.assertNoMembers = /**
  8216. * @return {?}
  8217. */
  8218. function () {
  8219. if (this.members.length) {
  8220. throw new Error("Illegal state: symbol without members expected, but got " + JSON.stringify(this) + ".");
  8221. }
  8222. };
  8223. return StaticSymbol;
  8224. }());
  8225. /**
  8226. * A cache of static symbol used by the StaticReflector to return the same symbol for the
  8227. * same symbol values.
  8228. */
  8229. var StaticSymbolCache = /** @class */ (function () {
  8230. function StaticSymbolCache() {
  8231. this.cache = new Map();
  8232. }
  8233. /**
  8234. * @param {?} declarationFile
  8235. * @param {?} name
  8236. * @param {?=} members
  8237. * @return {?}
  8238. */
  8239. StaticSymbolCache.prototype.get = /**
  8240. * @param {?} declarationFile
  8241. * @param {?} name
  8242. * @param {?=} members
  8243. * @return {?}
  8244. */
  8245. function (declarationFile, name, members) {
  8246. members = members || [];
  8247. var /** @type {?} */ memberSuffix = members.length ? "." + members.join('.') : '';
  8248. var /** @type {?} */ key = "\"" + declarationFile + "\"." + name + memberSuffix;
  8249. var /** @type {?} */ result = this.cache.get(key);
  8250. if (!result) {
  8251. result = new StaticSymbol(declarationFile, name, members);
  8252. this.cache.set(key, result);
  8253. }
  8254. return result;
  8255. };
  8256. return StaticSymbolCache;
  8257. }());
  8258. /**
  8259. * @fileoverview added by tsickle
  8260. * @suppress {checkTypes} checked by tsc
  8261. */
  8262. /**
  8263. * @license
  8264. * Copyright Google Inc. All Rights Reserved.
  8265. *
  8266. * Use of this source code is governed by an MIT-style license that can be
  8267. * found in the LICENSE file at https://angular.io/license
  8268. */
  8269. // group 0: "[prop] or (event) or @trigger"
  8270. // group 1: "prop" from "[prop]"
  8271. // group 2: "event" from "(event)"
  8272. // group 3: "@trigger" from "@trigger"
  8273. var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
  8274. /**
  8275. * @param {?} name
  8276. * @return {?}
  8277. */
  8278. function _sanitizeIdentifier(name) {
  8279. return name.replace(/\W/g, '_');
  8280. }
  8281. var _anonymousTypeIndex = 0;
  8282. /**
  8283. * @param {?} compileIdentifier
  8284. * @return {?}
  8285. */
  8286. function identifierName(compileIdentifier) {
  8287. if (!compileIdentifier || !compileIdentifier.reference) {
  8288. return null;
  8289. }
  8290. var /** @type {?} */ ref = compileIdentifier.reference;
  8291. if (ref instanceof StaticSymbol) {
  8292. return ref.name;
  8293. }
  8294. if (ref['__anonymousType']) {
  8295. return ref['__anonymousType'];
  8296. }
  8297. var /** @type {?} */ identifier = stringify(ref);
  8298. if (identifier.indexOf('(') >= 0) {
  8299. // case: anonymous functions!
  8300. identifier = "anonymous_" + _anonymousTypeIndex++;
  8301. ref['__anonymousType'] = identifier;
  8302. }
  8303. else {
  8304. identifier = _sanitizeIdentifier(identifier);
  8305. }
  8306. return identifier;
  8307. }
  8308. /**
  8309. * @param {?} compileIdentifier
  8310. * @return {?}
  8311. */
  8312. function identifierModuleUrl(compileIdentifier) {
  8313. var /** @type {?} */ ref = compileIdentifier.reference;
  8314. if (ref instanceof StaticSymbol) {
  8315. return ref.filePath;
  8316. }
  8317. // Runtime type
  8318. return "./" + stringify(ref);
  8319. }
  8320. /**
  8321. * @param {?} compType
  8322. * @param {?} embeddedTemplateIndex
  8323. * @return {?}
  8324. */
  8325. function viewClassName(compType, embeddedTemplateIndex) {
  8326. return "View_" + identifierName({ reference: compType }) + "_" + embeddedTemplateIndex;
  8327. }
  8328. /**
  8329. * @param {?} compType
  8330. * @return {?}
  8331. */
  8332. function rendererTypeName(compType) {
  8333. return "RenderType_" + identifierName({ reference: compType });
  8334. }
  8335. /**
  8336. * @param {?} compType
  8337. * @return {?}
  8338. */
  8339. function hostViewClassName(compType) {
  8340. return "HostView_" + identifierName({ reference: compType });
  8341. }
  8342. /**
  8343. * @param {?} compType
  8344. * @return {?}
  8345. */
  8346. function componentFactoryName(compType) {
  8347. return identifierName({ reference: compType }) + "NgFactory";
  8348. }
  8349. /**
  8350. * @record
  8351. */
  8352. /**
  8353. * @record
  8354. */
  8355. /** @enum {number} */
  8356. var CompileSummaryKind = {
  8357. Pipe: 0,
  8358. Directive: 1,
  8359. NgModule: 2,
  8360. Injectable: 3,
  8361. };
  8362. CompileSummaryKind[CompileSummaryKind.Pipe] = "Pipe";
  8363. CompileSummaryKind[CompileSummaryKind.Directive] = "Directive";
  8364. CompileSummaryKind[CompileSummaryKind.NgModule] = "NgModule";
  8365. CompileSummaryKind[CompileSummaryKind.Injectable] = "Injectable";
  8366. /**
  8367. * A CompileSummary is the data needed to use a directive / pipe / module
  8368. * in other modules / components. However, this data is not enough to compile
  8369. * the directive / module itself.
  8370. * @record
  8371. */
  8372. /**
  8373. * @record
  8374. */
  8375. /**
  8376. * @record
  8377. */
  8378. /**
  8379. * @record
  8380. */
  8381. /**
  8382. * @param {?} token
  8383. * @return {?}
  8384. */
  8385. function tokenName(token) {
  8386. return token.value != null ? _sanitizeIdentifier(token.value) : identifierName(token.identifier);
  8387. }
  8388. /**
  8389. * @param {?} token
  8390. * @return {?}
  8391. */
  8392. function tokenReference(token) {
  8393. if (token.identifier != null) {
  8394. return token.identifier.reference;
  8395. }
  8396. else {
  8397. return token.value;
  8398. }
  8399. }
  8400. /**
  8401. * @record
  8402. */
  8403. /**
  8404. * Metadata regarding compilation of a type.
  8405. * @record
  8406. */
  8407. /**
  8408. * @record
  8409. */
  8410. /**
  8411. * Metadata about a stylesheet
  8412. */
  8413. var CompileStylesheetMetadata = /** @class */ (function () {
  8414. function CompileStylesheetMetadata(_a) {
  8415. var _b = _a === void 0 ? {} : _a, moduleUrl = _b.moduleUrl, styles = _b.styles, styleUrls = _b.styleUrls;
  8416. this.moduleUrl = moduleUrl || null;
  8417. this.styles = _normalizeArray(styles);
  8418. this.styleUrls = _normalizeArray(styleUrls);
  8419. }
  8420. return CompileStylesheetMetadata;
  8421. }());
  8422. /**
  8423. * Summary Metadata regarding compilation of a template.
  8424. * @record
  8425. */
  8426. /**
  8427. * Metadata regarding compilation of a template.
  8428. */
  8429. var CompileTemplateMetadata = /** @class */ (function () {
  8430. function CompileTemplateMetadata(_a) {
  8431. var encapsulation = _a.encapsulation, template = _a.template, templateUrl = _a.templateUrl, htmlAst = _a.htmlAst, styles = _a.styles, styleUrls = _a.styleUrls, externalStylesheets = _a.externalStylesheets, animations = _a.animations, ngContentSelectors = _a.ngContentSelectors, interpolation = _a.interpolation, isInline = _a.isInline, preserveWhitespaces = _a.preserveWhitespaces;
  8432. this.encapsulation = encapsulation;
  8433. this.template = template;
  8434. this.templateUrl = templateUrl;
  8435. this.htmlAst = htmlAst;
  8436. this.styles = _normalizeArray(styles);
  8437. this.styleUrls = _normalizeArray(styleUrls);
  8438. this.externalStylesheets = _normalizeArray(externalStylesheets);
  8439. this.animations = animations ? flatten(animations) : [];
  8440. this.ngContentSelectors = ngContentSelectors || [];
  8441. if (interpolation && interpolation.length != 2) {
  8442. throw new Error("'interpolation' should have a start and an end symbol.");
  8443. }
  8444. this.interpolation = interpolation;
  8445. this.isInline = isInline;
  8446. this.preserveWhitespaces = preserveWhitespaces;
  8447. }
  8448. /**
  8449. * @return {?}
  8450. */
  8451. CompileTemplateMetadata.prototype.toSummary = /**
  8452. * @return {?}
  8453. */
  8454. function () {
  8455. return {
  8456. ngContentSelectors: this.ngContentSelectors,
  8457. encapsulation: this.encapsulation,
  8458. };
  8459. };
  8460. return CompileTemplateMetadata;
  8461. }());
  8462. /**
  8463. * @record
  8464. */
  8465. /**
  8466. * @record
  8467. */
  8468. /**
  8469. * Metadata regarding compilation of a directive.
  8470. */
  8471. var CompileDirectiveMetadata = /** @class */ (function () {
  8472. function CompileDirectiveMetadata(_a) {
  8473. var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, hostListeners = _a.hostListeners, hostProperties = _a.hostProperties, hostAttributes = _a.hostAttributes, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, guards = _a.guards, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory;
  8474. this.isHost = !!isHost;
  8475. this.type = type;
  8476. this.isComponent = isComponent;
  8477. this.selector = selector;
  8478. this.exportAs = exportAs;
  8479. this.changeDetection = changeDetection;
  8480. this.inputs = inputs;
  8481. this.outputs = outputs;
  8482. this.hostListeners = hostListeners;
  8483. this.hostProperties = hostProperties;
  8484. this.hostAttributes = hostAttributes;
  8485. this.providers = _normalizeArray(providers);
  8486. this.viewProviders = _normalizeArray(viewProviders);
  8487. this.queries = _normalizeArray(queries);
  8488. this.guards = guards;
  8489. this.viewQueries = _normalizeArray(viewQueries);
  8490. this.entryComponents = _normalizeArray(entryComponents);
  8491. this.template = template;
  8492. this.componentViewType = componentViewType;
  8493. this.rendererType = rendererType;
  8494. this.componentFactory = componentFactory;
  8495. }
  8496. /**
  8497. * @param {?} __0
  8498. * @return {?}
  8499. */
  8500. CompileDirectiveMetadata.create = /**
  8501. * @param {?} __0
  8502. * @return {?}
  8503. */
  8504. function (_a) {
  8505. var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, host = _a.host, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, guards = _a.guards, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory;
  8506. var /** @type {?} */ hostListeners = {};
  8507. var /** @type {?} */ hostProperties = {};
  8508. var /** @type {?} */ hostAttributes = {};
  8509. if (host != null) {
  8510. Object.keys(host).forEach(function (key) {
  8511. var /** @type {?} */ value = host[key];
  8512. var /** @type {?} */ matches = key.match(HOST_REG_EXP);
  8513. if (matches === null) {
  8514. hostAttributes[key] = value;
  8515. }
  8516. else if (matches[1] != null) {
  8517. hostProperties[matches[1]] = value;
  8518. }
  8519. else if (matches[2] != null) {
  8520. hostListeners[matches[2]] = value;
  8521. }
  8522. });
  8523. }
  8524. var /** @type {?} */ inputsMap = {};
  8525. if (inputs != null) {
  8526. inputs.forEach(function (bindConfig) {
  8527. // canonical syntax: `dirProp: elProp`
  8528. // if there is no `:`, use dirProp = elProp
  8529. var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
  8530. inputsMap[parts[0]] = parts[1];
  8531. });
  8532. }
  8533. var /** @type {?} */ outputsMap = {};
  8534. if (outputs != null) {
  8535. outputs.forEach(function (bindConfig) {
  8536. // canonical syntax: `dirProp: elProp`
  8537. // if there is no `:`, use dirProp = elProp
  8538. var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
  8539. outputsMap[parts[0]] = parts[1];
  8540. });
  8541. }
  8542. return new CompileDirectiveMetadata({
  8543. isHost: isHost,
  8544. type: type,
  8545. isComponent: !!isComponent, selector: selector, exportAs: exportAs, changeDetection: changeDetection,
  8546. inputs: inputsMap,
  8547. outputs: outputsMap,
  8548. hostListeners: hostListeners,
  8549. hostProperties: hostProperties,
  8550. hostAttributes: hostAttributes,
  8551. providers: providers,
  8552. viewProviders: viewProviders,
  8553. queries: queries,
  8554. guards: guards,
  8555. viewQueries: viewQueries,
  8556. entryComponents: entryComponents,
  8557. template: template,
  8558. componentViewType: componentViewType,
  8559. rendererType: rendererType,
  8560. componentFactory: componentFactory,
  8561. });
  8562. };
  8563. /**
  8564. * @return {?}
  8565. */
  8566. CompileDirectiveMetadata.prototype.toSummary = /**
  8567. * @return {?}
  8568. */
  8569. function () {
  8570. return {
  8571. summaryKind: CompileSummaryKind.Directive,
  8572. type: this.type,
  8573. isComponent: this.isComponent,
  8574. selector: this.selector,
  8575. exportAs: this.exportAs,
  8576. inputs: this.inputs,
  8577. outputs: this.outputs,
  8578. hostListeners: this.hostListeners,
  8579. hostProperties: this.hostProperties,
  8580. hostAttributes: this.hostAttributes,
  8581. providers: this.providers,
  8582. viewProviders: this.viewProviders,
  8583. queries: this.queries,
  8584. guards: this.guards,
  8585. viewQueries: this.viewQueries,
  8586. entryComponents: this.entryComponents,
  8587. changeDetection: this.changeDetection,
  8588. template: this.template && this.template.toSummary(),
  8589. componentViewType: this.componentViewType,
  8590. rendererType: this.rendererType,
  8591. componentFactory: this.componentFactory
  8592. };
  8593. };
  8594. return CompileDirectiveMetadata;
  8595. }());
  8596. /**
  8597. * @record
  8598. */
  8599. var CompilePipeMetadata = /** @class */ (function () {
  8600. function CompilePipeMetadata(_a) {
  8601. var type = _a.type, name = _a.name, pure = _a.pure;
  8602. this.type = type;
  8603. this.name = name;
  8604. this.pure = !!pure;
  8605. }
  8606. /**
  8607. * @return {?}
  8608. */
  8609. CompilePipeMetadata.prototype.toSummary = /**
  8610. * @return {?}
  8611. */
  8612. function () {
  8613. return {
  8614. summaryKind: CompileSummaryKind.Pipe,
  8615. type: this.type,
  8616. name: this.name,
  8617. pure: this.pure
  8618. };
  8619. };
  8620. return CompilePipeMetadata;
  8621. }());
  8622. /**
  8623. * @record
  8624. */
  8625. /**
  8626. * Metadata regarding compilation of a module.
  8627. */
  8628. var CompileNgModuleMetadata = /** @class */ (function () {
  8629. function CompileNgModuleMetadata(_a) {
  8630. var type = _a.type, providers = _a.providers, declaredDirectives = _a.declaredDirectives, exportedDirectives = _a.exportedDirectives, declaredPipes = _a.declaredPipes, exportedPipes = _a.exportedPipes, entryComponents = _a.entryComponents, bootstrapComponents = _a.bootstrapComponents, importedModules = _a.importedModules, exportedModules = _a.exportedModules, schemas = _a.schemas, transitiveModule = _a.transitiveModule, id = _a.id;
  8631. this.type = type || null;
  8632. this.declaredDirectives = _normalizeArray(declaredDirectives);
  8633. this.exportedDirectives = _normalizeArray(exportedDirectives);
  8634. this.declaredPipes = _normalizeArray(declaredPipes);
  8635. this.exportedPipes = _normalizeArray(exportedPipes);
  8636. this.providers = _normalizeArray(providers);
  8637. this.entryComponents = _normalizeArray(entryComponents);
  8638. this.bootstrapComponents = _normalizeArray(bootstrapComponents);
  8639. this.importedModules = _normalizeArray(importedModules);
  8640. this.exportedModules = _normalizeArray(exportedModules);
  8641. this.schemas = _normalizeArray(schemas);
  8642. this.id = id || null;
  8643. this.transitiveModule = transitiveModule || null;
  8644. }
  8645. /**
  8646. * @return {?}
  8647. */
  8648. CompileNgModuleMetadata.prototype.toSummary = /**
  8649. * @return {?}
  8650. */
  8651. function () {
  8652. var /** @type {?} */ module = /** @type {?} */ ((this.transitiveModule));
  8653. return {
  8654. summaryKind: CompileSummaryKind.NgModule,
  8655. type: this.type,
  8656. entryComponents: module.entryComponents,
  8657. providers: module.providers,
  8658. modules: module.modules,
  8659. exportedDirectives: module.exportedDirectives,
  8660. exportedPipes: module.exportedPipes
  8661. };
  8662. };
  8663. return CompileNgModuleMetadata;
  8664. }());
  8665. var TransitiveCompileNgModuleMetadata = /** @class */ (function () {
  8666. function TransitiveCompileNgModuleMetadata() {
  8667. this.directivesSet = new Set();
  8668. this.directives = [];
  8669. this.exportedDirectivesSet = new Set();
  8670. this.exportedDirectives = [];
  8671. this.pipesSet = new Set();
  8672. this.pipes = [];
  8673. this.exportedPipesSet = new Set();
  8674. this.exportedPipes = [];
  8675. this.modulesSet = new Set();
  8676. this.modules = [];
  8677. this.entryComponentsSet = new Set();
  8678. this.entryComponents = [];
  8679. this.providers = [];
  8680. }
  8681. /**
  8682. * @param {?} provider
  8683. * @param {?} module
  8684. * @return {?}
  8685. */
  8686. TransitiveCompileNgModuleMetadata.prototype.addProvider = /**
  8687. * @param {?} provider
  8688. * @param {?} module
  8689. * @return {?}
  8690. */
  8691. function (provider, module) {
  8692. this.providers.push({ provider: provider, module: module });
  8693. };
  8694. /**
  8695. * @param {?} id
  8696. * @return {?}
  8697. */
  8698. TransitiveCompileNgModuleMetadata.prototype.addDirective = /**
  8699. * @param {?} id
  8700. * @return {?}
  8701. */
  8702. function (id) {
  8703. if (!this.directivesSet.has(id.reference)) {
  8704. this.directivesSet.add(id.reference);
  8705. this.directives.push(id);
  8706. }
  8707. };
  8708. /**
  8709. * @param {?} id
  8710. * @return {?}
  8711. */
  8712. TransitiveCompileNgModuleMetadata.prototype.addExportedDirective = /**
  8713. * @param {?} id
  8714. * @return {?}
  8715. */
  8716. function (id) {
  8717. if (!this.exportedDirectivesSet.has(id.reference)) {
  8718. this.exportedDirectivesSet.add(id.reference);
  8719. this.exportedDirectives.push(id);
  8720. }
  8721. };
  8722. /**
  8723. * @param {?} id
  8724. * @return {?}
  8725. */
  8726. TransitiveCompileNgModuleMetadata.prototype.addPipe = /**
  8727. * @param {?} id
  8728. * @return {?}
  8729. */
  8730. function (id) {
  8731. if (!this.pipesSet.has(id.reference)) {
  8732. this.pipesSet.add(id.reference);
  8733. this.pipes.push(id);
  8734. }
  8735. };
  8736. /**
  8737. * @param {?} id
  8738. * @return {?}
  8739. */
  8740. TransitiveCompileNgModuleMetadata.prototype.addExportedPipe = /**
  8741. * @param {?} id
  8742. * @return {?}
  8743. */
  8744. function (id) {
  8745. if (!this.exportedPipesSet.has(id.reference)) {
  8746. this.exportedPipesSet.add(id.reference);
  8747. this.exportedPipes.push(id);
  8748. }
  8749. };
  8750. /**
  8751. * @param {?} id
  8752. * @return {?}
  8753. */
  8754. TransitiveCompileNgModuleMetadata.prototype.addModule = /**
  8755. * @param {?} id
  8756. * @return {?}
  8757. */
  8758. function (id) {
  8759. if (!this.modulesSet.has(id.reference)) {
  8760. this.modulesSet.add(id.reference);
  8761. this.modules.push(id);
  8762. }
  8763. };
  8764. /**
  8765. * @param {?} ec
  8766. * @return {?}
  8767. */
  8768. TransitiveCompileNgModuleMetadata.prototype.addEntryComponent = /**
  8769. * @param {?} ec
  8770. * @return {?}
  8771. */
  8772. function (ec) {
  8773. if (!this.entryComponentsSet.has(ec.componentType)) {
  8774. this.entryComponentsSet.add(ec.componentType);
  8775. this.entryComponents.push(ec);
  8776. }
  8777. };
  8778. return TransitiveCompileNgModuleMetadata;
  8779. }());
  8780. /**
  8781. * @param {?} obj
  8782. * @return {?}
  8783. */
  8784. function _normalizeArray(obj) {
  8785. return obj || [];
  8786. }
  8787. var ProviderMeta = /** @class */ (function () {
  8788. function ProviderMeta(token, _a) {
  8789. var useClass = _a.useClass, useValue = _a.useValue, useExisting = _a.useExisting, useFactory = _a.useFactory, deps = _a.deps, multi = _a.multi;
  8790. this.token = token;
  8791. this.useClass = useClass || null;
  8792. this.useValue = useValue;
  8793. this.useExisting = useExisting;
  8794. this.useFactory = useFactory || null;
  8795. this.dependencies = deps || null;
  8796. this.multi = !!multi;
  8797. }
  8798. return ProviderMeta;
  8799. }());
  8800. /**
  8801. * @template T
  8802. * @param {?} list
  8803. * @return {?}
  8804. */
  8805. function flatten(list) {
  8806. return list.reduce(function (flat, item) {
  8807. var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
  8808. return (/** @type {?} */ (flat)).concat(flatItem);
  8809. }, []);
  8810. }
  8811. /**
  8812. * @param {?} url
  8813. * @return {?}
  8814. */
  8815. function jitSourceUrl(url) {
  8816. // Note: We need 3 "/" so that ng shows up as a separate domain
  8817. // in the chrome dev tools.
  8818. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
  8819. }
  8820. /**
  8821. * @param {?} ngModuleType
  8822. * @param {?} compMeta
  8823. * @param {?} templateMeta
  8824. * @return {?}
  8825. */
  8826. function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
  8827. var /** @type {?} */ url;
  8828. if (templateMeta.isInline) {
  8829. if (compMeta.type.reference instanceof StaticSymbol) {
  8830. // Note: a .ts file might contain multiple components with inline templates,
  8831. // so we need to give them unique urls, as these will be used for sourcemaps.
  8832. url = compMeta.type.reference.filePath + "." + compMeta.type.reference.name + ".html";
  8833. }
  8834. else {
  8835. url = identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".html";
  8836. }
  8837. }
  8838. else {
  8839. url = /** @type {?} */ ((templateMeta.templateUrl));
  8840. }
  8841. return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url);
  8842. }
  8843. /**
  8844. * @param {?} meta
  8845. * @param {?} id
  8846. * @return {?}
  8847. */
  8848. function sharedStylesheetJitUrl(meta, id) {
  8849. var /** @type {?} */ pathParts = /** @type {?} */ ((meta.moduleUrl)).split(/\/\\/g);
  8850. var /** @type {?} */ baseName = pathParts[pathParts.length - 1];
  8851. return jitSourceUrl("css/" + id + baseName + ".ngstyle.js");
  8852. }
  8853. /**
  8854. * @param {?} moduleMeta
  8855. * @return {?}
  8856. */
  8857. function ngModuleJitUrl(moduleMeta) {
  8858. return jitSourceUrl(identifierName(moduleMeta.type) + "/module.ngfactory.js");
  8859. }
  8860. /**
  8861. * @param {?} ngModuleType
  8862. * @param {?} compMeta
  8863. * @return {?}
  8864. */
  8865. function templateJitUrl(ngModuleType, compMeta) {
  8866. return jitSourceUrl(identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".ngfactory.js");
  8867. }
  8868. /**
  8869. * @fileoverview added by tsickle
  8870. * @suppress {checkTypes} checked by tsc
  8871. */
  8872. /**
  8873. * @license
  8874. * Copyright Google Inc. All Rights Reserved.
  8875. *
  8876. * Use of this source code is governed by an MIT-style license that can be
  8877. * found in the LICENSE file at https://angular.io/license
  8878. */
  8879. /**
  8880. * A path is an ordered set of elements. Typically a path is to a
  8881. * particular offset in a source file. The head of the list is the top
  8882. * most node. The tail is the node that contains the offset directly.
  8883. *
  8884. * For example, the expresion `a + b + c` might have an ast that looks
  8885. * like:
  8886. * +
  8887. * / \
  8888. * a +
  8889. * / \
  8890. * b c
  8891. *
  8892. * The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10,
  8893. * 'c' at 9-10]` and the path the node at offset 1 would be
  8894. * `['+' at 1-10, 'a' at 1-2]`.
  8895. */
  8896. var AstPath = /** @class */ (function () {
  8897. function AstPath(path, position) {
  8898. if (position === void 0) { position = -1; }
  8899. this.path = path;
  8900. this.position = position;
  8901. }
  8902. Object.defineProperty(AstPath.prototype, "empty", {
  8903. get: /**
  8904. * @return {?}
  8905. */
  8906. function () { return !this.path || !this.path.length; },
  8907. enumerable: true,
  8908. configurable: true
  8909. });
  8910. Object.defineProperty(AstPath.prototype, "head", {
  8911. get: /**
  8912. * @return {?}
  8913. */
  8914. function () { return this.path[0]; },
  8915. enumerable: true,
  8916. configurable: true
  8917. });
  8918. Object.defineProperty(AstPath.prototype, "tail", {
  8919. get: /**
  8920. * @return {?}
  8921. */
  8922. function () { return this.path[this.path.length - 1]; },
  8923. enumerable: true,
  8924. configurable: true
  8925. });
  8926. /**
  8927. * @param {?} node
  8928. * @return {?}
  8929. */
  8930. AstPath.prototype.parentOf = /**
  8931. * @param {?} node
  8932. * @return {?}
  8933. */
  8934. function (node) {
  8935. return node && this.path[this.path.indexOf(node) - 1];
  8936. };
  8937. /**
  8938. * @param {?} node
  8939. * @return {?}
  8940. */
  8941. AstPath.prototype.childOf = /**
  8942. * @param {?} node
  8943. * @return {?}
  8944. */
  8945. function (node) { return this.path[this.path.indexOf(node) + 1]; };
  8946. /**
  8947. * @template N
  8948. * @param {?} ctor
  8949. * @return {?}
  8950. */
  8951. AstPath.prototype.first = /**
  8952. * @template N
  8953. * @param {?} ctor
  8954. * @return {?}
  8955. */
  8956. function (ctor) {
  8957. for (var /** @type {?} */ i = this.path.length - 1; i >= 0; i--) {
  8958. var /** @type {?} */ item = this.path[i];
  8959. if (item instanceof ctor)
  8960. return /** @type {?} */ (item);
  8961. }
  8962. };
  8963. /**
  8964. * @param {?} node
  8965. * @return {?}
  8966. */
  8967. AstPath.prototype.push = /**
  8968. * @param {?} node
  8969. * @return {?}
  8970. */
  8971. function (node) { this.path.push(node); };
  8972. /**
  8973. * @return {?}
  8974. */
  8975. AstPath.prototype.pop = /**
  8976. * @return {?}
  8977. */
  8978. function () { return /** @type {?} */ ((this.path.pop())); };
  8979. return AstPath;
  8980. }());
  8981. /**
  8982. * @fileoverview added by tsickle
  8983. * @suppress {checkTypes} checked by tsc
  8984. */
  8985. /**
  8986. * @license
  8987. * Copyright Google Inc. All Rights Reserved.
  8988. *
  8989. * Use of this source code is governed by an MIT-style license that can be
  8990. * found in the LICENSE file at https://angular.io/license
  8991. */
  8992. /**
  8993. * @record
  8994. */
  8995. var Text = /** @class */ (function () {
  8996. function Text(value, sourceSpan) {
  8997. this.value = value;
  8998. this.sourceSpan = sourceSpan;
  8999. }
  9000. /**
  9001. * @param {?} visitor
  9002. * @param {?} context
  9003. * @return {?}
  9004. */
  9005. Text.prototype.visit = /**
  9006. * @param {?} visitor
  9007. * @param {?} context
  9008. * @return {?}
  9009. */
  9010. function (visitor, context) { return visitor.visitText(this, context); };
  9011. return Text;
  9012. }());
  9013. var Expansion = /** @class */ (function () {
  9014. function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan) {
  9015. this.switchValue = switchValue;
  9016. this.type = type;
  9017. this.cases = cases;
  9018. this.sourceSpan = sourceSpan;
  9019. this.switchValueSourceSpan = switchValueSourceSpan;
  9020. }
  9021. /**
  9022. * @param {?} visitor
  9023. * @param {?} context
  9024. * @return {?}
  9025. */
  9026. Expansion.prototype.visit = /**
  9027. * @param {?} visitor
  9028. * @param {?} context
  9029. * @return {?}
  9030. */
  9031. function (visitor, context) { return visitor.visitExpansion(this, context); };
  9032. return Expansion;
  9033. }());
  9034. var ExpansionCase = /** @class */ (function () {
  9035. function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
  9036. this.value = value;
  9037. this.expression = expression;
  9038. this.sourceSpan = sourceSpan;
  9039. this.valueSourceSpan = valueSourceSpan;
  9040. this.expSourceSpan = expSourceSpan;
  9041. }
  9042. /**
  9043. * @param {?} visitor
  9044. * @param {?} context
  9045. * @return {?}
  9046. */
  9047. ExpansionCase.prototype.visit = /**
  9048. * @param {?} visitor
  9049. * @param {?} context
  9050. * @return {?}
  9051. */
  9052. function (visitor, context) { return visitor.visitExpansionCase(this, context); };
  9053. return ExpansionCase;
  9054. }());
  9055. var Attribute$1 = /** @class */ (function () {
  9056. function Attribute(name, value, sourceSpan, valueSpan) {
  9057. this.name = name;
  9058. this.value = value;
  9059. this.sourceSpan = sourceSpan;
  9060. this.valueSpan = valueSpan;
  9061. }
  9062. /**
  9063. * @param {?} visitor
  9064. * @param {?} context
  9065. * @return {?}
  9066. */
  9067. Attribute.prototype.visit = /**
  9068. * @param {?} visitor
  9069. * @param {?} context
  9070. * @return {?}
  9071. */
  9072. function (visitor, context) { return visitor.visitAttribute(this, context); };
  9073. return Attribute;
  9074. }());
  9075. var Element = /** @class */ (function () {
  9076. function Element(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan) {
  9077. if (startSourceSpan === void 0) { startSourceSpan = null; }
  9078. if (endSourceSpan === void 0) { endSourceSpan = null; }
  9079. this.name = name;
  9080. this.attrs = attrs;
  9081. this.children = children;
  9082. this.sourceSpan = sourceSpan;
  9083. this.startSourceSpan = startSourceSpan;
  9084. this.endSourceSpan = endSourceSpan;
  9085. }
  9086. /**
  9087. * @param {?} visitor
  9088. * @param {?} context
  9089. * @return {?}
  9090. */
  9091. Element.prototype.visit = /**
  9092. * @param {?} visitor
  9093. * @param {?} context
  9094. * @return {?}
  9095. */
  9096. function (visitor, context) { return visitor.visitElement(this, context); };
  9097. return Element;
  9098. }());
  9099. var Comment = /** @class */ (function () {
  9100. function Comment(value, sourceSpan) {
  9101. this.value = value;
  9102. this.sourceSpan = sourceSpan;
  9103. }
  9104. /**
  9105. * @param {?} visitor
  9106. * @param {?} context
  9107. * @return {?}
  9108. */
  9109. Comment.prototype.visit = /**
  9110. * @param {?} visitor
  9111. * @param {?} context
  9112. * @return {?}
  9113. */
  9114. function (visitor, context) { return visitor.visitComment(this, context); };
  9115. return Comment;
  9116. }());
  9117. /**
  9118. * @record
  9119. */
  9120. /**
  9121. * @param {?} visitor
  9122. * @param {?} nodes
  9123. * @param {?=} context
  9124. * @return {?}
  9125. */
  9126. function visitAll(visitor, nodes, context) {
  9127. if (context === void 0) { context = null; }
  9128. var /** @type {?} */ result = [];
  9129. var /** @type {?} */ visit = visitor.visit ?
  9130. function (ast) { return ((visitor.visit))(ast, context) || ast.visit(visitor, context); } :
  9131. function (ast) { return ast.visit(visitor, context); };
  9132. nodes.forEach(function (ast) {
  9133. var /** @type {?} */ astResult = visit(ast);
  9134. if (astResult) {
  9135. result.push(astResult);
  9136. }
  9137. });
  9138. return result;
  9139. }
  9140. var RecursiveVisitor = /** @class */ (function () {
  9141. function RecursiveVisitor() {
  9142. }
  9143. /**
  9144. * @param {?} ast
  9145. * @param {?} context
  9146. * @return {?}
  9147. */
  9148. RecursiveVisitor.prototype.visitElement = /**
  9149. * @param {?} ast
  9150. * @param {?} context
  9151. * @return {?}
  9152. */
  9153. function (ast, context) {
  9154. this.visitChildren(context, function (visit) {
  9155. visit(ast.attrs);
  9156. visit(ast.children);
  9157. });
  9158. };
  9159. /**
  9160. * @param {?} ast
  9161. * @param {?} context
  9162. * @return {?}
  9163. */
  9164. RecursiveVisitor.prototype.visitAttribute = /**
  9165. * @param {?} ast
  9166. * @param {?} context
  9167. * @return {?}
  9168. */
  9169. function (ast, context) { };
  9170. /**
  9171. * @param {?} ast
  9172. * @param {?} context
  9173. * @return {?}
  9174. */
  9175. RecursiveVisitor.prototype.visitText = /**
  9176. * @param {?} ast
  9177. * @param {?} context
  9178. * @return {?}
  9179. */
  9180. function (ast, context) { };
  9181. /**
  9182. * @param {?} ast
  9183. * @param {?} context
  9184. * @return {?}
  9185. */
  9186. RecursiveVisitor.prototype.visitComment = /**
  9187. * @param {?} ast
  9188. * @param {?} context
  9189. * @return {?}
  9190. */
  9191. function (ast, context) { };
  9192. /**
  9193. * @param {?} ast
  9194. * @param {?} context
  9195. * @return {?}
  9196. */
  9197. RecursiveVisitor.prototype.visitExpansion = /**
  9198. * @param {?} ast
  9199. * @param {?} context
  9200. * @return {?}
  9201. */
  9202. function (ast, context) {
  9203. return this.visitChildren(context, function (visit) { visit(ast.cases); });
  9204. };
  9205. /**
  9206. * @param {?} ast
  9207. * @param {?} context
  9208. * @return {?}
  9209. */
  9210. RecursiveVisitor.prototype.visitExpansionCase = /**
  9211. * @param {?} ast
  9212. * @param {?} context
  9213. * @return {?}
  9214. */
  9215. function (ast, context) { };
  9216. /**
  9217. * @template T
  9218. * @param {?} context
  9219. * @param {?} cb
  9220. * @return {?}
  9221. */
  9222. RecursiveVisitor.prototype.visitChildren = /**
  9223. * @template T
  9224. * @param {?} context
  9225. * @param {?} cb
  9226. * @return {?}
  9227. */
  9228. function (context, cb) {
  9229. var /** @type {?} */ results = [];
  9230. var /** @type {?} */ t = this;
  9231. /**
  9232. * @template T
  9233. * @param {?} children
  9234. * @return {?}
  9235. */
  9236. function visit(children) {
  9237. if (children)
  9238. results.push(visitAll(t, children, context));
  9239. }
  9240. cb(visit);
  9241. return [].concat.apply([], results);
  9242. };
  9243. return RecursiveVisitor;
  9244. }());
  9245. /**
  9246. * @param {?} ast
  9247. * @return {?}
  9248. */
  9249. function spanOf(ast) {
  9250. var /** @type {?} */ start = ast.sourceSpan.start.offset;
  9251. var /** @type {?} */ end = ast.sourceSpan.end.offset;
  9252. if (ast instanceof Element) {
  9253. if (ast.endSourceSpan) {
  9254. end = ast.endSourceSpan.end.offset;
  9255. }
  9256. else if (ast.children && ast.children.length) {
  9257. end = spanOf(ast.children[ast.children.length - 1]).end;
  9258. }
  9259. }
  9260. return { start: start, end: end };
  9261. }
  9262. /**
  9263. * @param {?} nodes
  9264. * @param {?} position
  9265. * @return {?}
  9266. */
  9267. function findNode(nodes, position) {
  9268. var /** @type {?} */ path = [];
  9269. var /** @type {?} */ visitor = new /** @class */ (function (_super) {
  9270. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(class_1, _super);
  9271. function class_1() {
  9272. return _super !== null && _super.apply(this, arguments) || this;
  9273. }
  9274. /**
  9275. * @param {?} ast
  9276. * @param {?} context
  9277. * @return {?}
  9278. */
  9279. class_1.prototype.visit = /**
  9280. * @param {?} ast
  9281. * @param {?} context
  9282. * @return {?}
  9283. */
  9284. function (ast, context) {
  9285. var /** @type {?} */ span = spanOf(ast);
  9286. if (span.start <= position && position < span.end) {
  9287. path.push(ast);
  9288. }
  9289. else {
  9290. // Returning a value here will result in the children being skipped.
  9291. return true;
  9292. }
  9293. };
  9294. return class_1;
  9295. }(RecursiveVisitor));
  9296. visitAll(visitor, nodes);
  9297. return new AstPath(path, position);
  9298. }
  9299. /**
  9300. * @fileoverview added by tsickle
  9301. * @suppress {checkTypes} checked by tsc
  9302. */
  9303. /**
  9304. * @license
  9305. * Copyright Google Inc. All Rights Reserved.
  9306. *
  9307. * Use of this source code is governed by an MIT-style license that can be
  9308. * found in the LICENSE file at https://angular.io/license
  9309. */
  9310. /**
  9311. * @param {?} identifier
  9312. * @param {?} value
  9313. * @return {?}
  9314. */
  9315. function assertArrayOfStrings(identifier, value) {
  9316. if (value == null) {
  9317. return;
  9318. }
  9319. if (!Array.isArray(value)) {
  9320. throw new Error("Expected '" + identifier + "' to be an array of strings.");
  9321. }
  9322. for (var /** @type {?} */ i = 0; i < value.length; i += 1) {
  9323. if (typeof value[i] !== 'string') {
  9324. throw new Error("Expected '" + identifier + "' to be an array of strings.");
  9325. }
  9326. }
  9327. }
  9328. var INTERPOLATION_BLACKLIST_REGEXPS = [
  9329. /^\s*$/,
  9330. /[<>]/,
  9331. /^[{}]$/,
  9332. /&(#|[a-z])/i,
  9333. /^\/\//,
  9334. ];
  9335. /**
  9336. * @param {?} identifier
  9337. * @param {?} value
  9338. * @return {?}
  9339. */
  9340. function assertInterpolationSymbols(identifier, value) {
  9341. if (value != null && !(Array.isArray(value) && value.length == 2)) {
  9342. throw new Error("Expected '" + identifier + "' to be an array, [start, end].");
  9343. }
  9344. else if (value != null) {
  9345. var /** @type {?} */ start_1 = /** @type {?} */ (value[0]);
  9346. var /** @type {?} */ end_1 = /** @type {?} */ (value[1]);
  9347. // black list checking
  9348. INTERPOLATION_BLACKLIST_REGEXPS.forEach(function (regexp) {
  9349. if (regexp.test(start_1) || regexp.test(end_1)) {
  9350. throw new Error("['" + start_1 + "', '" + end_1 + "'] contains unusable interpolation symbol.");
  9351. }
  9352. });
  9353. }
  9354. }
  9355. /**
  9356. * @fileoverview added by tsickle
  9357. * @suppress {checkTypes} checked by tsc
  9358. */
  9359. /**
  9360. * @license
  9361. * Copyright Google Inc. All Rights Reserved.
  9362. *
  9363. * Use of this source code is governed by an MIT-style license that can be
  9364. * found in the LICENSE file at https://angular.io/license
  9365. */
  9366. var InterpolationConfig = /** @class */ (function () {
  9367. function InterpolationConfig(start, end) {
  9368. this.start = start;
  9369. this.end = end;
  9370. }
  9371. /**
  9372. * @param {?} markers
  9373. * @return {?}
  9374. */
  9375. InterpolationConfig.fromArray = /**
  9376. * @param {?} markers
  9377. * @return {?}
  9378. */
  9379. function (markers) {
  9380. if (!markers) {
  9381. return DEFAULT_INTERPOLATION_CONFIG;
  9382. }
  9383. assertInterpolationSymbols('interpolation', markers);
  9384. return new InterpolationConfig(markers[0], markers[1]);
  9385. };
  9386. return InterpolationConfig;
  9387. }());
  9388. var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');
  9389. /**
  9390. * @fileoverview added by tsickle
  9391. * @suppress {checkTypes} checked by tsc
  9392. */
  9393. /**
  9394. * @license
  9395. * Copyright Google Inc. All Rights Reserved.
  9396. *
  9397. * Use of this source code is governed by an MIT-style license that can be
  9398. * found in the LICENSE file at https://angular.io/license
  9399. */
  9400. var StyleWithImports = /** @class */ (function () {
  9401. function StyleWithImports(style, styleUrls) {
  9402. this.style = style;
  9403. this.styleUrls = styleUrls;
  9404. }
  9405. return StyleWithImports;
  9406. }());
  9407. /**
  9408. * @param {?} url
  9409. * @return {?}
  9410. */
  9411. function isStyleUrlResolvable(url) {
  9412. if (url == null || url.length === 0 || url[0] == '/')
  9413. return false;
  9414. var /** @type {?} */ schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP);
  9415. return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset';
  9416. }
  9417. /**
  9418. * Rewrites stylesheets by resolving and removing the \@import urls that
  9419. * are either relative or don't have a `package:` scheme
  9420. * @param {?} resolver
  9421. * @param {?} baseUrl
  9422. * @param {?} cssText
  9423. * @return {?}
  9424. */
  9425. function extractStyleUrls(resolver, baseUrl, cssText) {
  9426. var /** @type {?} */ foundUrls = [];
  9427. var /** @type {?} */ modifiedCssText = cssText.replace(CSS_STRIPPABLE_COMMENT_REGEXP, '')
  9428. .replace(CSS_IMPORT_REGEXP, function () {
  9429. var m = [];
  9430. for (var _i = 0; _i < arguments.length; _i++) {
  9431. m[_i] = arguments[_i];
  9432. }
  9433. var /** @type {?} */ url = m[1] || m[2];
  9434. if (!isStyleUrlResolvable(url)) {
  9435. // Do not attempt to resolve non-package absolute URLs with URI
  9436. // scheme
  9437. return m[0];
  9438. }
  9439. foundUrls.push(resolver.resolve(baseUrl, url));
  9440. return '';
  9441. });
  9442. return new StyleWithImports(modifiedCssText, foundUrls);
  9443. }
  9444. var CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g;
  9445. var CSS_STRIPPABLE_COMMENT_REGEXP = /\/\*(?!#\s*(?:sourceURL|sourceMappingURL)=)[\s\S]+?\*\//g;
  9446. var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
  9447. /**
  9448. * @fileoverview added by tsickle
  9449. * @suppress {checkTypes} checked by tsc
  9450. */
  9451. /**
  9452. * @license
  9453. * Copyright Google Inc. All Rights Reserved.
  9454. *
  9455. * Use of this source code is governed by an MIT-style license that can be
  9456. * found in the LICENSE file at https://angular.io/license
  9457. */
  9458. /** @enum {number} */
  9459. var TagContentType = {
  9460. RAW_TEXT: 0,
  9461. ESCAPABLE_RAW_TEXT: 1,
  9462. PARSABLE_DATA: 2,
  9463. };
  9464. TagContentType[TagContentType.RAW_TEXT] = "RAW_TEXT";
  9465. TagContentType[TagContentType.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT";
  9466. TagContentType[TagContentType.PARSABLE_DATA] = "PARSABLE_DATA";
  9467. /**
  9468. * @record
  9469. */
  9470. /**
  9471. * @param {?} elementName
  9472. * @return {?}
  9473. */
  9474. function splitNsName(elementName) {
  9475. if (elementName[0] != ':') {
  9476. return [null, elementName];
  9477. }
  9478. var /** @type {?} */ colonIndex = elementName.indexOf(':', 1);
  9479. if (colonIndex == -1) {
  9480. throw new Error("Unsupported format \"" + elementName + "\" expecting \":namespace:name\"");
  9481. }
  9482. return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
  9483. }
  9484. /**
  9485. * @param {?} tagName
  9486. * @return {?}
  9487. */
  9488. function isNgContainer(tagName) {
  9489. return splitNsName(tagName)[1] === 'ng-container';
  9490. }
  9491. /**
  9492. * @param {?} tagName
  9493. * @return {?}
  9494. */
  9495. function isNgContent(tagName) {
  9496. return splitNsName(tagName)[1] === 'ng-content';
  9497. }
  9498. /**
  9499. * @param {?} tagName
  9500. * @return {?}
  9501. */
  9502. function isNgTemplate(tagName) {
  9503. return splitNsName(tagName)[1] === 'ng-template';
  9504. }
  9505. /**
  9506. * @param {?} fullName
  9507. * @return {?}
  9508. */
  9509. function getNsPrefix(fullName) {
  9510. return fullName === null ? null : splitNsName(fullName)[0];
  9511. }
  9512. /**
  9513. * @param {?} prefix
  9514. * @param {?} localName
  9515. * @return {?}
  9516. */
  9517. function mergeNsAndName(prefix, localName) {
  9518. return prefix ? ":" + prefix + ":" + localName : localName;
  9519. }
  9520. // see http://www.w3.org/TR/html51/syntax.html#named-character-references
  9521. // see https://html.spec.whatwg.org/multipage/entities.json
  9522. // This list is not exhaustive to keep the compiler footprint low.
  9523. // The `&#123;` / `&#x1ab;` syntax should be used when the named character reference does not
  9524. // exist.
  9525. var NAMED_ENTITIES = {
  9526. 'Aacute': '\u00C1',
  9527. 'aacute': '\u00E1',
  9528. 'Acirc': '\u00C2',
  9529. 'acirc': '\u00E2',
  9530. 'acute': '\u00B4',
  9531. 'AElig': '\u00C6',
  9532. 'aelig': '\u00E6',
  9533. 'Agrave': '\u00C0',
  9534. 'agrave': '\u00E0',
  9535. 'alefsym': '\u2135',
  9536. 'Alpha': '\u0391',
  9537. 'alpha': '\u03B1',
  9538. 'amp': '&',
  9539. 'and': '\u2227',
  9540. 'ang': '\u2220',
  9541. 'apos': '\u0027',
  9542. 'Aring': '\u00C5',
  9543. 'aring': '\u00E5',
  9544. 'asymp': '\u2248',
  9545. 'Atilde': '\u00C3',
  9546. 'atilde': '\u00E3',
  9547. 'Auml': '\u00C4',
  9548. 'auml': '\u00E4',
  9549. 'bdquo': '\u201E',
  9550. 'Beta': '\u0392',
  9551. 'beta': '\u03B2',
  9552. 'brvbar': '\u00A6',
  9553. 'bull': '\u2022',
  9554. 'cap': '\u2229',
  9555. 'Ccedil': '\u00C7',
  9556. 'ccedil': '\u00E7',
  9557. 'cedil': '\u00B8',
  9558. 'cent': '\u00A2',
  9559. 'Chi': '\u03A7',
  9560. 'chi': '\u03C7',
  9561. 'circ': '\u02C6',
  9562. 'clubs': '\u2663',
  9563. 'cong': '\u2245',
  9564. 'copy': '\u00A9',
  9565. 'crarr': '\u21B5',
  9566. 'cup': '\u222A',
  9567. 'curren': '\u00A4',
  9568. 'dagger': '\u2020',
  9569. 'Dagger': '\u2021',
  9570. 'darr': '\u2193',
  9571. 'dArr': '\u21D3',
  9572. 'deg': '\u00B0',
  9573. 'Delta': '\u0394',
  9574. 'delta': '\u03B4',
  9575. 'diams': '\u2666',
  9576. 'divide': '\u00F7',
  9577. 'Eacute': '\u00C9',
  9578. 'eacute': '\u00E9',
  9579. 'Ecirc': '\u00CA',
  9580. 'ecirc': '\u00EA',
  9581. 'Egrave': '\u00C8',
  9582. 'egrave': '\u00E8',
  9583. 'empty': '\u2205',
  9584. 'emsp': '\u2003',
  9585. 'ensp': '\u2002',
  9586. 'Epsilon': '\u0395',
  9587. 'epsilon': '\u03B5',
  9588. 'equiv': '\u2261',
  9589. 'Eta': '\u0397',
  9590. 'eta': '\u03B7',
  9591. 'ETH': '\u00D0',
  9592. 'eth': '\u00F0',
  9593. 'Euml': '\u00CB',
  9594. 'euml': '\u00EB',
  9595. 'euro': '\u20AC',
  9596. 'exist': '\u2203',
  9597. 'fnof': '\u0192',
  9598. 'forall': '\u2200',
  9599. 'frac12': '\u00BD',
  9600. 'frac14': '\u00BC',
  9601. 'frac34': '\u00BE',
  9602. 'frasl': '\u2044',
  9603. 'Gamma': '\u0393',
  9604. 'gamma': '\u03B3',
  9605. 'ge': '\u2265',
  9606. 'gt': '>',
  9607. 'harr': '\u2194',
  9608. 'hArr': '\u21D4',
  9609. 'hearts': '\u2665',
  9610. 'hellip': '\u2026',
  9611. 'Iacute': '\u00CD',
  9612. 'iacute': '\u00ED',
  9613. 'Icirc': '\u00CE',
  9614. 'icirc': '\u00EE',
  9615. 'iexcl': '\u00A1',
  9616. 'Igrave': '\u00CC',
  9617. 'igrave': '\u00EC',
  9618. 'image': '\u2111',
  9619. 'infin': '\u221E',
  9620. 'int': '\u222B',
  9621. 'Iota': '\u0399',
  9622. 'iota': '\u03B9',
  9623. 'iquest': '\u00BF',
  9624. 'isin': '\u2208',
  9625. 'Iuml': '\u00CF',
  9626. 'iuml': '\u00EF',
  9627. 'Kappa': '\u039A',
  9628. 'kappa': '\u03BA',
  9629. 'Lambda': '\u039B',
  9630. 'lambda': '\u03BB',
  9631. 'lang': '\u27E8',
  9632. 'laquo': '\u00AB',
  9633. 'larr': '\u2190',
  9634. 'lArr': '\u21D0',
  9635. 'lceil': '\u2308',
  9636. 'ldquo': '\u201C',
  9637. 'le': '\u2264',
  9638. 'lfloor': '\u230A',
  9639. 'lowast': '\u2217',
  9640. 'loz': '\u25CA',
  9641. 'lrm': '\u200E',
  9642. 'lsaquo': '\u2039',
  9643. 'lsquo': '\u2018',
  9644. 'lt': '<',
  9645. 'macr': '\u00AF',
  9646. 'mdash': '\u2014',
  9647. 'micro': '\u00B5',
  9648. 'middot': '\u00B7',
  9649. 'minus': '\u2212',
  9650. 'Mu': '\u039C',
  9651. 'mu': '\u03BC',
  9652. 'nabla': '\u2207',
  9653. 'nbsp': '\u00A0',
  9654. 'ndash': '\u2013',
  9655. 'ne': '\u2260',
  9656. 'ni': '\u220B',
  9657. 'not': '\u00AC',
  9658. 'notin': '\u2209',
  9659. 'nsub': '\u2284',
  9660. 'Ntilde': '\u00D1',
  9661. 'ntilde': '\u00F1',
  9662. 'Nu': '\u039D',
  9663. 'nu': '\u03BD',
  9664. 'Oacute': '\u00D3',
  9665. 'oacute': '\u00F3',
  9666. 'Ocirc': '\u00D4',
  9667. 'ocirc': '\u00F4',
  9668. 'OElig': '\u0152',
  9669. 'oelig': '\u0153',
  9670. 'Ograve': '\u00D2',
  9671. 'ograve': '\u00F2',
  9672. 'oline': '\u203E',
  9673. 'Omega': '\u03A9',
  9674. 'omega': '\u03C9',
  9675. 'Omicron': '\u039F',
  9676. 'omicron': '\u03BF',
  9677. 'oplus': '\u2295',
  9678. 'or': '\u2228',
  9679. 'ordf': '\u00AA',
  9680. 'ordm': '\u00BA',
  9681. 'Oslash': '\u00D8',
  9682. 'oslash': '\u00F8',
  9683. 'Otilde': '\u00D5',
  9684. 'otilde': '\u00F5',
  9685. 'otimes': '\u2297',
  9686. 'Ouml': '\u00D6',
  9687. 'ouml': '\u00F6',
  9688. 'para': '\u00B6',
  9689. 'permil': '\u2030',
  9690. 'perp': '\u22A5',
  9691. 'Phi': '\u03A6',
  9692. 'phi': '\u03C6',
  9693. 'Pi': '\u03A0',
  9694. 'pi': '\u03C0',
  9695. 'piv': '\u03D6',
  9696. 'plusmn': '\u00B1',
  9697. 'pound': '\u00A3',
  9698. 'prime': '\u2032',
  9699. 'Prime': '\u2033',
  9700. 'prod': '\u220F',
  9701. 'prop': '\u221D',
  9702. 'Psi': '\u03A8',
  9703. 'psi': '\u03C8',
  9704. 'quot': '\u0022',
  9705. 'radic': '\u221A',
  9706. 'rang': '\u27E9',
  9707. 'raquo': '\u00BB',
  9708. 'rarr': '\u2192',
  9709. 'rArr': '\u21D2',
  9710. 'rceil': '\u2309',
  9711. 'rdquo': '\u201D',
  9712. 'real': '\u211C',
  9713. 'reg': '\u00AE',
  9714. 'rfloor': '\u230B',
  9715. 'Rho': '\u03A1',
  9716. 'rho': '\u03C1',
  9717. 'rlm': '\u200F',
  9718. 'rsaquo': '\u203A',
  9719. 'rsquo': '\u2019',
  9720. 'sbquo': '\u201A',
  9721. 'Scaron': '\u0160',
  9722. 'scaron': '\u0161',
  9723. 'sdot': '\u22C5',
  9724. 'sect': '\u00A7',
  9725. 'shy': '\u00AD',
  9726. 'Sigma': '\u03A3',
  9727. 'sigma': '\u03C3',
  9728. 'sigmaf': '\u03C2',
  9729. 'sim': '\u223C',
  9730. 'spades': '\u2660',
  9731. 'sub': '\u2282',
  9732. 'sube': '\u2286',
  9733. 'sum': '\u2211',
  9734. 'sup': '\u2283',
  9735. 'sup1': '\u00B9',
  9736. 'sup2': '\u00B2',
  9737. 'sup3': '\u00B3',
  9738. 'supe': '\u2287',
  9739. 'szlig': '\u00DF',
  9740. 'Tau': '\u03A4',
  9741. 'tau': '\u03C4',
  9742. 'there4': '\u2234',
  9743. 'Theta': '\u0398',
  9744. 'theta': '\u03B8',
  9745. 'thetasym': '\u03D1',
  9746. 'thinsp': '\u2009',
  9747. 'THORN': '\u00DE',
  9748. 'thorn': '\u00FE',
  9749. 'tilde': '\u02DC',
  9750. 'times': '\u00D7',
  9751. 'trade': '\u2122',
  9752. 'Uacute': '\u00DA',
  9753. 'uacute': '\u00FA',
  9754. 'uarr': '\u2191',
  9755. 'uArr': '\u21D1',
  9756. 'Ucirc': '\u00DB',
  9757. 'ucirc': '\u00FB',
  9758. 'Ugrave': '\u00D9',
  9759. 'ugrave': '\u00F9',
  9760. 'uml': '\u00A8',
  9761. 'upsih': '\u03D2',
  9762. 'Upsilon': '\u03A5',
  9763. 'upsilon': '\u03C5',
  9764. 'Uuml': '\u00DC',
  9765. 'uuml': '\u00FC',
  9766. 'weierp': '\u2118',
  9767. 'Xi': '\u039E',
  9768. 'xi': '\u03BE',
  9769. 'Yacute': '\u00DD',
  9770. 'yacute': '\u00FD',
  9771. 'yen': '\u00A5',
  9772. 'yuml': '\u00FF',
  9773. 'Yuml': '\u0178',
  9774. 'Zeta': '\u0396',
  9775. 'zeta': '\u03B6',
  9776. 'zwj': '\u200D',
  9777. 'zwnj': '\u200C',
  9778. };
  9779. // The &ngsp; pseudo-entity is denoting a space. see:
  9780. // https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart
  9781. var NGSP_UNICODE = '\uE500';
  9782. NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
  9783. /**
  9784. * @fileoverview added by tsickle
  9785. * @suppress {checkTypes} checked by tsc
  9786. */
  9787. /**
  9788. * @license
  9789. * Copyright Google Inc. All Rights Reserved.
  9790. *
  9791. * Use of this source code is governed by an MIT-style license that can be
  9792. * found in the LICENSE file at https://angular.io/license
  9793. */
  9794. var NG_CONTENT_SELECT_ATTR = 'select';
  9795. var LINK_ELEMENT = 'link';
  9796. var LINK_STYLE_REL_ATTR = 'rel';
  9797. var LINK_STYLE_HREF_ATTR = 'href';
  9798. var LINK_STYLE_REL_VALUE = 'stylesheet';
  9799. var STYLE_ELEMENT = 'style';
  9800. var SCRIPT_ELEMENT = 'script';
  9801. var NG_NON_BINDABLE_ATTR = 'ngNonBindable';
  9802. var NG_PROJECT_AS = 'ngProjectAs';
  9803. /**
  9804. * @param {?} ast
  9805. * @return {?}
  9806. */
  9807. function preparseElement(ast) {
  9808. var /** @type {?} */ selectAttr = /** @type {?} */ ((null));
  9809. var /** @type {?} */ hrefAttr = /** @type {?} */ ((null));
  9810. var /** @type {?} */ relAttr = /** @type {?} */ ((null));
  9811. var /** @type {?} */ nonBindable = false;
  9812. var /** @type {?} */ projectAs = /** @type {?} */ ((null));
  9813. ast.attrs.forEach(function (attr) {
  9814. var /** @type {?} */ lcAttrName = attr.name.toLowerCase();
  9815. if (lcAttrName == NG_CONTENT_SELECT_ATTR) {
  9816. selectAttr = attr.value;
  9817. }
  9818. else if (lcAttrName == LINK_STYLE_HREF_ATTR) {
  9819. hrefAttr = attr.value;
  9820. }
  9821. else if (lcAttrName == LINK_STYLE_REL_ATTR) {
  9822. relAttr = attr.value;
  9823. }
  9824. else if (attr.name == NG_NON_BINDABLE_ATTR) {
  9825. nonBindable = true;
  9826. }
  9827. else if (attr.name == NG_PROJECT_AS) {
  9828. if (attr.value.length > 0) {
  9829. projectAs = attr.value;
  9830. }
  9831. }
  9832. });
  9833. selectAttr = normalizeNgContentSelect(selectAttr);
  9834. var /** @type {?} */ nodeName = ast.name.toLowerCase();
  9835. var /** @type {?} */ type = PreparsedElementType.OTHER;
  9836. if (isNgContent(nodeName)) {
  9837. type = PreparsedElementType.NG_CONTENT;
  9838. }
  9839. else if (nodeName == STYLE_ELEMENT) {
  9840. type = PreparsedElementType.STYLE;
  9841. }
  9842. else if (nodeName == SCRIPT_ELEMENT) {
  9843. type = PreparsedElementType.SCRIPT;
  9844. }
  9845. else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) {
  9846. type = PreparsedElementType.STYLESHEET;
  9847. }
  9848. return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs);
  9849. }
  9850. /** @enum {number} */
  9851. var PreparsedElementType = {
  9852. NG_CONTENT: 0,
  9853. STYLE: 1,
  9854. STYLESHEET: 2,
  9855. SCRIPT: 3,
  9856. OTHER: 4,
  9857. };
  9858. PreparsedElementType[PreparsedElementType.NG_CONTENT] = "NG_CONTENT";
  9859. PreparsedElementType[PreparsedElementType.STYLE] = "STYLE";
  9860. PreparsedElementType[PreparsedElementType.STYLESHEET] = "STYLESHEET";
  9861. PreparsedElementType[PreparsedElementType.SCRIPT] = "SCRIPT";
  9862. PreparsedElementType[PreparsedElementType.OTHER] = "OTHER";
  9863. var PreparsedElement = /** @class */ (function () {
  9864. function PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs) {
  9865. this.type = type;
  9866. this.selectAttr = selectAttr;
  9867. this.hrefAttr = hrefAttr;
  9868. this.nonBindable = nonBindable;
  9869. this.projectAs = projectAs;
  9870. }
  9871. return PreparsedElement;
  9872. }());
  9873. /**
  9874. * @param {?} selectAttr
  9875. * @return {?}
  9876. */
  9877. function normalizeNgContentSelect(selectAttr) {
  9878. if (selectAttr === null || selectAttr.length === 0) {
  9879. return '*';
  9880. }
  9881. return selectAttr;
  9882. }
  9883. /**
  9884. * @fileoverview added by tsickle
  9885. * @suppress {checkTypes} checked by tsc
  9886. */
  9887. /**
  9888. * @license
  9889. * Copyright Google Inc. All Rights Reserved.
  9890. *
  9891. * Use of this source code is governed by an MIT-style license that can be
  9892. * found in the LICENSE file at https://angular.io/license
  9893. */
  9894. /**
  9895. * @record
  9896. */
  9897. var DirectiveNormalizer = /** @class */ (function () {
  9898. function DirectiveNormalizer(_resourceLoader, _urlResolver, _htmlParser, _config) {
  9899. this._resourceLoader = _resourceLoader;
  9900. this._urlResolver = _urlResolver;
  9901. this._htmlParser = _htmlParser;
  9902. this._config = _config;
  9903. this._resourceLoaderCache = new Map();
  9904. }
  9905. /**
  9906. * @return {?}
  9907. */
  9908. DirectiveNormalizer.prototype.clearCache = /**
  9909. * @return {?}
  9910. */
  9911. function () { this._resourceLoaderCache.clear(); };
  9912. /**
  9913. * @param {?} normalizedDirective
  9914. * @return {?}
  9915. */
  9916. DirectiveNormalizer.prototype.clearCacheFor = /**
  9917. * @param {?} normalizedDirective
  9918. * @return {?}
  9919. */
  9920. function (normalizedDirective) {
  9921. var _this = this;
  9922. if (!normalizedDirective.isComponent) {
  9923. return;
  9924. }
  9925. var /** @type {?} */ template = /** @type {?} */ ((normalizedDirective.template));
  9926. this._resourceLoaderCache.delete(/** @type {?} */ ((template.templateUrl)));
  9927. template.externalStylesheets.forEach(function (stylesheet) { _this._resourceLoaderCache.delete(/** @type {?} */ ((stylesheet.moduleUrl))); });
  9928. };
  9929. /**
  9930. * @param {?} url
  9931. * @return {?}
  9932. */
  9933. DirectiveNormalizer.prototype._fetch = /**
  9934. * @param {?} url
  9935. * @return {?}
  9936. */
  9937. function (url) {
  9938. var /** @type {?} */ result = this._resourceLoaderCache.get(url);
  9939. if (!result) {
  9940. result = this._resourceLoader.get(url);
  9941. this._resourceLoaderCache.set(url, result);
  9942. }
  9943. return result;
  9944. };
  9945. /**
  9946. * @param {?} prenormData
  9947. * @return {?}
  9948. */
  9949. DirectiveNormalizer.prototype.normalizeTemplate = /**
  9950. * @param {?} prenormData
  9951. * @return {?}
  9952. */
  9953. function (prenormData) {
  9954. var _this = this;
  9955. if (isDefined(prenormData.template)) {
  9956. if (isDefined(prenormData.templateUrl)) {
  9957. throw syntaxError("'" + stringify(prenormData.componentType) + "' component cannot define both template and templateUrl");
  9958. }
  9959. if (typeof prenormData.template !== 'string') {
  9960. throw syntaxError("The template specified for component " + stringify(prenormData.componentType) + " is not a string");
  9961. }
  9962. }
  9963. else if (isDefined(prenormData.templateUrl)) {
  9964. if (typeof prenormData.templateUrl !== 'string') {
  9965. throw syntaxError("The templateUrl specified for component " + stringify(prenormData.componentType) + " is not a string");
  9966. }
  9967. }
  9968. else {
  9969. throw syntaxError("No template specified for component " + stringify(prenormData.componentType));
  9970. }
  9971. if (isDefined(prenormData.preserveWhitespaces) &&
  9972. typeof prenormData.preserveWhitespaces !== 'boolean') {
  9973. throw syntaxError("The preserveWhitespaces option for component " + stringify(prenormData.componentType) + " must be a boolean");
  9974. }
  9975. return SyncAsync.then(this._preParseTemplate(prenormData), function (preparsedTemplate) { return _this._normalizeTemplateMetadata(prenormData, preparsedTemplate); });
  9976. };
  9977. /**
  9978. * @param {?} prenomData
  9979. * @return {?}
  9980. */
  9981. DirectiveNormalizer.prototype._preParseTemplate = /**
  9982. * @param {?} prenomData
  9983. * @return {?}
  9984. */
  9985. function (prenomData) {
  9986. var _this = this;
  9987. var /** @type {?} */ template;
  9988. var /** @type {?} */ templateUrl;
  9989. if (prenomData.template != null) {
  9990. template = prenomData.template;
  9991. templateUrl = prenomData.moduleUrl;
  9992. }
  9993. else {
  9994. templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, /** @type {?} */ ((prenomData.templateUrl)));
  9995. template = this._fetch(templateUrl);
  9996. }
  9997. return SyncAsync.then(template, function (template) { return _this._preparseLoadedTemplate(prenomData, template, templateUrl); });
  9998. };
  9999. /**
  10000. * @param {?} prenormData
  10001. * @param {?} template
  10002. * @param {?} templateAbsUrl
  10003. * @return {?}
  10004. */
  10005. DirectiveNormalizer.prototype._preparseLoadedTemplate = /**
  10006. * @param {?} prenormData
  10007. * @param {?} template
  10008. * @param {?} templateAbsUrl
  10009. * @return {?}
  10010. */
  10011. function (prenormData, template, templateAbsUrl) {
  10012. var /** @type {?} */ isInline = !!prenormData.template;
  10013. var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((prenormData.interpolation)));
  10014. var /** @type {?} */ rootNodesAndErrors = this._htmlParser.parse(template, templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline: isInline, templateUrl: templateAbsUrl }), true, interpolationConfig);
  10015. if (rootNodesAndErrors.errors.length > 0) {
  10016. var /** @type {?} */ errorString = rootNodesAndErrors.errors.join('\n');
  10017. throw syntaxError("Template parse errors:\n" + errorString);
  10018. }
  10019. var /** @type {?} */ templateMetadataStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl }));
  10020. var /** @type {?} */ visitor = new TemplatePreparseVisitor();
  10021. visitAll(visitor, rootNodesAndErrors.rootNodes);
  10022. var /** @type {?} */ templateStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl }));
  10023. var /** @type {?} */ styles = templateMetadataStyles.styles.concat(templateStyles.styles);
  10024. var /** @type {?} */ inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls);
  10025. var /** @type {?} */ styleUrls = this
  10026. ._normalizeStylesheet(new CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl }))
  10027. .styleUrls;
  10028. return {
  10029. template: template,
  10030. templateUrl: templateAbsUrl, isInline: isInline,
  10031. htmlAst: rootNodesAndErrors, styles: styles, inlineStyleUrls: inlineStyleUrls, styleUrls: styleUrls,
  10032. ngContentSelectors: visitor.ngContentSelectors,
  10033. };
  10034. };
  10035. /**
  10036. * @param {?} prenormData
  10037. * @param {?} preparsedTemplate
  10038. * @return {?}
  10039. */
  10040. DirectiveNormalizer.prototype._normalizeTemplateMetadata = /**
  10041. * @param {?} prenormData
  10042. * @param {?} preparsedTemplate
  10043. * @return {?}
  10044. */
  10045. function (prenormData, preparsedTemplate) {
  10046. var _this = this;
  10047. return SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), function (externalStylesheets) {
  10048. return _this._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets);
  10049. });
  10050. };
  10051. /**
  10052. * @param {?} prenormData
  10053. * @param {?} preparsedTemplate
  10054. * @param {?} stylesheets
  10055. * @return {?}
  10056. */
  10057. DirectiveNormalizer.prototype._normalizeLoadedTemplateMetadata = /**
  10058. * @param {?} prenormData
  10059. * @param {?} preparsedTemplate
  10060. * @param {?} stylesheets
  10061. * @return {?}
  10062. */
  10063. function (prenormData, preparsedTemplate, stylesheets) {
  10064. var _this = this;
  10065. // Algorithm:
  10066. // - produce exactly 1 entry per original styleUrl in
  10067. // CompileTemplateMetadata.externalStylesheets whith all styles inlined
  10068. // - inline all styles that are referenced by the template into CompileTemplateMetadata.styles.
  10069. // Reason: be able to determine how many stylesheets there are even without loading
  10070. // the template nor the stylesheets, so we can create a stub for TypeScript always synchronously
  10071. // (as resouce loading may be async)
  10072. var /** @type {?} */ styles = preparsedTemplate.styles.slice();
  10073. this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles);
  10074. var /** @type {?} */ styleUrls = preparsedTemplate.styleUrls;
  10075. var /** @type {?} */ externalStylesheets = styleUrls.map(function (styleUrl) {
  10076. var /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl)));
  10077. var /** @type {?} */ styles = stylesheet.styles.slice();
  10078. _this._inlineStyles(stylesheet.styleUrls, stylesheets, styles);
  10079. return new CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles });
  10080. });
  10081. var /** @type {?} */ encapsulation = prenormData.encapsulation;
  10082. if (encapsulation == null) {
  10083. encapsulation = this._config.defaultEncapsulation;
  10084. }
  10085. if (encapsulation === ViewEncapsulation.Emulated && styles.length === 0 &&
  10086. styleUrls.length === 0) {
  10087. encapsulation = ViewEncapsulation.None;
  10088. }
  10089. return new CompileTemplateMetadata({
  10090. encapsulation: encapsulation,
  10091. template: preparsedTemplate.template,
  10092. templateUrl: preparsedTemplate.templateUrl,
  10093. htmlAst: preparsedTemplate.htmlAst, styles: styles, styleUrls: styleUrls,
  10094. ngContentSelectors: preparsedTemplate.ngContentSelectors,
  10095. animations: prenormData.animations,
  10096. interpolation: prenormData.interpolation,
  10097. isInline: preparsedTemplate.isInline, externalStylesheets: externalStylesheets,
  10098. preserveWhitespaces: preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces),
  10099. });
  10100. };
  10101. /**
  10102. * @param {?} styleUrls
  10103. * @param {?} stylesheets
  10104. * @param {?} targetStyles
  10105. * @return {?}
  10106. */
  10107. DirectiveNormalizer.prototype._inlineStyles = /**
  10108. * @param {?} styleUrls
  10109. * @param {?} stylesheets
  10110. * @param {?} targetStyles
  10111. * @return {?}
  10112. */
  10113. function (styleUrls, stylesheets, targetStyles) {
  10114. var _this = this;
  10115. styleUrls.forEach(function (styleUrl) {
  10116. var /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl)));
  10117. stylesheet.styles.forEach(function (style) { return targetStyles.push(style); });
  10118. _this._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles);
  10119. });
  10120. };
  10121. /**
  10122. * @param {?} styleUrls
  10123. * @param {?=} loadedStylesheets
  10124. * @return {?}
  10125. */
  10126. DirectiveNormalizer.prototype._loadMissingExternalStylesheets = /**
  10127. * @param {?} styleUrls
  10128. * @param {?=} loadedStylesheets
  10129. * @return {?}
  10130. */
  10131. function (styleUrls, loadedStylesheets) {
  10132. var _this = this;
  10133. if (loadedStylesheets === void 0) { loadedStylesheets = new Map(); }
  10134. return SyncAsync.then(SyncAsync.all(styleUrls.filter(function (styleUrl) { return !loadedStylesheets.has(styleUrl); })
  10135. .map(function (styleUrl) {
  10136. return SyncAsync.then(_this._fetch(styleUrl), function (loadedStyle) {
  10137. var /** @type {?} */ stylesheet = _this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl }));
  10138. loadedStylesheets.set(styleUrl, stylesheet);
  10139. return _this._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets);
  10140. });
  10141. })), function (_) { return loadedStylesheets; });
  10142. };
  10143. /**
  10144. * @param {?} stylesheet
  10145. * @return {?}
  10146. */
  10147. DirectiveNormalizer.prototype._normalizeStylesheet = /**
  10148. * @param {?} stylesheet
  10149. * @return {?}
  10150. */
  10151. function (stylesheet) {
  10152. var _this = this;
  10153. var /** @type {?} */ moduleUrl = /** @type {?} */ ((stylesheet.moduleUrl));
  10154. var /** @type {?} */ allStyleUrls = stylesheet.styleUrls.filter(isStyleUrlResolvable)
  10155. .map(function (url) { return _this._urlResolver.resolve(moduleUrl, url); });
  10156. var /** @type {?} */ allStyles = stylesheet.styles.map(function (style) {
  10157. var /** @type {?} */ styleWithImports = extractStyleUrls(_this._urlResolver, moduleUrl, style);
  10158. allStyleUrls.push.apply(allStyleUrls, styleWithImports.styleUrls);
  10159. return styleWithImports.style;
  10160. });
  10161. return new CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl });
  10162. };
  10163. return DirectiveNormalizer;
  10164. }());
  10165. var TemplatePreparseVisitor = /** @class */ (function () {
  10166. function TemplatePreparseVisitor() {
  10167. this.ngContentSelectors = [];
  10168. this.styles = [];
  10169. this.styleUrls = [];
  10170. this.ngNonBindableStackCount = 0;
  10171. }
  10172. /**
  10173. * @param {?} ast
  10174. * @param {?} context
  10175. * @return {?}
  10176. */
  10177. TemplatePreparseVisitor.prototype.visitElement = /**
  10178. * @param {?} ast
  10179. * @param {?} context
  10180. * @return {?}
  10181. */
  10182. function (ast, context) {
  10183. var /** @type {?} */ preparsedElement = preparseElement(ast);
  10184. switch (preparsedElement.type) {
  10185. case PreparsedElementType.NG_CONTENT:
  10186. if (this.ngNonBindableStackCount === 0) {
  10187. this.ngContentSelectors.push(preparsedElement.selectAttr);
  10188. }
  10189. break;
  10190. case PreparsedElementType.STYLE:
  10191. var /** @type {?} */ textContent_1 = '';
  10192. ast.children.forEach(function (child) {
  10193. if (child instanceof Text) {
  10194. textContent_1 += child.value;
  10195. }
  10196. });
  10197. this.styles.push(textContent_1);
  10198. break;
  10199. case PreparsedElementType.STYLESHEET:
  10200. this.styleUrls.push(preparsedElement.hrefAttr);
  10201. break;
  10202. default:
  10203. break;
  10204. }
  10205. if (preparsedElement.nonBindable) {
  10206. this.ngNonBindableStackCount++;
  10207. }
  10208. visitAll(this, ast.children);
  10209. if (preparsedElement.nonBindable) {
  10210. this.ngNonBindableStackCount--;
  10211. }
  10212. return null;
  10213. };
  10214. /**
  10215. * @param {?} ast
  10216. * @param {?} context
  10217. * @return {?}
  10218. */
  10219. TemplatePreparseVisitor.prototype.visitExpansion = /**
  10220. * @param {?} ast
  10221. * @param {?} context
  10222. * @return {?}
  10223. */
  10224. function (ast, context) { visitAll(this, ast.cases); };
  10225. /**
  10226. * @param {?} ast
  10227. * @param {?} context
  10228. * @return {?}
  10229. */
  10230. TemplatePreparseVisitor.prototype.visitExpansionCase = /**
  10231. * @param {?} ast
  10232. * @param {?} context
  10233. * @return {?}
  10234. */
  10235. function (ast, context) {
  10236. visitAll(this, ast.expression);
  10237. };
  10238. /**
  10239. * @param {?} ast
  10240. * @param {?} context
  10241. * @return {?}
  10242. */
  10243. TemplatePreparseVisitor.prototype.visitComment = /**
  10244. * @param {?} ast
  10245. * @param {?} context
  10246. * @return {?}
  10247. */
  10248. function (ast, context) { return null; };
  10249. /**
  10250. * @param {?} ast
  10251. * @param {?} context
  10252. * @return {?}
  10253. */
  10254. TemplatePreparseVisitor.prototype.visitAttribute = /**
  10255. * @param {?} ast
  10256. * @param {?} context
  10257. * @return {?}
  10258. */
  10259. function (ast, context) { return null; };
  10260. /**
  10261. * @param {?} ast
  10262. * @param {?} context
  10263. * @return {?}
  10264. */
  10265. TemplatePreparseVisitor.prototype.visitText = /**
  10266. * @param {?} ast
  10267. * @param {?} context
  10268. * @return {?}
  10269. */
  10270. function (ast, context) { return null; };
  10271. return TemplatePreparseVisitor;
  10272. }());
  10273. /**
  10274. * @fileoverview added by tsickle
  10275. * @suppress {checkTypes} checked by tsc
  10276. */
  10277. /**
  10278. * @license
  10279. * Copyright Google Inc. All Rights Reserved.
  10280. *
  10281. * Use of this source code is governed by an MIT-style license that can be
  10282. * found in the LICENSE file at https://angular.io/license
  10283. */
  10284. var QUERY_METADATA_IDENTIFIERS = [
  10285. createViewChild,
  10286. createViewChildren,
  10287. createContentChild,
  10288. createContentChildren,
  10289. ];
  10290. var DirectiveResolver = /** @class */ (function () {
  10291. function DirectiveResolver(_reflector) {
  10292. this._reflector = _reflector;
  10293. }
  10294. /**
  10295. * @param {?} type
  10296. * @return {?}
  10297. */
  10298. DirectiveResolver.prototype.isDirective = /**
  10299. * @param {?} type
  10300. * @return {?}
  10301. */
  10302. function (type) {
  10303. var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
  10304. return typeMetadata && typeMetadata.some(isDirectiveMetadata);
  10305. };
  10306. /**
  10307. * @param {?} type
  10308. * @param {?=} throwIfNotFound
  10309. * @return {?}
  10310. */
  10311. DirectiveResolver.prototype.resolve = /**
  10312. * @param {?} type
  10313. * @param {?=} throwIfNotFound
  10314. * @return {?}
  10315. */
  10316. function (type, throwIfNotFound) {
  10317. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  10318. var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
  10319. if (typeMetadata) {
  10320. var /** @type {?} */ metadata = findLast(typeMetadata, isDirectiveMetadata);
  10321. if (metadata) {
  10322. var /** @type {?} */ propertyMetadata = this._reflector.propMetadata(type);
  10323. var /** @type {?} */ guards = this._reflector.guards(type);
  10324. return this._mergeWithPropertyMetadata(metadata, propertyMetadata, guards, type);
  10325. }
  10326. }
  10327. if (throwIfNotFound) {
  10328. throw new Error("No Directive annotation found on " + stringify(type));
  10329. }
  10330. return null;
  10331. };
  10332. /**
  10333. * @param {?} dm
  10334. * @param {?} propertyMetadata
  10335. * @param {?} guards
  10336. * @param {?} directiveType
  10337. * @return {?}
  10338. */
  10339. DirectiveResolver.prototype._mergeWithPropertyMetadata = /**
  10340. * @param {?} dm
  10341. * @param {?} propertyMetadata
  10342. * @param {?} guards
  10343. * @param {?} directiveType
  10344. * @return {?}
  10345. */
  10346. function (dm, propertyMetadata, guards, directiveType) {
  10347. var /** @type {?} */ inputs = [];
  10348. var /** @type {?} */ outputs = [];
  10349. var /** @type {?} */ host = {};
  10350. var /** @type {?} */ queries = {};
  10351. Object.keys(propertyMetadata).forEach(function (propName) {
  10352. var /** @type {?} */ input = findLast(propertyMetadata[propName], function (a) { return createInput.isTypeOf(a); });
  10353. if (input) {
  10354. if (input.bindingPropertyName) {
  10355. inputs.push(propName + ": " + input.bindingPropertyName);
  10356. }
  10357. else {
  10358. inputs.push(propName);
  10359. }
  10360. }
  10361. var /** @type {?} */ output = findLast(propertyMetadata[propName], function (a) { return createOutput.isTypeOf(a); });
  10362. if (output) {
  10363. if (output.bindingPropertyName) {
  10364. outputs.push(propName + ": " + output.bindingPropertyName);
  10365. }
  10366. else {
  10367. outputs.push(propName);
  10368. }
  10369. }
  10370. var /** @type {?} */ hostBindings = propertyMetadata[propName].filter(function (a) { return createHostBinding.isTypeOf(a); });
  10371. hostBindings.forEach(function (hostBinding) {
  10372. if (hostBinding.hostPropertyName) {
  10373. var /** @type {?} */ startWith = hostBinding.hostPropertyName[0];
  10374. if (startWith === '(') {
  10375. throw new Error("@HostBinding can not bind to events. Use @HostListener instead.");
  10376. }
  10377. else if (startWith === '[') {
  10378. throw new Error("@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'.");
  10379. }
  10380. host["[" + hostBinding.hostPropertyName + "]"] = propName;
  10381. }
  10382. else {
  10383. host["[" + propName + "]"] = propName;
  10384. }
  10385. });
  10386. var /** @type {?} */ hostListeners = propertyMetadata[propName].filter(function (a) { return createHostListener.isTypeOf(a); });
  10387. hostListeners.forEach(function (hostListener) {
  10388. var /** @type {?} */ args = hostListener.args || [];
  10389. host["(" + hostListener.eventName + ")"] = propName + "(" + args.join(',') + ")";
  10390. });
  10391. var /** @type {?} */ query = findLast(propertyMetadata[propName], function (a) { return QUERY_METADATA_IDENTIFIERS.some(function (i) { return i.isTypeOf(a); }); });
  10392. if (query) {
  10393. queries[propName] = query;
  10394. }
  10395. });
  10396. return this._merge(dm, inputs, outputs, host, queries, guards, directiveType);
  10397. };
  10398. /**
  10399. * @param {?} def
  10400. * @return {?}
  10401. */
  10402. DirectiveResolver.prototype._extractPublicName = /**
  10403. * @param {?} def
  10404. * @return {?}
  10405. */
  10406. function (def) { return splitAtColon(def, [/** @type {?} */ ((null)), def])[1].trim(); };
  10407. /**
  10408. * @param {?} bindings
  10409. * @return {?}
  10410. */
  10411. DirectiveResolver.prototype._dedupeBindings = /**
  10412. * @param {?} bindings
  10413. * @return {?}
  10414. */
  10415. function (bindings) {
  10416. var /** @type {?} */ names = new Set();
  10417. var /** @type {?} */ publicNames = new Set();
  10418. var /** @type {?} */ reversedResult = [];
  10419. // go last to first to allow later entries to overwrite previous entries
  10420. for (var /** @type {?} */ i = bindings.length - 1; i >= 0; i--) {
  10421. var /** @type {?} */ binding = bindings[i];
  10422. var /** @type {?} */ name_1 = this._extractPublicName(binding);
  10423. publicNames.add(name_1);
  10424. if (!names.has(name_1)) {
  10425. names.add(name_1);
  10426. reversedResult.push(binding);
  10427. }
  10428. }
  10429. return reversedResult.reverse();
  10430. };
  10431. /**
  10432. * @param {?} directive
  10433. * @param {?} inputs
  10434. * @param {?} outputs
  10435. * @param {?} host
  10436. * @param {?} queries
  10437. * @param {?} guards
  10438. * @param {?} directiveType
  10439. * @return {?}
  10440. */
  10441. DirectiveResolver.prototype._merge = /**
  10442. * @param {?} directive
  10443. * @param {?} inputs
  10444. * @param {?} outputs
  10445. * @param {?} host
  10446. * @param {?} queries
  10447. * @param {?} guards
  10448. * @param {?} directiveType
  10449. * @return {?}
  10450. */
  10451. function (directive, inputs, outputs, host, queries, guards, directiveType) {
  10452. var /** @type {?} */ mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs);
  10453. var /** @type {?} */ mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs);
  10454. var /** @type {?} */ mergedHost = directive.host ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, directive.host, host) : host;
  10455. var /** @type {?} */ mergedQueries = directive.queries ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, directive.queries, queries) : queries;
  10456. if (createComponent.isTypeOf(directive)) {
  10457. var /** @type {?} */ comp = /** @type {?} */ (directive);
  10458. return createComponent({
  10459. selector: comp.selector,
  10460. inputs: mergedInputs,
  10461. outputs: mergedOutputs,
  10462. host: mergedHost,
  10463. exportAs: comp.exportAs,
  10464. moduleId: comp.moduleId,
  10465. queries: mergedQueries,
  10466. changeDetection: comp.changeDetection,
  10467. providers: comp.providers,
  10468. viewProviders: comp.viewProviders,
  10469. entryComponents: comp.entryComponents,
  10470. template: comp.template,
  10471. templateUrl: comp.templateUrl,
  10472. styles: comp.styles,
  10473. styleUrls: comp.styleUrls,
  10474. encapsulation: comp.encapsulation,
  10475. animations: comp.animations,
  10476. interpolation: comp.interpolation,
  10477. preserveWhitespaces: directive.preserveWhitespaces,
  10478. });
  10479. }
  10480. else {
  10481. return createDirective({
  10482. selector: directive.selector,
  10483. inputs: mergedInputs,
  10484. outputs: mergedOutputs,
  10485. host: mergedHost,
  10486. exportAs: directive.exportAs,
  10487. queries: mergedQueries,
  10488. providers: directive.providers, guards: guards
  10489. });
  10490. }
  10491. };
  10492. return DirectiveResolver;
  10493. }());
  10494. /**
  10495. * @param {?} type
  10496. * @return {?}
  10497. */
  10498. function isDirectiveMetadata(type) {
  10499. return createDirective.isTypeOf(type) || createComponent.isTypeOf(type);
  10500. }
  10501. /**
  10502. * @template T
  10503. * @param {?} arr
  10504. * @param {?} condition
  10505. * @return {?}
  10506. */
  10507. function findLast(arr, condition) {
  10508. for (var /** @type {?} */ i = arr.length - 1; i >= 0; i--) {
  10509. if (condition(arr[i])) {
  10510. return arr[i];
  10511. }
  10512. }
  10513. return null;
  10514. }
  10515. /**
  10516. * @fileoverview added by tsickle
  10517. * @suppress {checkTypes} checked by tsc
  10518. */
  10519. /**
  10520. * @license
  10521. * Copyright Google Inc. All Rights Reserved.
  10522. *
  10523. * Use of this source code is governed by an MIT-style license that can be
  10524. * found in the LICENSE file at https://angular.io/license
  10525. */
  10526. var $EOF = 0;
  10527. var $TAB = 9;
  10528. var $LF = 10;
  10529. var $VTAB = 11;
  10530. var $FF = 12;
  10531. var $CR = 13;
  10532. var $SPACE = 32;
  10533. var $BANG = 33;
  10534. var $DQ = 34;
  10535. var $HASH = 35;
  10536. var $$ = 36;
  10537. var $PERCENT = 37;
  10538. var $AMPERSAND = 38;
  10539. var $SQ = 39;
  10540. var $LPAREN = 40;
  10541. var $RPAREN = 41;
  10542. var $STAR = 42;
  10543. var $PLUS = 43;
  10544. var $COMMA = 44;
  10545. var $MINUS = 45;
  10546. var $PERIOD = 46;
  10547. var $SLASH = 47;
  10548. var $COLON = 58;
  10549. var $SEMICOLON = 59;
  10550. var $LT = 60;
  10551. var $EQ = 61;
  10552. var $GT = 62;
  10553. var $QUESTION = 63;
  10554. var $0 = 48;
  10555. var $9 = 57;
  10556. var $A = 65;
  10557. var $E = 69;
  10558. var $F = 70;
  10559. var $X = 88;
  10560. var $Z = 90;
  10561. var $LBRACKET = 91;
  10562. var $BACKSLASH = 92;
  10563. var $RBRACKET = 93;
  10564. var $CARET = 94;
  10565. var $_ = 95;
  10566. var $a = 97;
  10567. var $e = 101;
  10568. var $f = 102;
  10569. var $n = 110;
  10570. var $r = 114;
  10571. var $t = 116;
  10572. var $u = 117;
  10573. var $v = 118;
  10574. var $x = 120;
  10575. var $z = 122;
  10576. var $LBRACE = 123;
  10577. var $BAR = 124;
  10578. var $RBRACE = 125;
  10579. var $NBSP = 160;
  10580. var $BT = 96;
  10581. /**
  10582. * @param {?} code
  10583. * @return {?}
  10584. */
  10585. function isWhitespace(code) {
  10586. return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
  10587. }
  10588. /**
  10589. * @param {?} code
  10590. * @return {?}
  10591. */
  10592. function isDigit(code) {
  10593. return $0 <= code && code <= $9;
  10594. }
  10595. /**
  10596. * @param {?} code
  10597. * @return {?}
  10598. */
  10599. function isAsciiLetter(code) {
  10600. return code >= $a && code <= $z || code >= $A && code <= $Z;
  10601. }
  10602. /**
  10603. * @param {?} code
  10604. * @return {?}
  10605. */
  10606. function isAsciiHexDigit(code) {
  10607. return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
  10608. }
  10609. /**
  10610. * @fileoverview added by tsickle
  10611. * @suppress {checkTypes} checked by tsc
  10612. */
  10613. /**
  10614. * @license
  10615. * Copyright Google Inc. All Rights Reserved.
  10616. *
  10617. * Use of this source code is governed by an MIT-style license that can be
  10618. * found in the LICENSE file at https://angular.io/license
  10619. */
  10620. /** @enum {number} */
  10621. var TokenType = {
  10622. Character: 0,
  10623. Identifier: 1,
  10624. Keyword: 2,
  10625. String: 3,
  10626. Operator: 4,
  10627. Number: 5,
  10628. Error: 6,
  10629. };
  10630. TokenType[TokenType.Character] = "Character";
  10631. TokenType[TokenType.Identifier] = "Identifier";
  10632. TokenType[TokenType.Keyword] = "Keyword";
  10633. TokenType[TokenType.String] = "String";
  10634. TokenType[TokenType.Operator] = "Operator";
  10635. TokenType[TokenType.Number] = "Number";
  10636. TokenType[TokenType.Error] = "Error";
  10637. var KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];
  10638. var Lexer = /** @class */ (function () {
  10639. function Lexer() {
  10640. }
  10641. /**
  10642. * @param {?} text
  10643. * @return {?}
  10644. */
  10645. Lexer.prototype.tokenize = /**
  10646. * @param {?} text
  10647. * @return {?}
  10648. */
  10649. function (text) {
  10650. var /** @type {?} */ scanner = new _Scanner(text);
  10651. var /** @type {?} */ tokens = [];
  10652. var /** @type {?} */ token = scanner.scanToken();
  10653. while (token != null) {
  10654. tokens.push(token);
  10655. token = scanner.scanToken();
  10656. }
  10657. return tokens;
  10658. };
  10659. return Lexer;
  10660. }());
  10661. var Token = /** @class */ (function () {
  10662. function Token(index, type, numValue, strValue) {
  10663. this.index = index;
  10664. this.type = type;
  10665. this.numValue = numValue;
  10666. this.strValue = strValue;
  10667. }
  10668. /**
  10669. * @param {?} code
  10670. * @return {?}
  10671. */
  10672. Token.prototype.isCharacter = /**
  10673. * @param {?} code
  10674. * @return {?}
  10675. */
  10676. function (code) {
  10677. return this.type == TokenType.Character && this.numValue == code;
  10678. };
  10679. /**
  10680. * @return {?}
  10681. */
  10682. Token.prototype.isNumber = /**
  10683. * @return {?}
  10684. */
  10685. function () { return this.type == TokenType.Number; };
  10686. /**
  10687. * @return {?}
  10688. */
  10689. Token.prototype.isString = /**
  10690. * @return {?}
  10691. */
  10692. function () { return this.type == TokenType.String; };
  10693. /**
  10694. * @param {?} operater
  10695. * @return {?}
  10696. */
  10697. Token.prototype.isOperator = /**
  10698. * @param {?} operater
  10699. * @return {?}
  10700. */
  10701. function (operater) {
  10702. return this.type == TokenType.Operator && this.strValue == operater;
  10703. };
  10704. /**
  10705. * @return {?}
  10706. */
  10707. Token.prototype.isIdentifier = /**
  10708. * @return {?}
  10709. */
  10710. function () { return this.type == TokenType.Identifier; };
  10711. /**
  10712. * @return {?}
  10713. */
  10714. Token.prototype.isKeyword = /**
  10715. * @return {?}
  10716. */
  10717. function () { return this.type == TokenType.Keyword; };
  10718. /**
  10719. * @return {?}
  10720. */
  10721. Token.prototype.isKeywordLet = /**
  10722. * @return {?}
  10723. */
  10724. function () { return this.type == TokenType.Keyword && this.strValue == 'let'; };
  10725. /**
  10726. * @return {?}
  10727. */
  10728. Token.prototype.isKeywordAs = /**
  10729. * @return {?}
  10730. */
  10731. function () { return this.type == TokenType.Keyword && this.strValue == 'as'; };
  10732. /**
  10733. * @return {?}
  10734. */
  10735. Token.prototype.isKeywordNull = /**
  10736. * @return {?}
  10737. */
  10738. function () { return this.type == TokenType.Keyword && this.strValue == 'null'; };
  10739. /**
  10740. * @return {?}
  10741. */
  10742. Token.prototype.isKeywordUndefined = /**
  10743. * @return {?}
  10744. */
  10745. function () {
  10746. return this.type == TokenType.Keyword && this.strValue == 'undefined';
  10747. };
  10748. /**
  10749. * @return {?}
  10750. */
  10751. Token.prototype.isKeywordTrue = /**
  10752. * @return {?}
  10753. */
  10754. function () { return this.type == TokenType.Keyword && this.strValue == 'true'; };
  10755. /**
  10756. * @return {?}
  10757. */
  10758. Token.prototype.isKeywordFalse = /**
  10759. * @return {?}
  10760. */
  10761. function () { return this.type == TokenType.Keyword && this.strValue == 'false'; };
  10762. /**
  10763. * @return {?}
  10764. */
  10765. Token.prototype.isKeywordThis = /**
  10766. * @return {?}
  10767. */
  10768. function () { return this.type == TokenType.Keyword && this.strValue == 'this'; };
  10769. /**
  10770. * @return {?}
  10771. */
  10772. Token.prototype.isError = /**
  10773. * @return {?}
  10774. */
  10775. function () { return this.type == TokenType.Error; };
  10776. /**
  10777. * @return {?}
  10778. */
  10779. Token.prototype.toNumber = /**
  10780. * @return {?}
  10781. */
  10782. function () { return this.type == TokenType.Number ? this.numValue : -1; };
  10783. /**
  10784. * @return {?}
  10785. */
  10786. Token.prototype.toString = /**
  10787. * @return {?}
  10788. */
  10789. function () {
  10790. switch (this.type) {
  10791. case TokenType.Character:
  10792. case TokenType.Identifier:
  10793. case TokenType.Keyword:
  10794. case TokenType.Operator:
  10795. case TokenType.String:
  10796. case TokenType.Error:
  10797. return this.strValue;
  10798. case TokenType.Number:
  10799. return this.numValue.toString();
  10800. default:
  10801. return null;
  10802. }
  10803. };
  10804. return Token;
  10805. }());
  10806. /**
  10807. * @param {?} index
  10808. * @param {?} code
  10809. * @return {?}
  10810. */
  10811. function newCharacterToken(index, code) {
  10812. return new Token(index, TokenType.Character, code, String.fromCharCode(code));
  10813. }
  10814. /**
  10815. * @param {?} index
  10816. * @param {?} text
  10817. * @return {?}
  10818. */
  10819. function newIdentifierToken(index, text) {
  10820. return new Token(index, TokenType.Identifier, 0, text);
  10821. }
  10822. /**
  10823. * @param {?} index
  10824. * @param {?} text
  10825. * @return {?}
  10826. */
  10827. function newKeywordToken(index, text) {
  10828. return new Token(index, TokenType.Keyword, 0, text);
  10829. }
  10830. /**
  10831. * @param {?} index
  10832. * @param {?} text
  10833. * @return {?}
  10834. */
  10835. function newOperatorToken(index, text) {
  10836. return new Token(index, TokenType.Operator, 0, text);
  10837. }
  10838. /**
  10839. * @param {?} index
  10840. * @param {?} text
  10841. * @return {?}
  10842. */
  10843. function newStringToken(index, text) {
  10844. return new Token(index, TokenType.String, 0, text);
  10845. }
  10846. /**
  10847. * @param {?} index
  10848. * @param {?} n
  10849. * @return {?}
  10850. */
  10851. function newNumberToken(index, n) {
  10852. return new Token(index, TokenType.Number, n, '');
  10853. }
  10854. /**
  10855. * @param {?} index
  10856. * @param {?} message
  10857. * @return {?}
  10858. */
  10859. function newErrorToken(index, message) {
  10860. return new Token(index, TokenType.Error, 0, message);
  10861. }
  10862. var EOF = new Token(-1, TokenType.Character, 0, '');
  10863. var _Scanner = /** @class */ (function () {
  10864. function _Scanner(input) {
  10865. this.input = input;
  10866. this.peek = 0;
  10867. this.index = -1;
  10868. this.length = input.length;
  10869. this.advance();
  10870. }
  10871. /**
  10872. * @return {?}
  10873. */
  10874. _Scanner.prototype.advance = /**
  10875. * @return {?}
  10876. */
  10877. function () {
  10878. this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);
  10879. };
  10880. /**
  10881. * @return {?}
  10882. */
  10883. _Scanner.prototype.scanToken = /**
  10884. * @return {?}
  10885. */
  10886. function () {
  10887. var /** @type {?} */ input = this.input, /** @type {?} */ length = this.length;
  10888. var /** @type {?} */ peek = this.peek, /** @type {?} */ index = this.index;
  10889. // Skip whitespace.
  10890. while (peek <= $SPACE) {
  10891. if (++index >= length) {
  10892. peek = $EOF;
  10893. break;
  10894. }
  10895. else {
  10896. peek = input.charCodeAt(index);
  10897. }
  10898. }
  10899. this.peek = peek;
  10900. this.index = index;
  10901. if (index >= length) {
  10902. return null;
  10903. }
  10904. // Handle identifiers and numbers.
  10905. if (isIdentifierStart(peek))
  10906. return this.scanIdentifier();
  10907. if (isDigit(peek))
  10908. return this.scanNumber(index);
  10909. var /** @type {?} */ start = index;
  10910. switch (peek) {
  10911. case $PERIOD:
  10912. this.advance();
  10913. return isDigit(this.peek) ? this.scanNumber(start) :
  10914. newCharacterToken(start, $PERIOD);
  10915. case $LPAREN:
  10916. case $RPAREN:
  10917. case $LBRACE:
  10918. case $RBRACE:
  10919. case $LBRACKET:
  10920. case $RBRACKET:
  10921. case $COMMA:
  10922. case $COLON:
  10923. case $SEMICOLON:
  10924. return this.scanCharacter(start, peek);
  10925. case $SQ:
  10926. case $DQ:
  10927. return this.scanString();
  10928. case $HASH:
  10929. case $PLUS:
  10930. case $MINUS:
  10931. case $STAR:
  10932. case $SLASH:
  10933. case $PERCENT:
  10934. case $CARET:
  10935. return this.scanOperator(start, String.fromCharCode(peek));
  10936. case $QUESTION:
  10937. return this.scanComplexOperator(start, '?', $PERIOD, '.');
  10938. case $LT:
  10939. case $GT:
  10940. return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=');
  10941. case $BANG:
  10942. case $EQ:
  10943. return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '=');
  10944. case $AMPERSAND:
  10945. return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
  10946. case $BAR:
  10947. return this.scanComplexOperator(start, '|', $BAR, '|');
  10948. case $NBSP:
  10949. while (isWhitespace(this.peek))
  10950. this.advance();
  10951. return this.scanToken();
  10952. }
  10953. this.advance();
  10954. return this.error("Unexpected character [" + String.fromCharCode(peek) + "]", 0);
  10955. };
  10956. /**
  10957. * @param {?} start
  10958. * @param {?} code
  10959. * @return {?}
  10960. */
  10961. _Scanner.prototype.scanCharacter = /**
  10962. * @param {?} start
  10963. * @param {?} code
  10964. * @return {?}
  10965. */
  10966. function (start, code) {
  10967. this.advance();
  10968. return newCharacterToken(start, code);
  10969. };
  10970. /**
  10971. * @param {?} start
  10972. * @param {?} str
  10973. * @return {?}
  10974. */
  10975. _Scanner.prototype.scanOperator = /**
  10976. * @param {?} start
  10977. * @param {?} str
  10978. * @return {?}
  10979. */
  10980. function (start, str) {
  10981. this.advance();
  10982. return newOperatorToken(start, str);
  10983. };
  10984. /**
  10985. * Tokenize a 2/3 char long operator
  10986. *
  10987. * @param start start index in the expression
  10988. * @param one first symbol (always part of the operator)
  10989. * @param twoCode code point for the second symbol
  10990. * @param two second symbol (part of the operator when the second code point matches)
  10991. * @param threeCode code point for the third symbol
  10992. * @param three third symbol (part of the operator when provided and matches source expression)
  10993. */
  10994. /**
  10995. * Tokenize a 2/3 char long operator
  10996. *
  10997. * @param {?} start start index in the expression
  10998. * @param {?} one first symbol (always part of the operator)
  10999. * @param {?} twoCode code point for the second symbol
  11000. * @param {?} two second symbol (part of the operator when the second code point matches)
  11001. * @param {?=} threeCode code point for the third symbol
  11002. * @param {?=} three third symbol (part of the operator when provided and matches source expression)
  11003. * @return {?}
  11004. */
  11005. _Scanner.prototype.scanComplexOperator = /**
  11006. * Tokenize a 2/3 char long operator
  11007. *
  11008. * @param {?} start start index in the expression
  11009. * @param {?} one first symbol (always part of the operator)
  11010. * @param {?} twoCode code point for the second symbol
  11011. * @param {?} two second symbol (part of the operator when the second code point matches)
  11012. * @param {?=} threeCode code point for the third symbol
  11013. * @param {?=} three third symbol (part of the operator when provided and matches source expression)
  11014. * @return {?}
  11015. */
  11016. function (start, one, twoCode, two, threeCode, three) {
  11017. this.advance();
  11018. var /** @type {?} */ str = one;
  11019. if (this.peek == twoCode) {
  11020. this.advance();
  11021. str += two;
  11022. }
  11023. if (threeCode != null && this.peek == threeCode) {
  11024. this.advance();
  11025. str += three;
  11026. }
  11027. return newOperatorToken(start, str);
  11028. };
  11029. /**
  11030. * @return {?}
  11031. */
  11032. _Scanner.prototype.scanIdentifier = /**
  11033. * @return {?}
  11034. */
  11035. function () {
  11036. var /** @type {?} */ start = this.index;
  11037. this.advance();
  11038. while (isIdentifierPart(this.peek))
  11039. this.advance();
  11040. var /** @type {?} */ str = this.input.substring(start, this.index);
  11041. return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) :
  11042. newIdentifierToken(start, str);
  11043. };
  11044. /**
  11045. * @param {?} start
  11046. * @return {?}
  11047. */
  11048. _Scanner.prototype.scanNumber = /**
  11049. * @param {?} start
  11050. * @return {?}
  11051. */
  11052. function (start) {
  11053. var /** @type {?} */ simple = (this.index === start);
  11054. this.advance(); // Skip initial digit.
  11055. while (true) {
  11056. if (isDigit(this.peek)) {
  11057. // Do nothing.
  11058. }
  11059. else if (this.peek == $PERIOD) {
  11060. simple = false;
  11061. }
  11062. else if (isExponentStart(this.peek)) {
  11063. this.advance();
  11064. if (isExponentSign(this.peek))
  11065. this.advance();
  11066. if (!isDigit(this.peek))
  11067. return this.error('Invalid exponent', -1);
  11068. simple = false;
  11069. }
  11070. else {
  11071. break;
  11072. }
  11073. this.advance();
  11074. }
  11075. var /** @type {?} */ str = this.input.substring(start, this.index);
  11076. var /** @type {?} */ value = simple ? parseIntAutoRadix(str) : parseFloat(str);
  11077. return newNumberToken(start, value);
  11078. };
  11079. /**
  11080. * @return {?}
  11081. */
  11082. _Scanner.prototype.scanString = /**
  11083. * @return {?}
  11084. */
  11085. function () {
  11086. var /** @type {?} */ start = this.index;
  11087. var /** @type {?} */ quote = this.peek;
  11088. this.advance(); // Skip initial quote.
  11089. var /** @type {?} */ buffer = '';
  11090. var /** @type {?} */ marker = this.index;
  11091. var /** @type {?} */ input = this.input;
  11092. while (this.peek != quote) {
  11093. if (this.peek == $BACKSLASH) {
  11094. buffer += input.substring(marker, this.index);
  11095. this.advance();
  11096. var /** @type {?} */ unescapedCode = void 0;
  11097. // Workaround for TS2.1-introduced type strictness
  11098. this.peek = this.peek;
  11099. if (this.peek == $u) {
  11100. // 4 character hex code for unicode character.
  11101. var /** @type {?} */ hex = input.substring(this.index + 1, this.index + 5);
  11102. if (/^[0-9a-f]+$/i.test(hex)) {
  11103. unescapedCode = parseInt(hex, 16);
  11104. }
  11105. else {
  11106. return this.error("Invalid unicode escape [\\u" + hex + "]", 0);
  11107. }
  11108. for (var /** @type {?} */ i = 0; i < 5; i++) {
  11109. this.advance();
  11110. }
  11111. }
  11112. else {
  11113. unescapedCode = unescape(this.peek);
  11114. this.advance();
  11115. }
  11116. buffer += String.fromCharCode(unescapedCode);
  11117. marker = this.index;
  11118. }
  11119. else if (this.peek == $EOF) {
  11120. return this.error('Unterminated quote', 0);
  11121. }
  11122. else {
  11123. this.advance();
  11124. }
  11125. }
  11126. var /** @type {?} */ last = input.substring(marker, this.index);
  11127. this.advance(); // Skip terminating quote.
  11128. return newStringToken(start, buffer + last);
  11129. };
  11130. /**
  11131. * @param {?} message
  11132. * @param {?} offset
  11133. * @return {?}
  11134. */
  11135. _Scanner.prototype.error = /**
  11136. * @param {?} message
  11137. * @param {?} offset
  11138. * @return {?}
  11139. */
  11140. function (message, offset) {
  11141. var /** @type {?} */ position = this.index + offset;
  11142. return newErrorToken(position, "Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]");
  11143. };
  11144. return _Scanner;
  11145. }());
  11146. /**
  11147. * @param {?} code
  11148. * @return {?}
  11149. */
  11150. function isIdentifierStart(code) {
  11151. return ($a <= code && code <= $z) || ($A <= code && code <= $Z) ||
  11152. (code == $_) || (code == $$);
  11153. }
  11154. /**
  11155. * @param {?} input
  11156. * @return {?}
  11157. */
  11158. function isIdentifier(input) {
  11159. if (input.length == 0)
  11160. return false;
  11161. var /** @type {?} */ scanner = new _Scanner(input);
  11162. if (!isIdentifierStart(scanner.peek))
  11163. return false;
  11164. scanner.advance();
  11165. while (scanner.peek !== $EOF) {
  11166. if (!isIdentifierPart(scanner.peek))
  11167. return false;
  11168. scanner.advance();
  11169. }
  11170. return true;
  11171. }
  11172. /**
  11173. * @param {?} code
  11174. * @return {?}
  11175. */
  11176. function isIdentifierPart(code) {
  11177. return isAsciiLetter(code) || isDigit(code) || (code == $_) ||
  11178. (code == $$);
  11179. }
  11180. /**
  11181. * @param {?} code
  11182. * @return {?}
  11183. */
  11184. function isExponentStart(code) {
  11185. return code == $e || code == $E;
  11186. }
  11187. /**
  11188. * @param {?} code
  11189. * @return {?}
  11190. */
  11191. function isExponentSign(code) {
  11192. return code == $MINUS || code == $PLUS;
  11193. }
  11194. /**
  11195. * @param {?} code
  11196. * @return {?}
  11197. */
  11198. function isQuote(code) {
  11199. return code === $SQ || code === $DQ || code === $BT;
  11200. }
  11201. /**
  11202. * @param {?} code
  11203. * @return {?}
  11204. */
  11205. function unescape(code) {
  11206. switch (code) {
  11207. case $n:
  11208. return $LF;
  11209. case $f:
  11210. return $FF;
  11211. case $r:
  11212. return $CR;
  11213. case $t:
  11214. return $TAB;
  11215. case $v:
  11216. return $VTAB;
  11217. default:
  11218. return code;
  11219. }
  11220. }
  11221. /**
  11222. * @param {?} text
  11223. * @return {?}
  11224. */
  11225. function parseIntAutoRadix(text) {
  11226. var /** @type {?} */ result = parseInt(text);
  11227. if (isNaN(result)) {
  11228. throw new Error('Invalid integer literal when parsing ' + text);
  11229. }
  11230. return result;
  11231. }
  11232. /**
  11233. * @fileoverview added by tsickle
  11234. * @suppress {checkTypes} checked by tsc
  11235. */
  11236. /**
  11237. * @license
  11238. * Copyright Google Inc. All Rights Reserved.
  11239. *
  11240. * Use of this source code is governed by an MIT-style license that can be
  11241. * found in the LICENSE file at https://angular.io/license
  11242. */
  11243. var ParserError = /** @class */ (function () {
  11244. function ParserError(message, input, errLocation, ctxLocation) {
  11245. this.input = input;
  11246. this.errLocation = errLocation;
  11247. this.ctxLocation = ctxLocation;
  11248. this.message = "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation;
  11249. }
  11250. return ParserError;
  11251. }());
  11252. var ParseSpan = /** @class */ (function () {
  11253. function ParseSpan(start, end) {
  11254. this.start = start;
  11255. this.end = end;
  11256. }
  11257. return ParseSpan;
  11258. }());
  11259. var AST = /** @class */ (function () {
  11260. function AST(span) {
  11261. this.span = span;
  11262. }
  11263. /**
  11264. * @param {?} visitor
  11265. * @param {?=} context
  11266. * @return {?}
  11267. */
  11268. AST.prototype.visit = /**
  11269. * @param {?} visitor
  11270. * @param {?=} context
  11271. * @return {?}
  11272. */
  11273. function (visitor, context) {
  11274. if (context === void 0) { context = null; }
  11275. return null;
  11276. };
  11277. /**
  11278. * @return {?}
  11279. */
  11280. AST.prototype.toString = /**
  11281. * @return {?}
  11282. */
  11283. function () { return 'AST'; };
  11284. return AST;
  11285. }());
  11286. /**
  11287. * Represents a quoted expression of the form:
  11288. *
  11289. * quote = prefix `:` uninterpretedExpression
  11290. * prefix = identifier
  11291. * uninterpretedExpression = arbitrary string
  11292. *
  11293. * A quoted expression is meant to be pre-processed by an AST transformer that
  11294. * converts it into another AST that no longer contains quoted expressions.
  11295. * It is meant to allow third-party developers to extend Angular template
  11296. * expression language. The `uninterpretedExpression` part of the quote is
  11297. * therefore not interpreted by the Angular's own expression parser.
  11298. */
  11299. var Quote = /** @class */ (function (_super) {
  11300. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Quote, _super);
  11301. function Quote(span, prefix, uninterpretedExpression, location) {
  11302. var _this = _super.call(this, span) || this;
  11303. _this.prefix = prefix;
  11304. _this.uninterpretedExpression = uninterpretedExpression;
  11305. _this.location = location;
  11306. return _this;
  11307. }
  11308. /**
  11309. * @param {?} visitor
  11310. * @param {?=} context
  11311. * @return {?}
  11312. */
  11313. Quote.prototype.visit = /**
  11314. * @param {?} visitor
  11315. * @param {?=} context
  11316. * @return {?}
  11317. */
  11318. function (visitor, context) {
  11319. if (context === void 0) { context = null; }
  11320. return visitor.visitQuote(this, context);
  11321. };
  11322. /**
  11323. * @return {?}
  11324. */
  11325. Quote.prototype.toString = /**
  11326. * @return {?}
  11327. */
  11328. function () { return 'Quote'; };
  11329. return Quote;
  11330. }(AST));
  11331. var EmptyExpr = /** @class */ (function (_super) {
  11332. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EmptyExpr, _super);
  11333. function EmptyExpr() {
  11334. return _super !== null && _super.apply(this, arguments) || this;
  11335. }
  11336. /**
  11337. * @param {?} visitor
  11338. * @param {?=} context
  11339. * @return {?}
  11340. */
  11341. EmptyExpr.prototype.visit = /**
  11342. * @param {?} visitor
  11343. * @param {?=} context
  11344. * @return {?}
  11345. */
  11346. function (visitor, context) {
  11347. if (context === void 0) { context = null; }
  11348. // do nothing
  11349. };
  11350. return EmptyExpr;
  11351. }(AST));
  11352. var ImplicitReceiver = /** @class */ (function (_super) {
  11353. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ImplicitReceiver, _super);
  11354. function ImplicitReceiver() {
  11355. return _super !== null && _super.apply(this, arguments) || this;
  11356. }
  11357. /**
  11358. * @param {?} visitor
  11359. * @param {?=} context
  11360. * @return {?}
  11361. */
  11362. ImplicitReceiver.prototype.visit = /**
  11363. * @param {?} visitor
  11364. * @param {?=} context
  11365. * @return {?}
  11366. */
  11367. function (visitor, context) {
  11368. if (context === void 0) { context = null; }
  11369. return visitor.visitImplicitReceiver(this, context);
  11370. };
  11371. return ImplicitReceiver;
  11372. }(AST));
  11373. /**
  11374. * Multiple expressions separated by a semicolon.
  11375. */
  11376. var Chain = /** @class */ (function (_super) {
  11377. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Chain, _super);
  11378. function Chain(span, expressions) {
  11379. var _this = _super.call(this, span) || this;
  11380. _this.expressions = expressions;
  11381. return _this;
  11382. }
  11383. /**
  11384. * @param {?} visitor
  11385. * @param {?=} context
  11386. * @return {?}
  11387. */
  11388. Chain.prototype.visit = /**
  11389. * @param {?} visitor
  11390. * @param {?=} context
  11391. * @return {?}
  11392. */
  11393. function (visitor, context) {
  11394. if (context === void 0) { context = null; }
  11395. return visitor.visitChain(this, context);
  11396. };
  11397. return Chain;
  11398. }(AST));
  11399. var Conditional = /** @class */ (function (_super) {
  11400. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Conditional, _super);
  11401. function Conditional(span, condition, trueExp, falseExp) {
  11402. var _this = _super.call(this, span) || this;
  11403. _this.condition = condition;
  11404. _this.trueExp = trueExp;
  11405. _this.falseExp = falseExp;
  11406. return _this;
  11407. }
  11408. /**
  11409. * @param {?} visitor
  11410. * @param {?=} context
  11411. * @return {?}
  11412. */
  11413. Conditional.prototype.visit = /**
  11414. * @param {?} visitor
  11415. * @param {?=} context
  11416. * @return {?}
  11417. */
  11418. function (visitor, context) {
  11419. if (context === void 0) { context = null; }
  11420. return visitor.visitConditional(this, context);
  11421. };
  11422. return Conditional;
  11423. }(AST));
  11424. var PropertyRead = /** @class */ (function (_super) {
  11425. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PropertyRead, _super);
  11426. function PropertyRead(span, receiver, name) {
  11427. var _this = _super.call(this, span) || this;
  11428. _this.receiver = receiver;
  11429. _this.name = name;
  11430. return _this;
  11431. }
  11432. /**
  11433. * @param {?} visitor
  11434. * @param {?=} context
  11435. * @return {?}
  11436. */
  11437. PropertyRead.prototype.visit = /**
  11438. * @param {?} visitor
  11439. * @param {?=} context
  11440. * @return {?}
  11441. */
  11442. function (visitor, context) {
  11443. if (context === void 0) { context = null; }
  11444. return visitor.visitPropertyRead(this, context);
  11445. };
  11446. return PropertyRead;
  11447. }(AST));
  11448. var PropertyWrite = /** @class */ (function (_super) {
  11449. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PropertyWrite, _super);
  11450. function PropertyWrite(span, receiver, name, value) {
  11451. var _this = _super.call(this, span) || this;
  11452. _this.receiver = receiver;
  11453. _this.name = name;
  11454. _this.value = value;
  11455. return _this;
  11456. }
  11457. /**
  11458. * @param {?} visitor
  11459. * @param {?=} context
  11460. * @return {?}
  11461. */
  11462. PropertyWrite.prototype.visit = /**
  11463. * @param {?} visitor
  11464. * @param {?=} context
  11465. * @return {?}
  11466. */
  11467. function (visitor, context) {
  11468. if (context === void 0) { context = null; }
  11469. return visitor.visitPropertyWrite(this, context);
  11470. };
  11471. return PropertyWrite;
  11472. }(AST));
  11473. var SafePropertyRead = /** @class */ (function (_super) {
  11474. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SafePropertyRead, _super);
  11475. function SafePropertyRead(span, receiver, name) {
  11476. var _this = _super.call(this, span) || this;
  11477. _this.receiver = receiver;
  11478. _this.name = name;
  11479. return _this;
  11480. }
  11481. /**
  11482. * @param {?} visitor
  11483. * @param {?=} context
  11484. * @return {?}
  11485. */
  11486. SafePropertyRead.prototype.visit = /**
  11487. * @param {?} visitor
  11488. * @param {?=} context
  11489. * @return {?}
  11490. */
  11491. function (visitor, context) {
  11492. if (context === void 0) { context = null; }
  11493. return visitor.visitSafePropertyRead(this, context);
  11494. };
  11495. return SafePropertyRead;
  11496. }(AST));
  11497. var KeyedRead = /** @class */ (function (_super) {
  11498. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(KeyedRead, _super);
  11499. function KeyedRead(span, obj, key) {
  11500. var _this = _super.call(this, span) || this;
  11501. _this.obj = obj;
  11502. _this.key = key;
  11503. return _this;
  11504. }
  11505. /**
  11506. * @param {?} visitor
  11507. * @param {?=} context
  11508. * @return {?}
  11509. */
  11510. KeyedRead.prototype.visit = /**
  11511. * @param {?} visitor
  11512. * @param {?=} context
  11513. * @return {?}
  11514. */
  11515. function (visitor, context) {
  11516. if (context === void 0) { context = null; }
  11517. return visitor.visitKeyedRead(this, context);
  11518. };
  11519. return KeyedRead;
  11520. }(AST));
  11521. var KeyedWrite = /** @class */ (function (_super) {
  11522. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(KeyedWrite, _super);
  11523. function KeyedWrite(span, obj, key, value) {
  11524. var _this = _super.call(this, span) || this;
  11525. _this.obj = obj;
  11526. _this.key = key;
  11527. _this.value = value;
  11528. return _this;
  11529. }
  11530. /**
  11531. * @param {?} visitor
  11532. * @param {?=} context
  11533. * @return {?}
  11534. */
  11535. KeyedWrite.prototype.visit = /**
  11536. * @param {?} visitor
  11537. * @param {?=} context
  11538. * @return {?}
  11539. */
  11540. function (visitor, context) {
  11541. if (context === void 0) { context = null; }
  11542. return visitor.visitKeyedWrite(this, context);
  11543. };
  11544. return KeyedWrite;
  11545. }(AST));
  11546. var BindingPipe = /** @class */ (function (_super) {
  11547. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BindingPipe, _super);
  11548. function BindingPipe(span, exp, name, args) {
  11549. var _this = _super.call(this, span) || this;
  11550. _this.exp = exp;
  11551. _this.name = name;
  11552. _this.args = args;
  11553. return _this;
  11554. }
  11555. /**
  11556. * @param {?} visitor
  11557. * @param {?=} context
  11558. * @return {?}
  11559. */
  11560. BindingPipe.prototype.visit = /**
  11561. * @param {?} visitor
  11562. * @param {?=} context
  11563. * @return {?}
  11564. */
  11565. function (visitor, context) {
  11566. if (context === void 0) { context = null; }
  11567. return visitor.visitPipe(this, context);
  11568. };
  11569. return BindingPipe;
  11570. }(AST));
  11571. var LiteralPrimitive = /** @class */ (function (_super) {
  11572. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralPrimitive, _super);
  11573. function LiteralPrimitive(span, value) {
  11574. var _this = _super.call(this, span) || this;
  11575. _this.value = value;
  11576. return _this;
  11577. }
  11578. /**
  11579. * @param {?} visitor
  11580. * @param {?=} context
  11581. * @return {?}
  11582. */
  11583. LiteralPrimitive.prototype.visit = /**
  11584. * @param {?} visitor
  11585. * @param {?=} context
  11586. * @return {?}
  11587. */
  11588. function (visitor, context) {
  11589. if (context === void 0) { context = null; }
  11590. return visitor.visitLiteralPrimitive(this, context);
  11591. };
  11592. return LiteralPrimitive;
  11593. }(AST));
  11594. var LiteralArray = /** @class */ (function (_super) {
  11595. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralArray, _super);
  11596. function LiteralArray(span, expressions) {
  11597. var _this = _super.call(this, span) || this;
  11598. _this.expressions = expressions;
  11599. return _this;
  11600. }
  11601. /**
  11602. * @param {?} visitor
  11603. * @param {?=} context
  11604. * @return {?}
  11605. */
  11606. LiteralArray.prototype.visit = /**
  11607. * @param {?} visitor
  11608. * @param {?=} context
  11609. * @return {?}
  11610. */
  11611. function (visitor, context) {
  11612. if (context === void 0) { context = null; }
  11613. return visitor.visitLiteralArray(this, context);
  11614. };
  11615. return LiteralArray;
  11616. }(AST));
  11617. var LiteralMap = /** @class */ (function (_super) {
  11618. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralMap, _super);
  11619. function LiteralMap(span, keys, values) {
  11620. var _this = _super.call(this, span) || this;
  11621. _this.keys = keys;
  11622. _this.values = values;
  11623. return _this;
  11624. }
  11625. /**
  11626. * @param {?} visitor
  11627. * @param {?=} context
  11628. * @return {?}
  11629. */
  11630. LiteralMap.prototype.visit = /**
  11631. * @param {?} visitor
  11632. * @param {?=} context
  11633. * @return {?}
  11634. */
  11635. function (visitor, context) {
  11636. if (context === void 0) { context = null; }
  11637. return visitor.visitLiteralMap(this, context);
  11638. };
  11639. return LiteralMap;
  11640. }(AST));
  11641. var Interpolation = /** @class */ (function (_super) {
  11642. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Interpolation, _super);
  11643. function Interpolation(span, strings, expressions) {
  11644. var _this = _super.call(this, span) || this;
  11645. _this.strings = strings;
  11646. _this.expressions = expressions;
  11647. return _this;
  11648. }
  11649. /**
  11650. * @param {?} visitor
  11651. * @param {?=} context
  11652. * @return {?}
  11653. */
  11654. Interpolation.prototype.visit = /**
  11655. * @param {?} visitor
  11656. * @param {?=} context
  11657. * @return {?}
  11658. */
  11659. function (visitor, context) {
  11660. if (context === void 0) { context = null; }
  11661. return visitor.visitInterpolation(this, context);
  11662. };
  11663. return Interpolation;
  11664. }(AST));
  11665. var Binary = /** @class */ (function (_super) {
  11666. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Binary, _super);
  11667. function Binary(span, operation, left, right) {
  11668. var _this = _super.call(this, span) || this;
  11669. _this.operation = operation;
  11670. _this.left = left;
  11671. _this.right = right;
  11672. return _this;
  11673. }
  11674. /**
  11675. * @param {?} visitor
  11676. * @param {?=} context
  11677. * @return {?}
  11678. */
  11679. Binary.prototype.visit = /**
  11680. * @param {?} visitor
  11681. * @param {?=} context
  11682. * @return {?}
  11683. */
  11684. function (visitor, context) {
  11685. if (context === void 0) { context = null; }
  11686. return visitor.visitBinary(this, context);
  11687. };
  11688. return Binary;
  11689. }(AST));
  11690. var PrefixNot = /** @class */ (function (_super) {
  11691. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PrefixNot, _super);
  11692. function PrefixNot(span, expression) {
  11693. var _this = _super.call(this, span) || this;
  11694. _this.expression = expression;
  11695. return _this;
  11696. }
  11697. /**
  11698. * @param {?} visitor
  11699. * @param {?=} context
  11700. * @return {?}
  11701. */
  11702. PrefixNot.prototype.visit = /**
  11703. * @param {?} visitor
  11704. * @param {?=} context
  11705. * @return {?}
  11706. */
  11707. function (visitor, context) {
  11708. if (context === void 0) { context = null; }
  11709. return visitor.visitPrefixNot(this, context);
  11710. };
  11711. return PrefixNot;
  11712. }(AST));
  11713. var NonNullAssert = /** @class */ (function (_super) {
  11714. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NonNullAssert, _super);
  11715. function NonNullAssert(span, expression) {
  11716. var _this = _super.call(this, span) || this;
  11717. _this.expression = expression;
  11718. return _this;
  11719. }
  11720. /**
  11721. * @param {?} visitor
  11722. * @param {?=} context
  11723. * @return {?}
  11724. */
  11725. NonNullAssert.prototype.visit = /**
  11726. * @param {?} visitor
  11727. * @param {?=} context
  11728. * @return {?}
  11729. */
  11730. function (visitor, context) {
  11731. if (context === void 0) { context = null; }
  11732. return visitor.visitNonNullAssert(this, context);
  11733. };
  11734. return NonNullAssert;
  11735. }(AST));
  11736. var MethodCall = /** @class */ (function (_super) {
  11737. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MethodCall, _super);
  11738. function MethodCall(span, receiver, name, args) {
  11739. var _this = _super.call(this, span) || this;
  11740. _this.receiver = receiver;
  11741. _this.name = name;
  11742. _this.args = args;
  11743. return _this;
  11744. }
  11745. /**
  11746. * @param {?} visitor
  11747. * @param {?=} context
  11748. * @return {?}
  11749. */
  11750. MethodCall.prototype.visit = /**
  11751. * @param {?} visitor
  11752. * @param {?=} context
  11753. * @return {?}
  11754. */
  11755. function (visitor, context) {
  11756. if (context === void 0) { context = null; }
  11757. return visitor.visitMethodCall(this, context);
  11758. };
  11759. return MethodCall;
  11760. }(AST));
  11761. var SafeMethodCall = /** @class */ (function (_super) {
  11762. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SafeMethodCall, _super);
  11763. function SafeMethodCall(span, receiver, name, args) {
  11764. var _this = _super.call(this, span) || this;
  11765. _this.receiver = receiver;
  11766. _this.name = name;
  11767. _this.args = args;
  11768. return _this;
  11769. }
  11770. /**
  11771. * @param {?} visitor
  11772. * @param {?=} context
  11773. * @return {?}
  11774. */
  11775. SafeMethodCall.prototype.visit = /**
  11776. * @param {?} visitor
  11777. * @param {?=} context
  11778. * @return {?}
  11779. */
  11780. function (visitor, context) {
  11781. if (context === void 0) { context = null; }
  11782. return visitor.visitSafeMethodCall(this, context);
  11783. };
  11784. return SafeMethodCall;
  11785. }(AST));
  11786. var FunctionCall = /** @class */ (function (_super) {
  11787. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FunctionCall, _super);
  11788. function FunctionCall(span, target, args) {
  11789. var _this = _super.call(this, span) || this;
  11790. _this.target = target;
  11791. _this.args = args;
  11792. return _this;
  11793. }
  11794. /**
  11795. * @param {?} visitor
  11796. * @param {?=} context
  11797. * @return {?}
  11798. */
  11799. FunctionCall.prototype.visit = /**
  11800. * @param {?} visitor
  11801. * @param {?=} context
  11802. * @return {?}
  11803. */
  11804. function (visitor, context) {
  11805. if (context === void 0) { context = null; }
  11806. return visitor.visitFunctionCall(this, context);
  11807. };
  11808. return FunctionCall;
  11809. }(AST));
  11810. var ASTWithSource = /** @class */ (function (_super) {
  11811. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ASTWithSource, _super);
  11812. function ASTWithSource(ast, source, location, errors) {
  11813. var _this = _super.call(this, new ParseSpan(0, source == null ? 0 : source.length)) || this;
  11814. _this.ast = ast;
  11815. _this.source = source;
  11816. _this.location = location;
  11817. _this.errors = errors;
  11818. return _this;
  11819. }
  11820. /**
  11821. * @param {?} visitor
  11822. * @param {?=} context
  11823. * @return {?}
  11824. */
  11825. ASTWithSource.prototype.visit = /**
  11826. * @param {?} visitor
  11827. * @param {?=} context
  11828. * @return {?}
  11829. */
  11830. function (visitor, context) {
  11831. if (context === void 0) { context = null; }
  11832. return this.ast.visit(visitor, context);
  11833. };
  11834. /**
  11835. * @return {?}
  11836. */
  11837. ASTWithSource.prototype.toString = /**
  11838. * @return {?}
  11839. */
  11840. function () { return this.source + " in " + this.location; };
  11841. return ASTWithSource;
  11842. }(AST));
  11843. var TemplateBinding = /** @class */ (function () {
  11844. function TemplateBinding(span, key, keyIsVar, name, expression) {
  11845. this.span = span;
  11846. this.key = key;
  11847. this.keyIsVar = keyIsVar;
  11848. this.name = name;
  11849. this.expression = expression;
  11850. }
  11851. return TemplateBinding;
  11852. }());
  11853. /**
  11854. * @record
  11855. */
  11856. var NullAstVisitor = /** @class */ (function () {
  11857. function NullAstVisitor() {
  11858. }
  11859. /**
  11860. * @param {?} ast
  11861. * @param {?} context
  11862. * @return {?}
  11863. */
  11864. NullAstVisitor.prototype.visitBinary = /**
  11865. * @param {?} ast
  11866. * @param {?} context
  11867. * @return {?}
  11868. */
  11869. function (ast, context) { };
  11870. /**
  11871. * @param {?} ast
  11872. * @param {?} context
  11873. * @return {?}
  11874. */
  11875. NullAstVisitor.prototype.visitChain = /**
  11876. * @param {?} ast
  11877. * @param {?} context
  11878. * @return {?}
  11879. */
  11880. function (ast, context) { };
  11881. /**
  11882. * @param {?} ast
  11883. * @param {?} context
  11884. * @return {?}
  11885. */
  11886. NullAstVisitor.prototype.visitConditional = /**
  11887. * @param {?} ast
  11888. * @param {?} context
  11889. * @return {?}
  11890. */
  11891. function (ast, context) { };
  11892. /**
  11893. * @param {?} ast
  11894. * @param {?} context
  11895. * @return {?}
  11896. */
  11897. NullAstVisitor.prototype.visitFunctionCall = /**
  11898. * @param {?} ast
  11899. * @param {?} context
  11900. * @return {?}
  11901. */
  11902. function (ast, context) { };
  11903. /**
  11904. * @param {?} ast
  11905. * @param {?} context
  11906. * @return {?}
  11907. */
  11908. NullAstVisitor.prototype.visitImplicitReceiver = /**
  11909. * @param {?} ast
  11910. * @param {?} context
  11911. * @return {?}
  11912. */
  11913. function (ast, context) { };
  11914. /**
  11915. * @param {?} ast
  11916. * @param {?} context
  11917. * @return {?}
  11918. */
  11919. NullAstVisitor.prototype.visitInterpolation = /**
  11920. * @param {?} ast
  11921. * @param {?} context
  11922. * @return {?}
  11923. */
  11924. function (ast, context) { };
  11925. /**
  11926. * @param {?} ast
  11927. * @param {?} context
  11928. * @return {?}
  11929. */
  11930. NullAstVisitor.prototype.visitKeyedRead = /**
  11931. * @param {?} ast
  11932. * @param {?} context
  11933. * @return {?}
  11934. */
  11935. function (ast, context) { };
  11936. /**
  11937. * @param {?} ast
  11938. * @param {?} context
  11939. * @return {?}
  11940. */
  11941. NullAstVisitor.prototype.visitKeyedWrite = /**
  11942. * @param {?} ast
  11943. * @param {?} context
  11944. * @return {?}
  11945. */
  11946. function (ast, context) { };
  11947. /**
  11948. * @param {?} ast
  11949. * @param {?} context
  11950. * @return {?}
  11951. */
  11952. NullAstVisitor.prototype.visitLiteralArray = /**
  11953. * @param {?} ast
  11954. * @param {?} context
  11955. * @return {?}
  11956. */
  11957. function (ast, context) { };
  11958. /**
  11959. * @param {?} ast
  11960. * @param {?} context
  11961. * @return {?}
  11962. */
  11963. NullAstVisitor.prototype.visitLiteralMap = /**
  11964. * @param {?} ast
  11965. * @param {?} context
  11966. * @return {?}
  11967. */
  11968. function (ast, context) { };
  11969. /**
  11970. * @param {?} ast
  11971. * @param {?} context
  11972. * @return {?}
  11973. */
  11974. NullAstVisitor.prototype.visitLiteralPrimitive = /**
  11975. * @param {?} ast
  11976. * @param {?} context
  11977. * @return {?}
  11978. */
  11979. function (ast, context) { };
  11980. /**
  11981. * @param {?} ast
  11982. * @param {?} context
  11983. * @return {?}
  11984. */
  11985. NullAstVisitor.prototype.visitMethodCall = /**
  11986. * @param {?} ast
  11987. * @param {?} context
  11988. * @return {?}
  11989. */
  11990. function (ast, context) { };
  11991. /**
  11992. * @param {?} ast
  11993. * @param {?} context
  11994. * @return {?}
  11995. */
  11996. NullAstVisitor.prototype.visitPipe = /**
  11997. * @param {?} ast
  11998. * @param {?} context
  11999. * @return {?}
  12000. */
  12001. function (ast, context) { };
  12002. /**
  12003. * @param {?} ast
  12004. * @param {?} context
  12005. * @return {?}
  12006. */
  12007. NullAstVisitor.prototype.visitPrefixNot = /**
  12008. * @param {?} ast
  12009. * @param {?} context
  12010. * @return {?}
  12011. */
  12012. function (ast, context) { };
  12013. /**
  12014. * @param {?} ast
  12015. * @param {?} context
  12016. * @return {?}
  12017. */
  12018. NullAstVisitor.prototype.visitNonNullAssert = /**
  12019. * @param {?} ast
  12020. * @param {?} context
  12021. * @return {?}
  12022. */
  12023. function (ast, context) { };
  12024. /**
  12025. * @param {?} ast
  12026. * @param {?} context
  12027. * @return {?}
  12028. */
  12029. NullAstVisitor.prototype.visitPropertyRead = /**
  12030. * @param {?} ast
  12031. * @param {?} context
  12032. * @return {?}
  12033. */
  12034. function (ast, context) { };
  12035. /**
  12036. * @param {?} ast
  12037. * @param {?} context
  12038. * @return {?}
  12039. */
  12040. NullAstVisitor.prototype.visitPropertyWrite = /**
  12041. * @param {?} ast
  12042. * @param {?} context
  12043. * @return {?}
  12044. */
  12045. function (ast, context) { };
  12046. /**
  12047. * @param {?} ast
  12048. * @param {?} context
  12049. * @return {?}
  12050. */
  12051. NullAstVisitor.prototype.visitQuote = /**
  12052. * @param {?} ast
  12053. * @param {?} context
  12054. * @return {?}
  12055. */
  12056. function (ast, context) { };
  12057. /**
  12058. * @param {?} ast
  12059. * @param {?} context
  12060. * @return {?}
  12061. */
  12062. NullAstVisitor.prototype.visitSafeMethodCall = /**
  12063. * @param {?} ast
  12064. * @param {?} context
  12065. * @return {?}
  12066. */
  12067. function (ast, context) { };
  12068. /**
  12069. * @param {?} ast
  12070. * @param {?} context
  12071. * @return {?}
  12072. */
  12073. NullAstVisitor.prototype.visitSafePropertyRead = /**
  12074. * @param {?} ast
  12075. * @param {?} context
  12076. * @return {?}
  12077. */
  12078. function (ast, context) { };
  12079. return NullAstVisitor;
  12080. }());
  12081. var RecursiveAstVisitor = /** @class */ (function () {
  12082. function RecursiveAstVisitor() {
  12083. }
  12084. /**
  12085. * @param {?} ast
  12086. * @param {?} context
  12087. * @return {?}
  12088. */
  12089. RecursiveAstVisitor.prototype.visitBinary = /**
  12090. * @param {?} ast
  12091. * @param {?} context
  12092. * @return {?}
  12093. */
  12094. function (ast, context) {
  12095. ast.left.visit(this);
  12096. ast.right.visit(this);
  12097. return null;
  12098. };
  12099. /**
  12100. * @param {?} ast
  12101. * @param {?} context
  12102. * @return {?}
  12103. */
  12104. RecursiveAstVisitor.prototype.visitChain = /**
  12105. * @param {?} ast
  12106. * @param {?} context
  12107. * @return {?}
  12108. */
  12109. function (ast, context) { return this.visitAll(ast.expressions, context); };
  12110. /**
  12111. * @param {?} ast
  12112. * @param {?} context
  12113. * @return {?}
  12114. */
  12115. RecursiveAstVisitor.prototype.visitConditional = /**
  12116. * @param {?} ast
  12117. * @param {?} context
  12118. * @return {?}
  12119. */
  12120. function (ast, context) {
  12121. ast.condition.visit(this);
  12122. ast.trueExp.visit(this);
  12123. ast.falseExp.visit(this);
  12124. return null;
  12125. };
  12126. /**
  12127. * @param {?} ast
  12128. * @param {?} context
  12129. * @return {?}
  12130. */
  12131. RecursiveAstVisitor.prototype.visitPipe = /**
  12132. * @param {?} ast
  12133. * @param {?} context
  12134. * @return {?}
  12135. */
  12136. function (ast, context) {
  12137. ast.exp.visit(this);
  12138. this.visitAll(ast.args, context);
  12139. return null;
  12140. };
  12141. /**
  12142. * @param {?} ast
  12143. * @param {?} context
  12144. * @return {?}
  12145. */
  12146. RecursiveAstVisitor.prototype.visitFunctionCall = /**
  12147. * @param {?} ast
  12148. * @param {?} context
  12149. * @return {?}
  12150. */
  12151. function (ast, context) {
  12152. /** @type {?} */ ((ast.target)).visit(this);
  12153. this.visitAll(ast.args, context);
  12154. return null;
  12155. };
  12156. /**
  12157. * @param {?} ast
  12158. * @param {?} context
  12159. * @return {?}
  12160. */
  12161. RecursiveAstVisitor.prototype.visitImplicitReceiver = /**
  12162. * @param {?} ast
  12163. * @param {?} context
  12164. * @return {?}
  12165. */
  12166. function (ast, context) { return null; };
  12167. /**
  12168. * @param {?} ast
  12169. * @param {?} context
  12170. * @return {?}
  12171. */
  12172. RecursiveAstVisitor.prototype.visitInterpolation = /**
  12173. * @param {?} ast
  12174. * @param {?} context
  12175. * @return {?}
  12176. */
  12177. function (ast, context) {
  12178. return this.visitAll(ast.expressions, context);
  12179. };
  12180. /**
  12181. * @param {?} ast
  12182. * @param {?} context
  12183. * @return {?}
  12184. */
  12185. RecursiveAstVisitor.prototype.visitKeyedRead = /**
  12186. * @param {?} ast
  12187. * @param {?} context
  12188. * @return {?}
  12189. */
  12190. function (ast, context) {
  12191. ast.obj.visit(this);
  12192. ast.key.visit(this);
  12193. return null;
  12194. };
  12195. /**
  12196. * @param {?} ast
  12197. * @param {?} context
  12198. * @return {?}
  12199. */
  12200. RecursiveAstVisitor.prototype.visitKeyedWrite = /**
  12201. * @param {?} ast
  12202. * @param {?} context
  12203. * @return {?}
  12204. */
  12205. function (ast, context) {
  12206. ast.obj.visit(this);
  12207. ast.key.visit(this);
  12208. ast.value.visit(this);
  12209. return null;
  12210. };
  12211. /**
  12212. * @param {?} ast
  12213. * @param {?} context
  12214. * @return {?}
  12215. */
  12216. RecursiveAstVisitor.prototype.visitLiteralArray = /**
  12217. * @param {?} ast
  12218. * @param {?} context
  12219. * @return {?}
  12220. */
  12221. function (ast, context) {
  12222. return this.visitAll(ast.expressions, context);
  12223. };
  12224. /**
  12225. * @param {?} ast
  12226. * @param {?} context
  12227. * @return {?}
  12228. */
  12229. RecursiveAstVisitor.prototype.visitLiteralMap = /**
  12230. * @param {?} ast
  12231. * @param {?} context
  12232. * @return {?}
  12233. */
  12234. function (ast, context) { return this.visitAll(ast.values, context); };
  12235. /**
  12236. * @param {?} ast
  12237. * @param {?} context
  12238. * @return {?}
  12239. */
  12240. RecursiveAstVisitor.prototype.visitLiteralPrimitive = /**
  12241. * @param {?} ast
  12242. * @param {?} context
  12243. * @return {?}
  12244. */
  12245. function (ast, context) { return null; };
  12246. /**
  12247. * @param {?} ast
  12248. * @param {?} context
  12249. * @return {?}
  12250. */
  12251. RecursiveAstVisitor.prototype.visitMethodCall = /**
  12252. * @param {?} ast
  12253. * @param {?} context
  12254. * @return {?}
  12255. */
  12256. function (ast, context) {
  12257. ast.receiver.visit(this);
  12258. return this.visitAll(ast.args, context);
  12259. };
  12260. /**
  12261. * @param {?} ast
  12262. * @param {?} context
  12263. * @return {?}
  12264. */
  12265. RecursiveAstVisitor.prototype.visitPrefixNot = /**
  12266. * @param {?} ast
  12267. * @param {?} context
  12268. * @return {?}
  12269. */
  12270. function (ast, context) {
  12271. ast.expression.visit(this);
  12272. return null;
  12273. };
  12274. /**
  12275. * @param {?} ast
  12276. * @param {?} context
  12277. * @return {?}
  12278. */
  12279. RecursiveAstVisitor.prototype.visitNonNullAssert = /**
  12280. * @param {?} ast
  12281. * @param {?} context
  12282. * @return {?}
  12283. */
  12284. function (ast, context) {
  12285. ast.expression.visit(this);
  12286. return null;
  12287. };
  12288. /**
  12289. * @param {?} ast
  12290. * @param {?} context
  12291. * @return {?}
  12292. */
  12293. RecursiveAstVisitor.prototype.visitPropertyRead = /**
  12294. * @param {?} ast
  12295. * @param {?} context
  12296. * @return {?}
  12297. */
  12298. function (ast, context) {
  12299. ast.receiver.visit(this);
  12300. return null;
  12301. };
  12302. /**
  12303. * @param {?} ast
  12304. * @param {?} context
  12305. * @return {?}
  12306. */
  12307. RecursiveAstVisitor.prototype.visitPropertyWrite = /**
  12308. * @param {?} ast
  12309. * @param {?} context
  12310. * @return {?}
  12311. */
  12312. function (ast, context) {
  12313. ast.receiver.visit(this);
  12314. ast.value.visit(this);
  12315. return null;
  12316. };
  12317. /**
  12318. * @param {?} ast
  12319. * @param {?} context
  12320. * @return {?}
  12321. */
  12322. RecursiveAstVisitor.prototype.visitSafePropertyRead = /**
  12323. * @param {?} ast
  12324. * @param {?} context
  12325. * @return {?}
  12326. */
  12327. function (ast, context) {
  12328. ast.receiver.visit(this);
  12329. return null;
  12330. };
  12331. /**
  12332. * @param {?} ast
  12333. * @param {?} context
  12334. * @return {?}
  12335. */
  12336. RecursiveAstVisitor.prototype.visitSafeMethodCall = /**
  12337. * @param {?} ast
  12338. * @param {?} context
  12339. * @return {?}
  12340. */
  12341. function (ast, context) {
  12342. ast.receiver.visit(this);
  12343. return this.visitAll(ast.args, context);
  12344. };
  12345. /**
  12346. * @param {?} asts
  12347. * @param {?} context
  12348. * @return {?}
  12349. */
  12350. RecursiveAstVisitor.prototype.visitAll = /**
  12351. * @param {?} asts
  12352. * @param {?} context
  12353. * @return {?}
  12354. */
  12355. function (asts, context) {
  12356. var _this = this;
  12357. asts.forEach(function (ast) { return ast.visit(_this, context); });
  12358. return null;
  12359. };
  12360. /**
  12361. * @param {?} ast
  12362. * @param {?} context
  12363. * @return {?}
  12364. */
  12365. RecursiveAstVisitor.prototype.visitQuote = /**
  12366. * @param {?} ast
  12367. * @param {?} context
  12368. * @return {?}
  12369. */
  12370. function (ast, context) { return null; };
  12371. return RecursiveAstVisitor;
  12372. }());
  12373. var AstTransformer = /** @class */ (function () {
  12374. function AstTransformer() {
  12375. }
  12376. /**
  12377. * @param {?} ast
  12378. * @param {?} context
  12379. * @return {?}
  12380. */
  12381. AstTransformer.prototype.visitImplicitReceiver = /**
  12382. * @param {?} ast
  12383. * @param {?} context
  12384. * @return {?}
  12385. */
  12386. function (ast, context) { return ast; };
  12387. /**
  12388. * @param {?} ast
  12389. * @param {?} context
  12390. * @return {?}
  12391. */
  12392. AstTransformer.prototype.visitInterpolation = /**
  12393. * @param {?} ast
  12394. * @param {?} context
  12395. * @return {?}
  12396. */
  12397. function (ast, context) {
  12398. return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions));
  12399. };
  12400. /**
  12401. * @param {?} ast
  12402. * @param {?} context
  12403. * @return {?}
  12404. */
  12405. AstTransformer.prototype.visitLiteralPrimitive = /**
  12406. * @param {?} ast
  12407. * @param {?} context
  12408. * @return {?}
  12409. */
  12410. function (ast, context) {
  12411. return new LiteralPrimitive(ast.span, ast.value);
  12412. };
  12413. /**
  12414. * @param {?} ast
  12415. * @param {?} context
  12416. * @return {?}
  12417. */
  12418. AstTransformer.prototype.visitPropertyRead = /**
  12419. * @param {?} ast
  12420. * @param {?} context
  12421. * @return {?}
  12422. */
  12423. function (ast, context) {
  12424. return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name);
  12425. };
  12426. /**
  12427. * @param {?} ast
  12428. * @param {?} context
  12429. * @return {?}
  12430. */
  12431. AstTransformer.prototype.visitPropertyWrite = /**
  12432. * @param {?} ast
  12433. * @param {?} context
  12434. * @return {?}
  12435. */
  12436. function (ast, context) {
  12437. return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this));
  12438. };
  12439. /**
  12440. * @param {?} ast
  12441. * @param {?} context
  12442. * @return {?}
  12443. */
  12444. AstTransformer.prototype.visitSafePropertyRead = /**
  12445. * @param {?} ast
  12446. * @param {?} context
  12447. * @return {?}
  12448. */
  12449. function (ast, context) {
  12450. return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name);
  12451. };
  12452. /**
  12453. * @param {?} ast
  12454. * @param {?} context
  12455. * @return {?}
  12456. */
  12457. AstTransformer.prototype.visitMethodCall = /**
  12458. * @param {?} ast
  12459. * @param {?} context
  12460. * @return {?}
  12461. */
  12462. function (ast, context) {
  12463. return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
  12464. };
  12465. /**
  12466. * @param {?} ast
  12467. * @param {?} context
  12468. * @return {?}
  12469. */
  12470. AstTransformer.prototype.visitSafeMethodCall = /**
  12471. * @param {?} ast
  12472. * @param {?} context
  12473. * @return {?}
  12474. */
  12475. function (ast, context) {
  12476. return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
  12477. };
  12478. /**
  12479. * @param {?} ast
  12480. * @param {?} context
  12481. * @return {?}
  12482. */
  12483. AstTransformer.prototype.visitFunctionCall = /**
  12484. * @param {?} ast
  12485. * @param {?} context
  12486. * @return {?}
  12487. */
  12488. function (ast, context) {
  12489. return new FunctionCall(ast.span, /** @type {?} */ ((ast.target)).visit(this), this.visitAll(ast.args));
  12490. };
  12491. /**
  12492. * @param {?} ast
  12493. * @param {?} context
  12494. * @return {?}
  12495. */
  12496. AstTransformer.prototype.visitLiteralArray = /**
  12497. * @param {?} ast
  12498. * @param {?} context
  12499. * @return {?}
  12500. */
  12501. function (ast, context) {
  12502. return new LiteralArray(ast.span, this.visitAll(ast.expressions));
  12503. };
  12504. /**
  12505. * @param {?} ast
  12506. * @param {?} context
  12507. * @return {?}
  12508. */
  12509. AstTransformer.prototype.visitLiteralMap = /**
  12510. * @param {?} ast
  12511. * @param {?} context
  12512. * @return {?}
  12513. */
  12514. function (ast, context) {
  12515. return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values));
  12516. };
  12517. /**
  12518. * @param {?} ast
  12519. * @param {?} context
  12520. * @return {?}
  12521. */
  12522. AstTransformer.prototype.visitBinary = /**
  12523. * @param {?} ast
  12524. * @param {?} context
  12525. * @return {?}
  12526. */
  12527. function (ast, context) {
  12528. return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this));
  12529. };
  12530. /**
  12531. * @param {?} ast
  12532. * @param {?} context
  12533. * @return {?}
  12534. */
  12535. AstTransformer.prototype.visitPrefixNot = /**
  12536. * @param {?} ast
  12537. * @param {?} context
  12538. * @return {?}
  12539. */
  12540. function (ast, context) {
  12541. return new PrefixNot(ast.span, ast.expression.visit(this));
  12542. };
  12543. /**
  12544. * @param {?} ast
  12545. * @param {?} context
  12546. * @return {?}
  12547. */
  12548. AstTransformer.prototype.visitNonNullAssert = /**
  12549. * @param {?} ast
  12550. * @param {?} context
  12551. * @return {?}
  12552. */
  12553. function (ast, context) {
  12554. return new NonNullAssert(ast.span, ast.expression.visit(this));
  12555. };
  12556. /**
  12557. * @param {?} ast
  12558. * @param {?} context
  12559. * @return {?}
  12560. */
  12561. AstTransformer.prototype.visitConditional = /**
  12562. * @param {?} ast
  12563. * @param {?} context
  12564. * @return {?}
  12565. */
  12566. function (ast, context) {
  12567. return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));
  12568. };
  12569. /**
  12570. * @param {?} ast
  12571. * @param {?} context
  12572. * @return {?}
  12573. */
  12574. AstTransformer.prototype.visitPipe = /**
  12575. * @param {?} ast
  12576. * @param {?} context
  12577. * @return {?}
  12578. */
  12579. function (ast, context) {
  12580. return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args));
  12581. };
  12582. /**
  12583. * @param {?} ast
  12584. * @param {?} context
  12585. * @return {?}
  12586. */
  12587. AstTransformer.prototype.visitKeyedRead = /**
  12588. * @param {?} ast
  12589. * @param {?} context
  12590. * @return {?}
  12591. */
  12592. function (ast, context) {
  12593. return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this));
  12594. };
  12595. /**
  12596. * @param {?} ast
  12597. * @param {?} context
  12598. * @return {?}
  12599. */
  12600. AstTransformer.prototype.visitKeyedWrite = /**
  12601. * @param {?} ast
  12602. * @param {?} context
  12603. * @return {?}
  12604. */
  12605. function (ast, context) {
  12606. return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this));
  12607. };
  12608. /**
  12609. * @param {?} asts
  12610. * @return {?}
  12611. */
  12612. AstTransformer.prototype.visitAll = /**
  12613. * @param {?} asts
  12614. * @return {?}
  12615. */
  12616. function (asts) {
  12617. var /** @type {?} */ res = new Array(asts.length);
  12618. for (var /** @type {?} */ i = 0; i < asts.length; ++i) {
  12619. res[i] = asts[i].visit(this);
  12620. }
  12621. return res;
  12622. };
  12623. /**
  12624. * @param {?} ast
  12625. * @param {?} context
  12626. * @return {?}
  12627. */
  12628. AstTransformer.prototype.visitChain = /**
  12629. * @param {?} ast
  12630. * @param {?} context
  12631. * @return {?}
  12632. */
  12633. function (ast, context) {
  12634. return new Chain(ast.span, this.visitAll(ast.expressions));
  12635. };
  12636. /**
  12637. * @param {?} ast
  12638. * @param {?} context
  12639. * @return {?}
  12640. */
  12641. AstTransformer.prototype.visitQuote = /**
  12642. * @param {?} ast
  12643. * @param {?} context
  12644. * @return {?}
  12645. */
  12646. function (ast, context) {
  12647. return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location);
  12648. };
  12649. return AstTransformer;
  12650. }());
  12651. /**
  12652. * @param {?} ast
  12653. * @param {?} visitor
  12654. * @param {?=} context
  12655. * @return {?}
  12656. */
  12657. function visitAstChildren(ast, visitor, context) {
  12658. /**
  12659. * @param {?} ast
  12660. * @return {?}
  12661. */
  12662. function visit(ast) {
  12663. visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context);
  12664. }
  12665. /**
  12666. * @template T
  12667. * @param {?} asts
  12668. * @return {?}
  12669. */
  12670. function visitAll(asts) { asts.forEach(visit); }
  12671. ast.visit({
  12672. visitBinary: /**
  12673. * @param {?} ast
  12674. * @return {?}
  12675. */
  12676. function (ast) {
  12677. visit(ast.left);
  12678. visit(ast.right);
  12679. },
  12680. visitChain: /**
  12681. * @param {?} ast
  12682. * @return {?}
  12683. */
  12684. function (ast) { visitAll(ast.expressions); },
  12685. visitConditional: /**
  12686. * @param {?} ast
  12687. * @return {?}
  12688. */
  12689. function (ast) {
  12690. visit(ast.condition);
  12691. visit(ast.trueExp);
  12692. visit(ast.falseExp);
  12693. },
  12694. visitFunctionCall: /**
  12695. * @param {?} ast
  12696. * @return {?}
  12697. */
  12698. function (ast) {
  12699. if (ast.target) {
  12700. visit(ast.target);
  12701. }
  12702. visitAll(ast.args);
  12703. },
  12704. visitImplicitReceiver: /**
  12705. * @param {?} ast
  12706. * @return {?}
  12707. */
  12708. function (ast) { },
  12709. visitInterpolation: /**
  12710. * @param {?} ast
  12711. * @return {?}
  12712. */
  12713. function (ast) { visitAll(ast.expressions); },
  12714. visitKeyedRead: /**
  12715. * @param {?} ast
  12716. * @return {?}
  12717. */
  12718. function (ast) {
  12719. visit(ast.obj);
  12720. visit(ast.key);
  12721. },
  12722. visitKeyedWrite: /**
  12723. * @param {?} ast
  12724. * @return {?}
  12725. */
  12726. function (ast) {
  12727. visit(ast.obj);
  12728. visit(ast.key);
  12729. visit(ast.obj);
  12730. },
  12731. visitLiteralArray: /**
  12732. * @param {?} ast
  12733. * @return {?}
  12734. */
  12735. function (ast) { visitAll(ast.expressions); },
  12736. visitLiteralMap: /**
  12737. * @param {?} ast
  12738. * @return {?}
  12739. */
  12740. function (ast) { },
  12741. visitLiteralPrimitive: /**
  12742. * @param {?} ast
  12743. * @return {?}
  12744. */
  12745. function (ast) { },
  12746. visitMethodCall: /**
  12747. * @param {?} ast
  12748. * @return {?}
  12749. */
  12750. function (ast) {
  12751. visit(ast.receiver);
  12752. visitAll(ast.args);
  12753. },
  12754. visitPipe: /**
  12755. * @param {?} ast
  12756. * @return {?}
  12757. */
  12758. function (ast) {
  12759. visit(ast.exp);
  12760. visitAll(ast.args);
  12761. },
  12762. visitPrefixNot: /**
  12763. * @param {?} ast
  12764. * @return {?}
  12765. */
  12766. function (ast) { visit(ast.expression); },
  12767. visitNonNullAssert: /**
  12768. * @param {?} ast
  12769. * @return {?}
  12770. */
  12771. function (ast) { visit(ast.expression); },
  12772. visitPropertyRead: /**
  12773. * @param {?} ast
  12774. * @return {?}
  12775. */
  12776. function (ast) { visit(ast.receiver); },
  12777. visitPropertyWrite: /**
  12778. * @param {?} ast
  12779. * @return {?}
  12780. */
  12781. function (ast) {
  12782. visit(ast.receiver);
  12783. visit(ast.value);
  12784. },
  12785. visitQuote: /**
  12786. * @param {?} ast
  12787. * @return {?}
  12788. */
  12789. function (ast) { },
  12790. visitSafeMethodCall: /**
  12791. * @param {?} ast
  12792. * @return {?}
  12793. */
  12794. function (ast) {
  12795. visit(ast.receiver);
  12796. visitAll(ast.args);
  12797. },
  12798. visitSafePropertyRead: /**
  12799. * @param {?} ast
  12800. * @return {?}
  12801. */
  12802. function (ast) { visit(ast.receiver); },
  12803. });
  12804. }
  12805. /**
  12806. * @fileoverview added by tsickle
  12807. * @suppress {checkTypes} checked by tsc
  12808. */
  12809. /**
  12810. * @license
  12811. * Copyright Google Inc. All Rights Reserved.
  12812. *
  12813. * Use of this source code is governed by an MIT-style license that can be
  12814. * found in the LICENSE file at https://angular.io/license
  12815. */
  12816. var SplitInterpolation = /** @class */ (function () {
  12817. function SplitInterpolation(strings, expressions, offsets) {
  12818. this.strings = strings;
  12819. this.expressions = expressions;
  12820. this.offsets = offsets;
  12821. }
  12822. return SplitInterpolation;
  12823. }());
  12824. var TemplateBindingParseResult = /** @class */ (function () {
  12825. function TemplateBindingParseResult(templateBindings, warnings, errors) {
  12826. this.templateBindings = templateBindings;
  12827. this.warnings = warnings;
  12828. this.errors = errors;
  12829. }
  12830. return TemplateBindingParseResult;
  12831. }());
  12832. /**
  12833. * @param {?} config
  12834. * @return {?}
  12835. */
  12836. function _createInterpolateRegExp(config) {
  12837. var /** @type {?} */ pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
  12838. return new RegExp(pattern, 'g');
  12839. }
  12840. var Parser = /** @class */ (function () {
  12841. function Parser(_lexer) {
  12842. this._lexer = _lexer;
  12843. this.errors = [];
  12844. }
  12845. /**
  12846. * @param {?} input
  12847. * @param {?} location
  12848. * @param {?=} interpolationConfig
  12849. * @return {?}
  12850. */
  12851. Parser.prototype.parseAction = /**
  12852. * @param {?} input
  12853. * @param {?} location
  12854. * @param {?=} interpolationConfig
  12855. * @return {?}
  12856. */
  12857. function (input, location, interpolationConfig) {
  12858. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12859. this._checkNoInterpolation(input, location, interpolationConfig);
  12860. var /** @type {?} */ sourceToLex = this._stripComments(input);
  12861. var /** @type {?} */ tokens = this._lexer.tokenize(this._stripComments(input));
  12862. var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length)
  12863. .parseChain();
  12864. return new ASTWithSource(ast, input, location, this.errors);
  12865. };
  12866. /**
  12867. * @param {?} input
  12868. * @param {?} location
  12869. * @param {?=} interpolationConfig
  12870. * @return {?}
  12871. */
  12872. Parser.prototype.parseBinding = /**
  12873. * @param {?} input
  12874. * @param {?} location
  12875. * @param {?=} interpolationConfig
  12876. * @return {?}
  12877. */
  12878. function (input, location, interpolationConfig) {
  12879. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12880. var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig);
  12881. return new ASTWithSource(ast, input, location, this.errors);
  12882. };
  12883. /**
  12884. * @param {?} input
  12885. * @param {?} location
  12886. * @param {?=} interpolationConfig
  12887. * @return {?}
  12888. */
  12889. Parser.prototype.parseSimpleBinding = /**
  12890. * @param {?} input
  12891. * @param {?} location
  12892. * @param {?=} interpolationConfig
  12893. * @return {?}
  12894. */
  12895. function (input, location, interpolationConfig) {
  12896. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12897. var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig);
  12898. var /** @type {?} */ errors = SimpleExpressionChecker.check(ast);
  12899. if (errors.length > 0) {
  12900. this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location);
  12901. }
  12902. return new ASTWithSource(ast, input, location, this.errors);
  12903. };
  12904. /**
  12905. * @param {?} message
  12906. * @param {?} input
  12907. * @param {?} errLocation
  12908. * @param {?=} ctxLocation
  12909. * @return {?}
  12910. */
  12911. Parser.prototype._reportError = /**
  12912. * @param {?} message
  12913. * @param {?} input
  12914. * @param {?} errLocation
  12915. * @param {?=} ctxLocation
  12916. * @return {?}
  12917. */
  12918. function (message, input, errLocation, ctxLocation) {
  12919. this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
  12920. };
  12921. /**
  12922. * @param {?} input
  12923. * @param {?} location
  12924. * @param {?} interpolationConfig
  12925. * @return {?}
  12926. */
  12927. Parser.prototype._parseBindingAst = /**
  12928. * @param {?} input
  12929. * @param {?} location
  12930. * @param {?} interpolationConfig
  12931. * @return {?}
  12932. */
  12933. function (input, location, interpolationConfig) {
  12934. // Quotes expressions use 3rd-party expression language. We don't want to use
  12935. // our lexer or parser for that, so we check for that ahead of time.
  12936. var /** @type {?} */ quote = this._parseQuote(input, location);
  12937. if (quote != null) {
  12938. return quote;
  12939. }
  12940. this._checkNoInterpolation(input, location, interpolationConfig);
  12941. var /** @type {?} */ sourceToLex = this._stripComments(input);
  12942. var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex);
  12943. return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length)
  12944. .parseChain();
  12945. };
  12946. /**
  12947. * @param {?} input
  12948. * @param {?} location
  12949. * @return {?}
  12950. */
  12951. Parser.prototype._parseQuote = /**
  12952. * @param {?} input
  12953. * @param {?} location
  12954. * @return {?}
  12955. */
  12956. function (input, location) {
  12957. if (input == null)
  12958. return null;
  12959. var /** @type {?} */ prefixSeparatorIndex = input.indexOf(':');
  12960. if (prefixSeparatorIndex == -1)
  12961. return null;
  12962. var /** @type {?} */ prefix = input.substring(0, prefixSeparatorIndex).trim();
  12963. if (!isIdentifier(prefix))
  12964. return null;
  12965. var /** @type {?} */ uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
  12966. return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location);
  12967. };
  12968. /**
  12969. * @param {?} prefixToken
  12970. * @param {?} input
  12971. * @param {?} location
  12972. * @return {?}
  12973. */
  12974. Parser.prototype.parseTemplateBindings = /**
  12975. * @param {?} prefixToken
  12976. * @param {?} input
  12977. * @param {?} location
  12978. * @return {?}
  12979. */
  12980. function (prefixToken, input, location) {
  12981. var /** @type {?} */ tokens = this._lexer.tokenize(input);
  12982. if (prefixToken) {
  12983. // Prefix the tokens with the tokens from prefixToken but have them take no space (0 index).
  12984. var /** @type {?} */ prefixTokens = this._lexer.tokenize(prefixToken).map(function (t) {
  12985. t.index = 0;
  12986. return t;
  12987. });
  12988. tokens.unshift.apply(tokens, prefixTokens);
  12989. }
  12990. return new _ParseAST(input, location, tokens, input.length, false, this.errors, 0)
  12991. .parseTemplateBindings();
  12992. };
  12993. /**
  12994. * @param {?} input
  12995. * @param {?} location
  12996. * @param {?=} interpolationConfig
  12997. * @return {?}
  12998. */
  12999. Parser.prototype.parseInterpolation = /**
  13000. * @param {?} input
  13001. * @param {?} location
  13002. * @param {?=} interpolationConfig
  13003. * @return {?}
  13004. */
  13005. function (input, location, interpolationConfig) {
  13006. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  13007. var /** @type {?} */ split = this.splitInterpolation(input, location, interpolationConfig);
  13008. if (split == null)
  13009. return null;
  13010. var /** @type {?} */ expressions = [];
  13011. for (var /** @type {?} */ i = 0; i < split.expressions.length; ++i) {
  13012. var /** @type {?} */ expressionText = split.expressions[i];
  13013. var /** @type {?} */ sourceToLex = this._stripComments(expressionText);
  13014. var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex);
  13015. var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length))
  13016. .parseChain();
  13017. expressions.push(ast);
  13018. }
  13019. return new ASTWithSource(new Interpolation(new ParseSpan(0, input == null ? 0 : input.length), split.strings, expressions), input, location, this.errors);
  13020. };
  13021. /**
  13022. * @param {?} input
  13023. * @param {?} location
  13024. * @param {?=} interpolationConfig
  13025. * @return {?}
  13026. */
  13027. Parser.prototype.splitInterpolation = /**
  13028. * @param {?} input
  13029. * @param {?} location
  13030. * @param {?=} interpolationConfig
  13031. * @return {?}
  13032. */
  13033. function (input, location, interpolationConfig) {
  13034. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  13035. var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig);
  13036. var /** @type {?} */ parts = input.split(regexp);
  13037. if (parts.length <= 1) {
  13038. return null;
  13039. }
  13040. var /** @type {?} */ strings = [];
  13041. var /** @type {?} */ expressions = [];
  13042. var /** @type {?} */ offsets = [];
  13043. var /** @type {?} */ offset = 0;
  13044. for (var /** @type {?} */ i = 0; i < parts.length; i++) {
  13045. var /** @type {?} */ part = parts[i];
  13046. if (i % 2 === 0) {
  13047. // fixed string
  13048. strings.push(part);
  13049. offset += part.length;
  13050. }
  13051. else if (part.trim().length > 0) {
  13052. offset += interpolationConfig.start.length;
  13053. expressions.push(part);
  13054. offsets.push(offset);
  13055. offset += part.length + interpolationConfig.end.length;
  13056. }
  13057. else {
  13058. this._reportError('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i, interpolationConfig) + " in", location);
  13059. expressions.push('$implict');
  13060. offsets.push(offset);
  13061. }
  13062. }
  13063. return new SplitInterpolation(strings, expressions, offsets);
  13064. };
  13065. /**
  13066. * @param {?} input
  13067. * @param {?} location
  13068. * @return {?}
  13069. */
  13070. Parser.prototype.wrapLiteralPrimitive = /**
  13071. * @param {?} input
  13072. * @param {?} location
  13073. * @return {?}
  13074. */
  13075. function (input, location) {
  13076. return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, this.errors);
  13077. };
  13078. /**
  13079. * @param {?} input
  13080. * @return {?}
  13081. */
  13082. Parser.prototype._stripComments = /**
  13083. * @param {?} input
  13084. * @return {?}
  13085. */
  13086. function (input) {
  13087. var /** @type {?} */ i = this._commentStart(input);
  13088. return i != null ? input.substring(0, i).trim() : input;
  13089. };
  13090. /**
  13091. * @param {?} input
  13092. * @return {?}
  13093. */
  13094. Parser.prototype._commentStart = /**
  13095. * @param {?} input
  13096. * @return {?}
  13097. */
  13098. function (input) {
  13099. var /** @type {?} */ outerQuote = null;
  13100. for (var /** @type {?} */ i = 0; i < input.length - 1; i++) {
  13101. var /** @type {?} */ char = input.charCodeAt(i);
  13102. var /** @type {?} */ nextChar = input.charCodeAt(i + 1);
  13103. if (char === $SLASH && nextChar == $SLASH && outerQuote == null)
  13104. return i;
  13105. if (outerQuote === char) {
  13106. outerQuote = null;
  13107. }
  13108. else if (outerQuote == null && isQuote(char)) {
  13109. outerQuote = char;
  13110. }
  13111. }
  13112. return null;
  13113. };
  13114. /**
  13115. * @param {?} input
  13116. * @param {?} location
  13117. * @param {?} interpolationConfig
  13118. * @return {?}
  13119. */
  13120. Parser.prototype._checkNoInterpolation = /**
  13121. * @param {?} input
  13122. * @param {?} location
  13123. * @param {?} interpolationConfig
  13124. * @return {?}
  13125. */
  13126. function (input, location, interpolationConfig) {
  13127. var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig);
  13128. var /** @type {?} */ parts = input.split(regexp);
  13129. if (parts.length > 1) {
  13130. this._reportError("Got interpolation (" + interpolationConfig.start + interpolationConfig.end + ") where expression was expected", input, "at column " + this._findInterpolationErrorColumn(parts, 1, interpolationConfig) + " in", location);
  13131. }
  13132. };
  13133. /**
  13134. * @param {?} parts
  13135. * @param {?} partInErrIdx
  13136. * @param {?} interpolationConfig
  13137. * @return {?}
  13138. */
  13139. Parser.prototype._findInterpolationErrorColumn = /**
  13140. * @param {?} parts
  13141. * @param {?} partInErrIdx
  13142. * @param {?} interpolationConfig
  13143. * @return {?}
  13144. */
  13145. function (parts, partInErrIdx, interpolationConfig) {
  13146. var /** @type {?} */ errLocation = '';
  13147. for (var /** @type {?} */ j = 0; j < partInErrIdx; j++) {
  13148. errLocation += j % 2 === 0 ?
  13149. parts[j] :
  13150. "" + interpolationConfig.start + parts[j] + interpolationConfig.end;
  13151. }
  13152. return errLocation.length;
  13153. };
  13154. return Parser;
  13155. }());
  13156. var _ParseAST = /** @class */ (function () {
  13157. function _ParseAST(input, location, tokens, inputLength, parseAction, errors, offset) {
  13158. this.input = input;
  13159. this.location = location;
  13160. this.tokens = tokens;
  13161. this.inputLength = inputLength;
  13162. this.parseAction = parseAction;
  13163. this.errors = errors;
  13164. this.offset = offset;
  13165. this.rparensExpected = 0;
  13166. this.rbracketsExpected = 0;
  13167. this.rbracesExpected = 0;
  13168. this.index = 0;
  13169. }
  13170. /**
  13171. * @param {?} offset
  13172. * @return {?}
  13173. */
  13174. _ParseAST.prototype.peek = /**
  13175. * @param {?} offset
  13176. * @return {?}
  13177. */
  13178. function (offset) {
  13179. var /** @type {?} */ i = this.index + offset;
  13180. return i < this.tokens.length ? this.tokens[i] : EOF;
  13181. };
  13182. Object.defineProperty(_ParseAST.prototype, "next", {
  13183. get: /**
  13184. * @return {?}
  13185. */
  13186. function () { return this.peek(0); },
  13187. enumerable: true,
  13188. configurable: true
  13189. });
  13190. Object.defineProperty(_ParseAST.prototype, "inputIndex", {
  13191. get: /**
  13192. * @return {?}
  13193. */
  13194. function () {
  13195. return (this.index < this.tokens.length) ? this.next.index + this.offset :
  13196. this.inputLength + this.offset;
  13197. },
  13198. enumerable: true,
  13199. configurable: true
  13200. });
  13201. /**
  13202. * @param {?} start
  13203. * @return {?}
  13204. */
  13205. _ParseAST.prototype.span = /**
  13206. * @param {?} start
  13207. * @return {?}
  13208. */
  13209. function (start) { return new ParseSpan(start, this.inputIndex); };
  13210. /**
  13211. * @return {?}
  13212. */
  13213. _ParseAST.prototype.advance = /**
  13214. * @return {?}
  13215. */
  13216. function () { this.index++; };
  13217. /**
  13218. * @param {?} code
  13219. * @return {?}
  13220. */
  13221. _ParseAST.prototype.optionalCharacter = /**
  13222. * @param {?} code
  13223. * @return {?}
  13224. */
  13225. function (code) {
  13226. if (this.next.isCharacter(code)) {
  13227. this.advance();
  13228. return true;
  13229. }
  13230. else {
  13231. return false;
  13232. }
  13233. };
  13234. /**
  13235. * @return {?}
  13236. */
  13237. _ParseAST.prototype.peekKeywordLet = /**
  13238. * @return {?}
  13239. */
  13240. function () { return this.next.isKeywordLet(); };
  13241. /**
  13242. * @return {?}
  13243. */
  13244. _ParseAST.prototype.peekKeywordAs = /**
  13245. * @return {?}
  13246. */
  13247. function () { return this.next.isKeywordAs(); };
  13248. /**
  13249. * @param {?} code
  13250. * @return {?}
  13251. */
  13252. _ParseAST.prototype.expectCharacter = /**
  13253. * @param {?} code
  13254. * @return {?}
  13255. */
  13256. function (code) {
  13257. if (this.optionalCharacter(code))
  13258. return;
  13259. this.error("Missing expected " + String.fromCharCode(code));
  13260. };
  13261. /**
  13262. * @param {?} op
  13263. * @return {?}
  13264. */
  13265. _ParseAST.prototype.optionalOperator = /**
  13266. * @param {?} op
  13267. * @return {?}
  13268. */
  13269. function (op) {
  13270. if (this.next.isOperator(op)) {
  13271. this.advance();
  13272. return true;
  13273. }
  13274. else {
  13275. return false;
  13276. }
  13277. };
  13278. /**
  13279. * @param {?} operator
  13280. * @return {?}
  13281. */
  13282. _ParseAST.prototype.expectOperator = /**
  13283. * @param {?} operator
  13284. * @return {?}
  13285. */
  13286. function (operator) {
  13287. if (this.optionalOperator(operator))
  13288. return;
  13289. this.error("Missing expected operator " + operator);
  13290. };
  13291. /**
  13292. * @return {?}
  13293. */
  13294. _ParseAST.prototype.expectIdentifierOrKeyword = /**
  13295. * @return {?}
  13296. */
  13297. function () {
  13298. var /** @type {?} */ n = this.next;
  13299. if (!n.isIdentifier() && !n.isKeyword()) {
  13300. this.error("Unexpected token " + n + ", expected identifier or keyword");
  13301. return '';
  13302. }
  13303. this.advance();
  13304. return /** @type {?} */ (n.toString());
  13305. };
  13306. /**
  13307. * @return {?}
  13308. */
  13309. _ParseAST.prototype.expectIdentifierOrKeywordOrString = /**
  13310. * @return {?}
  13311. */
  13312. function () {
  13313. var /** @type {?} */ n = this.next;
  13314. if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
  13315. this.error("Unexpected token " + n + ", expected identifier, keyword, or string");
  13316. return '';
  13317. }
  13318. this.advance();
  13319. return /** @type {?} */ (n.toString());
  13320. };
  13321. /**
  13322. * @return {?}
  13323. */
  13324. _ParseAST.prototype.parseChain = /**
  13325. * @return {?}
  13326. */
  13327. function () {
  13328. var /** @type {?} */ exprs = [];
  13329. var /** @type {?} */ start = this.inputIndex;
  13330. while (this.index < this.tokens.length) {
  13331. var /** @type {?} */ expr = this.parsePipe();
  13332. exprs.push(expr);
  13333. if (this.optionalCharacter($SEMICOLON)) {
  13334. if (!this.parseAction) {
  13335. this.error('Binding expression cannot contain chained expression');
  13336. }
  13337. while (this.optionalCharacter($SEMICOLON)) {
  13338. } // read all semicolons
  13339. }
  13340. else if (this.index < this.tokens.length) {
  13341. this.error("Unexpected token '" + this.next + "'");
  13342. }
  13343. }
  13344. if (exprs.length == 0)
  13345. return new EmptyExpr(this.span(start));
  13346. if (exprs.length == 1)
  13347. return exprs[0];
  13348. return new Chain(this.span(start), exprs);
  13349. };
  13350. /**
  13351. * @return {?}
  13352. */
  13353. _ParseAST.prototype.parsePipe = /**
  13354. * @return {?}
  13355. */
  13356. function () {
  13357. var /** @type {?} */ result = this.parseExpression();
  13358. if (this.optionalOperator('|')) {
  13359. if (this.parseAction) {
  13360. this.error('Cannot have a pipe in an action expression');
  13361. }
  13362. do {
  13363. var /** @type {?} */ name_1 = this.expectIdentifierOrKeyword();
  13364. var /** @type {?} */ args = [];
  13365. while (this.optionalCharacter($COLON)) {
  13366. args.push(this.parseExpression());
  13367. }
  13368. result = new BindingPipe(this.span(result.span.start), result, name_1, args);
  13369. } while (this.optionalOperator('|'));
  13370. }
  13371. return result;
  13372. };
  13373. /**
  13374. * @return {?}
  13375. */
  13376. _ParseAST.prototype.parseExpression = /**
  13377. * @return {?}
  13378. */
  13379. function () { return this.parseConditional(); };
  13380. /**
  13381. * @return {?}
  13382. */
  13383. _ParseAST.prototype.parseConditional = /**
  13384. * @return {?}
  13385. */
  13386. function () {
  13387. var /** @type {?} */ start = this.inputIndex;
  13388. var /** @type {?} */ result = this.parseLogicalOr();
  13389. if (this.optionalOperator('?')) {
  13390. var /** @type {?} */ yes = this.parsePipe();
  13391. var /** @type {?} */ no = void 0;
  13392. if (!this.optionalCharacter($COLON)) {
  13393. var /** @type {?} */ end = this.inputIndex;
  13394. var /** @type {?} */ expression = this.input.substring(start, end);
  13395. this.error("Conditional expression " + expression + " requires all 3 expressions");
  13396. no = new EmptyExpr(this.span(start));
  13397. }
  13398. else {
  13399. no = this.parsePipe();
  13400. }
  13401. return new Conditional(this.span(start), result, yes, no);
  13402. }
  13403. else {
  13404. return result;
  13405. }
  13406. };
  13407. /**
  13408. * @return {?}
  13409. */
  13410. _ParseAST.prototype.parseLogicalOr = /**
  13411. * @return {?}
  13412. */
  13413. function () {
  13414. // '||'
  13415. var /** @type {?} */ result = this.parseLogicalAnd();
  13416. while (this.optionalOperator('||')) {
  13417. var /** @type {?} */ right = this.parseLogicalAnd();
  13418. result = new Binary(this.span(result.span.start), '||', result, right);
  13419. }
  13420. return result;
  13421. };
  13422. /**
  13423. * @return {?}
  13424. */
  13425. _ParseAST.prototype.parseLogicalAnd = /**
  13426. * @return {?}
  13427. */
  13428. function () {
  13429. // '&&'
  13430. var /** @type {?} */ result = this.parseEquality();
  13431. while (this.optionalOperator('&&')) {
  13432. var /** @type {?} */ right = this.parseEquality();
  13433. result = new Binary(this.span(result.span.start), '&&', result, right);
  13434. }
  13435. return result;
  13436. };
  13437. /**
  13438. * @return {?}
  13439. */
  13440. _ParseAST.prototype.parseEquality = /**
  13441. * @return {?}
  13442. */
  13443. function () {
  13444. // '==','!=','===','!=='
  13445. var /** @type {?} */ result = this.parseRelational();
  13446. while (this.next.type == TokenType.Operator) {
  13447. var /** @type {?} */ operator = this.next.strValue;
  13448. switch (operator) {
  13449. case '==':
  13450. case '===':
  13451. case '!=':
  13452. case '!==':
  13453. this.advance();
  13454. var /** @type {?} */ right = this.parseRelational();
  13455. result = new Binary(this.span(result.span.start), operator, result, right);
  13456. continue;
  13457. }
  13458. break;
  13459. }
  13460. return result;
  13461. };
  13462. /**
  13463. * @return {?}
  13464. */
  13465. _ParseAST.prototype.parseRelational = /**
  13466. * @return {?}
  13467. */
  13468. function () {
  13469. // '<', '>', '<=', '>='
  13470. var /** @type {?} */ result = this.parseAdditive();
  13471. while (this.next.type == TokenType.Operator) {
  13472. var /** @type {?} */ operator = this.next.strValue;
  13473. switch (operator) {
  13474. case '<':
  13475. case '>':
  13476. case '<=':
  13477. case '>=':
  13478. this.advance();
  13479. var /** @type {?} */ right = this.parseAdditive();
  13480. result = new Binary(this.span(result.span.start), operator, result, right);
  13481. continue;
  13482. }
  13483. break;
  13484. }
  13485. return result;
  13486. };
  13487. /**
  13488. * @return {?}
  13489. */
  13490. _ParseAST.prototype.parseAdditive = /**
  13491. * @return {?}
  13492. */
  13493. function () {
  13494. // '+', '-'
  13495. var /** @type {?} */ result = this.parseMultiplicative();
  13496. while (this.next.type == TokenType.Operator) {
  13497. var /** @type {?} */ operator = this.next.strValue;
  13498. switch (operator) {
  13499. case '+':
  13500. case '-':
  13501. this.advance();
  13502. var /** @type {?} */ right = this.parseMultiplicative();
  13503. result = new Binary(this.span(result.span.start), operator, result, right);
  13504. continue;
  13505. }
  13506. break;
  13507. }
  13508. return result;
  13509. };
  13510. /**
  13511. * @return {?}
  13512. */
  13513. _ParseAST.prototype.parseMultiplicative = /**
  13514. * @return {?}
  13515. */
  13516. function () {
  13517. // '*', '%', '/'
  13518. var /** @type {?} */ result = this.parsePrefix();
  13519. while (this.next.type == TokenType.Operator) {
  13520. var /** @type {?} */ operator = this.next.strValue;
  13521. switch (operator) {
  13522. case '*':
  13523. case '%':
  13524. case '/':
  13525. this.advance();
  13526. var /** @type {?} */ right = this.parsePrefix();
  13527. result = new Binary(this.span(result.span.start), operator, result, right);
  13528. continue;
  13529. }
  13530. break;
  13531. }
  13532. return result;
  13533. };
  13534. /**
  13535. * @return {?}
  13536. */
  13537. _ParseAST.prototype.parsePrefix = /**
  13538. * @return {?}
  13539. */
  13540. function () {
  13541. if (this.next.type == TokenType.Operator) {
  13542. var /** @type {?} */ start = this.inputIndex;
  13543. var /** @type {?} */ operator = this.next.strValue;
  13544. var /** @type {?} */ result = void 0;
  13545. switch (operator) {
  13546. case '+':
  13547. this.advance();
  13548. result = this.parsePrefix();
  13549. return new Binary(this.span(start), '-', result, new LiteralPrimitive(new ParseSpan(start, start), 0));
  13550. case '-':
  13551. this.advance();
  13552. result = this.parsePrefix();
  13553. return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result);
  13554. case '!':
  13555. this.advance();
  13556. result = this.parsePrefix();
  13557. return new PrefixNot(this.span(start), result);
  13558. }
  13559. }
  13560. return this.parseCallChain();
  13561. };
  13562. /**
  13563. * @return {?}
  13564. */
  13565. _ParseAST.prototype.parseCallChain = /**
  13566. * @return {?}
  13567. */
  13568. function () {
  13569. var /** @type {?} */ result = this.parsePrimary();
  13570. while (true) {
  13571. if (this.optionalCharacter($PERIOD)) {
  13572. result = this.parseAccessMemberOrMethodCall(result, false);
  13573. }
  13574. else if (this.optionalOperator('?.')) {
  13575. result = this.parseAccessMemberOrMethodCall(result, true);
  13576. }
  13577. else if (this.optionalCharacter($LBRACKET)) {
  13578. this.rbracketsExpected++;
  13579. var /** @type {?} */ key = this.parsePipe();
  13580. this.rbracketsExpected--;
  13581. this.expectCharacter($RBRACKET);
  13582. if (this.optionalOperator('=')) {
  13583. var /** @type {?} */ value = this.parseConditional();
  13584. result = new KeyedWrite(this.span(result.span.start), result, key, value);
  13585. }
  13586. else {
  13587. result = new KeyedRead(this.span(result.span.start), result, key);
  13588. }
  13589. }
  13590. else if (this.optionalCharacter($LPAREN)) {
  13591. this.rparensExpected++;
  13592. var /** @type {?} */ args = this.parseCallArguments();
  13593. this.rparensExpected--;
  13594. this.expectCharacter($RPAREN);
  13595. result = new FunctionCall(this.span(result.span.start), result, args);
  13596. }
  13597. else if (this.optionalOperator('!')) {
  13598. result = new NonNullAssert(this.span(result.span.start), result);
  13599. }
  13600. else {
  13601. return result;
  13602. }
  13603. }
  13604. };
  13605. /**
  13606. * @return {?}
  13607. */
  13608. _ParseAST.prototype.parsePrimary = /**
  13609. * @return {?}
  13610. */
  13611. function () {
  13612. var /** @type {?} */ start = this.inputIndex;
  13613. if (this.optionalCharacter($LPAREN)) {
  13614. this.rparensExpected++;
  13615. var /** @type {?} */ result = this.parsePipe();
  13616. this.rparensExpected--;
  13617. this.expectCharacter($RPAREN);
  13618. return result;
  13619. }
  13620. else if (this.next.isKeywordNull()) {
  13621. this.advance();
  13622. return new LiteralPrimitive(this.span(start), null);
  13623. }
  13624. else if (this.next.isKeywordUndefined()) {
  13625. this.advance();
  13626. return new LiteralPrimitive(this.span(start), void 0);
  13627. }
  13628. else if (this.next.isKeywordTrue()) {
  13629. this.advance();
  13630. return new LiteralPrimitive(this.span(start), true);
  13631. }
  13632. else if (this.next.isKeywordFalse()) {
  13633. this.advance();
  13634. return new LiteralPrimitive(this.span(start), false);
  13635. }
  13636. else if (this.next.isKeywordThis()) {
  13637. this.advance();
  13638. return new ImplicitReceiver(this.span(start));
  13639. }
  13640. else if (this.optionalCharacter($LBRACKET)) {
  13641. this.rbracketsExpected++;
  13642. var /** @type {?} */ elements = this.parseExpressionList($RBRACKET);
  13643. this.rbracketsExpected--;
  13644. this.expectCharacter($RBRACKET);
  13645. return new LiteralArray(this.span(start), elements);
  13646. }
  13647. else if (this.next.isCharacter($LBRACE)) {
  13648. return this.parseLiteralMap();
  13649. }
  13650. else if (this.next.isIdentifier()) {
  13651. return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false);
  13652. }
  13653. else if (this.next.isNumber()) {
  13654. var /** @type {?} */ value = this.next.toNumber();
  13655. this.advance();
  13656. return new LiteralPrimitive(this.span(start), value);
  13657. }
  13658. else if (this.next.isString()) {
  13659. var /** @type {?} */ literalValue = this.next.toString();
  13660. this.advance();
  13661. return new LiteralPrimitive(this.span(start), literalValue);
  13662. }
  13663. else if (this.index >= this.tokens.length) {
  13664. this.error("Unexpected end of expression: " + this.input);
  13665. return new EmptyExpr(this.span(start));
  13666. }
  13667. else {
  13668. this.error("Unexpected token " + this.next);
  13669. return new EmptyExpr(this.span(start));
  13670. }
  13671. };
  13672. /**
  13673. * @param {?} terminator
  13674. * @return {?}
  13675. */
  13676. _ParseAST.prototype.parseExpressionList = /**
  13677. * @param {?} terminator
  13678. * @return {?}
  13679. */
  13680. function (terminator) {
  13681. var /** @type {?} */ result = [];
  13682. if (!this.next.isCharacter(terminator)) {
  13683. do {
  13684. result.push(this.parsePipe());
  13685. } while (this.optionalCharacter($COMMA));
  13686. }
  13687. return result;
  13688. };
  13689. /**
  13690. * @return {?}
  13691. */
  13692. _ParseAST.prototype.parseLiteralMap = /**
  13693. * @return {?}
  13694. */
  13695. function () {
  13696. var /** @type {?} */ keys = [];
  13697. var /** @type {?} */ values = [];
  13698. var /** @type {?} */ start = this.inputIndex;
  13699. this.expectCharacter($LBRACE);
  13700. if (!this.optionalCharacter($RBRACE)) {
  13701. this.rbracesExpected++;
  13702. do {
  13703. var /** @type {?} */ quoted = this.next.isString();
  13704. var /** @type {?} */ key = this.expectIdentifierOrKeywordOrString();
  13705. keys.push({ key: key, quoted: quoted });
  13706. this.expectCharacter($COLON);
  13707. values.push(this.parsePipe());
  13708. } while (this.optionalCharacter($COMMA));
  13709. this.rbracesExpected--;
  13710. this.expectCharacter($RBRACE);
  13711. }
  13712. return new LiteralMap(this.span(start), keys, values);
  13713. };
  13714. /**
  13715. * @param {?} receiver
  13716. * @param {?=} isSafe
  13717. * @return {?}
  13718. */
  13719. _ParseAST.prototype.parseAccessMemberOrMethodCall = /**
  13720. * @param {?} receiver
  13721. * @param {?=} isSafe
  13722. * @return {?}
  13723. */
  13724. function (receiver, isSafe) {
  13725. if (isSafe === void 0) { isSafe = false; }
  13726. var /** @type {?} */ start = receiver.span.start;
  13727. var /** @type {?} */ id = this.expectIdentifierOrKeyword();
  13728. if (this.optionalCharacter($LPAREN)) {
  13729. this.rparensExpected++;
  13730. var /** @type {?} */ args = this.parseCallArguments();
  13731. this.expectCharacter($RPAREN);
  13732. this.rparensExpected--;
  13733. var /** @type {?} */ span = this.span(start);
  13734. return isSafe ? new SafeMethodCall(span, receiver, id, args) :
  13735. new MethodCall(span, receiver, id, args);
  13736. }
  13737. else {
  13738. if (isSafe) {
  13739. if (this.optionalOperator('=')) {
  13740. this.error('The \'?.\' operator cannot be used in the assignment');
  13741. return new EmptyExpr(this.span(start));
  13742. }
  13743. else {
  13744. return new SafePropertyRead(this.span(start), receiver, id);
  13745. }
  13746. }
  13747. else {
  13748. if (this.optionalOperator('=')) {
  13749. if (!this.parseAction) {
  13750. this.error('Bindings cannot contain assignments');
  13751. return new EmptyExpr(this.span(start));
  13752. }
  13753. var /** @type {?} */ value = this.parseConditional();
  13754. return new PropertyWrite(this.span(start), receiver, id, value);
  13755. }
  13756. else {
  13757. return new PropertyRead(this.span(start), receiver, id);
  13758. }
  13759. }
  13760. }
  13761. };
  13762. /**
  13763. * @return {?}
  13764. */
  13765. _ParseAST.prototype.parseCallArguments = /**
  13766. * @return {?}
  13767. */
  13768. function () {
  13769. if (this.next.isCharacter($RPAREN))
  13770. return [];
  13771. var /** @type {?} */ positionals = [];
  13772. do {
  13773. positionals.push(this.parsePipe());
  13774. } while (this.optionalCharacter($COMMA));
  13775. return /** @type {?} */ (positionals);
  13776. };
  13777. /**
  13778. * An identifier, a keyword, a string with an optional `-` inbetween.
  13779. */
  13780. /**
  13781. * An identifier, a keyword, a string with an optional `-` inbetween.
  13782. * @return {?}
  13783. */
  13784. _ParseAST.prototype.expectTemplateBindingKey = /**
  13785. * An identifier, a keyword, a string with an optional `-` inbetween.
  13786. * @return {?}
  13787. */
  13788. function () {
  13789. var /** @type {?} */ result = '';
  13790. var /** @type {?} */ operatorFound = false;
  13791. do {
  13792. result += this.expectIdentifierOrKeywordOrString();
  13793. operatorFound = this.optionalOperator('-');
  13794. if (operatorFound) {
  13795. result += '-';
  13796. }
  13797. } while (operatorFound);
  13798. return result.toString();
  13799. };
  13800. /**
  13801. * @return {?}
  13802. */
  13803. _ParseAST.prototype.parseTemplateBindings = /**
  13804. * @return {?}
  13805. */
  13806. function () {
  13807. var /** @type {?} */ bindings = [];
  13808. var /** @type {?} */ prefix = /** @type {?} */ ((null));
  13809. var /** @type {?} */ warnings = [];
  13810. while (this.index < this.tokens.length) {
  13811. var /** @type {?} */ start = this.inputIndex;
  13812. var /** @type {?} */ keyIsVar = this.peekKeywordLet();
  13813. if (keyIsVar) {
  13814. this.advance();
  13815. }
  13816. var /** @type {?} */ rawKey = this.expectTemplateBindingKey();
  13817. var /** @type {?} */ key = rawKey;
  13818. if (!keyIsVar) {
  13819. if (prefix == null) {
  13820. prefix = key;
  13821. }
  13822. else {
  13823. key = prefix + key[0].toUpperCase() + key.substring(1);
  13824. }
  13825. }
  13826. this.optionalCharacter($COLON);
  13827. var /** @type {?} */ name_2 = /** @type {?} */ ((null));
  13828. var /** @type {?} */ expression = /** @type {?} */ ((null));
  13829. if (keyIsVar) {
  13830. if (this.optionalOperator('=')) {
  13831. name_2 = this.expectTemplateBindingKey();
  13832. }
  13833. else {
  13834. name_2 = '\$implicit';
  13835. }
  13836. }
  13837. else if (this.peekKeywordAs()) {
  13838. var /** @type {?} */ letStart = this.inputIndex;
  13839. this.advance(); // consume `as`
  13840. name_2 = rawKey;
  13841. key = this.expectTemplateBindingKey(); // read local var name
  13842. keyIsVar = true;
  13843. }
  13844. else if (this.next !== EOF && !this.peekKeywordLet()) {
  13845. var /** @type {?} */ start_1 = this.inputIndex;
  13846. var /** @type {?} */ ast = this.parsePipe();
  13847. var /** @type {?} */ source = this.input.substring(start_1 - this.offset, this.inputIndex - this.offset);
  13848. expression = new ASTWithSource(ast, source, this.location, this.errors);
  13849. }
  13850. bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name_2, expression));
  13851. if (this.peekKeywordAs() && !keyIsVar) {
  13852. var /** @type {?} */ letStart = this.inputIndex;
  13853. this.advance(); // consume `as`
  13854. var /** @type {?} */ letName = this.expectTemplateBindingKey(); // read local var name
  13855. bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, /** @type {?} */ ((null))));
  13856. }
  13857. if (!this.optionalCharacter($SEMICOLON)) {
  13858. this.optionalCharacter($COMMA);
  13859. }
  13860. }
  13861. return new TemplateBindingParseResult(bindings, warnings, this.errors);
  13862. };
  13863. /**
  13864. * @param {?} message
  13865. * @param {?=} index
  13866. * @return {?}
  13867. */
  13868. _ParseAST.prototype.error = /**
  13869. * @param {?} message
  13870. * @param {?=} index
  13871. * @return {?}
  13872. */
  13873. function (message, index) {
  13874. if (index === void 0) { index = null; }
  13875. this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
  13876. this.skip();
  13877. };
  13878. /**
  13879. * @param {?=} index
  13880. * @return {?}
  13881. */
  13882. _ParseAST.prototype.locationText = /**
  13883. * @param {?=} index
  13884. * @return {?}
  13885. */
  13886. function (index) {
  13887. if (index === void 0) { index = null; }
  13888. if (index == null)
  13889. index = this.index;
  13890. return (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" :
  13891. "at the end of the expression";
  13892. };
  13893. /**
  13894. * @return {?}
  13895. */
  13896. _ParseAST.prototype.skip = /**
  13897. * @return {?}
  13898. */
  13899. function () {
  13900. var /** @type {?} */ n = this.next;
  13901. while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) &&
  13902. (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) &&
  13903. (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) &&
  13904. (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) {
  13905. if (this.next.isError()) {
  13906. this.errors.push(new ParserError(/** @type {?} */ ((this.next.toString())), this.input, this.locationText(), this.location));
  13907. }
  13908. this.advance();
  13909. n = this.next;
  13910. }
  13911. };
  13912. return _ParseAST;
  13913. }());
  13914. var SimpleExpressionChecker = /** @class */ (function () {
  13915. function SimpleExpressionChecker() {
  13916. this.errors = [];
  13917. }
  13918. /**
  13919. * @param {?} ast
  13920. * @return {?}
  13921. */
  13922. SimpleExpressionChecker.check = /**
  13923. * @param {?} ast
  13924. * @return {?}
  13925. */
  13926. function (ast) {
  13927. var /** @type {?} */ s = new SimpleExpressionChecker();
  13928. ast.visit(s);
  13929. return s.errors;
  13930. };
  13931. /**
  13932. * @param {?} ast
  13933. * @param {?} context
  13934. * @return {?}
  13935. */
  13936. SimpleExpressionChecker.prototype.visitImplicitReceiver = /**
  13937. * @param {?} ast
  13938. * @param {?} context
  13939. * @return {?}
  13940. */
  13941. function (ast, context) { };
  13942. /**
  13943. * @param {?} ast
  13944. * @param {?} context
  13945. * @return {?}
  13946. */
  13947. SimpleExpressionChecker.prototype.visitInterpolation = /**
  13948. * @param {?} ast
  13949. * @param {?} context
  13950. * @return {?}
  13951. */
  13952. function (ast, context) { };
  13953. /**
  13954. * @param {?} ast
  13955. * @param {?} context
  13956. * @return {?}
  13957. */
  13958. SimpleExpressionChecker.prototype.visitLiteralPrimitive = /**
  13959. * @param {?} ast
  13960. * @param {?} context
  13961. * @return {?}
  13962. */
  13963. function (ast, context) { };
  13964. /**
  13965. * @param {?} ast
  13966. * @param {?} context
  13967. * @return {?}
  13968. */
  13969. SimpleExpressionChecker.prototype.visitPropertyRead = /**
  13970. * @param {?} ast
  13971. * @param {?} context
  13972. * @return {?}
  13973. */
  13974. function (ast, context) { };
  13975. /**
  13976. * @param {?} ast
  13977. * @param {?} context
  13978. * @return {?}
  13979. */
  13980. SimpleExpressionChecker.prototype.visitPropertyWrite = /**
  13981. * @param {?} ast
  13982. * @param {?} context
  13983. * @return {?}
  13984. */
  13985. function (ast, context) { };
  13986. /**
  13987. * @param {?} ast
  13988. * @param {?} context
  13989. * @return {?}
  13990. */
  13991. SimpleExpressionChecker.prototype.visitSafePropertyRead = /**
  13992. * @param {?} ast
  13993. * @param {?} context
  13994. * @return {?}
  13995. */
  13996. function (ast, context) { };
  13997. /**
  13998. * @param {?} ast
  13999. * @param {?} context
  14000. * @return {?}
  14001. */
  14002. SimpleExpressionChecker.prototype.visitMethodCall = /**
  14003. * @param {?} ast
  14004. * @param {?} context
  14005. * @return {?}
  14006. */
  14007. function (ast, context) { };
  14008. /**
  14009. * @param {?} ast
  14010. * @param {?} context
  14011. * @return {?}
  14012. */
  14013. SimpleExpressionChecker.prototype.visitSafeMethodCall = /**
  14014. * @param {?} ast
  14015. * @param {?} context
  14016. * @return {?}
  14017. */
  14018. function (ast, context) { };
  14019. /**
  14020. * @param {?} ast
  14021. * @param {?} context
  14022. * @return {?}
  14023. */
  14024. SimpleExpressionChecker.prototype.visitFunctionCall = /**
  14025. * @param {?} ast
  14026. * @param {?} context
  14027. * @return {?}
  14028. */
  14029. function (ast, context) { };
  14030. /**
  14031. * @param {?} ast
  14032. * @param {?} context
  14033. * @return {?}
  14034. */
  14035. SimpleExpressionChecker.prototype.visitLiteralArray = /**
  14036. * @param {?} ast
  14037. * @param {?} context
  14038. * @return {?}
  14039. */
  14040. function (ast, context) { this.visitAll(ast.expressions); };
  14041. /**
  14042. * @param {?} ast
  14043. * @param {?} context
  14044. * @return {?}
  14045. */
  14046. SimpleExpressionChecker.prototype.visitLiteralMap = /**
  14047. * @param {?} ast
  14048. * @param {?} context
  14049. * @return {?}
  14050. */
  14051. function (ast, context) { this.visitAll(ast.values); };
  14052. /**
  14053. * @param {?} ast
  14054. * @param {?} context
  14055. * @return {?}
  14056. */
  14057. SimpleExpressionChecker.prototype.visitBinary = /**
  14058. * @param {?} ast
  14059. * @param {?} context
  14060. * @return {?}
  14061. */
  14062. function (ast, context) { };
  14063. /**
  14064. * @param {?} ast
  14065. * @param {?} context
  14066. * @return {?}
  14067. */
  14068. SimpleExpressionChecker.prototype.visitPrefixNot = /**
  14069. * @param {?} ast
  14070. * @param {?} context
  14071. * @return {?}
  14072. */
  14073. function (ast, context) { };
  14074. /**
  14075. * @param {?} ast
  14076. * @param {?} context
  14077. * @return {?}
  14078. */
  14079. SimpleExpressionChecker.prototype.visitNonNullAssert = /**
  14080. * @param {?} ast
  14081. * @param {?} context
  14082. * @return {?}
  14083. */
  14084. function (ast, context) { };
  14085. /**
  14086. * @param {?} ast
  14087. * @param {?} context
  14088. * @return {?}
  14089. */
  14090. SimpleExpressionChecker.prototype.visitConditional = /**
  14091. * @param {?} ast
  14092. * @param {?} context
  14093. * @return {?}
  14094. */
  14095. function (ast, context) { };
  14096. /**
  14097. * @param {?} ast
  14098. * @param {?} context
  14099. * @return {?}
  14100. */
  14101. SimpleExpressionChecker.prototype.visitPipe = /**
  14102. * @param {?} ast
  14103. * @param {?} context
  14104. * @return {?}
  14105. */
  14106. function (ast, context) { this.errors.push('pipes'); };
  14107. /**
  14108. * @param {?} ast
  14109. * @param {?} context
  14110. * @return {?}
  14111. */
  14112. SimpleExpressionChecker.prototype.visitKeyedRead = /**
  14113. * @param {?} ast
  14114. * @param {?} context
  14115. * @return {?}
  14116. */
  14117. function (ast, context) { };
  14118. /**
  14119. * @param {?} ast
  14120. * @param {?} context
  14121. * @return {?}
  14122. */
  14123. SimpleExpressionChecker.prototype.visitKeyedWrite = /**
  14124. * @param {?} ast
  14125. * @param {?} context
  14126. * @return {?}
  14127. */
  14128. function (ast, context) { };
  14129. /**
  14130. * @param {?} asts
  14131. * @return {?}
  14132. */
  14133. SimpleExpressionChecker.prototype.visitAll = /**
  14134. * @param {?} asts
  14135. * @return {?}
  14136. */
  14137. function (asts) {
  14138. var _this = this;
  14139. return asts.map(function (node) { return node.visit(_this); });
  14140. };
  14141. /**
  14142. * @param {?} ast
  14143. * @param {?} context
  14144. * @return {?}
  14145. */
  14146. SimpleExpressionChecker.prototype.visitChain = /**
  14147. * @param {?} ast
  14148. * @param {?} context
  14149. * @return {?}
  14150. */
  14151. function (ast, context) { };
  14152. /**
  14153. * @param {?} ast
  14154. * @param {?} context
  14155. * @return {?}
  14156. */
  14157. SimpleExpressionChecker.prototype.visitQuote = /**
  14158. * @param {?} ast
  14159. * @param {?} context
  14160. * @return {?}
  14161. */
  14162. function (ast, context) { };
  14163. return SimpleExpressionChecker;
  14164. }());
  14165. /**
  14166. * @fileoverview added by tsickle
  14167. * @suppress {checkTypes} checked by tsc
  14168. */
  14169. var ParseLocation = /** @class */ (function () {
  14170. function ParseLocation(file, offset, line, col) {
  14171. this.file = file;
  14172. this.offset = offset;
  14173. this.line = line;
  14174. this.col = col;
  14175. }
  14176. /**
  14177. * @return {?}
  14178. */
  14179. ParseLocation.prototype.toString = /**
  14180. * @return {?}
  14181. */
  14182. function () {
  14183. return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url;
  14184. };
  14185. /**
  14186. * @param {?} delta
  14187. * @return {?}
  14188. */
  14189. ParseLocation.prototype.moveBy = /**
  14190. * @param {?} delta
  14191. * @return {?}
  14192. */
  14193. function (delta) {
  14194. var /** @type {?} */ source = this.file.content;
  14195. var /** @type {?} */ len = source.length;
  14196. var /** @type {?} */ offset = this.offset;
  14197. var /** @type {?} */ line = this.line;
  14198. var /** @type {?} */ col = this.col;
  14199. while (offset > 0 && delta < 0) {
  14200. offset--;
  14201. delta++;
  14202. var /** @type {?} */ ch = source.charCodeAt(offset);
  14203. if (ch == $LF) {
  14204. line--;
  14205. var /** @type {?} */ priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
  14206. col = priorLine > 0 ? offset - priorLine : offset;
  14207. }
  14208. else {
  14209. col--;
  14210. }
  14211. }
  14212. while (offset < len && delta > 0) {
  14213. var /** @type {?} */ ch = source.charCodeAt(offset);
  14214. offset++;
  14215. delta--;
  14216. if (ch == $LF) {
  14217. line++;
  14218. col = 0;
  14219. }
  14220. else {
  14221. col++;
  14222. }
  14223. }
  14224. return new ParseLocation(this.file, offset, line, col);
  14225. };
  14226. // Return the source around the location
  14227. // Up to `maxChars` or `maxLines` on each side of the location
  14228. /**
  14229. * @param {?} maxChars
  14230. * @param {?} maxLines
  14231. * @return {?}
  14232. */
  14233. ParseLocation.prototype.getContext = /**
  14234. * @param {?} maxChars
  14235. * @param {?} maxLines
  14236. * @return {?}
  14237. */
  14238. function (maxChars, maxLines) {
  14239. var /** @type {?} */ content = this.file.content;
  14240. var /** @type {?} */ startOffset = this.offset;
  14241. if (startOffset != null) {
  14242. if (startOffset > content.length - 1) {
  14243. startOffset = content.length - 1;
  14244. }
  14245. var /** @type {?} */ endOffset = startOffset;
  14246. var /** @type {?} */ ctxChars = 0;
  14247. var /** @type {?} */ ctxLines = 0;
  14248. while (ctxChars < maxChars && startOffset > 0) {
  14249. startOffset--;
  14250. ctxChars++;
  14251. if (content[startOffset] == '\n') {
  14252. if (++ctxLines == maxLines) {
  14253. break;
  14254. }
  14255. }
  14256. }
  14257. ctxChars = 0;
  14258. ctxLines = 0;
  14259. while (ctxChars < maxChars && endOffset < content.length - 1) {
  14260. endOffset++;
  14261. ctxChars++;
  14262. if (content[endOffset] == '\n') {
  14263. if (++ctxLines == maxLines) {
  14264. break;
  14265. }
  14266. }
  14267. }
  14268. return {
  14269. before: content.substring(startOffset, this.offset),
  14270. after: content.substring(this.offset, endOffset + 1),
  14271. };
  14272. }
  14273. return null;
  14274. };
  14275. return ParseLocation;
  14276. }());
  14277. var ParseSourceFile = /** @class */ (function () {
  14278. function ParseSourceFile(content, url) {
  14279. this.content = content;
  14280. this.url = url;
  14281. }
  14282. return ParseSourceFile;
  14283. }());
  14284. var ParseSourceSpan = /** @class */ (function () {
  14285. function ParseSourceSpan(start, end, details) {
  14286. if (details === void 0) { details = null; }
  14287. this.start = start;
  14288. this.end = end;
  14289. this.details = details;
  14290. }
  14291. /**
  14292. * @return {?}
  14293. */
  14294. ParseSourceSpan.prototype.toString = /**
  14295. * @return {?}
  14296. */
  14297. function () {
  14298. return this.start.file.content.substring(this.start.offset, this.end.offset);
  14299. };
  14300. return ParseSourceSpan;
  14301. }());
  14302. /** @enum {number} */
  14303. var ParseErrorLevel = {
  14304. WARNING: 0,
  14305. ERROR: 1,
  14306. };
  14307. ParseErrorLevel[ParseErrorLevel.WARNING] = "WARNING";
  14308. ParseErrorLevel[ParseErrorLevel.ERROR] = "ERROR";
  14309. var ParseError = /** @class */ (function () {
  14310. function ParseError(span, msg, level) {
  14311. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  14312. this.span = span;
  14313. this.msg = msg;
  14314. this.level = level;
  14315. }
  14316. /**
  14317. * @return {?}
  14318. */
  14319. ParseError.prototype.contextualMessage = /**
  14320. * @return {?}
  14321. */
  14322. function () {
  14323. var /** @type {?} */ ctx = this.span.start.getContext(100, 3);
  14324. return ctx ? this.msg + " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" :
  14325. this.msg;
  14326. };
  14327. /**
  14328. * @return {?}
  14329. */
  14330. ParseError.prototype.toString = /**
  14331. * @return {?}
  14332. */
  14333. function () {
  14334. var /** @type {?} */ details = this.span.details ? ", " + this.span.details : '';
  14335. return this.contextualMessage() + ": " + this.span.start + details;
  14336. };
  14337. return ParseError;
  14338. }());
  14339. /**
  14340. * @param {?} kind
  14341. * @param {?} type
  14342. * @return {?}
  14343. */
  14344. function typeSourceSpan(kind, type) {
  14345. var /** @type {?} */ moduleUrl = identifierModuleUrl(type);
  14346. var /** @type {?} */ sourceFileName = moduleUrl != null ? "in " + kind + " " + identifierName(type) + " in " + moduleUrl :
  14347. "in " + kind + " " + identifierName(type);
  14348. var /** @type {?} */ sourceFile = new ParseSourceFile('', sourceFileName);
  14349. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  14350. }
  14351. /**
  14352. * @fileoverview added by tsickle
  14353. * @suppress {checkTypes} checked by tsc
  14354. */
  14355. /**
  14356. * @license
  14357. * Copyright Google Inc. All Rights Reserved.
  14358. *
  14359. * Use of this source code is governed by an MIT-style license that can be
  14360. * found in the LICENSE file at https://angular.io/license
  14361. */
  14362. /** @enum {number} */
  14363. var TokenType$1 = {
  14364. TAG_OPEN_START: 0,
  14365. TAG_OPEN_END: 1,
  14366. TAG_OPEN_END_VOID: 2,
  14367. TAG_CLOSE: 3,
  14368. TEXT: 4,
  14369. ESCAPABLE_RAW_TEXT: 5,
  14370. RAW_TEXT: 6,
  14371. COMMENT_START: 7,
  14372. COMMENT_END: 8,
  14373. CDATA_START: 9,
  14374. CDATA_END: 10,
  14375. ATTR_NAME: 11,
  14376. ATTR_VALUE: 12,
  14377. DOC_TYPE: 13,
  14378. EXPANSION_FORM_START: 14,
  14379. EXPANSION_CASE_VALUE: 15,
  14380. EXPANSION_CASE_EXP_START: 16,
  14381. EXPANSION_CASE_EXP_END: 17,
  14382. EXPANSION_FORM_END: 18,
  14383. EOF: 19,
  14384. };
  14385. TokenType$1[TokenType$1.TAG_OPEN_START] = "TAG_OPEN_START";
  14386. TokenType$1[TokenType$1.TAG_OPEN_END] = "TAG_OPEN_END";
  14387. TokenType$1[TokenType$1.TAG_OPEN_END_VOID] = "TAG_OPEN_END_VOID";
  14388. TokenType$1[TokenType$1.TAG_CLOSE] = "TAG_CLOSE";
  14389. TokenType$1[TokenType$1.TEXT] = "TEXT";
  14390. TokenType$1[TokenType$1.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT";
  14391. TokenType$1[TokenType$1.RAW_TEXT] = "RAW_TEXT";
  14392. TokenType$1[TokenType$1.COMMENT_START] = "COMMENT_START";
  14393. TokenType$1[TokenType$1.COMMENT_END] = "COMMENT_END";
  14394. TokenType$1[TokenType$1.CDATA_START] = "CDATA_START";
  14395. TokenType$1[TokenType$1.CDATA_END] = "CDATA_END";
  14396. TokenType$1[TokenType$1.ATTR_NAME] = "ATTR_NAME";
  14397. TokenType$1[TokenType$1.ATTR_VALUE] = "ATTR_VALUE";
  14398. TokenType$1[TokenType$1.DOC_TYPE] = "DOC_TYPE";
  14399. TokenType$1[TokenType$1.EXPANSION_FORM_START] = "EXPANSION_FORM_START";
  14400. TokenType$1[TokenType$1.EXPANSION_CASE_VALUE] = "EXPANSION_CASE_VALUE";
  14401. TokenType$1[TokenType$1.EXPANSION_CASE_EXP_START] = "EXPANSION_CASE_EXP_START";
  14402. TokenType$1[TokenType$1.EXPANSION_CASE_EXP_END] = "EXPANSION_CASE_EXP_END";
  14403. TokenType$1[TokenType$1.EXPANSION_FORM_END] = "EXPANSION_FORM_END";
  14404. TokenType$1[TokenType$1.EOF] = "EOF";
  14405. var Token$1 = /** @class */ (function () {
  14406. function Token(type, parts, sourceSpan) {
  14407. this.type = type;
  14408. this.parts = parts;
  14409. this.sourceSpan = sourceSpan;
  14410. }
  14411. return Token;
  14412. }());
  14413. var TokenError = /** @class */ (function (_super) {
  14414. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TokenError, _super);
  14415. function TokenError(errorMsg, tokenType, span) {
  14416. var _this = _super.call(this, span, errorMsg) || this;
  14417. _this.tokenType = tokenType;
  14418. return _this;
  14419. }
  14420. return TokenError;
  14421. }(ParseError));
  14422. var TokenizeResult = /** @class */ (function () {
  14423. function TokenizeResult(tokens, errors) {
  14424. this.tokens = tokens;
  14425. this.errors = errors;
  14426. }
  14427. return TokenizeResult;
  14428. }());
  14429. /**
  14430. * @param {?} source
  14431. * @param {?} url
  14432. * @param {?} getTagDefinition
  14433. * @param {?=} tokenizeExpansionForms
  14434. * @param {?=} interpolationConfig
  14435. * @return {?}
  14436. */
  14437. function tokenize(source, url, getTagDefinition, tokenizeExpansionForms, interpolationConfig) {
  14438. if (tokenizeExpansionForms === void 0) { tokenizeExpansionForms = false; }
  14439. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  14440. return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, tokenizeExpansionForms, interpolationConfig)
  14441. .tokenize();
  14442. }
  14443. var _CR_OR_CRLF_REGEXP = /\r\n?/g;
  14444. /**
  14445. * @param {?} charCode
  14446. * @return {?}
  14447. */
  14448. function _unexpectedCharacterErrorMsg(charCode) {
  14449. var /** @type {?} */ char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode);
  14450. return "Unexpected character \"" + char + "\"";
  14451. }
  14452. /**
  14453. * @param {?} entitySrc
  14454. * @return {?}
  14455. */
  14456. function _unknownEntityErrorMsg(entitySrc) {
  14457. return "Unknown entity \"" + entitySrc + "\" - use the \"&#<decimal>;\" or \"&#x<hex>;\" syntax";
  14458. }
  14459. var _ControlFlowError = /** @class */ (function () {
  14460. function _ControlFlowError(error) {
  14461. this.error = error;
  14462. }
  14463. return _ControlFlowError;
  14464. }());
  14465. var _Tokenizer = /** @class */ (function () {
  14466. /**
  14467. * @param _file The html source
  14468. * @param _getTagDefinition
  14469. * @param _tokenizeIcu Whether to tokenize ICU messages (considered as text nodes when false)
  14470. * @param _interpolationConfig
  14471. */
  14472. function _Tokenizer(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig) {
  14473. if (_interpolationConfig === void 0) { _interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  14474. this._file = _file;
  14475. this._getTagDefinition = _getTagDefinition;
  14476. this._tokenizeIcu = _tokenizeIcu;
  14477. this._interpolationConfig = _interpolationConfig;
  14478. this._peek = -1;
  14479. this._nextPeek = -1;
  14480. this._index = -1;
  14481. this._line = 0;
  14482. this._column = -1;
  14483. this._expansionCaseStack = [];
  14484. this._inInterpolation = false;
  14485. this.tokens = [];
  14486. this.errors = [];
  14487. this._input = _file.content;
  14488. this._length = _file.content.length;
  14489. this._advance();
  14490. }
  14491. /**
  14492. * @param {?} content
  14493. * @return {?}
  14494. */
  14495. _Tokenizer.prototype._processCarriageReturns = /**
  14496. * @param {?} content
  14497. * @return {?}
  14498. */
  14499. function (content) {
  14500. // http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
  14501. // In order to keep the original position in the source, we can not
  14502. // pre-process it.
  14503. // Instead CRs are processed right before instantiating the tokens.
  14504. return content.replace(_CR_OR_CRLF_REGEXP, '\n');
  14505. };
  14506. /**
  14507. * @return {?}
  14508. */
  14509. _Tokenizer.prototype.tokenize = /**
  14510. * @return {?}
  14511. */
  14512. function () {
  14513. while (this._peek !== $EOF) {
  14514. var /** @type {?} */ start = this._getLocation();
  14515. try {
  14516. if (this._attemptCharCode($LT)) {
  14517. if (this._attemptCharCode($BANG)) {
  14518. if (this._attemptCharCode($LBRACKET)) {
  14519. this._consumeCdata(start);
  14520. }
  14521. else if (this._attemptCharCode($MINUS)) {
  14522. this._consumeComment(start);
  14523. }
  14524. else {
  14525. this._consumeDocType(start);
  14526. }
  14527. }
  14528. else if (this._attemptCharCode($SLASH)) {
  14529. this._consumeTagClose(start);
  14530. }
  14531. else {
  14532. this._consumeTagOpen(start);
  14533. }
  14534. }
  14535. else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
  14536. this._consumeText();
  14537. }
  14538. }
  14539. catch (/** @type {?} */ e) {
  14540. if (e instanceof _ControlFlowError) {
  14541. this.errors.push(e.error);
  14542. }
  14543. else {
  14544. throw e;
  14545. }
  14546. }
  14547. }
  14548. this._beginToken(TokenType$1.EOF);
  14549. this._endToken([]);
  14550. return new TokenizeResult(mergeTextTokens(this.tokens), this.errors);
  14551. };
  14552. /**
  14553. * \@internal
  14554. * @return {?} whether an ICU token has been created
  14555. */
  14556. _Tokenizer.prototype._tokenizeExpansionForm = /**
  14557. * \@internal
  14558. * @return {?} whether an ICU token has been created
  14559. */
  14560. function () {
  14561. if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
  14562. this._consumeExpansionFormStart();
  14563. return true;
  14564. }
  14565. if (isExpansionCaseStart(this._peek) && this._isInExpansionForm()) {
  14566. this._consumeExpansionCaseStart();
  14567. return true;
  14568. }
  14569. if (this._peek === $RBRACE) {
  14570. if (this._isInExpansionCase()) {
  14571. this._consumeExpansionCaseEnd();
  14572. return true;
  14573. }
  14574. if (this._isInExpansionForm()) {
  14575. this._consumeExpansionFormEnd();
  14576. return true;
  14577. }
  14578. }
  14579. return false;
  14580. };
  14581. /**
  14582. * @return {?}
  14583. */
  14584. _Tokenizer.prototype._getLocation = /**
  14585. * @return {?}
  14586. */
  14587. function () {
  14588. return new ParseLocation(this._file, this._index, this._line, this._column);
  14589. };
  14590. /**
  14591. * @param {?=} start
  14592. * @param {?=} end
  14593. * @return {?}
  14594. */
  14595. _Tokenizer.prototype._getSpan = /**
  14596. * @param {?=} start
  14597. * @param {?=} end
  14598. * @return {?}
  14599. */
  14600. function (start, end) {
  14601. if (start === void 0) { start = this._getLocation(); }
  14602. if (end === void 0) { end = this._getLocation(); }
  14603. return new ParseSourceSpan(start, end);
  14604. };
  14605. /**
  14606. * @param {?} type
  14607. * @param {?=} start
  14608. * @return {?}
  14609. */
  14610. _Tokenizer.prototype._beginToken = /**
  14611. * @param {?} type
  14612. * @param {?=} start
  14613. * @return {?}
  14614. */
  14615. function (type, start) {
  14616. if (start === void 0) { start = this._getLocation(); }
  14617. this._currentTokenStart = start;
  14618. this._currentTokenType = type;
  14619. };
  14620. /**
  14621. * @param {?} parts
  14622. * @param {?=} end
  14623. * @return {?}
  14624. */
  14625. _Tokenizer.prototype._endToken = /**
  14626. * @param {?} parts
  14627. * @param {?=} end
  14628. * @return {?}
  14629. */
  14630. function (parts, end) {
  14631. if (end === void 0) { end = this._getLocation(); }
  14632. var /** @type {?} */ token = new Token$1(this._currentTokenType, parts, new ParseSourceSpan(this._currentTokenStart, end));
  14633. this.tokens.push(token);
  14634. this._currentTokenStart = /** @type {?} */ ((null));
  14635. this._currentTokenType = /** @type {?} */ ((null));
  14636. return token;
  14637. };
  14638. /**
  14639. * @param {?} msg
  14640. * @param {?} span
  14641. * @return {?}
  14642. */
  14643. _Tokenizer.prototype._createError = /**
  14644. * @param {?} msg
  14645. * @param {?} span
  14646. * @return {?}
  14647. */
  14648. function (msg, span) {
  14649. if (this._isInExpansionForm()) {
  14650. msg += " (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)";
  14651. }
  14652. var /** @type {?} */ error = new TokenError(msg, this._currentTokenType, span);
  14653. this._currentTokenStart = /** @type {?} */ ((null));
  14654. this._currentTokenType = /** @type {?} */ ((null));
  14655. return new _ControlFlowError(error);
  14656. };
  14657. /**
  14658. * @return {?}
  14659. */
  14660. _Tokenizer.prototype._advance = /**
  14661. * @return {?}
  14662. */
  14663. function () {
  14664. if (this._index >= this._length) {
  14665. throw this._createError(_unexpectedCharacterErrorMsg($EOF), this._getSpan());
  14666. }
  14667. if (this._peek === $LF) {
  14668. this._line++;
  14669. this._column = 0;
  14670. }
  14671. else if (this._peek !== $LF && this._peek !== $CR) {
  14672. this._column++;
  14673. }
  14674. this._index++;
  14675. this._peek = this._index >= this._length ? $EOF : this._input.charCodeAt(this._index);
  14676. this._nextPeek =
  14677. this._index + 1 >= this._length ? $EOF : this._input.charCodeAt(this._index + 1);
  14678. };
  14679. /**
  14680. * @param {?} charCode
  14681. * @return {?}
  14682. */
  14683. _Tokenizer.prototype._attemptCharCode = /**
  14684. * @param {?} charCode
  14685. * @return {?}
  14686. */
  14687. function (charCode) {
  14688. if (this._peek === charCode) {
  14689. this._advance();
  14690. return true;
  14691. }
  14692. return false;
  14693. };
  14694. /**
  14695. * @param {?} charCode
  14696. * @return {?}
  14697. */
  14698. _Tokenizer.prototype._attemptCharCodeCaseInsensitive = /**
  14699. * @param {?} charCode
  14700. * @return {?}
  14701. */
  14702. function (charCode) {
  14703. if (compareCharCodeCaseInsensitive(this._peek, charCode)) {
  14704. this._advance();
  14705. return true;
  14706. }
  14707. return false;
  14708. };
  14709. /**
  14710. * @param {?} charCode
  14711. * @return {?}
  14712. */
  14713. _Tokenizer.prototype._requireCharCode = /**
  14714. * @param {?} charCode
  14715. * @return {?}
  14716. */
  14717. function (charCode) {
  14718. var /** @type {?} */ location = this._getLocation();
  14719. if (!this._attemptCharCode(charCode)) {
  14720. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location, location));
  14721. }
  14722. };
  14723. /**
  14724. * @param {?} chars
  14725. * @return {?}
  14726. */
  14727. _Tokenizer.prototype._attemptStr = /**
  14728. * @param {?} chars
  14729. * @return {?}
  14730. */
  14731. function (chars) {
  14732. var /** @type {?} */ len = chars.length;
  14733. if (this._index + len > this._length) {
  14734. return false;
  14735. }
  14736. var /** @type {?} */ initialPosition = this._savePosition();
  14737. for (var /** @type {?} */ i = 0; i < len; i++) {
  14738. if (!this._attemptCharCode(chars.charCodeAt(i))) {
  14739. // If attempting to parse the string fails, we want to reset the parser
  14740. // to where it was before the attempt
  14741. this._restorePosition(initialPosition);
  14742. return false;
  14743. }
  14744. }
  14745. return true;
  14746. };
  14747. /**
  14748. * @param {?} chars
  14749. * @return {?}
  14750. */
  14751. _Tokenizer.prototype._attemptStrCaseInsensitive = /**
  14752. * @param {?} chars
  14753. * @return {?}
  14754. */
  14755. function (chars) {
  14756. for (var /** @type {?} */ i = 0; i < chars.length; i++) {
  14757. if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) {
  14758. return false;
  14759. }
  14760. }
  14761. return true;
  14762. };
  14763. /**
  14764. * @param {?} chars
  14765. * @return {?}
  14766. */
  14767. _Tokenizer.prototype._requireStr = /**
  14768. * @param {?} chars
  14769. * @return {?}
  14770. */
  14771. function (chars) {
  14772. var /** @type {?} */ location = this._getLocation();
  14773. if (!this._attemptStr(chars)) {
  14774. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location));
  14775. }
  14776. };
  14777. /**
  14778. * @param {?} predicate
  14779. * @return {?}
  14780. */
  14781. _Tokenizer.prototype._attemptCharCodeUntilFn = /**
  14782. * @param {?} predicate
  14783. * @return {?}
  14784. */
  14785. function (predicate) {
  14786. while (!predicate(this._peek)) {
  14787. this._advance();
  14788. }
  14789. };
  14790. /**
  14791. * @param {?} predicate
  14792. * @param {?} len
  14793. * @return {?}
  14794. */
  14795. _Tokenizer.prototype._requireCharCodeUntilFn = /**
  14796. * @param {?} predicate
  14797. * @param {?} len
  14798. * @return {?}
  14799. */
  14800. function (predicate, len) {
  14801. var /** @type {?} */ start = this._getLocation();
  14802. this._attemptCharCodeUntilFn(predicate);
  14803. if (this._index - start.offset < len) {
  14804. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(start, start));
  14805. }
  14806. };
  14807. /**
  14808. * @param {?} char
  14809. * @return {?}
  14810. */
  14811. _Tokenizer.prototype._attemptUntilChar = /**
  14812. * @param {?} char
  14813. * @return {?}
  14814. */
  14815. function (char) {
  14816. while (this._peek !== char) {
  14817. this._advance();
  14818. }
  14819. };
  14820. /**
  14821. * @param {?} decodeEntities
  14822. * @return {?}
  14823. */
  14824. _Tokenizer.prototype._readChar = /**
  14825. * @param {?} decodeEntities
  14826. * @return {?}
  14827. */
  14828. function (decodeEntities) {
  14829. if (decodeEntities && this._peek === $AMPERSAND) {
  14830. return this._decodeEntity();
  14831. }
  14832. else {
  14833. var /** @type {?} */ index = this._index;
  14834. this._advance();
  14835. return this._input[index];
  14836. }
  14837. };
  14838. /**
  14839. * @return {?}
  14840. */
  14841. _Tokenizer.prototype._decodeEntity = /**
  14842. * @return {?}
  14843. */
  14844. function () {
  14845. var /** @type {?} */ start = this._getLocation();
  14846. this._advance();
  14847. if (this._attemptCharCode($HASH)) {
  14848. var /** @type {?} */ isHex = this._attemptCharCode($x) || this._attemptCharCode($X);
  14849. var /** @type {?} */ numberStart = this._getLocation().offset;
  14850. this._attemptCharCodeUntilFn(isDigitEntityEnd);
  14851. if (this._peek != $SEMICOLON) {
  14852. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
  14853. }
  14854. this._advance();
  14855. var /** @type {?} */ strNum = this._input.substring(numberStart, this._index - 1);
  14856. try {
  14857. var /** @type {?} */ charCode = parseInt(strNum, isHex ? 16 : 10);
  14858. return String.fromCharCode(charCode);
  14859. }
  14860. catch (/** @type {?} */ e) {
  14861. var /** @type {?} */ entity = this._input.substring(start.offset + 1, this._index - 1);
  14862. throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start));
  14863. }
  14864. }
  14865. else {
  14866. var /** @type {?} */ startPosition = this._savePosition();
  14867. this._attemptCharCodeUntilFn(isNamedEntityEnd);
  14868. if (this._peek != $SEMICOLON) {
  14869. this._restorePosition(startPosition);
  14870. return '&';
  14871. }
  14872. this._advance();
  14873. var /** @type {?} */ name_1 = this._input.substring(start.offset + 1, this._index - 1);
  14874. var /** @type {?} */ char = NAMED_ENTITIES[name_1];
  14875. if (!char) {
  14876. throw this._createError(_unknownEntityErrorMsg(name_1), this._getSpan(start));
  14877. }
  14878. return char;
  14879. }
  14880. };
  14881. /**
  14882. * @param {?} decodeEntities
  14883. * @param {?} firstCharOfEnd
  14884. * @param {?} attemptEndRest
  14885. * @return {?}
  14886. */
  14887. _Tokenizer.prototype._consumeRawText = /**
  14888. * @param {?} decodeEntities
  14889. * @param {?} firstCharOfEnd
  14890. * @param {?} attemptEndRest
  14891. * @return {?}
  14892. */
  14893. function (decodeEntities, firstCharOfEnd, attemptEndRest) {
  14894. var /** @type {?} */ tagCloseStart;
  14895. var /** @type {?} */ textStart = this._getLocation();
  14896. this._beginToken(decodeEntities ? TokenType$1.ESCAPABLE_RAW_TEXT : TokenType$1.RAW_TEXT, textStart);
  14897. var /** @type {?} */ parts = [];
  14898. while (true) {
  14899. tagCloseStart = this._getLocation();
  14900. if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
  14901. break;
  14902. }
  14903. if (this._index > tagCloseStart.offset) {
  14904. // add the characters consumed by the previous if statement to the output
  14905. parts.push(this._input.substring(tagCloseStart.offset, this._index));
  14906. }
  14907. while (this._peek !== firstCharOfEnd) {
  14908. parts.push(this._readChar(decodeEntities));
  14909. }
  14910. }
  14911. return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart);
  14912. };
  14913. /**
  14914. * @param {?} start
  14915. * @return {?}
  14916. */
  14917. _Tokenizer.prototype._consumeComment = /**
  14918. * @param {?} start
  14919. * @return {?}
  14920. */
  14921. function (start) {
  14922. var _this = this;
  14923. this._beginToken(TokenType$1.COMMENT_START, start);
  14924. this._requireCharCode($MINUS);
  14925. this._endToken([]);
  14926. var /** @type {?} */ textToken = this._consumeRawText(false, $MINUS, function () { return _this._attemptStr('->'); });
  14927. this._beginToken(TokenType$1.COMMENT_END, textToken.sourceSpan.end);
  14928. this._endToken([]);
  14929. };
  14930. /**
  14931. * @param {?} start
  14932. * @return {?}
  14933. */
  14934. _Tokenizer.prototype._consumeCdata = /**
  14935. * @param {?} start
  14936. * @return {?}
  14937. */
  14938. function (start) {
  14939. var _this = this;
  14940. this._beginToken(TokenType$1.CDATA_START, start);
  14941. this._requireStr('CDATA[');
  14942. this._endToken([]);
  14943. var /** @type {?} */ textToken = this._consumeRawText(false, $RBRACKET, function () { return _this._attemptStr(']>'); });
  14944. this._beginToken(TokenType$1.CDATA_END, textToken.sourceSpan.end);
  14945. this._endToken([]);
  14946. };
  14947. /**
  14948. * @param {?} start
  14949. * @return {?}
  14950. */
  14951. _Tokenizer.prototype._consumeDocType = /**
  14952. * @param {?} start
  14953. * @return {?}
  14954. */
  14955. function (start) {
  14956. this._beginToken(TokenType$1.DOC_TYPE, start);
  14957. this._attemptUntilChar($GT);
  14958. this._advance();
  14959. this._endToken([this._input.substring(start.offset + 2, this._index - 1)]);
  14960. };
  14961. /**
  14962. * @return {?}
  14963. */
  14964. _Tokenizer.prototype._consumePrefixAndName = /**
  14965. * @return {?}
  14966. */
  14967. function () {
  14968. var /** @type {?} */ nameOrPrefixStart = this._index;
  14969. var /** @type {?} */ prefix = /** @type {?} */ ((null));
  14970. while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
  14971. this._advance();
  14972. }
  14973. var /** @type {?} */ nameStart;
  14974. if (this._peek === $COLON) {
  14975. this._advance();
  14976. prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
  14977. nameStart = this._index;
  14978. }
  14979. else {
  14980. nameStart = nameOrPrefixStart;
  14981. }
  14982. this._requireCharCodeUntilFn(isNameEnd, this._index === nameStart ? 1 : 0);
  14983. var /** @type {?} */ name = this._input.substring(nameStart, this._index);
  14984. return [prefix, name];
  14985. };
  14986. /**
  14987. * @param {?} start
  14988. * @return {?}
  14989. */
  14990. _Tokenizer.prototype._consumeTagOpen = /**
  14991. * @param {?} start
  14992. * @return {?}
  14993. */
  14994. function (start) {
  14995. var /** @type {?} */ savedPos = this._savePosition();
  14996. var /** @type {?} */ tagName;
  14997. var /** @type {?} */ lowercaseTagName;
  14998. try {
  14999. if (!isAsciiLetter(this._peek)) {
  15000. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
  15001. }
  15002. var /** @type {?} */ nameStart = this._index;
  15003. this._consumeTagOpenStart(start);
  15004. tagName = this._input.substring(nameStart, this._index);
  15005. lowercaseTagName = tagName.toLowerCase();
  15006. this._attemptCharCodeUntilFn(isNotWhitespace);
  15007. while (this._peek !== $SLASH && this._peek !== $GT) {
  15008. this._consumeAttributeName();
  15009. this._attemptCharCodeUntilFn(isNotWhitespace);
  15010. if (this._attemptCharCode($EQ)) {
  15011. this._attemptCharCodeUntilFn(isNotWhitespace);
  15012. this._consumeAttributeValue();
  15013. }
  15014. this._attemptCharCodeUntilFn(isNotWhitespace);
  15015. }
  15016. this._consumeTagOpenEnd();
  15017. }
  15018. catch (/** @type {?} */ e) {
  15019. if (e instanceof _ControlFlowError) {
  15020. // When the start tag is invalid, assume we want a "<"
  15021. this._restorePosition(savedPos);
  15022. // Back to back text tokens are merged at the end
  15023. this._beginToken(TokenType$1.TEXT, start);
  15024. this._endToken(['<']);
  15025. return;
  15026. }
  15027. throw e;
  15028. }
  15029. var /** @type {?} */ contentTokenType = this._getTagDefinition(tagName).contentType;
  15030. if (contentTokenType === TagContentType.RAW_TEXT) {
  15031. this._consumeRawTextWithTagClose(lowercaseTagName, false);
  15032. }
  15033. else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {
  15034. this._consumeRawTextWithTagClose(lowercaseTagName, true);
  15035. }
  15036. };
  15037. /**
  15038. * @param {?} lowercaseTagName
  15039. * @param {?} decodeEntities
  15040. * @return {?}
  15041. */
  15042. _Tokenizer.prototype._consumeRawTextWithTagClose = /**
  15043. * @param {?} lowercaseTagName
  15044. * @param {?} decodeEntities
  15045. * @return {?}
  15046. */
  15047. function (lowercaseTagName, decodeEntities) {
  15048. var _this = this;
  15049. var /** @type {?} */ textToken = this._consumeRawText(decodeEntities, $LT, function () {
  15050. if (!_this._attemptCharCode($SLASH))
  15051. return false;
  15052. _this._attemptCharCodeUntilFn(isNotWhitespace);
  15053. if (!_this._attemptStrCaseInsensitive(lowercaseTagName))
  15054. return false;
  15055. _this._attemptCharCodeUntilFn(isNotWhitespace);
  15056. return _this._attemptCharCode($GT);
  15057. });
  15058. this._beginToken(TokenType$1.TAG_CLOSE, textToken.sourceSpan.end);
  15059. this._endToken([/** @type {?} */ ((null)), lowercaseTagName]);
  15060. };
  15061. /**
  15062. * @param {?} start
  15063. * @return {?}
  15064. */
  15065. _Tokenizer.prototype._consumeTagOpenStart = /**
  15066. * @param {?} start
  15067. * @return {?}
  15068. */
  15069. function (start) {
  15070. this._beginToken(TokenType$1.TAG_OPEN_START, start);
  15071. var /** @type {?} */ parts = this._consumePrefixAndName();
  15072. this._endToken(parts);
  15073. };
  15074. /**
  15075. * @return {?}
  15076. */
  15077. _Tokenizer.prototype._consumeAttributeName = /**
  15078. * @return {?}
  15079. */
  15080. function () {
  15081. this._beginToken(TokenType$1.ATTR_NAME);
  15082. var /** @type {?} */ prefixAndName = this._consumePrefixAndName();
  15083. this._endToken(prefixAndName);
  15084. };
  15085. /**
  15086. * @return {?}
  15087. */
  15088. _Tokenizer.prototype._consumeAttributeValue = /**
  15089. * @return {?}
  15090. */
  15091. function () {
  15092. this._beginToken(TokenType$1.ATTR_VALUE);
  15093. var /** @type {?} */ value;
  15094. if (this._peek === $SQ || this._peek === $DQ) {
  15095. var /** @type {?} */ quoteChar = this._peek;
  15096. this._advance();
  15097. var /** @type {?} */ parts = [];
  15098. while (this._peek !== quoteChar) {
  15099. parts.push(this._readChar(true));
  15100. }
  15101. value = parts.join('');
  15102. this._advance();
  15103. }
  15104. else {
  15105. var /** @type {?} */ valueStart = this._index;
  15106. this._requireCharCodeUntilFn(isNameEnd, 1);
  15107. value = this._input.substring(valueStart, this._index);
  15108. }
  15109. this._endToken([this._processCarriageReturns(value)]);
  15110. };
  15111. /**
  15112. * @return {?}
  15113. */
  15114. _Tokenizer.prototype._consumeTagOpenEnd = /**
  15115. * @return {?}
  15116. */
  15117. function () {
  15118. var /** @type {?} */ tokenType = this._attemptCharCode($SLASH) ? TokenType$1.TAG_OPEN_END_VOID : TokenType$1.TAG_OPEN_END;
  15119. this._beginToken(tokenType);
  15120. this._requireCharCode($GT);
  15121. this._endToken([]);
  15122. };
  15123. /**
  15124. * @param {?} start
  15125. * @return {?}
  15126. */
  15127. _Tokenizer.prototype._consumeTagClose = /**
  15128. * @param {?} start
  15129. * @return {?}
  15130. */
  15131. function (start) {
  15132. this._beginToken(TokenType$1.TAG_CLOSE, start);
  15133. this._attemptCharCodeUntilFn(isNotWhitespace);
  15134. var /** @type {?} */ prefixAndName = this._consumePrefixAndName();
  15135. this._attemptCharCodeUntilFn(isNotWhitespace);
  15136. this._requireCharCode($GT);
  15137. this._endToken(prefixAndName);
  15138. };
  15139. /**
  15140. * @return {?}
  15141. */
  15142. _Tokenizer.prototype._consumeExpansionFormStart = /**
  15143. * @return {?}
  15144. */
  15145. function () {
  15146. this._beginToken(TokenType$1.EXPANSION_FORM_START, this._getLocation());
  15147. this._requireCharCode($LBRACE);
  15148. this._endToken([]);
  15149. this._expansionCaseStack.push(TokenType$1.EXPANSION_FORM_START);
  15150. this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
  15151. var /** @type {?} */ condition = this._readUntil($COMMA);
  15152. this._endToken([condition], this._getLocation());
  15153. this._requireCharCode($COMMA);
  15154. this._attemptCharCodeUntilFn(isNotWhitespace);
  15155. this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
  15156. var /** @type {?} */ type = this._readUntil($COMMA);
  15157. this._endToken([type], this._getLocation());
  15158. this._requireCharCode($COMMA);
  15159. this._attemptCharCodeUntilFn(isNotWhitespace);
  15160. };
  15161. /**
  15162. * @return {?}
  15163. */
  15164. _Tokenizer.prototype._consumeExpansionCaseStart = /**
  15165. * @return {?}
  15166. */
  15167. function () {
  15168. this._beginToken(TokenType$1.EXPANSION_CASE_VALUE, this._getLocation());
  15169. var /** @type {?} */ value = this._readUntil($LBRACE).trim();
  15170. this._endToken([value], this._getLocation());
  15171. this._attemptCharCodeUntilFn(isNotWhitespace);
  15172. this._beginToken(TokenType$1.EXPANSION_CASE_EXP_START, this._getLocation());
  15173. this._requireCharCode($LBRACE);
  15174. this._endToken([], this._getLocation());
  15175. this._attemptCharCodeUntilFn(isNotWhitespace);
  15176. this._expansionCaseStack.push(TokenType$1.EXPANSION_CASE_EXP_START);
  15177. };
  15178. /**
  15179. * @return {?}
  15180. */
  15181. _Tokenizer.prototype._consumeExpansionCaseEnd = /**
  15182. * @return {?}
  15183. */
  15184. function () {
  15185. this._beginToken(TokenType$1.EXPANSION_CASE_EXP_END, this._getLocation());
  15186. this._requireCharCode($RBRACE);
  15187. this._endToken([], this._getLocation());
  15188. this._attemptCharCodeUntilFn(isNotWhitespace);
  15189. this._expansionCaseStack.pop();
  15190. };
  15191. /**
  15192. * @return {?}
  15193. */
  15194. _Tokenizer.prototype._consumeExpansionFormEnd = /**
  15195. * @return {?}
  15196. */
  15197. function () {
  15198. this._beginToken(TokenType$1.EXPANSION_FORM_END, this._getLocation());
  15199. this._requireCharCode($RBRACE);
  15200. this._endToken([]);
  15201. this._expansionCaseStack.pop();
  15202. };
  15203. /**
  15204. * @return {?}
  15205. */
  15206. _Tokenizer.prototype._consumeText = /**
  15207. * @return {?}
  15208. */
  15209. function () {
  15210. var /** @type {?} */ start = this._getLocation();
  15211. this._beginToken(TokenType$1.TEXT, start);
  15212. var /** @type {?} */ parts = [];
  15213. do {
  15214. if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) {
  15215. parts.push(this._interpolationConfig.start);
  15216. this._inInterpolation = true;
  15217. }
  15218. else if (this._interpolationConfig && this._inInterpolation &&
  15219. this._attemptStr(this._interpolationConfig.end)) {
  15220. parts.push(this._interpolationConfig.end);
  15221. this._inInterpolation = false;
  15222. }
  15223. else {
  15224. parts.push(this._readChar(true));
  15225. }
  15226. } while (!this._isTextEnd());
  15227. this._endToken([this._processCarriageReturns(parts.join(''))]);
  15228. };
  15229. /**
  15230. * @return {?}
  15231. */
  15232. _Tokenizer.prototype._isTextEnd = /**
  15233. * @return {?}
  15234. */
  15235. function () {
  15236. if (this._peek === $LT || this._peek === $EOF) {
  15237. return true;
  15238. }
  15239. if (this._tokenizeIcu && !this._inInterpolation) {
  15240. if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
  15241. // start of an expansion form
  15242. return true;
  15243. }
  15244. if (this._peek === $RBRACE && this._isInExpansionCase()) {
  15245. // end of and expansion case
  15246. return true;
  15247. }
  15248. }
  15249. return false;
  15250. };
  15251. /**
  15252. * @return {?}
  15253. */
  15254. _Tokenizer.prototype._savePosition = /**
  15255. * @return {?}
  15256. */
  15257. function () {
  15258. return [this._peek, this._index, this._column, this._line, this.tokens.length];
  15259. };
  15260. /**
  15261. * @param {?} char
  15262. * @return {?}
  15263. */
  15264. _Tokenizer.prototype._readUntil = /**
  15265. * @param {?} char
  15266. * @return {?}
  15267. */
  15268. function (char) {
  15269. var /** @type {?} */ start = this._index;
  15270. this._attemptUntilChar(char);
  15271. return this._input.substring(start, this._index);
  15272. };
  15273. /**
  15274. * @param {?} position
  15275. * @return {?}
  15276. */
  15277. _Tokenizer.prototype._restorePosition = /**
  15278. * @param {?} position
  15279. * @return {?}
  15280. */
  15281. function (position) {
  15282. this._peek = position[0];
  15283. this._index = position[1];
  15284. this._column = position[2];
  15285. this._line = position[3];
  15286. var /** @type {?} */ nbTokens = position[4];
  15287. if (nbTokens < this.tokens.length) {
  15288. // remove any extra tokens
  15289. this.tokens = this.tokens.slice(0, nbTokens);
  15290. }
  15291. };
  15292. /**
  15293. * @return {?}
  15294. */
  15295. _Tokenizer.prototype._isInExpansionCase = /**
  15296. * @return {?}
  15297. */
  15298. function () {
  15299. return this._expansionCaseStack.length > 0 &&
  15300. this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
  15301. TokenType$1.EXPANSION_CASE_EXP_START;
  15302. };
  15303. /**
  15304. * @return {?}
  15305. */
  15306. _Tokenizer.prototype._isInExpansionForm = /**
  15307. * @return {?}
  15308. */
  15309. function () {
  15310. return this._expansionCaseStack.length > 0 &&
  15311. this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
  15312. TokenType$1.EXPANSION_FORM_START;
  15313. };
  15314. return _Tokenizer;
  15315. }());
  15316. /**
  15317. * @param {?} code
  15318. * @return {?}
  15319. */
  15320. function isNotWhitespace(code) {
  15321. return !isWhitespace(code) || code === $EOF;
  15322. }
  15323. /**
  15324. * @param {?} code
  15325. * @return {?}
  15326. */
  15327. function isNameEnd(code) {
  15328. return isWhitespace(code) || code === $GT || code === $SLASH ||
  15329. code === $SQ || code === $DQ || code === $EQ;
  15330. }
  15331. /**
  15332. * @param {?} code
  15333. * @return {?}
  15334. */
  15335. function isPrefixEnd(code) {
  15336. return (code < $a || $z < code) && (code < $A || $Z < code) &&
  15337. (code < $0 || code > $9);
  15338. }
  15339. /**
  15340. * @param {?} code
  15341. * @return {?}
  15342. */
  15343. function isDigitEntityEnd(code) {
  15344. return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code);
  15345. }
  15346. /**
  15347. * @param {?} code
  15348. * @return {?}
  15349. */
  15350. function isNamedEntityEnd(code) {
  15351. return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code);
  15352. }
  15353. /**
  15354. * @param {?} input
  15355. * @param {?} offset
  15356. * @param {?} interpolationConfig
  15357. * @return {?}
  15358. */
  15359. function isExpansionFormStart(input, offset, interpolationConfig) {
  15360. var /** @type {?} */ isInterpolationStart = interpolationConfig ? input.indexOf(interpolationConfig.start, offset) == offset : false;
  15361. return input.charCodeAt(offset) == $LBRACE && !isInterpolationStart;
  15362. }
  15363. /**
  15364. * @param {?} peek
  15365. * @return {?}
  15366. */
  15367. function isExpansionCaseStart(peek) {
  15368. return peek === $EQ || isAsciiLetter(peek) || isDigit(peek);
  15369. }
  15370. /**
  15371. * @param {?} code1
  15372. * @param {?} code2
  15373. * @return {?}
  15374. */
  15375. function compareCharCodeCaseInsensitive(code1, code2) {
  15376. return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2);
  15377. }
  15378. /**
  15379. * @param {?} code
  15380. * @return {?}
  15381. */
  15382. function toUpperCaseCharCode(code) {
  15383. return code >= $a && code <= $z ? code - $a + $A : code;
  15384. }
  15385. /**
  15386. * @param {?} srcTokens
  15387. * @return {?}
  15388. */
  15389. function mergeTextTokens(srcTokens) {
  15390. var /** @type {?} */ dstTokens = [];
  15391. var /** @type {?} */ lastDstToken = undefined;
  15392. for (var /** @type {?} */ i = 0; i < srcTokens.length; i++) {
  15393. var /** @type {?} */ token = srcTokens[i];
  15394. if (lastDstToken && lastDstToken.type == TokenType$1.TEXT && token.type == TokenType$1.TEXT) {
  15395. lastDstToken.parts[0] += token.parts[0];
  15396. lastDstToken.sourceSpan.end = token.sourceSpan.end;
  15397. }
  15398. else {
  15399. lastDstToken = token;
  15400. dstTokens.push(lastDstToken);
  15401. }
  15402. }
  15403. return dstTokens;
  15404. }
  15405. /**
  15406. * @fileoverview added by tsickle
  15407. * @suppress {checkTypes} checked by tsc
  15408. */
  15409. /**
  15410. * @license
  15411. * Copyright Google Inc. All Rights Reserved.
  15412. *
  15413. * Use of this source code is governed by an MIT-style license that can be
  15414. * found in the LICENSE file at https://angular.io/license
  15415. */
  15416. var TreeError = /** @class */ (function (_super) {
  15417. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TreeError, _super);
  15418. function TreeError(elementName, span, msg) {
  15419. var _this = _super.call(this, span, msg) || this;
  15420. _this.elementName = elementName;
  15421. return _this;
  15422. }
  15423. /**
  15424. * @param {?} elementName
  15425. * @param {?} span
  15426. * @param {?} msg
  15427. * @return {?}
  15428. */
  15429. TreeError.create = /**
  15430. * @param {?} elementName
  15431. * @param {?} span
  15432. * @param {?} msg
  15433. * @return {?}
  15434. */
  15435. function (elementName, span, msg) {
  15436. return new TreeError(elementName, span, msg);
  15437. };
  15438. return TreeError;
  15439. }(ParseError));
  15440. var ParseTreeResult = /** @class */ (function () {
  15441. function ParseTreeResult(rootNodes, errors) {
  15442. this.rootNodes = rootNodes;
  15443. this.errors = errors;
  15444. }
  15445. return ParseTreeResult;
  15446. }());
  15447. var Parser$1 = /** @class */ (function () {
  15448. function Parser(getTagDefinition) {
  15449. this.getTagDefinition = getTagDefinition;
  15450. }
  15451. /**
  15452. * @param {?} source
  15453. * @param {?} url
  15454. * @param {?=} parseExpansionForms
  15455. * @param {?=} interpolationConfig
  15456. * @return {?}
  15457. */
  15458. Parser.prototype.parse = /**
  15459. * @param {?} source
  15460. * @param {?} url
  15461. * @param {?=} parseExpansionForms
  15462. * @param {?=} interpolationConfig
  15463. * @return {?}
  15464. */
  15465. function (source, url, parseExpansionForms, interpolationConfig) {
  15466. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  15467. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  15468. var /** @type {?} */ tokensAndErrors = tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig);
  15469. var /** @type {?} */ treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build();
  15470. return new ParseTreeResult(treeAndErrors.rootNodes, (/** @type {?} */ (tokensAndErrors.errors)).concat(treeAndErrors.errors));
  15471. };
  15472. return Parser;
  15473. }());
  15474. var _TreeBuilder = /** @class */ (function () {
  15475. function _TreeBuilder(tokens, getTagDefinition) {
  15476. this.tokens = tokens;
  15477. this.getTagDefinition = getTagDefinition;
  15478. this._index = -1;
  15479. this._rootNodes = [];
  15480. this._errors = [];
  15481. this._elementStack = [];
  15482. this._advance();
  15483. }
  15484. /**
  15485. * @return {?}
  15486. */
  15487. _TreeBuilder.prototype.build = /**
  15488. * @return {?}
  15489. */
  15490. function () {
  15491. while (this._peek.type !== TokenType$1.EOF) {
  15492. if (this._peek.type === TokenType$1.TAG_OPEN_START) {
  15493. this._consumeStartTag(this._advance());
  15494. }
  15495. else if (this._peek.type === TokenType$1.TAG_CLOSE) {
  15496. this._consumeEndTag(this._advance());
  15497. }
  15498. else if (this._peek.type === TokenType$1.CDATA_START) {
  15499. this._closeVoidElement();
  15500. this._consumeCdata(this._advance());
  15501. }
  15502. else if (this._peek.type === TokenType$1.COMMENT_START) {
  15503. this._closeVoidElement();
  15504. this._consumeComment(this._advance());
  15505. }
  15506. else if (this._peek.type === TokenType$1.TEXT || this._peek.type === TokenType$1.RAW_TEXT ||
  15507. this._peek.type === TokenType$1.ESCAPABLE_RAW_TEXT) {
  15508. this._closeVoidElement();
  15509. this._consumeText(this._advance());
  15510. }
  15511. else if (this._peek.type === TokenType$1.EXPANSION_FORM_START) {
  15512. this._consumeExpansion(this._advance());
  15513. }
  15514. else {
  15515. // Skip all other tokens...
  15516. this._advance();
  15517. }
  15518. }
  15519. return new ParseTreeResult(this._rootNodes, this._errors);
  15520. };
  15521. /**
  15522. * @return {?}
  15523. */
  15524. _TreeBuilder.prototype._advance = /**
  15525. * @return {?}
  15526. */
  15527. function () {
  15528. var /** @type {?} */ prev = this._peek;
  15529. if (this._index < this.tokens.length - 1) {
  15530. // Note: there is always an EOF token at the end
  15531. this._index++;
  15532. }
  15533. this._peek = this.tokens[this._index];
  15534. return prev;
  15535. };
  15536. /**
  15537. * @param {?} type
  15538. * @return {?}
  15539. */
  15540. _TreeBuilder.prototype._advanceIf = /**
  15541. * @param {?} type
  15542. * @return {?}
  15543. */
  15544. function (type) {
  15545. if (this._peek.type === type) {
  15546. return this._advance();
  15547. }
  15548. return null;
  15549. };
  15550. /**
  15551. * @param {?} startToken
  15552. * @return {?}
  15553. */
  15554. _TreeBuilder.prototype._consumeCdata = /**
  15555. * @param {?} startToken
  15556. * @return {?}
  15557. */
  15558. function (startToken) {
  15559. this._consumeText(this._advance());
  15560. this._advanceIf(TokenType$1.CDATA_END);
  15561. };
  15562. /**
  15563. * @param {?} token
  15564. * @return {?}
  15565. */
  15566. _TreeBuilder.prototype._consumeComment = /**
  15567. * @param {?} token
  15568. * @return {?}
  15569. */
  15570. function (token) {
  15571. var /** @type {?} */ text = this._advanceIf(TokenType$1.RAW_TEXT);
  15572. this._advanceIf(TokenType$1.COMMENT_END);
  15573. var /** @type {?} */ value = text != null ? text.parts[0].trim() : null;
  15574. this._addToParent(new Comment(value, token.sourceSpan));
  15575. };
  15576. /**
  15577. * @param {?} token
  15578. * @return {?}
  15579. */
  15580. _TreeBuilder.prototype._consumeExpansion = /**
  15581. * @param {?} token
  15582. * @return {?}
  15583. */
  15584. function (token) {
  15585. var /** @type {?} */ switchValue = this._advance();
  15586. var /** @type {?} */ type = this._advance();
  15587. var /** @type {?} */ cases = [];
  15588. // read =
  15589. while (this._peek.type === TokenType$1.EXPANSION_CASE_VALUE) {
  15590. var /** @type {?} */ expCase = this._parseExpansionCase();
  15591. if (!expCase)
  15592. return; // error
  15593. cases.push(expCase);
  15594. }
  15595. // read the final }
  15596. if (this._peek.type !== TokenType$1.EXPANSION_FORM_END) {
  15597. this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'."));
  15598. return;
  15599. }
  15600. var /** @type {?} */ sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end);
  15601. this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
  15602. this._advance();
  15603. };
  15604. /**
  15605. * @return {?}
  15606. */
  15607. _TreeBuilder.prototype._parseExpansionCase = /**
  15608. * @return {?}
  15609. */
  15610. function () {
  15611. var /** @type {?} */ value = this._advance();
  15612. // read {
  15613. if (this._peek.type !== TokenType$1.EXPANSION_CASE_EXP_START) {
  15614. this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'."));
  15615. return null;
  15616. }
  15617. // read until }
  15618. var /** @type {?} */ start = this._advance();
  15619. var /** @type {?} */ exp = this._collectExpansionExpTokens(start);
  15620. if (!exp)
  15621. return null;
  15622. var /** @type {?} */ end = this._advance();
  15623. exp.push(new Token$1(TokenType$1.EOF, [], end.sourceSpan));
  15624. // parse everything in between { and }
  15625. var /** @type {?} */ parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build();
  15626. if (parsedExp.errors.length > 0) {
  15627. this._errors = this._errors.concat(/** @type {?} */ (parsedExp.errors));
  15628. return null;
  15629. }
  15630. var /** @type {?} */ sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end);
  15631. var /** @type {?} */ expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end);
  15632. return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
  15633. };
  15634. /**
  15635. * @param {?} start
  15636. * @return {?}
  15637. */
  15638. _TreeBuilder.prototype._collectExpansionExpTokens = /**
  15639. * @param {?} start
  15640. * @return {?}
  15641. */
  15642. function (start) {
  15643. var /** @type {?} */ exp = [];
  15644. var /** @type {?} */ expansionFormStack = [TokenType$1.EXPANSION_CASE_EXP_START];
  15645. while (true) {
  15646. if (this._peek.type === TokenType$1.EXPANSION_FORM_START ||
  15647. this._peek.type === TokenType$1.EXPANSION_CASE_EXP_START) {
  15648. expansionFormStack.push(this._peek.type);
  15649. }
  15650. if (this._peek.type === TokenType$1.EXPANSION_CASE_EXP_END) {
  15651. if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_CASE_EXP_START)) {
  15652. expansionFormStack.pop();
  15653. if (expansionFormStack.length == 0)
  15654. return exp;
  15655. }
  15656. else {
  15657. this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
  15658. return null;
  15659. }
  15660. }
  15661. if (this._peek.type === TokenType$1.EXPANSION_FORM_END) {
  15662. if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_FORM_START)) {
  15663. expansionFormStack.pop();
  15664. }
  15665. else {
  15666. this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
  15667. return null;
  15668. }
  15669. }
  15670. if (this._peek.type === TokenType$1.EOF) {
  15671. this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
  15672. return null;
  15673. }
  15674. exp.push(this._advance());
  15675. }
  15676. };
  15677. /**
  15678. * @param {?} token
  15679. * @return {?}
  15680. */
  15681. _TreeBuilder.prototype._consumeText = /**
  15682. * @param {?} token
  15683. * @return {?}
  15684. */
  15685. function (token) {
  15686. var /** @type {?} */ text = token.parts[0];
  15687. if (text.length > 0 && text[0] == '\n') {
  15688. var /** @type {?} */ parent_1 = this._getParentElement();
  15689. if (parent_1 != null && parent_1.children.length == 0 &&
  15690. this.getTagDefinition(parent_1.name).ignoreFirstLf) {
  15691. text = text.substring(1);
  15692. }
  15693. }
  15694. if (text.length > 0) {
  15695. this._addToParent(new Text(text, token.sourceSpan));
  15696. }
  15697. };
  15698. /**
  15699. * @return {?}
  15700. */
  15701. _TreeBuilder.prototype._closeVoidElement = /**
  15702. * @return {?}
  15703. */
  15704. function () {
  15705. var /** @type {?} */ el = this._getParentElement();
  15706. if (el && this.getTagDefinition(el.name).isVoid) {
  15707. this._elementStack.pop();
  15708. }
  15709. };
  15710. /**
  15711. * @param {?} startTagToken
  15712. * @return {?}
  15713. */
  15714. _TreeBuilder.prototype._consumeStartTag = /**
  15715. * @param {?} startTagToken
  15716. * @return {?}
  15717. */
  15718. function (startTagToken) {
  15719. var /** @type {?} */ prefix = startTagToken.parts[0];
  15720. var /** @type {?} */ name = startTagToken.parts[1];
  15721. var /** @type {?} */ attrs = [];
  15722. while (this._peek.type === TokenType$1.ATTR_NAME) {
  15723. attrs.push(this._consumeAttr(this._advance()));
  15724. }
  15725. var /** @type {?} */ fullName = this._getElementFullName(prefix, name, this._getParentElement());
  15726. var /** @type {?} */ selfClosing = false;
  15727. // Note: There could have been a tokenizer error
  15728. // so that we don't get a token for the end tag...
  15729. if (this._peek.type === TokenType$1.TAG_OPEN_END_VOID) {
  15730. this._advance();
  15731. selfClosing = true;
  15732. var /** @type {?} */ tagDef = this.getTagDefinition(fullName);
  15733. if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) {
  15734. this._errors.push(TreeError.create(fullName, startTagToken.sourceSpan, "Only void and foreign elements can be self closed \"" + startTagToken.parts[1] + "\""));
  15735. }
  15736. }
  15737. else if (this._peek.type === TokenType$1.TAG_OPEN_END) {
  15738. this._advance();
  15739. selfClosing = false;
  15740. }
  15741. var /** @type {?} */ end = this._peek.sourceSpan.start;
  15742. var /** @type {?} */ span = new ParseSourceSpan(startTagToken.sourceSpan.start, end);
  15743. var /** @type {?} */ el = new Element(fullName, attrs, [], span, span, undefined);
  15744. this._pushElement(el);
  15745. if (selfClosing) {
  15746. this._popElement(fullName);
  15747. el.endSourceSpan = span;
  15748. }
  15749. };
  15750. /**
  15751. * @param {?} el
  15752. * @return {?}
  15753. */
  15754. _TreeBuilder.prototype._pushElement = /**
  15755. * @param {?} el
  15756. * @return {?}
  15757. */
  15758. function (el) {
  15759. var /** @type {?} */ parentEl = this._getParentElement();
  15760. if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
  15761. this._elementStack.pop();
  15762. }
  15763. var /** @type {?} */ tagDef = this.getTagDefinition(el.name);
  15764. var _a = this._getParentElementSkippingContainers(), parent = _a.parent, container = _a.container;
  15765. if (parent && tagDef.requireExtraParent(parent.name)) {
  15766. var /** @type {?} */ newParent = new Element(tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
  15767. this._insertBeforeContainer(parent, container, newParent);
  15768. }
  15769. this._addToParent(el);
  15770. this._elementStack.push(el);
  15771. };
  15772. /**
  15773. * @param {?} endTagToken
  15774. * @return {?}
  15775. */
  15776. _TreeBuilder.prototype._consumeEndTag = /**
  15777. * @param {?} endTagToken
  15778. * @return {?}
  15779. */
  15780. function (endTagToken) {
  15781. var /** @type {?} */ fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
  15782. if (this._getParentElement()) {
  15783. /** @type {?} */ ((this._getParentElement())).endSourceSpan = endTagToken.sourceSpan;
  15784. }
  15785. if (this.getTagDefinition(fullName).isVoid) {
  15786. this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, "Void elements do not have end tags \"" + endTagToken.parts[1] + "\""));
  15787. }
  15788. else if (!this._popElement(fullName)) {
  15789. var /** @type {?} */ errMsg = "Unexpected closing tag \"" + fullName + "\". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags";
  15790. this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
  15791. }
  15792. };
  15793. /**
  15794. * @param {?} fullName
  15795. * @return {?}
  15796. */
  15797. _TreeBuilder.prototype._popElement = /**
  15798. * @param {?} fullName
  15799. * @return {?}
  15800. */
  15801. function (fullName) {
  15802. for (var /** @type {?} */ stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
  15803. var /** @type {?} */ el = this._elementStack[stackIndex];
  15804. if (el.name == fullName) {
  15805. this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
  15806. return true;
  15807. }
  15808. if (!this.getTagDefinition(el.name).closedByParent) {
  15809. return false;
  15810. }
  15811. }
  15812. return false;
  15813. };
  15814. /**
  15815. * @param {?} attrName
  15816. * @return {?}
  15817. */
  15818. _TreeBuilder.prototype._consumeAttr = /**
  15819. * @param {?} attrName
  15820. * @return {?}
  15821. */
  15822. function (attrName) {
  15823. var /** @type {?} */ fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
  15824. var /** @type {?} */ end = attrName.sourceSpan.end;
  15825. var /** @type {?} */ value = '';
  15826. var /** @type {?} */ valueSpan = /** @type {?} */ ((undefined));
  15827. if (this._peek.type === TokenType$1.ATTR_VALUE) {
  15828. var /** @type {?} */ valueToken = this._advance();
  15829. value = valueToken.parts[0];
  15830. end = valueToken.sourceSpan.end;
  15831. valueSpan = valueToken.sourceSpan;
  15832. }
  15833. return new Attribute$1(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan);
  15834. };
  15835. /**
  15836. * @return {?}
  15837. */
  15838. _TreeBuilder.prototype._getParentElement = /**
  15839. * @return {?}
  15840. */
  15841. function () {
  15842. return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
  15843. };
  15844. /**
  15845. * Returns the parent in the DOM and the container.
  15846. *
  15847. * `<ng-container>` elements are skipped as they are not rendered as DOM element.
  15848. * @return {?}
  15849. */
  15850. _TreeBuilder.prototype._getParentElementSkippingContainers = /**
  15851. * Returns the parent in the DOM and the container.
  15852. *
  15853. * `<ng-container>` elements are skipped as they are not rendered as DOM element.
  15854. * @return {?}
  15855. */
  15856. function () {
  15857. var /** @type {?} */ container = null;
  15858. for (var /** @type {?} */ i = this._elementStack.length - 1; i >= 0; i--) {
  15859. if (!isNgContainer(this._elementStack[i].name)) {
  15860. return { parent: this._elementStack[i], container: container };
  15861. }
  15862. container = this._elementStack[i];
  15863. }
  15864. return { parent: null, container: container };
  15865. };
  15866. /**
  15867. * @param {?} node
  15868. * @return {?}
  15869. */
  15870. _TreeBuilder.prototype._addToParent = /**
  15871. * @param {?} node
  15872. * @return {?}
  15873. */
  15874. function (node) {
  15875. var /** @type {?} */ parent = this._getParentElement();
  15876. if (parent != null) {
  15877. parent.children.push(node);
  15878. }
  15879. else {
  15880. this._rootNodes.push(node);
  15881. }
  15882. };
  15883. /**
  15884. * Insert a node between the parent and the container.
  15885. * When no container is given, the node is appended as a child of the parent.
  15886. * Also updates the element stack accordingly.
  15887. *
  15888. * \@internal
  15889. * @param {?} parent
  15890. * @param {?} container
  15891. * @param {?} node
  15892. * @return {?}
  15893. */
  15894. _TreeBuilder.prototype._insertBeforeContainer = /**
  15895. * Insert a node between the parent and the container.
  15896. * When no container is given, the node is appended as a child of the parent.
  15897. * Also updates the element stack accordingly.
  15898. *
  15899. * \@internal
  15900. * @param {?} parent
  15901. * @param {?} container
  15902. * @param {?} node
  15903. * @return {?}
  15904. */
  15905. function (parent, container, node) {
  15906. if (!container) {
  15907. this._addToParent(node);
  15908. this._elementStack.push(node);
  15909. }
  15910. else {
  15911. if (parent) {
  15912. // replace the container with the new node in the children
  15913. var /** @type {?} */ index = parent.children.indexOf(container);
  15914. parent.children[index] = node;
  15915. }
  15916. else {
  15917. this._rootNodes.push(node);
  15918. }
  15919. node.children.push(container);
  15920. this._elementStack.splice(this._elementStack.indexOf(container), 0, node);
  15921. }
  15922. };
  15923. /**
  15924. * @param {?} prefix
  15925. * @param {?} localName
  15926. * @param {?} parentElement
  15927. * @return {?}
  15928. */
  15929. _TreeBuilder.prototype._getElementFullName = /**
  15930. * @param {?} prefix
  15931. * @param {?} localName
  15932. * @param {?} parentElement
  15933. * @return {?}
  15934. */
  15935. function (prefix, localName, parentElement) {
  15936. if (prefix == null) {
  15937. prefix = /** @type {?} */ ((this.getTagDefinition(localName).implicitNamespacePrefix));
  15938. if (prefix == null && parentElement != null) {
  15939. prefix = getNsPrefix(parentElement.name);
  15940. }
  15941. }
  15942. return mergeNsAndName(prefix, localName);
  15943. };
  15944. return _TreeBuilder;
  15945. }());
  15946. /**
  15947. * @param {?} stack
  15948. * @param {?} element
  15949. * @return {?}
  15950. */
  15951. function lastOnStack(stack, element) {
  15952. return stack.length > 0 && stack[stack.length - 1] === element;
  15953. }
  15954. /**
  15955. * @fileoverview added by tsickle
  15956. * @suppress {checkTypes} checked by tsc
  15957. */
  15958. /**
  15959. * @license
  15960. * Copyright Google Inc. All Rights Reserved.
  15961. *
  15962. * Use of this source code is governed by an MIT-style license that can be
  15963. * found in the LICENSE file at https://angular.io/license
  15964. */
  15965. /**
  15966. * @param {?} message
  15967. * @return {?}
  15968. */
  15969. function digest(message) {
  15970. return message.id || sha1(serializeNodes(message.nodes).join('') + ("[" + message.meaning + "]"));
  15971. }
  15972. /**
  15973. * @param {?} message
  15974. * @return {?}
  15975. */
  15976. function decimalDigest(message) {
  15977. if (message.id) {
  15978. return message.id;
  15979. }
  15980. var /** @type {?} */ visitor = new _SerializerIgnoreIcuExpVisitor();
  15981. var /** @type {?} */ parts = message.nodes.map(function (a) { return a.visit(visitor, null); });
  15982. return computeMsgId(parts.join(''), message.meaning);
  15983. }
  15984. /**
  15985. * Serialize the i18n ast to something xml-like in order to generate an UID.
  15986. *
  15987. * The visitor is also used in the i18n parser tests
  15988. *
  15989. * \@internal
  15990. */
  15991. var _SerializerVisitor = /** @class */ (function () {
  15992. function _SerializerVisitor() {
  15993. }
  15994. /**
  15995. * @param {?} text
  15996. * @param {?} context
  15997. * @return {?}
  15998. */
  15999. _SerializerVisitor.prototype.visitText = /**
  16000. * @param {?} text
  16001. * @param {?} context
  16002. * @return {?}
  16003. */
  16004. function (text, context) { return text.value; };
  16005. /**
  16006. * @param {?} container
  16007. * @param {?} context
  16008. * @return {?}
  16009. */
  16010. _SerializerVisitor.prototype.visitContainer = /**
  16011. * @param {?} container
  16012. * @param {?} context
  16013. * @return {?}
  16014. */
  16015. function (container, context) {
  16016. var _this = this;
  16017. return "[" + container.children.map(function (child) { return child.visit(_this); }).join(', ') + "]";
  16018. };
  16019. /**
  16020. * @param {?} icu
  16021. * @param {?} context
  16022. * @return {?}
  16023. */
  16024. _SerializerVisitor.prototype.visitIcu = /**
  16025. * @param {?} icu
  16026. * @param {?} context
  16027. * @return {?}
  16028. */
  16029. function (icu, context) {
  16030. var _this = this;
  16031. var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
  16032. return "{" + icu.expression + ", " + icu.type + ", " + strCases.join(', ') + "}";
  16033. };
  16034. /**
  16035. * @param {?} ph
  16036. * @param {?} context
  16037. * @return {?}
  16038. */
  16039. _SerializerVisitor.prototype.visitTagPlaceholder = /**
  16040. * @param {?} ph
  16041. * @param {?} context
  16042. * @return {?}
  16043. */
  16044. function (ph, context) {
  16045. var _this = this;
  16046. return ph.isVoid ?
  16047. "<ph tag name=\"" + ph.startName + "\"/>" :
  16048. "<ph tag name=\"" + ph.startName + "\">" + ph.children.map(function (child) { return child.visit(_this); }).join(', ') + "</ph name=\"" + ph.closeName + "\">";
  16049. };
  16050. /**
  16051. * @param {?} ph
  16052. * @param {?} context
  16053. * @return {?}
  16054. */
  16055. _SerializerVisitor.prototype.visitPlaceholder = /**
  16056. * @param {?} ph
  16057. * @param {?} context
  16058. * @return {?}
  16059. */
  16060. function (ph, context) {
  16061. return ph.value ? "<ph name=\"" + ph.name + "\">" + ph.value + "</ph>" : "<ph name=\"" + ph.name + "\"/>";
  16062. };
  16063. /**
  16064. * @param {?} ph
  16065. * @param {?=} context
  16066. * @return {?}
  16067. */
  16068. _SerializerVisitor.prototype.visitIcuPlaceholder = /**
  16069. * @param {?} ph
  16070. * @param {?=} context
  16071. * @return {?}
  16072. */
  16073. function (ph, context) {
  16074. return "<ph icu name=\"" + ph.name + "\">" + ph.value.visit(this) + "</ph>";
  16075. };
  16076. return _SerializerVisitor;
  16077. }());
  16078. var serializerVisitor = new _SerializerVisitor();
  16079. /**
  16080. * @param {?} nodes
  16081. * @return {?}
  16082. */
  16083. function serializeNodes(nodes) {
  16084. return nodes.map(function (a) { return a.visit(serializerVisitor, null); });
  16085. }
  16086. /**
  16087. * Serialize the i18n ast to something xml-like in order to generate an UID.
  16088. *
  16089. * Ignore the ICU expressions so that message IDs stays identical if only the expression changes.
  16090. *
  16091. * \@internal
  16092. */
  16093. var _SerializerIgnoreIcuExpVisitor = /** @class */ (function (_super) {
  16094. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_SerializerIgnoreIcuExpVisitor, _super);
  16095. function _SerializerIgnoreIcuExpVisitor() {
  16096. return _super !== null && _super.apply(this, arguments) || this;
  16097. }
  16098. /**
  16099. * @param {?} icu
  16100. * @param {?} context
  16101. * @return {?}
  16102. */
  16103. _SerializerIgnoreIcuExpVisitor.prototype.visitIcu = /**
  16104. * @param {?} icu
  16105. * @param {?} context
  16106. * @return {?}
  16107. */
  16108. function (icu, context) {
  16109. var _this = this;
  16110. var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
  16111. // Do not take the expression into account
  16112. return "{" + icu.type + ", " + strCases.join(', ') + "}";
  16113. };
  16114. return _SerializerIgnoreIcuExpVisitor;
  16115. }(_SerializerVisitor));
  16116. /**
  16117. * Compute the SHA1 of the given string
  16118. *
  16119. * see http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
  16120. *
  16121. * WARNING: this function has not been designed not tested with security in mind.
  16122. * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
  16123. * @param {?} str
  16124. * @return {?}
  16125. */
  16126. function sha1(str) {
  16127. var /** @type {?} */ utf8 = utf8Encode(str);
  16128. var /** @type {?} */ words32 = stringToWords32(utf8, Endian.Big);
  16129. var /** @type {?} */ len = utf8.length * 8;
  16130. var /** @type {?} */ w = new Array(80);
  16131. var _a = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], a = _a[0], b = _a[1], c = _a[2], d = _a[3], e = _a[4];
  16132. words32[len >> 5] |= 0x80 << (24 - len % 32);
  16133. words32[((len + 64 >> 9) << 4) + 15] = len;
  16134. for (var /** @type {?} */ i = 0; i < words32.length; i += 16) {
  16135. var _b = [a, b, c, d, e], h0 = _b[0], h1 = _b[1], h2 = _b[2], h3 = _b[3], h4 = _b[4];
  16136. for (var /** @type {?} */ j = 0; j < 80; j++) {
  16137. if (j < 16) {
  16138. w[j] = words32[i + j];
  16139. }
  16140. else {
  16141. w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
  16142. }
  16143. var _c = fk(j, b, c, d), f = _c[0], k = _c[1];
  16144. var /** @type {?} */ temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
  16145. _d = [d, c, rol32(b, 30), a, temp], e = _d[0], d = _d[1], c = _d[2], b = _d[3], a = _d[4];
  16146. }
  16147. _e = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)], a = _e[0], b = _e[1], c = _e[2], d = _e[3], e = _e[4];
  16148. }
  16149. return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
  16150. var _d, _e;
  16151. }
  16152. /**
  16153. * @param {?} index
  16154. * @param {?} b
  16155. * @param {?} c
  16156. * @param {?} d
  16157. * @return {?}
  16158. */
  16159. function fk(index, b, c, d) {
  16160. if (index < 20) {
  16161. return [(b & c) | (~b & d), 0x5a827999];
  16162. }
  16163. if (index < 40) {
  16164. return [b ^ c ^ d, 0x6ed9eba1];
  16165. }
  16166. if (index < 60) {
  16167. return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
  16168. }
  16169. return [b ^ c ^ d, 0xca62c1d6];
  16170. }
  16171. /**
  16172. * Compute the fingerprint of the given string
  16173. *
  16174. * The output is 64 bit number encoded as a decimal string
  16175. *
  16176. * based on:
  16177. * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
  16178. * @param {?} str
  16179. * @return {?}
  16180. */
  16181. function fingerprint(str) {
  16182. var /** @type {?} */ utf8 = utf8Encode(str);
  16183. var _a = [hash32(utf8, 0), hash32(utf8, 102072)], hi = _a[0], lo = _a[1];
  16184. if (hi == 0 && (lo == 0 || lo == 1)) {
  16185. hi = hi ^ 0x130f9bef;
  16186. lo = lo ^ -0x6b5f56d8;
  16187. }
  16188. return [hi, lo];
  16189. }
  16190. /**
  16191. * @param {?} msg
  16192. * @param {?} meaning
  16193. * @return {?}
  16194. */
  16195. function computeMsgId(msg, meaning) {
  16196. var _a = fingerprint(msg), hi = _a[0], lo = _a[1];
  16197. if (meaning) {
  16198. var _b = fingerprint(meaning), him = _b[0], lom = _b[1];
  16199. _c = add64(rol64([hi, lo], 1), [him, lom]), hi = _c[0], lo = _c[1];
  16200. }
  16201. return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo]));
  16202. var _c;
  16203. }
  16204. /**
  16205. * @param {?} str
  16206. * @param {?} c
  16207. * @return {?}
  16208. */
  16209. function hash32(str, c) {
  16210. var _a = [0x9e3779b9, 0x9e3779b9], a = _a[0], b = _a[1];
  16211. var /** @type {?} */ i;
  16212. var /** @type {?} */ len = str.length;
  16213. for (i = 0; i + 12 <= len; i += 12) {
  16214. a = add32(a, wordAt(str, i, Endian.Little));
  16215. b = add32(b, wordAt(str, i + 4, Endian.Little));
  16216. c = add32(c, wordAt(str, i + 8, Endian.Little));
  16217. _b = mix([a, b, c]), a = _b[0], b = _b[1], c = _b[2];
  16218. }
  16219. a = add32(a, wordAt(str, i, Endian.Little));
  16220. b = add32(b, wordAt(str, i + 4, Endian.Little));
  16221. // the first byte of c is reserved for the length
  16222. c = add32(c, len);
  16223. c = add32(c, wordAt(str, i + 8, Endian.Little) << 8);
  16224. return mix([a, b, c])[2];
  16225. var _b;
  16226. }
  16227. /**
  16228. * @param {?} __0
  16229. * @return {?}
  16230. */
  16231. function mix(_a) {
  16232. var a = _a[0], b = _a[1], c = _a[2];
  16233. a = sub32(a, b);
  16234. a = sub32(a, c);
  16235. a ^= c >>> 13;
  16236. b = sub32(b, c);
  16237. b = sub32(b, a);
  16238. b ^= a << 8;
  16239. c = sub32(c, a);
  16240. c = sub32(c, b);
  16241. c ^= b >>> 13;
  16242. a = sub32(a, b);
  16243. a = sub32(a, c);
  16244. a ^= c >>> 12;
  16245. b = sub32(b, c);
  16246. b = sub32(b, a);
  16247. b ^= a << 16;
  16248. c = sub32(c, a);
  16249. c = sub32(c, b);
  16250. c ^= b >>> 5;
  16251. a = sub32(a, b);
  16252. a = sub32(a, c);
  16253. a ^= c >>> 3;
  16254. b = sub32(b, c);
  16255. b = sub32(b, a);
  16256. b ^= a << 10;
  16257. c = sub32(c, a);
  16258. c = sub32(c, b);
  16259. c ^= b >>> 15;
  16260. return [a, b, c];
  16261. }
  16262. /** @enum {number} */
  16263. var Endian = {
  16264. Little: 0,
  16265. Big: 1,
  16266. };
  16267. Endian[Endian.Little] = "Little";
  16268. Endian[Endian.Big] = "Big";
  16269. /**
  16270. * @param {?} a
  16271. * @param {?} b
  16272. * @return {?}
  16273. */
  16274. function add32(a, b) {
  16275. return add32to64(a, b)[1];
  16276. }
  16277. /**
  16278. * @param {?} a
  16279. * @param {?} b
  16280. * @return {?}
  16281. */
  16282. function add32to64(a, b) {
  16283. var /** @type {?} */ low = (a & 0xffff) + (b & 0xffff);
  16284. var /** @type {?} */ high = (a >>> 16) + (b >>> 16) + (low >>> 16);
  16285. return [high >>> 16, (high << 16) | (low & 0xffff)];
  16286. }
  16287. /**
  16288. * @param {?} __0
  16289. * @param {?} __1
  16290. * @return {?}
  16291. */
  16292. function add64(_a, _b) {
  16293. var ah = _a[0], al = _a[1];
  16294. var bh = _b[0], bl = _b[1];
  16295. var _c = add32to64(al, bl), carry = _c[0], l = _c[1];
  16296. var /** @type {?} */ h = add32(add32(ah, bh), carry);
  16297. return [h, l];
  16298. }
  16299. /**
  16300. * @param {?} a
  16301. * @param {?} b
  16302. * @return {?}
  16303. */
  16304. function sub32(a, b) {
  16305. var /** @type {?} */ low = (a & 0xffff) - (b & 0xffff);
  16306. var /** @type {?} */ high = (a >> 16) - (b >> 16) + (low >> 16);
  16307. return (high << 16) | (low & 0xffff);
  16308. }
  16309. /**
  16310. * @param {?} a
  16311. * @param {?} count
  16312. * @return {?}
  16313. */
  16314. function rol32(a, count) {
  16315. return (a << count) | (a >>> (32 - count));
  16316. }
  16317. /**
  16318. * @param {?} __0
  16319. * @param {?} count
  16320. * @return {?}
  16321. */
  16322. function rol64(_a, count) {
  16323. var hi = _a[0], lo = _a[1];
  16324. var /** @type {?} */ h = (hi << count) | (lo >>> (32 - count));
  16325. var /** @type {?} */ l = (lo << count) | (hi >>> (32 - count));
  16326. return [h, l];
  16327. }
  16328. /**
  16329. * @param {?} str
  16330. * @param {?} endian
  16331. * @return {?}
  16332. */
  16333. function stringToWords32(str, endian) {
  16334. var /** @type {?} */ words32 = Array((str.length + 3) >>> 2);
  16335. for (var /** @type {?} */ i = 0; i < words32.length; i++) {
  16336. words32[i] = wordAt(str, i * 4, endian);
  16337. }
  16338. return words32;
  16339. }
  16340. /**
  16341. * @param {?} str
  16342. * @param {?} index
  16343. * @return {?}
  16344. */
  16345. function byteAt(str, index) {
  16346. return index >= str.length ? 0 : str.charCodeAt(index) & 0xff;
  16347. }
  16348. /**
  16349. * @param {?} str
  16350. * @param {?} index
  16351. * @param {?} endian
  16352. * @return {?}
  16353. */
  16354. function wordAt(str, index, endian) {
  16355. var /** @type {?} */ word = 0;
  16356. if (endian === Endian.Big) {
  16357. for (var /** @type {?} */ i = 0; i < 4; i++) {
  16358. word += byteAt(str, index + i) << (24 - 8 * i);
  16359. }
  16360. }
  16361. else {
  16362. for (var /** @type {?} */ i = 0; i < 4; i++) {
  16363. word += byteAt(str, index + i) << 8 * i;
  16364. }
  16365. }
  16366. return word;
  16367. }
  16368. /**
  16369. * @param {?} words32
  16370. * @return {?}
  16371. */
  16372. function words32ToByteString(words32) {
  16373. return words32.reduce(function (str, word) { return str + word32ToByteString(word); }, '');
  16374. }
  16375. /**
  16376. * @param {?} word
  16377. * @return {?}
  16378. */
  16379. function word32ToByteString(word) {
  16380. var /** @type {?} */ str = '';
  16381. for (var /** @type {?} */ i = 0; i < 4; i++) {
  16382. str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff);
  16383. }
  16384. return str;
  16385. }
  16386. /**
  16387. * @param {?} str
  16388. * @return {?}
  16389. */
  16390. function byteStringToHexString(str) {
  16391. var /** @type {?} */ hex = '';
  16392. for (var /** @type {?} */ i = 0; i < str.length; i++) {
  16393. var /** @type {?} */ b = byteAt(str, i);
  16394. hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
  16395. }
  16396. return hex.toLowerCase();
  16397. }
  16398. /**
  16399. * @param {?} str
  16400. * @return {?}
  16401. */
  16402. function byteStringToDecString(str) {
  16403. var /** @type {?} */ decimal = '';
  16404. var /** @type {?} */ toThePower = '1';
  16405. for (var /** @type {?} */ i = str.length - 1; i >= 0; i--) {
  16406. decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower));
  16407. toThePower = numberTimesBigInt(256, toThePower);
  16408. }
  16409. return decimal.split('').reverse().join('');
  16410. }
  16411. /**
  16412. * @param {?} x
  16413. * @param {?} y
  16414. * @return {?}
  16415. */
  16416. function addBigInt(x, y) {
  16417. var /** @type {?} */ sum = '';
  16418. var /** @type {?} */ len = Math.max(x.length, y.length);
  16419. for (var /** @type {?} */ i = 0, /** @type {?} */ carry = 0; i < len || carry; i++) {
  16420. var /** @type {?} */ tmpSum = carry + +(x[i] || 0) + +(y[i] || 0);
  16421. if (tmpSum >= 10) {
  16422. carry = 1;
  16423. sum += tmpSum - 10;
  16424. }
  16425. else {
  16426. carry = 0;
  16427. sum += tmpSum;
  16428. }
  16429. }
  16430. return sum;
  16431. }
  16432. /**
  16433. * @param {?} num
  16434. * @param {?} b
  16435. * @return {?}
  16436. */
  16437. function numberTimesBigInt(num, b) {
  16438. var /** @type {?} */ product = '';
  16439. var /** @type {?} */ bToThePower = b;
  16440. for (; num !== 0; num = num >>> 1) {
  16441. if (num & 1)
  16442. product = addBigInt(product, bToThePower);
  16443. bToThePower = addBigInt(bToThePower, bToThePower);
  16444. }
  16445. return product;
  16446. }
  16447. /**
  16448. * @fileoverview added by tsickle
  16449. * @suppress {checkTypes} checked by tsc
  16450. */
  16451. /**
  16452. * @license
  16453. * Copyright Google Inc. All Rights Reserved.
  16454. *
  16455. * Use of this source code is governed by an MIT-style license that can be
  16456. * found in the LICENSE file at https://angular.io/license
  16457. */
  16458. var Message = /** @class */ (function () {
  16459. /**
  16460. * @param nodes message AST
  16461. * @param placeholders maps placeholder names to static content
  16462. * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
  16463. * @param meaning
  16464. * @param description
  16465. * @param id
  16466. */
  16467. function Message(nodes, placeholders, placeholderToMessage, meaning, description, id) {
  16468. this.nodes = nodes;
  16469. this.placeholders = placeholders;
  16470. this.placeholderToMessage = placeholderToMessage;
  16471. this.meaning = meaning;
  16472. this.description = description;
  16473. this.id = id;
  16474. if (nodes.length) {
  16475. this.sources = [{
  16476. filePath: nodes[0].sourceSpan.start.file.url,
  16477. startLine: nodes[0].sourceSpan.start.line + 1,
  16478. startCol: nodes[0].sourceSpan.start.col + 1,
  16479. endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,
  16480. endCol: nodes[0].sourceSpan.start.col + 1
  16481. }];
  16482. }
  16483. else {
  16484. this.sources = [];
  16485. }
  16486. }
  16487. return Message;
  16488. }());
  16489. /**
  16490. * @record
  16491. */
  16492. /**
  16493. * @record
  16494. */
  16495. var Text$1 = /** @class */ (function () {
  16496. function Text(value, sourceSpan) {
  16497. this.value = value;
  16498. this.sourceSpan = sourceSpan;
  16499. }
  16500. /**
  16501. * @param {?} visitor
  16502. * @param {?=} context
  16503. * @return {?}
  16504. */
  16505. Text.prototype.visit = /**
  16506. * @param {?} visitor
  16507. * @param {?=} context
  16508. * @return {?}
  16509. */
  16510. function (visitor, context) { return visitor.visitText(this, context); };
  16511. return Text;
  16512. }());
  16513. var Container = /** @class */ (function () {
  16514. function Container(children, sourceSpan) {
  16515. this.children = children;
  16516. this.sourceSpan = sourceSpan;
  16517. }
  16518. /**
  16519. * @param {?} visitor
  16520. * @param {?=} context
  16521. * @return {?}
  16522. */
  16523. Container.prototype.visit = /**
  16524. * @param {?} visitor
  16525. * @param {?=} context
  16526. * @return {?}
  16527. */
  16528. function (visitor, context) { return visitor.visitContainer(this, context); };
  16529. return Container;
  16530. }());
  16531. var Icu = /** @class */ (function () {
  16532. function Icu(expression, type, cases, sourceSpan) {
  16533. this.expression = expression;
  16534. this.type = type;
  16535. this.cases = cases;
  16536. this.sourceSpan = sourceSpan;
  16537. }
  16538. /**
  16539. * @param {?} visitor
  16540. * @param {?=} context
  16541. * @return {?}
  16542. */
  16543. Icu.prototype.visit = /**
  16544. * @param {?} visitor
  16545. * @param {?=} context
  16546. * @return {?}
  16547. */
  16548. function (visitor, context) { return visitor.visitIcu(this, context); };
  16549. return Icu;
  16550. }());
  16551. var TagPlaceholder = /** @class */ (function () {
  16552. function TagPlaceholder(tag, attrs, startName, closeName, children, isVoid, sourceSpan) {
  16553. this.tag = tag;
  16554. this.attrs = attrs;
  16555. this.startName = startName;
  16556. this.closeName = closeName;
  16557. this.children = children;
  16558. this.isVoid = isVoid;
  16559. this.sourceSpan = sourceSpan;
  16560. }
  16561. /**
  16562. * @param {?} visitor
  16563. * @param {?=} context
  16564. * @return {?}
  16565. */
  16566. TagPlaceholder.prototype.visit = /**
  16567. * @param {?} visitor
  16568. * @param {?=} context
  16569. * @return {?}
  16570. */
  16571. function (visitor, context) { return visitor.visitTagPlaceholder(this, context); };
  16572. return TagPlaceholder;
  16573. }());
  16574. var Placeholder = /** @class */ (function () {
  16575. function Placeholder(value, name, sourceSpan) {
  16576. this.value = value;
  16577. this.name = name;
  16578. this.sourceSpan = sourceSpan;
  16579. }
  16580. /**
  16581. * @param {?} visitor
  16582. * @param {?=} context
  16583. * @return {?}
  16584. */
  16585. Placeholder.prototype.visit = /**
  16586. * @param {?} visitor
  16587. * @param {?=} context
  16588. * @return {?}
  16589. */
  16590. function (visitor, context) { return visitor.visitPlaceholder(this, context); };
  16591. return Placeholder;
  16592. }());
  16593. var IcuPlaceholder = /** @class */ (function () {
  16594. function IcuPlaceholder(value, name, sourceSpan) {
  16595. this.value = value;
  16596. this.name = name;
  16597. this.sourceSpan = sourceSpan;
  16598. }
  16599. /**
  16600. * @param {?} visitor
  16601. * @param {?=} context
  16602. * @return {?}
  16603. */
  16604. IcuPlaceholder.prototype.visit = /**
  16605. * @param {?} visitor
  16606. * @param {?=} context
  16607. * @return {?}
  16608. */
  16609. function (visitor, context) { return visitor.visitIcuPlaceholder(this, context); };
  16610. return IcuPlaceholder;
  16611. }());
  16612. /**
  16613. * @record
  16614. */
  16615. var CloneVisitor = /** @class */ (function () {
  16616. function CloneVisitor() {
  16617. }
  16618. /**
  16619. * @param {?} text
  16620. * @param {?=} context
  16621. * @return {?}
  16622. */
  16623. CloneVisitor.prototype.visitText = /**
  16624. * @param {?} text
  16625. * @param {?=} context
  16626. * @return {?}
  16627. */
  16628. function (text, context) { return new Text$1(text.value, text.sourceSpan); };
  16629. /**
  16630. * @param {?} container
  16631. * @param {?=} context
  16632. * @return {?}
  16633. */
  16634. CloneVisitor.prototype.visitContainer = /**
  16635. * @param {?} container
  16636. * @param {?=} context
  16637. * @return {?}
  16638. */
  16639. function (container, context) {
  16640. var _this = this;
  16641. var /** @type {?} */ children = container.children.map(function (n) { return n.visit(_this, context); });
  16642. return new Container(children, container.sourceSpan);
  16643. };
  16644. /**
  16645. * @param {?} icu
  16646. * @param {?=} context
  16647. * @return {?}
  16648. */
  16649. CloneVisitor.prototype.visitIcu = /**
  16650. * @param {?} icu
  16651. * @param {?=} context
  16652. * @return {?}
  16653. */
  16654. function (icu, context) {
  16655. var _this = this;
  16656. var /** @type {?} */ cases = {};
  16657. Object.keys(icu.cases).forEach(function (key) { return cases[key] = icu.cases[key].visit(_this, context); });
  16658. var /** @type {?} */ msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan);
  16659. msg.expressionPlaceholder = icu.expressionPlaceholder;
  16660. return msg;
  16661. };
  16662. /**
  16663. * @param {?} ph
  16664. * @param {?=} context
  16665. * @return {?}
  16666. */
  16667. CloneVisitor.prototype.visitTagPlaceholder = /**
  16668. * @param {?} ph
  16669. * @param {?=} context
  16670. * @return {?}
  16671. */
  16672. function (ph, context) {
  16673. var _this = this;
  16674. var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, context); });
  16675. return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan);
  16676. };
  16677. /**
  16678. * @param {?} ph
  16679. * @param {?=} context
  16680. * @return {?}
  16681. */
  16682. CloneVisitor.prototype.visitPlaceholder = /**
  16683. * @param {?} ph
  16684. * @param {?=} context
  16685. * @return {?}
  16686. */
  16687. function (ph, context) {
  16688. return new Placeholder(ph.value, ph.name, ph.sourceSpan);
  16689. };
  16690. /**
  16691. * @param {?} ph
  16692. * @param {?=} context
  16693. * @return {?}
  16694. */
  16695. CloneVisitor.prototype.visitIcuPlaceholder = /**
  16696. * @param {?} ph
  16697. * @param {?=} context
  16698. * @return {?}
  16699. */
  16700. function (ph, context) {
  16701. return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan);
  16702. };
  16703. return CloneVisitor;
  16704. }());
  16705. var RecurseVisitor = /** @class */ (function () {
  16706. function RecurseVisitor() {
  16707. }
  16708. /**
  16709. * @param {?} text
  16710. * @param {?=} context
  16711. * @return {?}
  16712. */
  16713. RecurseVisitor.prototype.visitText = /**
  16714. * @param {?} text
  16715. * @param {?=} context
  16716. * @return {?}
  16717. */
  16718. function (text, context) { };
  16719. /**
  16720. * @param {?} container
  16721. * @param {?=} context
  16722. * @return {?}
  16723. */
  16724. RecurseVisitor.prototype.visitContainer = /**
  16725. * @param {?} container
  16726. * @param {?=} context
  16727. * @return {?}
  16728. */
  16729. function (container, context) {
  16730. var _this = this;
  16731. container.children.forEach(function (child) { return child.visit(_this); });
  16732. };
  16733. /**
  16734. * @param {?} icu
  16735. * @param {?=} context
  16736. * @return {?}
  16737. */
  16738. RecurseVisitor.prototype.visitIcu = /**
  16739. * @param {?} icu
  16740. * @param {?=} context
  16741. * @return {?}
  16742. */
  16743. function (icu, context) {
  16744. var _this = this;
  16745. Object.keys(icu.cases).forEach(function (k) { icu.cases[k].visit(_this); });
  16746. };
  16747. /**
  16748. * @param {?} ph
  16749. * @param {?=} context
  16750. * @return {?}
  16751. */
  16752. RecurseVisitor.prototype.visitTagPlaceholder = /**
  16753. * @param {?} ph
  16754. * @param {?=} context
  16755. * @return {?}
  16756. */
  16757. function (ph, context) {
  16758. var _this = this;
  16759. ph.children.forEach(function (child) { return child.visit(_this); });
  16760. };
  16761. /**
  16762. * @param {?} ph
  16763. * @param {?=} context
  16764. * @return {?}
  16765. */
  16766. RecurseVisitor.prototype.visitPlaceholder = /**
  16767. * @param {?} ph
  16768. * @param {?=} context
  16769. * @return {?}
  16770. */
  16771. function (ph, context) { };
  16772. /**
  16773. * @param {?} ph
  16774. * @param {?=} context
  16775. * @return {?}
  16776. */
  16777. RecurseVisitor.prototype.visitIcuPlaceholder = /**
  16778. * @param {?} ph
  16779. * @param {?=} context
  16780. * @return {?}
  16781. */
  16782. function (ph, context) { };
  16783. return RecurseVisitor;
  16784. }());
  16785. /**
  16786. * @fileoverview added by tsickle
  16787. * @suppress {checkTypes} checked by tsc
  16788. */
  16789. /**
  16790. * @license
  16791. * Copyright Google Inc. All Rights Reserved.
  16792. *
  16793. * Use of this source code is governed by an MIT-style license that can be
  16794. * found in the LICENSE file at https://angular.io/license
  16795. */
  16796. var HtmlTagDefinition = /** @class */ (function () {
  16797. function HtmlTagDefinition(_a) {
  16798. var _b = _a === void 0 ? {} : _a, closedByChildren = _b.closedByChildren, requiredParents = _b.requiredParents, implicitNamespacePrefix = _b.implicitNamespacePrefix, _c = _b.contentType, contentType = _c === void 0 ? TagContentType.PARSABLE_DATA : _c, _d = _b.closedByParent, closedByParent = _d === void 0 ? false : _d, _e = _b.isVoid, isVoid = _e === void 0 ? false : _e, _f = _b.ignoreFirstLf, ignoreFirstLf = _f === void 0 ? false : _f;
  16799. var _this = this;
  16800. this.closedByChildren = {};
  16801. this.closedByParent = false;
  16802. this.canSelfClose = false;
  16803. if (closedByChildren && closedByChildren.length > 0) {
  16804. closedByChildren.forEach(function (tagName) { return _this.closedByChildren[tagName] = true; });
  16805. }
  16806. this.isVoid = isVoid;
  16807. this.closedByParent = closedByParent || isVoid;
  16808. if (requiredParents && requiredParents.length > 0) {
  16809. this.requiredParents = {};
  16810. // The first parent is the list is automatically when none of the listed parents are present
  16811. this.parentToAdd = requiredParents[0];
  16812. requiredParents.forEach(function (tagName) { return _this.requiredParents[tagName] = true; });
  16813. }
  16814. this.implicitNamespacePrefix = implicitNamespacePrefix || null;
  16815. this.contentType = contentType;
  16816. this.ignoreFirstLf = ignoreFirstLf;
  16817. }
  16818. /**
  16819. * @param {?} currentParent
  16820. * @return {?}
  16821. */
  16822. HtmlTagDefinition.prototype.requireExtraParent = /**
  16823. * @param {?} currentParent
  16824. * @return {?}
  16825. */
  16826. function (currentParent) {
  16827. if (!this.requiredParents) {
  16828. return false;
  16829. }
  16830. if (!currentParent) {
  16831. return true;
  16832. }
  16833. var /** @type {?} */ lcParent = currentParent.toLowerCase();
  16834. var /** @type {?} */ isParentTemplate = lcParent === 'template' || currentParent === 'ng-template';
  16835. return !isParentTemplate && this.requiredParents[lcParent] != true;
  16836. };
  16837. /**
  16838. * @param {?} name
  16839. * @return {?}
  16840. */
  16841. HtmlTagDefinition.prototype.isClosedByChild = /**
  16842. * @param {?} name
  16843. * @return {?}
  16844. */
  16845. function (name) {
  16846. return this.isVoid || name.toLowerCase() in this.closedByChildren;
  16847. };
  16848. return HtmlTagDefinition;
  16849. }());
  16850. // see http://www.w3.org/TR/html51/syntax.html#optional-tags
  16851. // This implementation does not fully conform to the HTML5 spec.
  16852. var TAG_DEFINITIONS = {
  16853. 'base': new HtmlTagDefinition({ isVoid: true }),
  16854. 'meta': new HtmlTagDefinition({ isVoid: true }),
  16855. 'area': new HtmlTagDefinition({ isVoid: true }),
  16856. 'embed': new HtmlTagDefinition({ isVoid: true }),
  16857. 'link': new HtmlTagDefinition({ isVoid: true }),
  16858. 'img': new HtmlTagDefinition({ isVoid: true }),
  16859. 'input': new HtmlTagDefinition({ isVoid: true }),
  16860. 'param': new HtmlTagDefinition({ isVoid: true }),
  16861. 'hr': new HtmlTagDefinition({ isVoid: true }),
  16862. 'br': new HtmlTagDefinition({ isVoid: true }),
  16863. 'source': new HtmlTagDefinition({ isVoid: true }),
  16864. 'track': new HtmlTagDefinition({ isVoid: true }),
  16865. 'wbr': new HtmlTagDefinition({ isVoid: true }),
  16866. 'p': new HtmlTagDefinition({
  16867. closedByChildren: [
  16868. 'address', 'article', 'aside', 'blockquote', 'div', 'dl', 'fieldset', 'footer', 'form',
  16869. 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr',
  16870. 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'
  16871. ],
  16872. closedByParent: true
  16873. }),
  16874. 'thead': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'] }),
  16875. 'tbody': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'], closedByParent: true }),
  16876. 'tfoot': new HtmlTagDefinition({ closedByChildren: ['tbody'], closedByParent: true }),
  16877. 'tr': new HtmlTagDefinition({
  16878. closedByChildren: ['tr'],
  16879. requiredParents: ['tbody', 'tfoot', 'thead'],
  16880. closedByParent: true
  16881. }),
  16882. 'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
  16883. 'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
  16884. 'col': new HtmlTagDefinition({ requiredParents: ['colgroup'], isVoid: true }),
  16885. 'svg': new HtmlTagDefinition({ implicitNamespacePrefix: 'svg' }),
  16886. 'math': new HtmlTagDefinition({ implicitNamespacePrefix: 'math' }),
  16887. 'li': new HtmlTagDefinition({ closedByChildren: ['li'], closedByParent: true }),
  16888. 'dt': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'] }),
  16889. 'dd': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'], closedByParent: true }),
  16890. 'rb': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
  16891. 'rt': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
  16892. 'rtc': new HtmlTagDefinition({ closedByChildren: ['rb', 'rtc', 'rp'], closedByParent: true }),
  16893. 'rp': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
  16894. 'optgroup': new HtmlTagDefinition({ closedByChildren: ['optgroup'], closedByParent: true }),
  16895. 'option': new HtmlTagDefinition({ closedByChildren: ['option', 'optgroup'], closedByParent: true }),
  16896. 'pre': new HtmlTagDefinition({ ignoreFirstLf: true }),
  16897. 'listing': new HtmlTagDefinition({ ignoreFirstLf: true }),
  16898. 'style': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
  16899. 'script': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
  16900. 'title': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT }),
  16901. 'textarea': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true }),
  16902. };
  16903. var _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition();
  16904. /**
  16905. * @param {?} tagName
  16906. * @return {?}
  16907. */
  16908. function getHtmlTagDefinition(tagName) {
  16909. return TAG_DEFINITIONS[tagName.toLowerCase()] || _DEFAULT_TAG_DEFINITION;
  16910. }
  16911. /**
  16912. * @fileoverview added by tsickle
  16913. * @suppress {checkTypes} checked by tsc
  16914. */
  16915. /**
  16916. * @license
  16917. * Copyright Google Inc. All Rights Reserved.
  16918. *
  16919. * Use of this source code is governed by an MIT-style license that can be
  16920. * found in the LICENSE file at https://angular.io/license
  16921. */
  16922. var TAG_TO_PLACEHOLDER_NAMES = {
  16923. 'A': 'LINK',
  16924. 'B': 'BOLD_TEXT',
  16925. 'BR': 'LINE_BREAK',
  16926. 'EM': 'EMPHASISED_TEXT',
  16927. 'H1': 'HEADING_LEVEL1',
  16928. 'H2': 'HEADING_LEVEL2',
  16929. 'H3': 'HEADING_LEVEL3',
  16930. 'H4': 'HEADING_LEVEL4',
  16931. 'H5': 'HEADING_LEVEL5',
  16932. 'H6': 'HEADING_LEVEL6',
  16933. 'HR': 'HORIZONTAL_RULE',
  16934. 'I': 'ITALIC_TEXT',
  16935. 'LI': 'LIST_ITEM',
  16936. 'LINK': 'MEDIA_LINK',
  16937. 'OL': 'ORDERED_LIST',
  16938. 'P': 'PARAGRAPH',
  16939. 'Q': 'QUOTATION',
  16940. 'S': 'STRIKETHROUGH_TEXT',
  16941. 'SMALL': 'SMALL_TEXT',
  16942. 'SUB': 'SUBSTRIPT',
  16943. 'SUP': 'SUPERSCRIPT',
  16944. 'TBODY': 'TABLE_BODY',
  16945. 'TD': 'TABLE_CELL',
  16946. 'TFOOT': 'TABLE_FOOTER',
  16947. 'TH': 'TABLE_HEADER_CELL',
  16948. 'THEAD': 'TABLE_HEADER',
  16949. 'TR': 'TABLE_ROW',
  16950. 'TT': 'MONOSPACED_TEXT',
  16951. 'U': 'UNDERLINED_TEXT',
  16952. 'UL': 'UNORDERED_LIST',
  16953. };
  16954. /**
  16955. * Creates unique names for placeholder with different content.
  16956. *
  16957. * Returns the same placeholder name when the content is identical.
  16958. */
  16959. var PlaceholderRegistry = /** @class */ (function () {
  16960. function PlaceholderRegistry() {
  16961. this._placeHolderNameCounts = {};
  16962. this._signatureToName = {};
  16963. }
  16964. /**
  16965. * @param {?} tag
  16966. * @param {?} attrs
  16967. * @param {?} isVoid
  16968. * @return {?}
  16969. */
  16970. PlaceholderRegistry.prototype.getStartTagPlaceholderName = /**
  16971. * @param {?} tag
  16972. * @param {?} attrs
  16973. * @param {?} isVoid
  16974. * @return {?}
  16975. */
  16976. function (tag, attrs, isVoid) {
  16977. var /** @type {?} */ signature = this._hashTag(tag, attrs, isVoid);
  16978. if (this._signatureToName[signature]) {
  16979. return this._signatureToName[signature];
  16980. }
  16981. var /** @type {?} */ upperTag = tag.toUpperCase();
  16982. var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
  16983. var /** @type {?} */ name = this._generateUniqueName(isVoid ? baseName : "START_" + baseName);
  16984. this._signatureToName[signature] = name;
  16985. return name;
  16986. };
  16987. /**
  16988. * @param {?} tag
  16989. * @return {?}
  16990. */
  16991. PlaceholderRegistry.prototype.getCloseTagPlaceholderName = /**
  16992. * @param {?} tag
  16993. * @return {?}
  16994. */
  16995. function (tag) {
  16996. var /** @type {?} */ signature = this._hashClosingTag(tag);
  16997. if (this._signatureToName[signature]) {
  16998. return this._signatureToName[signature];
  16999. }
  17000. var /** @type {?} */ upperTag = tag.toUpperCase();
  17001. var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
  17002. var /** @type {?} */ name = this._generateUniqueName("CLOSE_" + baseName);
  17003. this._signatureToName[signature] = name;
  17004. return name;
  17005. };
  17006. /**
  17007. * @param {?} name
  17008. * @param {?} content
  17009. * @return {?}
  17010. */
  17011. PlaceholderRegistry.prototype.getPlaceholderName = /**
  17012. * @param {?} name
  17013. * @param {?} content
  17014. * @return {?}
  17015. */
  17016. function (name, content) {
  17017. var /** @type {?} */ upperName = name.toUpperCase();
  17018. var /** @type {?} */ signature = "PH: " + upperName + "=" + content;
  17019. if (this._signatureToName[signature]) {
  17020. return this._signatureToName[signature];
  17021. }
  17022. var /** @type {?} */ uniqueName = this._generateUniqueName(upperName);
  17023. this._signatureToName[signature] = uniqueName;
  17024. return uniqueName;
  17025. };
  17026. /**
  17027. * @param {?} name
  17028. * @return {?}
  17029. */
  17030. PlaceholderRegistry.prototype.getUniquePlaceholder = /**
  17031. * @param {?} name
  17032. * @return {?}
  17033. */
  17034. function (name) {
  17035. return this._generateUniqueName(name.toUpperCase());
  17036. };
  17037. /**
  17038. * @param {?} tag
  17039. * @param {?} attrs
  17040. * @param {?} isVoid
  17041. * @return {?}
  17042. */
  17043. PlaceholderRegistry.prototype._hashTag = /**
  17044. * @param {?} tag
  17045. * @param {?} attrs
  17046. * @param {?} isVoid
  17047. * @return {?}
  17048. */
  17049. function (tag, attrs, isVoid) {
  17050. var /** @type {?} */ start = "<" + tag;
  17051. var /** @type {?} */ strAttrs = Object.keys(attrs).sort().map(function (name) { return " " + name + "=" + attrs[name]; }).join('');
  17052. var /** @type {?} */ end = isVoid ? '/>' : "></" + tag + ">";
  17053. return start + strAttrs + end;
  17054. };
  17055. /**
  17056. * @param {?} tag
  17057. * @return {?}
  17058. */
  17059. PlaceholderRegistry.prototype._hashClosingTag = /**
  17060. * @param {?} tag
  17061. * @return {?}
  17062. */
  17063. function (tag) { return this._hashTag("/" + tag, {}, false); };
  17064. /**
  17065. * @param {?} base
  17066. * @return {?}
  17067. */
  17068. PlaceholderRegistry.prototype._generateUniqueName = /**
  17069. * @param {?} base
  17070. * @return {?}
  17071. */
  17072. function (base) {
  17073. var /** @type {?} */ seen = this._placeHolderNameCounts.hasOwnProperty(base);
  17074. if (!seen) {
  17075. this._placeHolderNameCounts[base] = 1;
  17076. return base;
  17077. }
  17078. var /** @type {?} */ id = this._placeHolderNameCounts[base];
  17079. this._placeHolderNameCounts[base] = id + 1;
  17080. return base + "_" + id;
  17081. };
  17082. return PlaceholderRegistry;
  17083. }());
  17084. /**
  17085. * @fileoverview added by tsickle
  17086. * @suppress {checkTypes} checked by tsc
  17087. */
  17088. /**
  17089. * @license
  17090. * Copyright Google Inc. All Rights Reserved.
  17091. *
  17092. * Use of this source code is governed by an MIT-style license that can be
  17093. * found in the LICENSE file at https://angular.io/license
  17094. */
  17095. var _expParser = new Parser(new Lexer());
  17096. /**
  17097. * Returns a function converting html nodes to an i18n Message given an interpolationConfig
  17098. * @param {?} interpolationConfig
  17099. * @return {?}
  17100. */
  17101. function createI18nMessageFactory(interpolationConfig) {
  17102. var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig);
  17103. return function (nodes, meaning, description, id) {
  17104. return visitor.toI18nMessage(nodes, meaning, description, id);
  17105. };
  17106. }
  17107. var _I18nVisitor = /** @class */ (function () {
  17108. function _I18nVisitor(_expressionParser, _interpolationConfig) {
  17109. this._expressionParser = _expressionParser;
  17110. this._interpolationConfig = _interpolationConfig;
  17111. }
  17112. /**
  17113. * @param {?} nodes
  17114. * @param {?} meaning
  17115. * @param {?} description
  17116. * @param {?} id
  17117. * @return {?}
  17118. */
  17119. _I18nVisitor.prototype.toI18nMessage = /**
  17120. * @param {?} nodes
  17121. * @param {?} meaning
  17122. * @param {?} description
  17123. * @param {?} id
  17124. * @return {?}
  17125. */
  17126. function (nodes, meaning, description, id) {
  17127. this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion;
  17128. this._icuDepth = 0;
  17129. this._placeholderRegistry = new PlaceholderRegistry();
  17130. this._placeholderToContent = {};
  17131. this._placeholderToMessage = {};
  17132. var /** @type {?} */ i18nodes = visitAll(this, nodes, {});
  17133. return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id);
  17134. };
  17135. /**
  17136. * @param {?} el
  17137. * @param {?} context
  17138. * @return {?}
  17139. */
  17140. _I18nVisitor.prototype.visitElement = /**
  17141. * @param {?} el
  17142. * @param {?} context
  17143. * @return {?}
  17144. */
  17145. function (el, context) {
  17146. var /** @type {?} */ children = visitAll(this, el.children);
  17147. var /** @type {?} */ attrs = {};
  17148. el.attrs.forEach(function (attr) {
  17149. // Do not visit the attributes, translatable ones are top-level ASTs
  17150. attrs[attr.name] = attr.value;
  17151. });
  17152. var /** @type {?} */ isVoid = getHtmlTagDefinition(el.name).isVoid;
  17153. var /** @type {?} */ startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid);
  17154. this._placeholderToContent[startPhName] = /** @type {?} */ ((el.sourceSpan)).toString();
  17155. var /** @type {?} */ closePhName = '';
  17156. if (!isVoid) {
  17157. closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name);
  17158. this._placeholderToContent[closePhName] = "</" + el.name + ">";
  17159. }
  17160. return new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, /** @type {?} */ ((el.sourceSpan)));
  17161. };
  17162. /**
  17163. * @param {?} attribute
  17164. * @param {?} context
  17165. * @return {?}
  17166. */
  17167. _I18nVisitor.prototype.visitAttribute = /**
  17168. * @param {?} attribute
  17169. * @param {?} context
  17170. * @return {?}
  17171. */
  17172. function (attribute, context) {
  17173. return this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan);
  17174. };
  17175. /**
  17176. * @param {?} text
  17177. * @param {?} context
  17178. * @return {?}
  17179. */
  17180. _I18nVisitor.prototype.visitText = /**
  17181. * @param {?} text
  17182. * @param {?} context
  17183. * @return {?}
  17184. */
  17185. function (text, context) {
  17186. return this._visitTextWithInterpolation(text.value, /** @type {?} */ ((text.sourceSpan)));
  17187. };
  17188. /**
  17189. * @param {?} comment
  17190. * @param {?} context
  17191. * @return {?}
  17192. */
  17193. _I18nVisitor.prototype.visitComment = /**
  17194. * @param {?} comment
  17195. * @param {?} context
  17196. * @return {?}
  17197. */
  17198. function (comment, context) { return null; };
  17199. /**
  17200. * @param {?} icu
  17201. * @param {?} context
  17202. * @return {?}
  17203. */
  17204. _I18nVisitor.prototype.visitExpansion = /**
  17205. * @param {?} icu
  17206. * @param {?} context
  17207. * @return {?}
  17208. */
  17209. function (icu, context) {
  17210. var _this = this;
  17211. this._icuDepth++;
  17212. var /** @type {?} */ i18nIcuCases = {};
  17213. var /** @type {?} */ i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan);
  17214. icu.cases.forEach(function (caze) {
  17215. i18nIcuCases[caze.value] = new Container(caze.expression.map(function (node) { return node.visit(_this, {}); }), caze.expSourceSpan);
  17216. });
  17217. this._icuDepth--;
  17218. if (this._isIcu || this._icuDepth > 0) {
  17219. // Returns an ICU node when:
  17220. // - the message (vs a part of the message) is an ICU message, or
  17221. // - the ICU message is nested.
  17222. var /** @type {?} */ expPh = this._placeholderRegistry.getUniquePlaceholder("VAR_" + icu.type);
  17223. i18nIcu.expressionPlaceholder = expPh;
  17224. this._placeholderToContent[expPh] = icu.switchValue;
  17225. return i18nIcu;
  17226. }
  17227. // Else returns a placeholder
  17228. // ICU placeholders should not be replaced with their original content but with the their
  17229. // translations. We need to create a new visitor (they are not re-entrant) to compute the
  17230. // message id.
  17231. // TODO(vicb): add a html.Node -> i18n.Message cache to avoid having to re-create the msg
  17232. var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString());
  17233. var /** @type {?} */ visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig);
  17234. this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', '');
  17235. return new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan);
  17236. };
  17237. /**
  17238. * @param {?} icuCase
  17239. * @param {?} context
  17240. * @return {?}
  17241. */
  17242. _I18nVisitor.prototype.visitExpansionCase = /**
  17243. * @param {?} icuCase
  17244. * @param {?} context
  17245. * @return {?}
  17246. */
  17247. function (icuCase, context) {
  17248. throw new Error('Unreachable code');
  17249. };
  17250. /**
  17251. * @param {?} text
  17252. * @param {?} sourceSpan
  17253. * @return {?}
  17254. */
  17255. _I18nVisitor.prototype._visitTextWithInterpolation = /**
  17256. * @param {?} text
  17257. * @param {?} sourceSpan
  17258. * @return {?}
  17259. */
  17260. function (text, sourceSpan) {
  17261. var /** @type {?} */ splitInterpolation = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig);
  17262. if (!splitInterpolation) {
  17263. // No expression, return a single text
  17264. return new Text$1(text, sourceSpan);
  17265. }
  17266. // Return a group of text + expressions
  17267. var /** @type {?} */ nodes = [];
  17268. var /** @type {?} */ container = new Container(nodes, sourceSpan);
  17269. var _a = this._interpolationConfig, sDelimiter = _a.start, eDelimiter = _a.end;
  17270. for (var /** @type {?} */ i = 0; i < splitInterpolation.strings.length - 1; i++) {
  17271. var /** @type {?} */ expression = splitInterpolation.expressions[i];
  17272. var /** @type {?} */ baseName = _extractPlaceholderName(expression) || 'INTERPOLATION';
  17273. var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName(baseName, expression);
  17274. if (splitInterpolation.strings[i].length) {
  17275. // No need to add empty strings
  17276. nodes.push(new Text$1(splitInterpolation.strings[i], sourceSpan));
  17277. }
  17278. nodes.push(new Placeholder(expression, phName, sourceSpan));
  17279. this._placeholderToContent[phName] = sDelimiter + expression + eDelimiter;
  17280. }
  17281. // The last index contains no expression
  17282. var /** @type {?} */ lastStringIdx = splitInterpolation.strings.length - 1;
  17283. if (splitInterpolation.strings[lastStringIdx].length) {
  17284. nodes.push(new Text$1(splitInterpolation.strings[lastStringIdx], sourceSpan));
  17285. }
  17286. return container;
  17287. };
  17288. return _I18nVisitor;
  17289. }());
  17290. var _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
  17291. /**
  17292. * @param {?} input
  17293. * @return {?}
  17294. */
  17295. function _extractPlaceholderName(input) {
  17296. return input.split(_CUSTOM_PH_EXP)[2];
  17297. }
  17298. /**
  17299. * @fileoverview added by tsickle
  17300. * @suppress {checkTypes} checked by tsc
  17301. */
  17302. /**
  17303. * @license
  17304. * Copyright Google Inc. All Rights Reserved.
  17305. *
  17306. * Use of this source code is governed by an MIT-style license that can be
  17307. * found in the LICENSE file at https://angular.io/license
  17308. */
  17309. /**
  17310. * An i18n error.
  17311. */
  17312. var I18nError = /** @class */ (function (_super) {
  17313. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(I18nError, _super);
  17314. function I18nError(span, msg) {
  17315. return _super.call(this, span, msg) || this;
  17316. }
  17317. return I18nError;
  17318. }(ParseError));
  17319. /**
  17320. * @fileoverview added by tsickle
  17321. * @suppress {checkTypes} checked by tsc
  17322. */
  17323. /**
  17324. * @license
  17325. * Copyright Google Inc. All Rights Reserved.
  17326. *
  17327. * Use of this source code is governed by an MIT-style license that can be
  17328. * found in the LICENSE file at https://angular.io/license
  17329. */
  17330. var _I18N_ATTR = 'i18n';
  17331. var _I18N_ATTR_PREFIX = 'i18n-';
  17332. var _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/;
  17333. var MEANING_SEPARATOR = '|';
  17334. var ID_SEPARATOR = '@@';
  17335. var i18nCommentsWarned = false;
  17336. /**
  17337. * Extract translatable messages from an html AST
  17338. * @param {?} nodes
  17339. * @param {?} interpolationConfig
  17340. * @param {?} implicitTags
  17341. * @param {?} implicitAttrs
  17342. * @return {?}
  17343. */
  17344. function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
  17345. var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs);
  17346. return visitor.extract(nodes, interpolationConfig);
  17347. }
  17348. /**
  17349. * @param {?} nodes
  17350. * @param {?} translations
  17351. * @param {?} interpolationConfig
  17352. * @param {?} implicitTags
  17353. * @param {?} implicitAttrs
  17354. * @return {?}
  17355. */
  17356. function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) {
  17357. var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs);
  17358. return visitor.merge(nodes, translations, interpolationConfig);
  17359. }
  17360. var ExtractionResult = /** @class */ (function () {
  17361. function ExtractionResult(messages, errors) {
  17362. this.messages = messages;
  17363. this.errors = errors;
  17364. }
  17365. return ExtractionResult;
  17366. }());
  17367. /** @enum {number} */
  17368. var _VisitorMode = {
  17369. Extract: 0,
  17370. Merge: 1,
  17371. };
  17372. _VisitorMode[_VisitorMode.Extract] = "Extract";
  17373. _VisitorMode[_VisitorMode.Merge] = "Merge";
  17374. /**
  17375. * This Visitor is used:
  17376. * 1. to extract all the translatable strings from an html AST (see `extract()`),
  17377. * 2. to replace the translatable strings with the actual translations (see `merge()`)
  17378. *
  17379. * \@internal
  17380. */
  17381. var _Visitor = /** @class */ (function () {
  17382. function _Visitor(_implicitTags, _implicitAttrs) {
  17383. this._implicitTags = _implicitTags;
  17384. this._implicitAttrs = _implicitAttrs;
  17385. }
  17386. /**
  17387. * Extracts the messages from the tree
  17388. */
  17389. /**
  17390. * Extracts the messages from the tree
  17391. * @param {?} nodes
  17392. * @param {?} interpolationConfig
  17393. * @return {?}
  17394. */
  17395. _Visitor.prototype.extract = /**
  17396. * Extracts the messages from the tree
  17397. * @param {?} nodes
  17398. * @param {?} interpolationConfig
  17399. * @return {?}
  17400. */
  17401. function (nodes, interpolationConfig) {
  17402. var _this = this;
  17403. this._init(_VisitorMode.Extract, interpolationConfig);
  17404. nodes.forEach(function (node) { return node.visit(_this, null); });
  17405. if (this._inI18nBlock) {
  17406. this._reportError(nodes[nodes.length - 1], 'Unclosed block');
  17407. }
  17408. return new ExtractionResult(this._messages, this._errors);
  17409. };
  17410. /**
  17411. * Returns a tree where all translatable nodes are translated
  17412. */
  17413. /**
  17414. * Returns a tree where all translatable nodes are translated
  17415. * @param {?} nodes
  17416. * @param {?} translations
  17417. * @param {?} interpolationConfig
  17418. * @return {?}
  17419. */
  17420. _Visitor.prototype.merge = /**
  17421. * Returns a tree where all translatable nodes are translated
  17422. * @param {?} nodes
  17423. * @param {?} translations
  17424. * @param {?} interpolationConfig
  17425. * @return {?}
  17426. */
  17427. function (nodes, translations, interpolationConfig) {
  17428. this._init(_VisitorMode.Merge, interpolationConfig);
  17429. this._translations = translations;
  17430. // Construct a single fake root element
  17431. var /** @type {?} */ wrapper = new Element('wrapper', [], nodes, /** @type {?} */ ((undefined)), undefined, undefined);
  17432. var /** @type {?} */ translatedNode = wrapper.visit(this, null);
  17433. if (this._inI18nBlock) {
  17434. this._reportError(nodes[nodes.length - 1], 'Unclosed block');
  17435. }
  17436. return new ParseTreeResult(translatedNode.children, this._errors);
  17437. };
  17438. /**
  17439. * @param {?} icuCase
  17440. * @param {?} context
  17441. * @return {?}
  17442. */
  17443. _Visitor.prototype.visitExpansionCase = /**
  17444. * @param {?} icuCase
  17445. * @param {?} context
  17446. * @return {?}
  17447. */
  17448. function (icuCase, context) {
  17449. // Parse cases for translatable html attributes
  17450. var /** @type {?} */ expression = visitAll(this, icuCase.expression, context);
  17451. if (this._mode === _VisitorMode.Merge) {
  17452. return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan);
  17453. }
  17454. };
  17455. /**
  17456. * @param {?} icu
  17457. * @param {?} context
  17458. * @return {?}
  17459. */
  17460. _Visitor.prototype.visitExpansion = /**
  17461. * @param {?} icu
  17462. * @param {?} context
  17463. * @return {?}
  17464. */
  17465. function (icu, context) {
  17466. this._mayBeAddBlockChildren(icu);
  17467. var /** @type {?} */ wasInIcu = this._inIcu;
  17468. if (!this._inIcu) {
  17469. // nested ICU messages should not be extracted but top-level translated as a whole
  17470. if (this._isInTranslatableSection) {
  17471. this._addMessage([icu]);
  17472. }
  17473. this._inIcu = true;
  17474. }
  17475. var /** @type {?} */ cases = visitAll(this, icu.cases, context);
  17476. if (this._mode === _VisitorMode.Merge) {
  17477. icu = new Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan);
  17478. }
  17479. this._inIcu = wasInIcu;
  17480. return icu;
  17481. };
  17482. /**
  17483. * @param {?} comment
  17484. * @param {?} context
  17485. * @return {?}
  17486. */
  17487. _Visitor.prototype.visitComment = /**
  17488. * @param {?} comment
  17489. * @param {?} context
  17490. * @return {?}
  17491. */
  17492. function (comment, context) {
  17493. var /** @type {?} */ isOpening = _isOpeningComment(comment);
  17494. if (isOpening && this._isInTranslatableSection) {
  17495. this._reportError(comment, 'Could not start a block inside a translatable section');
  17496. return;
  17497. }
  17498. var /** @type {?} */ isClosing = _isClosingComment(comment);
  17499. if (isClosing && !this._inI18nBlock) {
  17500. this._reportError(comment, 'Trying to close an unopened block');
  17501. return;
  17502. }
  17503. if (!this._inI18nNode && !this._inIcu) {
  17504. if (!this._inI18nBlock) {
  17505. if (isOpening) {
  17506. // deprecated from v5 you should use <ng-container i18n> instead of i18n comments
  17507. if (!i18nCommentsWarned && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
  17508. i18nCommentsWarned = true;
  17509. var /** @type {?} */ details = comment.sourceSpan.details ? ", " + comment.sourceSpan.details : '';
  17510. // TODO(ocombe): use a log service once there is a public one available
  17511. console.warn("I18n comments are deprecated, use an <ng-container> element instead (" + comment.sourceSpan.start + details + ")");
  17512. }
  17513. this._inI18nBlock = true;
  17514. this._blockStartDepth = this._depth;
  17515. this._blockChildren = [];
  17516. this._blockMeaningAndDesc = /** @type {?} */ ((comment.value)).replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim();
  17517. this._openTranslatableSection(comment);
  17518. }
  17519. }
  17520. else {
  17521. if (isClosing) {
  17522. if (this._depth == this._blockStartDepth) {
  17523. this._closeTranslatableSection(comment, this._blockChildren);
  17524. this._inI18nBlock = false;
  17525. var /** @type {?} */ message = /** @type {?} */ ((this._addMessage(this._blockChildren, this._blockMeaningAndDesc)));
  17526. // merge attributes in sections
  17527. var /** @type {?} */ nodes = this._translateMessage(comment, message);
  17528. return visitAll(this, nodes);
  17529. }
  17530. else {
  17531. this._reportError(comment, 'I18N blocks should not cross element boundaries');
  17532. return;
  17533. }
  17534. }
  17535. }
  17536. }
  17537. };
  17538. /**
  17539. * @param {?} text
  17540. * @param {?} context
  17541. * @return {?}
  17542. */
  17543. _Visitor.prototype.visitText = /**
  17544. * @param {?} text
  17545. * @param {?} context
  17546. * @return {?}
  17547. */
  17548. function (text, context) {
  17549. if (this._isInTranslatableSection) {
  17550. this._mayBeAddBlockChildren(text);
  17551. }
  17552. return text;
  17553. };
  17554. /**
  17555. * @param {?} el
  17556. * @param {?} context
  17557. * @return {?}
  17558. */
  17559. _Visitor.prototype.visitElement = /**
  17560. * @param {?} el
  17561. * @param {?} context
  17562. * @return {?}
  17563. */
  17564. function (el, context) {
  17565. var _this = this;
  17566. this._mayBeAddBlockChildren(el);
  17567. this._depth++;
  17568. var /** @type {?} */ wasInI18nNode = this._inI18nNode;
  17569. var /** @type {?} */ wasInImplicitNode = this._inImplicitNode;
  17570. var /** @type {?} */ childNodes = [];
  17571. var /** @type {?} */ translatedChildNodes = /** @type {?} */ ((undefined));
  17572. // Extract:
  17573. // - top level nodes with the (implicit) "i18n" attribute if not already in a section
  17574. // - ICU messages
  17575. var /** @type {?} */ i18nAttr = _getI18nAttr(el);
  17576. var /** @type {?} */ i18nMeta = i18nAttr ? i18nAttr.value : '';
  17577. var /** @type {?} */ isImplicit = this._implicitTags.some(function (tag) { return el.name === tag; }) && !this._inIcu &&
  17578. !this._isInTranslatableSection;
  17579. var /** @type {?} */ isTopLevelImplicit = !wasInImplicitNode && isImplicit;
  17580. this._inImplicitNode = wasInImplicitNode || isImplicit;
  17581. if (!this._isInTranslatableSection && !this._inIcu) {
  17582. if (i18nAttr || isTopLevelImplicit) {
  17583. this._inI18nNode = true;
  17584. var /** @type {?} */ message = /** @type {?} */ ((this._addMessage(el.children, i18nMeta)));
  17585. translatedChildNodes = this._translateMessage(el, message);
  17586. }
  17587. if (this._mode == _VisitorMode.Extract) {
  17588. var /** @type {?} */ isTranslatable = i18nAttr || isTopLevelImplicit;
  17589. if (isTranslatable)
  17590. this._openTranslatableSection(el);
  17591. visitAll(this, el.children);
  17592. if (isTranslatable)
  17593. this._closeTranslatableSection(el, el.children);
  17594. }
  17595. }
  17596. else {
  17597. if (i18nAttr || isTopLevelImplicit) {
  17598. this._reportError(el, 'Could not mark an element as translatable inside a translatable section');
  17599. }
  17600. if (this._mode == _VisitorMode.Extract) {
  17601. // Descend into child nodes for extraction
  17602. visitAll(this, el.children);
  17603. }
  17604. }
  17605. if (this._mode === _VisitorMode.Merge) {
  17606. var /** @type {?} */ visitNodes = translatedChildNodes || el.children;
  17607. visitNodes.forEach(function (child) {
  17608. var /** @type {?} */ visited = child.visit(_this, context);
  17609. if (visited && !_this._isInTranslatableSection) {
  17610. // Do not add the children from translatable sections (= i18n blocks here)
  17611. // They will be added later in this loop when the block closes (i.e. on `<!-- /i18n -->`)
  17612. childNodes = childNodes.concat(visited);
  17613. }
  17614. });
  17615. }
  17616. this._visitAttributesOf(el);
  17617. this._depth--;
  17618. this._inI18nNode = wasInI18nNode;
  17619. this._inImplicitNode = wasInImplicitNode;
  17620. if (this._mode === _VisitorMode.Merge) {
  17621. var /** @type {?} */ translatedAttrs = this._translateAttributes(el);
  17622. return new Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
  17623. }
  17624. return null;
  17625. };
  17626. /**
  17627. * @param {?} attribute
  17628. * @param {?} context
  17629. * @return {?}
  17630. */
  17631. _Visitor.prototype.visitAttribute = /**
  17632. * @param {?} attribute
  17633. * @param {?} context
  17634. * @return {?}
  17635. */
  17636. function (attribute, context) {
  17637. throw new Error('unreachable code');
  17638. };
  17639. /**
  17640. * @param {?} mode
  17641. * @param {?} interpolationConfig
  17642. * @return {?}
  17643. */
  17644. _Visitor.prototype._init = /**
  17645. * @param {?} mode
  17646. * @param {?} interpolationConfig
  17647. * @return {?}
  17648. */
  17649. function (mode, interpolationConfig) {
  17650. this._mode = mode;
  17651. this._inI18nBlock = false;
  17652. this._inI18nNode = false;
  17653. this._depth = 0;
  17654. this._inIcu = false;
  17655. this._msgCountAtSectionStart = undefined;
  17656. this._errors = [];
  17657. this._messages = [];
  17658. this._inImplicitNode = false;
  17659. this._createI18nMessage = createI18nMessageFactory(interpolationConfig);
  17660. };
  17661. /**
  17662. * @param {?} el
  17663. * @return {?}
  17664. */
  17665. _Visitor.prototype._visitAttributesOf = /**
  17666. * @param {?} el
  17667. * @return {?}
  17668. */
  17669. function (el) {
  17670. var _this = this;
  17671. var /** @type {?} */ explicitAttrNameToValue = {};
  17672. var /** @type {?} */ implicitAttrNames = this._implicitAttrs[el.name] || [];
  17673. el.attrs.filter(function (attr) { return attr.name.startsWith(_I18N_ATTR_PREFIX); })
  17674. .forEach(function (attr) {
  17675. return explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
  17676. attr.value;
  17677. });
  17678. el.attrs.forEach(function (attr) {
  17679. if (attr.name in explicitAttrNameToValue) {
  17680. _this._addMessage([attr], explicitAttrNameToValue[attr.name]);
  17681. }
  17682. else if (implicitAttrNames.some(function (name) { return attr.name === name; })) {
  17683. _this._addMessage([attr]);
  17684. }
  17685. });
  17686. };
  17687. /**
  17688. * @param {?} ast
  17689. * @param {?=} msgMeta
  17690. * @return {?}
  17691. */
  17692. _Visitor.prototype._addMessage = /**
  17693. * @param {?} ast
  17694. * @param {?=} msgMeta
  17695. * @return {?}
  17696. */
  17697. function (ast, msgMeta) {
  17698. if (ast.length == 0 ||
  17699. ast.length == 1 && ast[0] instanceof Attribute$1 && !(/** @type {?} */ (ast[0])).value) {
  17700. // Do not create empty messages
  17701. return null;
  17702. }
  17703. var _a = _parseMessageMeta(msgMeta), meaning = _a.meaning, description = _a.description, id = _a.id;
  17704. var /** @type {?} */ message = this._createI18nMessage(ast, meaning, description, id);
  17705. this._messages.push(message);
  17706. return message;
  17707. };
  17708. /**
  17709. * @param {?} el
  17710. * @param {?} message
  17711. * @return {?}
  17712. */
  17713. _Visitor.prototype._translateMessage = /**
  17714. * @param {?} el
  17715. * @param {?} message
  17716. * @return {?}
  17717. */
  17718. function (el, message) {
  17719. if (message && this._mode === _VisitorMode.Merge) {
  17720. var /** @type {?} */ nodes = this._translations.get(message);
  17721. if (nodes) {
  17722. return nodes;
  17723. }
  17724. this._reportError(el, "Translation unavailable for message id=\"" + this._translations.digest(message) + "\"");
  17725. }
  17726. return [];
  17727. };
  17728. /**
  17729. * @param {?} el
  17730. * @return {?}
  17731. */
  17732. _Visitor.prototype._translateAttributes = /**
  17733. * @param {?} el
  17734. * @return {?}
  17735. */
  17736. function (el) {
  17737. var _this = this;
  17738. var /** @type {?} */ attributes = el.attrs;
  17739. var /** @type {?} */ i18nParsedMessageMeta = {};
  17740. attributes.forEach(function (attr) {
  17741. if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
  17742. i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
  17743. _parseMessageMeta(attr.value);
  17744. }
  17745. });
  17746. var /** @type {?} */ translatedAttributes = [];
  17747. attributes.forEach(function (attr) {
  17748. if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
  17749. // strip i18n specific attributes
  17750. return;
  17751. }
  17752. if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) {
  17753. var _a = i18nParsedMessageMeta[attr.name], meaning = _a.meaning, description = _a.description, id = _a.id;
  17754. var /** @type {?} */ message = _this._createI18nMessage([attr], meaning, description, id);
  17755. var /** @type {?} */ nodes = _this._translations.get(message);
  17756. if (nodes) {
  17757. if (nodes.length == 0) {
  17758. translatedAttributes.push(new Attribute$1(attr.name, '', attr.sourceSpan));
  17759. }
  17760. else if (nodes[0] instanceof Text) {
  17761. var /** @type {?} */ value = (/** @type {?} */ (nodes[0])).value;
  17762. translatedAttributes.push(new Attribute$1(attr.name, value, attr.sourceSpan));
  17763. }
  17764. else {
  17765. _this._reportError(el, "Unexpected translation for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
  17766. }
  17767. }
  17768. else {
  17769. _this._reportError(el, "Translation unavailable for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
  17770. }
  17771. }
  17772. else {
  17773. translatedAttributes.push(attr);
  17774. }
  17775. });
  17776. return translatedAttributes;
  17777. };
  17778. /**
  17779. * Add the node as a child of the block when:
  17780. * - we are in a block,
  17781. * - we are not inside a ICU message (those are handled separately),
  17782. * - the node is a "direct child" of the block
  17783. * @param {?} node
  17784. * @return {?}
  17785. */
  17786. _Visitor.prototype._mayBeAddBlockChildren = /**
  17787. * Add the node as a child of the block when:
  17788. * - we are in a block,
  17789. * - we are not inside a ICU message (those are handled separately),
  17790. * - the node is a "direct child" of the block
  17791. * @param {?} node
  17792. * @return {?}
  17793. */
  17794. function (node) {
  17795. if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) {
  17796. this._blockChildren.push(node);
  17797. }
  17798. };
  17799. /**
  17800. * Marks the start of a section, see `_closeTranslatableSection`
  17801. * @param {?} node
  17802. * @return {?}
  17803. */
  17804. _Visitor.prototype._openTranslatableSection = /**
  17805. * Marks the start of a section, see `_closeTranslatableSection`
  17806. * @param {?} node
  17807. * @return {?}
  17808. */
  17809. function (node) {
  17810. if (this._isInTranslatableSection) {
  17811. this._reportError(node, 'Unexpected section start');
  17812. }
  17813. else {
  17814. this._msgCountAtSectionStart = this._messages.length;
  17815. }
  17816. };
  17817. Object.defineProperty(_Visitor.prototype, "_isInTranslatableSection", {
  17818. get: /**
  17819. * A translatable section could be:
  17820. * - the content of translatable element,
  17821. * - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments
  17822. * @return {?}
  17823. */
  17824. function () {
  17825. return this._msgCountAtSectionStart !== void 0;
  17826. },
  17827. enumerable: true,
  17828. configurable: true
  17829. });
  17830. /**
  17831. * Terminates a section.
  17832. *
  17833. * If a section has only one significant children (comments not significant) then we should not
  17834. * keep the message from this children:
  17835. *
  17836. * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
  17837. * - one for the <p> content with meaning and description,
  17838. * - another one for the ICU message.
  17839. *
  17840. * In this case the last message is discarded as it contains less information (the AST is
  17841. * otherwise identical).
  17842. *
  17843. * Note that we should still keep messages extracted from attributes inside the section (ie in the
  17844. * ICU message here)
  17845. * @param {?} node
  17846. * @param {?} directChildren
  17847. * @return {?}
  17848. */
  17849. _Visitor.prototype._closeTranslatableSection = /**
  17850. * Terminates a section.
  17851. *
  17852. * If a section has only one significant children (comments not significant) then we should not
  17853. * keep the message from this children:
  17854. *
  17855. * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
  17856. * - one for the <p> content with meaning and description,
  17857. * - another one for the ICU message.
  17858. *
  17859. * In this case the last message is discarded as it contains less information (the AST is
  17860. * otherwise identical).
  17861. *
  17862. * Note that we should still keep messages extracted from attributes inside the section (ie in the
  17863. * ICU message here)
  17864. * @param {?} node
  17865. * @param {?} directChildren
  17866. * @return {?}
  17867. */
  17868. function (node, directChildren) {
  17869. if (!this._isInTranslatableSection) {
  17870. this._reportError(node, 'Unexpected section end');
  17871. return;
  17872. }
  17873. var /** @type {?} */ startIndex = this._msgCountAtSectionStart;
  17874. var /** @type {?} */ significantChildren = directChildren.reduce(function (count, node) { return count + (node instanceof Comment ? 0 : 1); }, 0);
  17875. if (significantChildren == 1) {
  17876. for (var /** @type {?} */ i = this._messages.length - 1; i >= /** @type {?} */ ((startIndex)); i--) {
  17877. var /** @type {?} */ ast = this._messages[i].nodes;
  17878. if (!(ast.length == 1 && ast[0] instanceof Text$1)) {
  17879. this._messages.splice(i, 1);
  17880. break;
  17881. }
  17882. }
  17883. }
  17884. this._msgCountAtSectionStart = undefined;
  17885. };
  17886. /**
  17887. * @param {?} node
  17888. * @param {?} msg
  17889. * @return {?}
  17890. */
  17891. _Visitor.prototype._reportError = /**
  17892. * @param {?} node
  17893. * @param {?} msg
  17894. * @return {?}
  17895. */
  17896. function (node, msg) {
  17897. this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), msg));
  17898. };
  17899. return _Visitor;
  17900. }());
  17901. /**
  17902. * @param {?} n
  17903. * @return {?}
  17904. */
  17905. function _isOpeningComment(n) {
  17906. return !!(n instanceof Comment && n.value && n.value.startsWith('i18n'));
  17907. }
  17908. /**
  17909. * @param {?} n
  17910. * @return {?}
  17911. */
  17912. function _isClosingComment(n) {
  17913. return !!(n instanceof Comment && n.value && n.value === '/i18n');
  17914. }
  17915. /**
  17916. * @param {?} p
  17917. * @return {?}
  17918. */
  17919. function _getI18nAttr(p) {
  17920. return p.attrs.find(function (attr) { return attr.name === _I18N_ATTR; }) || null;
  17921. }
  17922. /**
  17923. * @param {?=} i18n
  17924. * @return {?}
  17925. */
  17926. function _parseMessageMeta(i18n) {
  17927. if (!i18n)
  17928. return { meaning: '', description: '', id: '' };
  17929. var /** @type {?} */ idIndex = i18n.indexOf(ID_SEPARATOR);
  17930. var /** @type {?} */ descIndex = i18n.indexOf(MEANING_SEPARATOR);
  17931. var _a = (idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], meaningAndDesc = _a[0], id = _a[1];
  17932. var _b = (descIndex > -1) ?
  17933. [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] :
  17934. ['', meaningAndDesc], meaning = _b[0], description = _b[1];
  17935. return { meaning: meaning, description: description, id: id };
  17936. }
  17937. /**
  17938. * @fileoverview added by tsickle
  17939. * @suppress {checkTypes} checked by tsc
  17940. */
  17941. /**
  17942. * @license
  17943. * Copyright Google Inc. All Rights Reserved.
  17944. *
  17945. * Use of this source code is governed by an MIT-style license that can be
  17946. * found in the LICENSE file at https://angular.io/license
  17947. */
  17948. var XmlTagDefinition = /** @class */ (function () {
  17949. function XmlTagDefinition() {
  17950. this.closedByParent = false;
  17951. this.contentType = TagContentType.PARSABLE_DATA;
  17952. this.isVoid = false;
  17953. this.ignoreFirstLf = false;
  17954. this.canSelfClose = true;
  17955. }
  17956. /**
  17957. * @param {?} currentParent
  17958. * @return {?}
  17959. */
  17960. XmlTagDefinition.prototype.requireExtraParent = /**
  17961. * @param {?} currentParent
  17962. * @return {?}
  17963. */
  17964. function (currentParent) { return false; };
  17965. /**
  17966. * @param {?} name
  17967. * @return {?}
  17968. */
  17969. XmlTagDefinition.prototype.isClosedByChild = /**
  17970. * @param {?} name
  17971. * @return {?}
  17972. */
  17973. function (name) { return false; };
  17974. return XmlTagDefinition;
  17975. }());
  17976. var _TAG_DEFINITION = new XmlTagDefinition();
  17977. /**
  17978. * @param {?} tagName
  17979. * @return {?}
  17980. */
  17981. function getXmlTagDefinition(tagName) {
  17982. return _TAG_DEFINITION;
  17983. }
  17984. /**
  17985. * @fileoverview added by tsickle
  17986. * @suppress {checkTypes} checked by tsc
  17987. */
  17988. /**
  17989. * @license
  17990. * Copyright Google Inc. All Rights Reserved.
  17991. *
  17992. * Use of this source code is governed by an MIT-style license that can be
  17993. * found in the LICENSE file at https://angular.io/license
  17994. */
  17995. var XmlParser = /** @class */ (function (_super) {
  17996. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(XmlParser, _super);
  17997. function XmlParser() {
  17998. return _super.call(this, getXmlTagDefinition) || this;
  17999. }
  18000. /**
  18001. * @param {?} source
  18002. * @param {?} url
  18003. * @param {?=} parseExpansionForms
  18004. * @return {?}
  18005. */
  18006. XmlParser.prototype.parse = /**
  18007. * @param {?} source
  18008. * @param {?} url
  18009. * @param {?=} parseExpansionForms
  18010. * @return {?}
  18011. */
  18012. function (source, url, parseExpansionForms) {
  18013. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  18014. return _super.prototype.parse.call(this, source, url, parseExpansionForms);
  18015. };
  18016. return XmlParser;
  18017. }(Parser$1));
  18018. /**
  18019. * @fileoverview added by tsickle
  18020. * @suppress {checkTypes} checked by tsc
  18021. */
  18022. /**
  18023. * @license
  18024. * Copyright Google Inc. All Rights Reserved.
  18025. *
  18026. * Use of this source code is governed by an MIT-style license that can be
  18027. * found in the LICENSE file at https://angular.io/license
  18028. */
  18029. /**
  18030. * @abstract
  18031. */
  18032. var Serializer = /** @class */ (function () {
  18033. function Serializer() {
  18034. }
  18035. // Creates a name mapper, see `PlaceholderMapper`
  18036. // Returning `null` means that no name mapping is used.
  18037. /**
  18038. * @param {?} message
  18039. * @return {?}
  18040. */
  18041. Serializer.prototype.createNameMapper = /**
  18042. * @param {?} message
  18043. * @return {?}
  18044. */
  18045. function (message) { return null; };
  18046. return Serializer;
  18047. }());
  18048. /**
  18049. * A `PlaceholderMapper` converts placeholder names from internal to serialized representation and
  18050. * back.
  18051. *
  18052. * It should be used for serialization format that put constraints on the placeholder names.
  18053. * @record
  18054. */
  18055. /**
  18056. * A simple mapper that take a function to transform an internal name to a public name
  18057. */
  18058. var SimplePlaceholderMapper = /** @class */ (function (_super) {
  18059. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SimplePlaceholderMapper, _super);
  18060. // create a mapping from the message
  18061. function SimplePlaceholderMapper(message, mapName) {
  18062. var _this = _super.call(this) || this;
  18063. _this.mapName = mapName;
  18064. _this.internalToPublic = {};
  18065. _this.publicToNextId = {};
  18066. _this.publicToInternal = {};
  18067. message.nodes.forEach(function (node) { return node.visit(_this); });
  18068. return _this;
  18069. }
  18070. /**
  18071. * @param {?} internalName
  18072. * @return {?}
  18073. */
  18074. SimplePlaceholderMapper.prototype.toPublicName = /**
  18075. * @param {?} internalName
  18076. * @return {?}
  18077. */
  18078. function (internalName) {
  18079. return this.internalToPublic.hasOwnProperty(internalName) ?
  18080. this.internalToPublic[internalName] :
  18081. null;
  18082. };
  18083. /**
  18084. * @param {?} publicName
  18085. * @return {?}
  18086. */
  18087. SimplePlaceholderMapper.prototype.toInternalName = /**
  18088. * @param {?} publicName
  18089. * @return {?}
  18090. */
  18091. function (publicName) {
  18092. return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] :
  18093. null;
  18094. };
  18095. /**
  18096. * @param {?} text
  18097. * @param {?=} context
  18098. * @return {?}
  18099. */
  18100. SimplePlaceholderMapper.prototype.visitText = /**
  18101. * @param {?} text
  18102. * @param {?=} context
  18103. * @return {?}
  18104. */
  18105. function (text, context) { return null; };
  18106. /**
  18107. * @param {?} ph
  18108. * @param {?=} context
  18109. * @return {?}
  18110. */
  18111. SimplePlaceholderMapper.prototype.visitTagPlaceholder = /**
  18112. * @param {?} ph
  18113. * @param {?=} context
  18114. * @return {?}
  18115. */
  18116. function (ph, context) {
  18117. this.visitPlaceholderName(ph.startName);
  18118. _super.prototype.visitTagPlaceholder.call(this, ph, context);
  18119. this.visitPlaceholderName(ph.closeName);
  18120. };
  18121. /**
  18122. * @param {?} ph
  18123. * @param {?=} context
  18124. * @return {?}
  18125. */
  18126. SimplePlaceholderMapper.prototype.visitPlaceholder = /**
  18127. * @param {?} ph
  18128. * @param {?=} context
  18129. * @return {?}
  18130. */
  18131. function (ph, context) { this.visitPlaceholderName(ph.name); };
  18132. /**
  18133. * @param {?} ph
  18134. * @param {?=} context
  18135. * @return {?}
  18136. */
  18137. SimplePlaceholderMapper.prototype.visitIcuPlaceholder = /**
  18138. * @param {?} ph
  18139. * @param {?=} context
  18140. * @return {?}
  18141. */
  18142. function (ph, context) {
  18143. this.visitPlaceholderName(ph.name);
  18144. };
  18145. /**
  18146. * @param {?} internalName
  18147. * @return {?}
  18148. */
  18149. SimplePlaceholderMapper.prototype.visitPlaceholderName = /**
  18150. * @param {?} internalName
  18151. * @return {?}
  18152. */
  18153. function (internalName) {
  18154. if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) {
  18155. return;
  18156. }
  18157. var /** @type {?} */ publicName = this.mapName(internalName);
  18158. if (this.publicToInternal.hasOwnProperty(publicName)) {
  18159. // Create a new XMB when it has already been used
  18160. var /** @type {?} */ nextId = this.publicToNextId[publicName];
  18161. this.publicToNextId[publicName] = nextId + 1;
  18162. publicName = publicName + "_" + nextId;
  18163. }
  18164. else {
  18165. this.publicToNextId[publicName] = 1;
  18166. }
  18167. this.internalToPublic[internalName] = publicName;
  18168. this.publicToInternal[publicName] = internalName;
  18169. };
  18170. return SimplePlaceholderMapper;
  18171. }(RecurseVisitor));
  18172. /**
  18173. * @fileoverview added by tsickle
  18174. * @suppress {checkTypes} checked by tsc
  18175. */
  18176. /**
  18177. * @license
  18178. * Copyright Google Inc. All Rights Reserved.
  18179. *
  18180. * Use of this source code is governed by an MIT-style license that can be
  18181. * found in the LICENSE file at https://angular.io/license
  18182. */
  18183. /**
  18184. * @record
  18185. */
  18186. var _Visitor$1 = /** @class */ (function () {
  18187. function _Visitor() {
  18188. }
  18189. /**
  18190. * @param {?} tag
  18191. * @return {?}
  18192. */
  18193. _Visitor.prototype.visitTag = /**
  18194. * @param {?} tag
  18195. * @return {?}
  18196. */
  18197. function (tag) {
  18198. var _this = this;
  18199. var /** @type {?} */ strAttrs = this._serializeAttributes(tag.attrs);
  18200. if (tag.children.length == 0) {
  18201. return "<" + tag.name + strAttrs + "/>";
  18202. }
  18203. var /** @type {?} */ strChildren = tag.children.map(function (node) { return node.visit(_this); });
  18204. return "<" + tag.name + strAttrs + ">" + strChildren.join('') + "</" + tag.name + ">";
  18205. };
  18206. /**
  18207. * @param {?} text
  18208. * @return {?}
  18209. */
  18210. _Visitor.prototype.visitText = /**
  18211. * @param {?} text
  18212. * @return {?}
  18213. */
  18214. function (text) { return text.value; };
  18215. /**
  18216. * @param {?} decl
  18217. * @return {?}
  18218. */
  18219. _Visitor.prototype.visitDeclaration = /**
  18220. * @param {?} decl
  18221. * @return {?}
  18222. */
  18223. function (decl) {
  18224. return "<?xml" + this._serializeAttributes(decl.attrs) + " ?>";
  18225. };
  18226. /**
  18227. * @param {?} attrs
  18228. * @return {?}
  18229. */
  18230. _Visitor.prototype._serializeAttributes = /**
  18231. * @param {?} attrs
  18232. * @return {?}
  18233. */
  18234. function (attrs) {
  18235. var /** @type {?} */ strAttrs = Object.keys(attrs).map(function (name) { return name + "=\"" + attrs[name] + "\""; }).join(' ');
  18236. return strAttrs.length > 0 ? ' ' + strAttrs : '';
  18237. };
  18238. /**
  18239. * @param {?} doctype
  18240. * @return {?}
  18241. */
  18242. _Visitor.prototype.visitDoctype = /**
  18243. * @param {?} doctype
  18244. * @return {?}
  18245. */
  18246. function (doctype) {
  18247. return "<!DOCTYPE " + doctype.rootTag + " [\n" + doctype.dtd + "\n]>";
  18248. };
  18249. return _Visitor;
  18250. }());
  18251. var _visitor = new _Visitor$1();
  18252. /**
  18253. * @param {?} nodes
  18254. * @return {?}
  18255. */
  18256. function serialize(nodes) {
  18257. return nodes.map(function (node) { return node.visit(_visitor); }).join('');
  18258. }
  18259. /**
  18260. * @record
  18261. */
  18262. var Declaration = /** @class */ (function () {
  18263. function Declaration(unescapedAttrs) {
  18264. var _this = this;
  18265. this.attrs = {};
  18266. Object.keys(unescapedAttrs).forEach(function (k) {
  18267. _this.attrs[k] = _escapeXml(unescapedAttrs[k]);
  18268. });
  18269. }
  18270. /**
  18271. * @param {?} visitor
  18272. * @return {?}
  18273. */
  18274. Declaration.prototype.visit = /**
  18275. * @param {?} visitor
  18276. * @return {?}
  18277. */
  18278. function (visitor) { return visitor.visitDeclaration(this); };
  18279. return Declaration;
  18280. }());
  18281. var Doctype = /** @class */ (function () {
  18282. function Doctype(rootTag, dtd) {
  18283. this.rootTag = rootTag;
  18284. this.dtd = dtd;
  18285. }
  18286. /**
  18287. * @param {?} visitor
  18288. * @return {?}
  18289. */
  18290. Doctype.prototype.visit = /**
  18291. * @param {?} visitor
  18292. * @return {?}
  18293. */
  18294. function (visitor) { return visitor.visitDoctype(this); };
  18295. return Doctype;
  18296. }());
  18297. var Tag = /** @class */ (function () {
  18298. function Tag(name, unescapedAttrs, children) {
  18299. if (unescapedAttrs === void 0) { unescapedAttrs = {}; }
  18300. if (children === void 0) { children = []; }
  18301. var _this = this;
  18302. this.name = name;
  18303. this.children = children;
  18304. this.attrs = {};
  18305. Object.keys(unescapedAttrs).forEach(function (k) {
  18306. _this.attrs[k] = _escapeXml(unescapedAttrs[k]);
  18307. });
  18308. }
  18309. /**
  18310. * @param {?} visitor
  18311. * @return {?}
  18312. */
  18313. Tag.prototype.visit = /**
  18314. * @param {?} visitor
  18315. * @return {?}
  18316. */
  18317. function (visitor) { return visitor.visitTag(this); };
  18318. return Tag;
  18319. }());
  18320. var Text$2 = /** @class */ (function () {
  18321. function Text(unescapedValue) {
  18322. this.value = _escapeXml(unescapedValue);
  18323. }
  18324. /**
  18325. * @param {?} visitor
  18326. * @return {?}
  18327. */
  18328. Text.prototype.visit = /**
  18329. * @param {?} visitor
  18330. * @return {?}
  18331. */
  18332. function (visitor) { return visitor.visitText(this); };
  18333. return Text;
  18334. }());
  18335. var CR = /** @class */ (function (_super) {
  18336. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CR, _super);
  18337. function CR(ws) {
  18338. if (ws === void 0) { ws = 0; }
  18339. return _super.call(this, "\n" + new Array(ws + 1).join(' ')) || this;
  18340. }
  18341. return CR;
  18342. }(Text$2));
  18343. var _ESCAPED_CHARS = [
  18344. [/&/g, '&amp;'],
  18345. [/"/g, '&quot;'],
  18346. [/'/g, '&apos;'],
  18347. [/</g, '&lt;'],
  18348. [/>/g, '&gt;'],
  18349. ];
  18350. /**
  18351. * @param {?} text
  18352. * @return {?}
  18353. */
  18354. function _escapeXml(text) {
  18355. return _ESCAPED_CHARS.reduce(function (text, entry) { return text.replace(entry[0], entry[1]); }, text);
  18356. }
  18357. /**
  18358. * @fileoverview added by tsickle
  18359. * @suppress {checkTypes} checked by tsc
  18360. */
  18361. /**
  18362. * @license
  18363. * Copyright Google Inc. All Rights Reserved.
  18364. *
  18365. * Use of this source code is governed by an MIT-style license that can be
  18366. * found in the LICENSE file at https://angular.io/license
  18367. */
  18368. var _VERSION = '1.2';
  18369. var _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2';
  18370. // TODO(vicb): make this a param (s/_/-/)
  18371. var _DEFAULT_SOURCE_LANG = 'en';
  18372. var _PLACEHOLDER_TAG = 'x';
  18373. var _MARKER_TAG = 'mrk';
  18374. var _FILE_TAG = 'file';
  18375. var _SOURCE_TAG = 'source';
  18376. var _SEGMENT_SOURCE_TAG = 'seg-source';
  18377. var _TARGET_TAG = 'target';
  18378. var _UNIT_TAG = 'trans-unit';
  18379. var _CONTEXT_GROUP_TAG = 'context-group';
  18380. var _CONTEXT_TAG = 'context';
  18381. var Xliff = /** @class */ (function (_super) {
  18382. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xliff, _super);
  18383. function Xliff() {
  18384. return _super !== null && _super.apply(this, arguments) || this;
  18385. }
  18386. /**
  18387. * @param {?} messages
  18388. * @param {?} locale
  18389. * @return {?}
  18390. */
  18391. Xliff.prototype.write = /**
  18392. * @param {?} messages
  18393. * @param {?} locale
  18394. * @return {?}
  18395. */
  18396. function (messages, locale) {
  18397. var /** @type {?} */ visitor = new _WriteVisitor();
  18398. var /** @type {?} */ transUnits = [];
  18399. messages.forEach(function (message) {
  18400. var /** @type {?} */ contextTags = [];
  18401. message.sources.forEach(function (source) {
  18402. var /** @type {?} */ contextGroupTag = new Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' });
  18403. contextGroupTag.children.push(new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'sourcefile' }, [new Text$2(source.filePath)]), new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'linenumber' }, [new Text$2("" + source.startLine)]), new CR(8));
  18404. contextTags.push(new CR(8), contextGroupTag);
  18405. });
  18406. var /** @type {?} */ transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' });
  18407. (_a = transUnit.children).push.apply(_a, [new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes))].concat(contextTags));
  18408. if (message.description) {
  18409. transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'description' }, [new Text$2(message.description)]));
  18410. }
  18411. if (message.meaning) {
  18412. transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'meaning' }, [new Text$2(message.meaning)]));
  18413. }
  18414. transUnit.children.push(new CR(6));
  18415. transUnits.push(new CR(6), transUnit);
  18416. var _a;
  18417. });
  18418. var /** @type {?} */ body = new Tag('body', {}, transUnits.concat([new CR(4)]));
  18419. var /** @type {?} */ file = new Tag('file', {
  18420. 'source-language': locale || _DEFAULT_SOURCE_LANG,
  18421. datatype: 'plaintext',
  18422. original: 'ng2.template',
  18423. }, [new CR(4), body, new CR(2)]);
  18424. var /** @type {?} */ xliff = new Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new CR(2), file, new CR()]);
  18425. return serialize([
  18426. new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
  18427. ]);
  18428. };
  18429. /**
  18430. * @param {?} content
  18431. * @param {?} url
  18432. * @return {?}
  18433. */
  18434. Xliff.prototype.load = /**
  18435. * @param {?} content
  18436. * @param {?} url
  18437. * @return {?}
  18438. */
  18439. function (content, url) {
  18440. // xliff to xml nodes
  18441. var /** @type {?} */ xliffParser = new XliffParser();
  18442. var _a = xliffParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
  18443. // xml nodes to i18n nodes
  18444. var /** @type {?} */ i18nNodesByMsgId = {};
  18445. var /** @type {?} */ converter = new XmlToI18n();
  18446. Object.keys(msgIdToHtml).forEach(function (msgId) {
  18447. var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
  18448. errors.push.apply(errors, e);
  18449. i18nNodesByMsgId[msgId] = i18nNodes;
  18450. });
  18451. if (errors.length) {
  18452. throw new Error("xliff parse errors:\n" + errors.join('\n'));
  18453. }
  18454. return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
  18455. };
  18456. /**
  18457. * @param {?} message
  18458. * @return {?}
  18459. */
  18460. Xliff.prototype.digest = /**
  18461. * @param {?} message
  18462. * @return {?}
  18463. */
  18464. function (message) { return digest(message); };
  18465. return Xliff;
  18466. }(Serializer));
  18467. var _WriteVisitor = /** @class */ (function () {
  18468. function _WriteVisitor() {
  18469. }
  18470. /**
  18471. * @param {?} text
  18472. * @param {?=} context
  18473. * @return {?}
  18474. */
  18475. _WriteVisitor.prototype.visitText = /**
  18476. * @param {?} text
  18477. * @param {?=} context
  18478. * @return {?}
  18479. */
  18480. function (text, context) { return [new Text$2(text.value)]; };
  18481. /**
  18482. * @param {?} container
  18483. * @param {?=} context
  18484. * @return {?}
  18485. */
  18486. _WriteVisitor.prototype.visitContainer = /**
  18487. * @param {?} container
  18488. * @param {?=} context
  18489. * @return {?}
  18490. */
  18491. function (container, context) {
  18492. var _this = this;
  18493. var /** @type {?} */ nodes = [];
  18494. container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
  18495. return nodes;
  18496. };
  18497. /**
  18498. * @param {?} icu
  18499. * @param {?=} context
  18500. * @return {?}
  18501. */
  18502. _WriteVisitor.prototype.visitIcu = /**
  18503. * @param {?} icu
  18504. * @param {?=} context
  18505. * @return {?}
  18506. */
  18507. function (icu, context) {
  18508. var _this = this;
  18509. var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
  18510. Object.keys(icu.cases).forEach(function (c) {
  18511. nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
  18512. });
  18513. nodes.push(new Text$2("}"));
  18514. return nodes;
  18515. };
  18516. /**
  18517. * @param {?} ph
  18518. * @param {?=} context
  18519. * @return {?}
  18520. */
  18521. _WriteVisitor.prototype.visitTagPlaceholder = /**
  18522. * @param {?} ph
  18523. * @param {?=} context
  18524. * @return {?}
  18525. */
  18526. function (ph, context) {
  18527. var /** @type {?} */ ctype = getCtypeForTag(ph.tag);
  18528. if (ph.isVoid) {
  18529. // void tags have no children nor closing tags
  18530. return [new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + "/>" })];
  18531. }
  18532. var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + ">" });
  18533. var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype: ctype, 'equiv-text': "</" + ph.tag + ">" });
  18534. return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]);
  18535. };
  18536. /**
  18537. * @param {?} ph
  18538. * @param {?=} context
  18539. * @return {?}
  18540. */
  18541. _WriteVisitor.prototype.visitPlaceholder = /**
  18542. * @param {?} ph
  18543. * @param {?=} context
  18544. * @return {?}
  18545. */
  18546. function (ph, context) {
  18547. return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': "{{" + ph.value + "}}" })];
  18548. };
  18549. /**
  18550. * @param {?} ph
  18551. * @param {?=} context
  18552. * @return {?}
  18553. */
  18554. _WriteVisitor.prototype.visitIcuPlaceholder = /**
  18555. * @param {?} ph
  18556. * @param {?=} context
  18557. * @return {?}
  18558. */
  18559. function (ph, context) {
  18560. var /** @type {?} */ equivText = "{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}";
  18561. return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': equivText })];
  18562. };
  18563. /**
  18564. * @param {?} nodes
  18565. * @return {?}
  18566. */
  18567. _WriteVisitor.prototype.serialize = /**
  18568. * @param {?} nodes
  18569. * @return {?}
  18570. */
  18571. function (nodes) {
  18572. var _this = this;
  18573. return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
  18574. };
  18575. return _WriteVisitor;
  18576. }());
  18577. var XliffParser = /** @class */ (function () {
  18578. function XliffParser() {
  18579. this._locale = null;
  18580. }
  18581. /**
  18582. * @param {?} xliff
  18583. * @param {?} url
  18584. * @return {?}
  18585. */
  18586. XliffParser.prototype.parse = /**
  18587. * @param {?} xliff
  18588. * @param {?} url
  18589. * @return {?}
  18590. */
  18591. function (xliff, url) {
  18592. this._unitMlString = null;
  18593. this._msgIdToHtml = {};
  18594. var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false);
  18595. this._errors = xml.errors;
  18596. visitAll(this, xml.rootNodes, null);
  18597. return {
  18598. msgIdToHtml: this._msgIdToHtml,
  18599. errors: this._errors,
  18600. locale: this._locale,
  18601. };
  18602. };
  18603. /**
  18604. * @param {?} element
  18605. * @param {?} context
  18606. * @return {?}
  18607. */
  18608. XliffParser.prototype.visitElement = /**
  18609. * @param {?} element
  18610. * @param {?} context
  18611. * @return {?}
  18612. */
  18613. function (element, context) {
  18614. switch (element.name) {
  18615. case _UNIT_TAG:
  18616. this._unitMlString = /** @type {?} */ ((null));
  18617. var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
  18618. if (!idAttr) {
  18619. this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute");
  18620. }
  18621. else {
  18622. var /** @type {?} */ id = idAttr.value;
  18623. if (this._msgIdToHtml.hasOwnProperty(id)) {
  18624. this._addError(element, "Duplicated translations for msg " + id);
  18625. }
  18626. else {
  18627. visitAll(this, element.children, null);
  18628. if (typeof this._unitMlString === 'string') {
  18629. this._msgIdToHtml[id] = this._unitMlString;
  18630. }
  18631. else {
  18632. this._addError(element, "Message " + id + " misses a translation");
  18633. }
  18634. }
  18635. }
  18636. break;
  18637. // ignore those tags
  18638. case _SOURCE_TAG:
  18639. case _SEGMENT_SOURCE_TAG:
  18640. break;
  18641. case _TARGET_TAG:
  18642. var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
  18643. var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
  18644. var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
  18645. var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd);
  18646. this._unitMlString = innerText;
  18647. break;
  18648. case _FILE_TAG:
  18649. var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; });
  18650. if (localeAttr) {
  18651. this._locale = localeAttr.value;
  18652. }
  18653. visitAll(this, element.children, null);
  18654. break;
  18655. default:
  18656. // TODO(vicb): assert file structure, xliff version
  18657. // For now only recurse on unhandled nodes
  18658. visitAll(this, element.children, null);
  18659. }
  18660. };
  18661. /**
  18662. * @param {?} attribute
  18663. * @param {?} context
  18664. * @return {?}
  18665. */
  18666. XliffParser.prototype.visitAttribute = /**
  18667. * @param {?} attribute
  18668. * @param {?} context
  18669. * @return {?}
  18670. */
  18671. function (attribute, context) { };
  18672. /**
  18673. * @param {?} text
  18674. * @param {?} context
  18675. * @return {?}
  18676. */
  18677. XliffParser.prototype.visitText = /**
  18678. * @param {?} text
  18679. * @param {?} context
  18680. * @return {?}
  18681. */
  18682. function (text, context) { };
  18683. /**
  18684. * @param {?} comment
  18685. * @param {?} context
  18686. * @return {?}
  18687. */
  18688. XliffParser.prototype.visitComment = /**
  18689. * @param {?} comment
  18690. * @param {?} context
  18691. * @return {?}
  18692. */
  18693. function (comment, context) { };
  18694. /**
  18695. * @param {?} expansion
  18696. * @param {?} context
  18697. * @return {?}
  18698. */
  18699. XliffParser.prototype.visitExpansion = /**
  18700. * @param {?} expansion
  18701. * @param {?} context
  18702. * @return {?}
  18703. */
  18704. function (expansion, context) { };
  18705. /**
  18706. * @param {?} expansionCase
  18707. * @param {?} context
  18708. * @return {?}
  18709. */
  18710. XliffParser.prototype.visitExpansionCase = /**
  18711. * @param {?} expansionCase
  18712. * @param {?} context
  18713. * @return {?}
  18714. */
  18715. function (expansionCase, context) { };
  18716. /**
  18717. * @param {?} node
  18718. * @param {?} message
  18719. * @return {?}
  18720. */
  18721. XliffParser.prototype._addError = /**
  18722. * @param {?} node
  18723. * @param {?} message
  18724. * @return {?}
  18725. */
  18726. function (node, message) {
  18727. this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
  18728. };
  18729. return XliffParser;
  18730. }());
  18731. var XmlToI18n = /** @class */ (function () {
  18732. function XmlToI18n() {
  18733. }
  18734. /**
  18735. * @param {?} message
  18736. * @param {?} url
  18737. * @return {?}
  18738. */
  18739. XmlToI18n.prototype.convert = /**
  18740. * @param {?} message
  18741. * @param {?} url
  18742. * @return {?}
  18743. */
  18744. function (message, url) {
  18745. var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
  18746. this._errors = xmlIcu.errors;
  18747. var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
  18748. [] : [].concat.apply([], visitAll(this, xmlIcu.rootNodes));
  18749. return {
  18750. i18nNodes: i18nNodes,
  18751. errors: this._errors,
  18752. };
  18753. };
  18754. /**
  18755. * @param {?} text
  18756. * @param {?} context
  18757. * @return {?}
  18758. */
  18759. XmlToI18n.prototype.visitText = /**
  18760. * @param {?} text
  18761. * @param {?} context
  18762. * @return {?}
  18763. */
  18764. function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); };
  18765. /**
  18766. * @param {?} el
  18767. * @param {?} context
  18768. * @return {?}
  18769. */
  18770. XmlToI18n.prototype.visitElement = /**
  18771. * @param {?} el
  18772. * @param {?} context
  18773. * @return {?}
  18774. */
  18775. function (el, context) {
  18776. if (el.name === _PLACEHOLDER_TAG) {
  18777. var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; });
  18778. if (nameAttr) {
  18779. return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan)));
  18780. }
  18781. this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"id\" attribute");
  18782. return null;
  18783. }
  18784. if (el.name === _MARKER_TAG) {
  18785. return [].concat.apply([], visitAll(this, el.children));
  18786. }
  18787. this._addError(el, "Unexpected tag");
  18788. return null;
  18789. };
  18790. /**
  18791. * @param {?} icu
  18792. * @param {?} context
  18793. * @return {?}
  18794. */
  18795. XmlToI18n.prototype.visitExpansion = /**
  18796. * @param {?} icu
  18797. * @param {?} context
  18798. * @return {?}
  18799. */
  18800. function (icu, context) {
  18801. var /** @type {?} */ caseMap = {};
  18802. visitAll(this, icu.cases).forEach(function (c) {
  18803. caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
  18804. });
  18805. return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
  18806. };
  18807. /**
  18808. * @param {?} icuCase
  18809. * @param {?} context
  18810. * @return {?}
  18811. */
  18812. XmlToI18n.prototype.visitExpansionCase = /**
  18813. * @param {?} icuCase
  18814. * @param {?} context
  18815. * @return {?}
  18816. */
  18817. function (icuCase, context) {
  18818. return {
  18819. value: icuCase.value,
  18820. nodes: visitAll(this, icuCase.expression),
  18821. };
  18822. };
  18823. /**
  18824. * @param {?} comment
  18825. * @param {?} context
  18826. * @return {?}
  18827. */
  18828. XmlToI18n.prototype.visitComment = /**
  18829. * @param {?} comment
  18830. * @param {?} context
  18831. * @return {?}
  18832. */
  18833. function (comment, context) { };
  18834. /**
  18835. * @param {?} attribute
  18836. * @param {?} context
  18837. * @return {?}
  18838. */
  18839. XmlToI18n.prototype.visitAttribute = /**
  18840. * @param {?} attribute
  18841. * @param {?} context
  18842. * @return {?}
  18843. */
  18844. function (attribute, context) { };
  18845. /**
  18846. * @param {?} node
  18847. * @param {?} message
  18848. * @return {?}
  18849. */
  18850. XmlToI18n.prototype._addError = /**
  18851. * @param {?} node
  18852. * @param {?} message
  18853. * @return {?}
  18854. */
  18855. function (node, message) {
  18856. this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
  18857. };
  18858. return XmlToI18n;
  18859. }());
  18860. /**
  18861. * @param {?} tag
  18862. * @return {?}
  18863. */
  18864. function getCtypeForTag(tag) {
  18865. switch (tag.toLowerCase()) {
  18866. case 'br':
  18867. return 'lb';
  18868. case 'img':
  18869. return 'image';
  18870. default:
  18871. return "x-" + tag;
  18872. }
  18873. }
  18874. /**
  18875. * @fileoverview added by tsickle
  18876. * @suppress {checkTypes} checked by tsc
  18877. */
  18878. /**
  18879. * @license
  18880. * Copyright Google Inc. All Rights Reserved.
  18881. *
  18882. * Use of this source code is governed by an MIT-style license that can be
  18883. * found in the LICENSE file at https://angular.io/license
  18884. */
  18885. var _VERSION$1 = '2.0';
  18886. var _XMLNS$1 = 'urn:oasis:names:tc:xliff:document:2.0';
  18887. // TODO(vicb): make this a param (s/_/-/)
  18888. var _DEFAULT_SOURCE_LANG$1 = 'en';
  18889. var _PLACEHOLDER_TAG$1 = 'ph';
  18890. var _PLACEHOLDER_SPANNING_TAG = 'pc';
  18891. var _MARKER_TAG$1 = 'mrk';
  18892. var _XLIFF_TAG = 'xliff';
  18893. var _SOURCE_TAG$1 = 'source';
  18894. var _TARGET_TAG$1 = 'target';
  18895. var _UNIT_TAG$1 = 'unit';
  18896. var Xliff2 = /** @class */ (function (_super) {
  18897. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xliff2, _super);
  18898. function Xliff2() {
  18899. return _super !== null && _super.apply(this, arguments) || this;
  18900. }
  18901. /**
  18902. * @param {?} messages
  18903. * @param {?} locale
  18904. * @return {?}
  18905. */
  18906. Xliff2.prototype.write = /**
  18907. * @param {?} messages
  18908. * @param {?} locale
  18909. * @return {?}
  18910. */
  18911. function (messages, locale) {
  18912. var /** @type {?} */ visitor = new _WriteVisitor$1();
  18913. var /** @type {?} */ units = [];
  18914. messages.forEach(function (message) {
  18915. var /** @type {?} */ unit = new Tag(_UNIT_TAG$1, { id: message.id });
  18916. var /** @type {?} */ notes = new Tag('notes');
  18917. if (message.description || message.meaning) {
  18918. if (message.description) {
  18919. notes.children.push(new CR(8), new Tag('note', { category: 'description' }, [new Text$2(message.description)]));
  18920. }
  18921. if (message.meaning) {
  18922. notes.children.push(new CR(8), new Tag('note', { category: 'meaning' }, [new Text$2(message.meaning)]));
  18923. }
  18924. }
  18925. message.sources.forEach(function (source) {
  18926. notes.children.push(new CR(8), new Tag('note', { category: 'location' }, [
  18927. new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
  18928. ]));
  18929. });
  18930. notes.children.push(new CR(6));
  18931. unit.children.push(new CR(6), notes);
  18932. var /** @type {?} */ segment = new Tag('segment');
  18933. segment.children.push(new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes)), new CR(6));
  18934. unit.children.push(new CR(6), segment, new CR(4));
  18935. units.push(new CR(4), unit);
  18936. });
  18937. var /** @type {?} */ file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, units.concat([new CR(2)]));
  18938. var /** @type {?} */ xliff = new Tag(_XLIFF_TAG, { version: _VERSION$1, xmlns: _XMLNS$1, srcLang: locale || _DEFAULT_SOURCE_LANG$1 }, [new CR(2), file, new CR()]);
  18939. return serialize([
  18940. new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
  18941. ]);
  18942. };
  18943. /**
  18944. * @param {?} content
  18945. * @param {?} url
  18946. * @return {?}
  18947. */
  18948. Xliff2.prototype.load = /**
  18949. * @param {?} content
  18950. * @param {?} url
  18951. * @return {?}
  18952. */
  18953. function (content, url) {
  18954. // xliff to xml nodes
  18955. var /** @type {?} */ xliff2Parser = new Xliff2Parser();
  18956. var _a = xliff2Parser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
  18957. // xml nodes to i18n nodes
  18958. var /** @type {?} */ i18nNodesByMsgId = {};
  18959. var /** @type {?} */ converter = new XmlToI18n$1();
  18960. Object.keys(msgIdToHtml).forEach(function (msgId) {
  18961. var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
  18962. errors.push.apply(errors, e);
  18963. i18nNodesByMsgId[msgId] = i18nNodes;
  18964. });
  18965. if (errors.length) {
  18966. throw new Error("xliff2 parse errors:\n" + errors.join('\n'));
  18967. }
  18968. return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
  18969. };
  18970. /**
  18971. * @param {?} message
  18972. * @return {?}
  18973. */
  18974. Xliff2.prototype.digest = /**
  18975. * @param {?} message
  18976. * @return {?}
  18977. */
  18978. function (message) { return decimalDigest(message); };
  18979. return Xliff2;
  18980. }(Serializer));
  18981. var _WriteVisitor$1 = /** @class */ (function () {
  18982. function _WriteVisitor() {
  18983. }
  18984. /**
  18985. * @param {?} text
  18986. * @param {?=} context
  18987. * @return {?}
  18988. */
  18989. _WriteVisitor.prototype.visitText = /**
  18990. * @param {?} text
  18991. * @param {?=} context
  18992. * @return {?}
  18993. */
  18994. function (text, context) { return [new Text$2(text.value)]; };
  18995. /**
  18996. * @param {?} container
  18997. * @param {?=} context
  18998. * @return {?}
  18999. */
  19000. _WriteVisitor.prototype.visitContainer = /**
  19001. * @param {?} container
  19002. * @param {?=} context
  19003. * @return {?}
  19004. */
  19005. function (container, context) {
  19006. var _this = this;
  19007. var /** @type {?} */ nodes = [];
  19008. container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
  19009. return nodes;
  19010. };
  19011. /**
  19012. * @param {?} icu
  19013. * @param {?=} context
  19014. * @return {?}
  19015. */
  19016. _WriteVisitor.prototype.visitIcu = /**
  19017. * @param {?} icu
  19018. * @param {?=} context
  19019. * @return {?}
  19020. */
  19021. function (icu, context) {
  19022. var _this = this;
  19023. var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
  19024. Object.keys(icu.cases).forEach(function (c) {
  19025. nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
  19026. });
  19027. nodes.push(new Text$2("}"));
  19028. return nodes;
  19029. };
  19030. /**
  19031. * @param {?} ph
  19032. * @param {?=} context
  19033. * @return {?}
  19034. */
  19035. _WriteVisitor.prototype.visitTagPlaceholder = /**
  19036. * @param {?} ph
  19037. * @param {?=} context
  19038. * @return {?}
  19039. */
  19040. function (ph, context) {
  19041. var _this = this;
  19042. var /** @type {?} */ type = getTypeForTag(ph.tag);
  19043. if (ph.isVoid) {
  19044. var /** @type {?} */ tagPh = new Tag(_PLACEHOLDER_TAG$1, {
  19045. id: (this._nextPlaceholderId++).toString(),
  19046. equiv: ph.startName,
  19047. type: type,
  19048. disp: "<" + ph.tag + "/>",
  19049. });
  19050. return [tagPh];
  19051. }
  19052. var /** @type {?} */ tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, {
  19053. id: (this._nextPlaceholderId++).toString(),
  19054. equivStart: ph.startName,
  19055. equivEnd: ph.closeName,
  19056. type: type,
  19057. dispStart: "<" + ph.tag + ">",
  19058. dispEnd: "</" + ph.tag + ">",
  19059. });
  19060. var /** @type {?} */ nodes = [].concat.apply([], ph.children.map(function (node) { return node.visit(_this); }));
  19061. if (nodes.length) {
  19062. nodes.forEach(function (node) { return tagPc.children.push(node); });
  19063. }
  19064. else {
  19065. tagPc.children.push(new Text$2(''));
  19066. }
  19067. return [tagPc];
  19068. };
  19069. /**
  19070. * @param {?} ph
  19071. * @param {?=} context
  19072. * @return {?}
  19073. */
  19074. _WriteVisitor.prototype.visitPlaceholder = /**
  19075. * @param {?} ph
  19076. * @param {?=} context
  19077. * @return {?}
  19078. */
  19079. function (ph, context) {
  19080. var /** @type {?} */ idStr = (this._nextPlaceholderId++).toString();
  19081. return [new Tag(_PLACEHOLDER_TAG$1, {
  19082. id: idStr,
  19083. equiv: ph.name,
  19084. disp: "{{" + ph.value + "}}",
  19085. })];
  19086. };
  19087. /**
  19088. * @param {?} ph
  19089. * @param {?=} context
  19090. * @return {?}
  19091. */
  19092. _WriteVisitor.prototype.visitIcuPlaceholder = /**
  19093. * @param {?} ph
  19094. * @param {?=} context
  19095. * @return {?}
  19096. */
  19097. function (ph, context) {
  19098. var /** @type {?} */ cases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ');
  19099. var /** @type {?} */ idStr = (this._nextPlaceholderId++).toString();
  19100. return [new Tag(_PLACEHOLDER_TAG$1, { id: idStr, equiv: ph.name, disp: "{" + ph.value.expression + ", " + ph.value.type + ", " + cases + "}" })];
  19101. };
  19102. /**
  19103. * @param {?} nodes
  19104. * @return {?}
  19105. */
  19106. _WriteVisitor.prototype.serialize = /**
  19107. * @param {?} nodes
  19108. * @return {?}
  19109. */
  19110. function (nodes) {
  19111. var _this = this;
  19112. this._nextPlaceholderId = 0;
  19113. return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
  19114. };
  19115. return _WriteVisitor;
  19116. }());
  19117. var Xliff2Parser = /** @class */ (function () {
  19118. function Xliff2Parser() {
  19119. this._locale = null;
  19120. }
  19121. /**
  19122. * @param {?} xliff
  19123. * @param {?} url
  19124. * @return {?}
  19125. */
  19126. Xliff2Parser.prototype.parse = /**
  19127. * @param {?} xliff
  19128. * @param {?} url
  19129. * @return {?}
  19130. */
  19131. function (xliff, url) {
  19132. this._unitMlString = null;
  19133. this._msgIdToHtml = {};
  19134. var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false);
  19135. this._errors = xml.errors;
  19136. visitAll(this, xml.rootNodes, null);
  19137. return {
  19138. msgIdToHtml: this._msgIdToHtml,
  19139. errors: this._errors,
  19140. locale: this._locale,
  19141. };
  19142. };
  19143. /**
  19144. * @param {?} element
  19145. * @param {?} context
  19146. * @return {?}
  19147. */
  19148. Xliff2Parser.prototype.visitElement = /**
  19149. * @param {?} element
  19150. * @param {?} context
  19151. * @return {?}
  19152. */
  19153. function (element, context) {
  19154. switch (element.name) {
  19155. case _UNIT_TAG$1:
  19156. this._unitMlString = null;
  19157. var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
  19158. if (!idAttr) {
  19159. this._addError(element, "<" + _UNIT_TAG$1 + "> misses the \"id\" attribute");
  19160. }
  19161. else {
  19162. var /** @type {?} */ id = idAttr.value;
  19163. if (this._msgIdToHtml.hasOwnProperty(id)) {
  19164. this._addError(element, "Duplicated translations for msg " + id);
  19165. }
  19166. else {
  19167. visitAll(this, element.children, null);
  19168. if (typeof this._unitMlString === 'string') {
  19169. this._msgIdToHtml[id] = this._unitMlString;
  19170. }
  19171. else {
  19172. this._addError(element, "Message " + id + " misses a translation");
  19173. }
  19174. }
  19175. }
  19176. break;
  19177. case _SOURCE_TAG$1:
  19178. // ignore source message
  19179. break;
  19180. case _TARGET_TAG$1:
  19181. var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
  19182. var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
  19183. var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
  19184. var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd);
  19185. this._unitMlString = innerText;
  19186. break;
  19187. case _XLIFF_TAG:
  19188. var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; });
  19189. if (localeAttr) {
  19190. this._locale = localeAttr.value;
  19191. }
  19192. var /** @type {?} */ versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; });
  19193. if (versionAttr) {
  19194. var /** @type {?} */ version = versionAttr.value;
  19195. if (version !== '2.0') {
  19196. this._addError(element, "The XLIFF file version " + version + " is not compatible with XLIFF 2.0 serializer");
  19197. }
  19198. else {
  19199. visitAll(this, element.children, null);
  19200. }
  19201. }
  19202. break;
  19203. default:
  19204. visitAll(this, element.children, null);
  19205. }
  19206. };
  19207. /**
  19208. * @param {?} attribute
  19209. * @param {?} context
  19210. * @return {?}
  19211. */
  19212. Xliff2Parser.prototype.visitAttribute = /**
  19213. * @param {?} attribute
  19214. * @param {?} context
  19215. * @return {?}
  19216. */
  19217. function (attribute, context) { };
  19218. /**
  19219. * @param {?} text
  19220. * @param {?} context
  19221. * @return {?}
  19222. */
  19223. Xliff2Parser.prototype.visitText = /**
  19224. * @param {?} text
  19225. * @param {?} context
  19226. * @return {?}
  19227. */
  19228. function (text, context) { };
  19229. /**
  19230. * @param {?} comment
  19231. * @param {?} context
  19232. * @return {?}
  19233. */
  19234. Xliff2Parser.prototype.visitComment = /**
  19235. * @param {?} comment
  19236. * @param {?} context
  19237. * @return {?}
  19238. */
  19239. function (comment, context) { };
  19240. /**
  19241. * @param {?} expansion
  19242. * @param {?} context
  19243. * @return {?}
  19244. */
  19245. Xliff2Parser.prototype.visitExpansion = /**
  19246. * @param {?} expansion
  19247. * @param {?} context
  19248. * @return {?}
  19249. */
  19250. function (expansion, context) { };
  19251. /**
  19252. * @param {?} expansionCase
  19253. * @param {?} context
  19254. * @return {?}
  19255. */
  19256. Xliff2Parser.prototype.visitExpansionCase = /**
  19257. * @param {?} expansionCase
  19258. * @param {?} context
  19259. * @return {?}
  19260. */
  19261. function (expansionCase, context) { };
  19262. /**
  19263. * @param {?} node
  19264. * @param {?} message
  19265. * @return {?}
  19266. */
  19267. Xliff2Parser.prototype._addError = /**
  19268. * @param {?} node
  19269. * @param {?} message
  19270. * @return {?}
  19271. */
  19272. function (node, message) {
  19273. this._errors.push(new I18nError(node.sourceSpan, message));
  19274. };
  19275. return Xliff2Parser;
  19276. }());
  19277. var XmlToI18n$1 = /** @class */ (function () {
  19278. function XmlToI18n() {
  19279. }
  19280. /**
  19281. * @param {?} message
  19282. * @param {?} url
  19283. * @return {?}
  19284. */
  19285. XmlToI18n.prototype.convert = /**
  19286. * @param {?} message
  19287. * @param {?} url
  19288. * @return {?}
  19289. */
  19290. function (message, url) {
  19291. var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
  19292. this._errors = xmlIcu.errors;
  19293. var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
  19294. [] : [].concat.apply([], visitAll(this, xmlIcu.rootNodes));
  19295. return {
  19296. i18nNodes: i18nNodes,
  19297. errors: this._errors,
  19298. };
  19299. };
  19300. /**
  19301. * @param {?} text
  19302. * @param {?} context
  19303. * @return {?}
  19304. */
  19305. XmlToI18n.prototype.visitText = /**
  19306. * @param {?} text
  19307. * @param {?} context
  19308. * @return {?}
  19309. */
  19310. function (text, context) { return new Text$1(text.value, text.sourceSpan); };
  19311. /**
  19312. * @param {?} el
  19313. * @param {?} context
  19314. * @return {?}
  19315. */
  19316. XmlToI18n.prototype.visitElement = /**
  19317. * @param {?} el
  19318. * @param {?} context
  19319. * @return {?}
  19320. */
  19321. function (el, context) {
  19322. var _this = this;
  19323. switch (el.name) {
  19324. case _PLACEHOLDER_TAG$1:
  19325. var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; });
  19326. if (nameAttr) {
  19327. return [new Placeholder('', nameAttr.value, el.sourceSpan)];
  19328. }
  19329. this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equiv\" attribute");
  19330. break;
  19331. case _PLACEHOLDER_SPANNING_TAG:
  19332. var /** @type {?} */ startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; });
  19333. var /** @type {?} */ endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; });
  19334. if (!startAttr) {
  19335. this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivStart\" attribute");
  19336. }
  19337. else if (!endAttr) {
  19338. this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivEnd\" attribute");
  19339. }
  19340. else {
  19341. var /** @type {?} */ startId = startAttr.value;
  19342. var /** @type {?} */ endId = endAttr.value;
  19343. var /** @type {?} */ nodes = [];
  19344. return nodes.concat.apply(nodes, [new Placeholder('', startId, el.sourceSpan)].concat(el.children.map(function (node) { return node.visit(_this, null); }), [new Placeholder('', endId, el.sourceSpan)]));
  19345. }
  19346. break;
  19347. case _MARKER_TAG$1:
  19348. return [].concat.apply([], visitAll(this, el.children));
  19349. default:
  19350. this._addError(el, "Unexpected tag");
  19351. }
  19352. return null;
  19353. };
  19354. /**
  19355. * @param {?} icu
  19356. * @param {?} context
  19357. * @return {?}
  19358. */
  19359. XmlToI18n.prototype.visitExpansion = /**
  19360. * @param {?} icu
  19361. * @param {?} context
  19362. * @return {?}
  19363. */
  19364. function (icu, context) {
  19365. var /** @type {?} */ caseMap = {};
  19366. visitAll(this, icu.cases).forEach(function (c) {
  19367. caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
  19368. });
  19369. return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
  19370. };
  19371. /**
  19372. * @param {?} icuCase
  19373. * @param {?} context
  19374. * @return {?}
  19375. */
  19376. XmlToI18n.prototype.visitExpansionCase = /**
  19377. * @param {?} icuCase
  19378. * @param {?} context
  19379. * @return {?}
  19380. */
  19381. function (icuCase, context) {
  19382. return {
  19383. value: icuCase.value,
  19384. nodes: [].concat.apply([], visitAll(this, icuCase.expression)),
  19385. };
  19386. };
  19387. /**
  19388. * @param {?} comment
  19389. * @param {?} context
  19390. * @return {?}
  19391. */
  19392. XmlToI18n.prototype.visitComment = /**
  19393. * @param {?} comment
  19394. * @param {?} context
  19395. * @return {?}
  19396. */
  19397. function (comment, context) { };
  19398. /**
  19399. * @param {?} attribute
  19400. * @param {?} context
  19401. * @return {?}
  19402. */
  19403. XmlToI18n.prototype.visitAttribute = /**
  19404. * @param {?} attribute
  19405. * @param {?} context
  19406. * @return {?}
  19407. */
  19408. function (attribute, context) { };
  19409. /**
  19410. * @param {?} node
  19411. * @param {?} message
  19412. * @return {?}
  19413. */
  19414. XmlToI18n.prototype._addError = /**
  19415. * @param {?} node
  19416. * @param {?} message
  19417. * @return {?}
  19418. */
  19419. function (node, message) {
  19420. this._errors.push(new I18nError(node.sourceSpan, message));
  19421. };
  19422. return XmlToI18n;
  19423. }());
  19424. /**
  19425. * @param {?} tag
  19426. * @return {?}
  19427. */
  19428. function getTypeForTag(tag) {
  19429. switch (tag.toLowerCase()) {
  19430. case 'br':
  19431. case 'b':
  19432. case 'i':
  19433. case 'u':
  19434. return 'fmt';
  19435. case 'img':
  19436. return 'image';
  19437. case 'a':
  19438. return 'link';
  19439. default:
  19440. return 'other';
  19441. }
  19442. }
  19443. /**
  19444. * @fileoverview added by tsickle
  19445. * @suppress {checkTypes} checked by tsc
  19446. */
  19447. /**
  19448. * @license
  19449. * Copyright Google Inc. All Rights Reserved.
  19450. *
  19451. * Use of this source code is governed by an MIT-style license that can be
  19452. * found in the LICENSE file at https://angular.io/license
  19453. */
  19454. var _MESSAGES_TAG = 'messagebundle';
  19455. var _MESSAGE_TAG = 'msg';
  19456. var _PLACEHOLDER_TAG$2 = 'ph';
  19457. var _EXEMPLE_TAG = 'ex';
  19458. var _SOURCE_TAG$2 = 'source';
  19459. var _DOCTYPE = "<!ELEMENT messagebundle (msg)*>\n<!ATTLIST messagebundle class CDATA #IMPLIED>\n\n<!ELEMENT msg (#PCDATA|ph|source)*>\n<!ATTLIST msg id CDATA #IMPLIED>\n<!ATTLIST msg seq CDATA #IMPLIED>\n<!ATTLIST msg name CDATA #IMPLIED>\n<!ATTLIST msg desc CDATA #IMPLIED>\n<!ATTLIST msg meaning CDATA #IMPLIED>\n<!ATTLIST msg obsolete (obsolete) #IMPLIED>\n<!ATTLIST msg xml:space (default|preserve) \"default\">\n<!ATTLIST msg is_hidden CDATA #IMPLIED>\n\n<!ELEMENT source (#PCDATA)>\n\n<!ELEMENT ph (#PCDATA|ex)*>\n<!ATTLIST ph name CDATA #REQUIRED>\n\n<!ELEMENT ex (#PCDATA)>";
  19460. var Xmb = /** @class */ (function (_super) {
  19461. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xmb, _super);
  19462. function Xmb() {
  19463. return _super !== null && _super.apply(this, arguments) || this;
  19464. }
  19465. /**
  19466. * @param {?} messages
  19467. * @param {?} locale
  19468. * @return {?}
  19469. */
  19470. Xmb.prototype.write = /**
  19471. * @param {?} messages
  19472. * @param {?} locale
  19473. * @return {?}
  19474. */
  19475. function (messages, locale) {
  19476. var /** @type {?} */ exampleVisitor = new ExampleVisitor();
  19477. var /** @type {?} */ visitor = new _Visitor$2();
  19478. var /** @type {?} */ rootNode = new Tag(_MESSAGES_TAG);
  19479. messages.forEach(function (message) {
  19480. var /** @type {?} */ attrs = { id: message.id };
  19481. if (message.description) {
  19482. attrs['desc'] = message.description;
  19483. }
  19484. if (message.meaning) {
  19485. attrs['meaning'] = message.meaning;
  19486. }
  19487. var /** @type {?} */ sourceTags = [];
  19488. message.sources.forEach(function (source) {
  19489. sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [
  19490. new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
  19491. ]));
  19492. });
  19493. rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, sourceTags.concat(visitor.serialize(message.nodes))));
  19494. });
  19495. rootNode.children.push(new CR());
  19496. return serialize([
  19497. new Declaration({ version: '1.0', encoding: 'UTF-8' }),
  19498. new CR(),
  19499. new Doctype(_MESSAGES_TAG, _DOCTYPE),
  19500. new CR(),
  19501. exampleVisitor.addDefaultExamples(rootNode),
  19502. new CR(),
  19503. ]);
  19504. };
  19505. /**
  19506. * @param {?} content
  19507. * @param {?} url
  19508. * @return {?}
  19509. */
  19510. Xmb.prototype.load = /**
  19511. * @param {?} content
  19512. * @param {?} url
  19513. * @return {?}
  19514. */
  19515. function (content, url) {
  19516. throw new Error('Unsupported');
  19517. };
  19518. /**
  19519. * @param {?} message
  19520. * @return {?}
  19521. */
  19522. Xmb.prototype.digest = /**
  19523. * @param {?} message
  19524. * @return {?}
  19525. */
  19526. function (message) { return digest$1(message); };
  19527. /**
  19528. * @param {?} message
  19529. * @return {?}
  19530. */
  19531. Xmb.prototype.createNameMapper = /**
  19532. * @param {?} message
  19533. * @return {?}
  19534. */
  19535. function (message) {
  19536. return new SimplePlaceholderMapper(message, toPublicName);
  19537. };
  19538. return Xmb;
  19539. }(Serializer));
  19540. var _Visitor$2 = /** @class */ (function () {
  19541. function _Visitor() {
  19542. }
  19543. /**
  19544. * @param {?} text
  19545. * @param {?=} context
  19546. * @return {?}
  19547. */
  19548. _Visitor.prototype.visitText = /**
  19549. * @param {?} text
  19550. * @param {?=} context
  19551. * @return {?}
  19552. */
  19553. function (text, context) { return [new Text$2(text.value)]; };
  19554. /**
  19555. * @param {?} container
  19556. * @param {?} context
  19557. * @return {?}
  19558. */
  19559. _Visitor.prototype.visitContainer = /**
  19560. * @param {?} container
  19561. * @param {?} context
  19562. * @return {?}
  19563. */
  19564. function (container, context) {
  19565. var _this = this;
  19566. var /** @type {?} */ nodes = [];
  19567. container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
  19568. return nodes;
  19569. };
  19570. /**
  19571. * @param {?} icu
  19572. * @param {?=} context
  19573. * @return {?}
  19574. */
  19575. _Visitor.prototype.visitIcu = /**
  19576. * @param {?} icu
  19577. * @param {?=} context
  19578. * @return {?}
  19579. */
  19580. function (icu, context) {
  19581. var _this = this;
  19582. var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
  19583. Object.keys(icu.cases).forEach(function (c) {
  19584. nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
  19585. });
  19586. nodes.push(new Text$2("}"));
  19587. return nodes;
  19588. };
  19589. /**
  19590. * @param {?} ph
  19591. * @param {?=} context
  19592. * @return {?}
  19593. */
  19594. _Visitor.prototype.visitTagPlaceholder = /**
  19595. * @param {?} ph
  19596. * @param {?=} context
  19597. * @return {?}
  19598. */
  19599. function (ph, context) {
  19600. var /** @type {?} */ startEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("<" + ph.tag + ">")]);
  19601. var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.startName }, [startEx]);
  19602. if (ph.isVoid) {
  19603. // void tags have no children nor closing tags
  19604. return [startTagPh];
  19605. }
  19606. var /** @type {?} */ closeEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("</" + ph.tag + ">")]);
  19607. var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.closeName }, [closeEx]);
  19608. return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]);
  19609. };
  19610. /**
  19611. * @param {?} ph
  19612. * @param {?=} context
  19613. * @return {?}
  19614. */
  19615. _Visitor.prototype.visitPlaceholder = /**
  19616. * @param {?} ph
  19617. * @param {?=} context
  19618. * @return {?}
  19619. */
  19620. function (ph, context) {
  19621. var /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [new Text$2("{{" + ph.value + "}}")]);
  19622. return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
  19623. };
  19624. /**
  19625. * @param {?} ph
  19626. * @param {?=} context
  19627. * @return {?}
  19628. */
  19629. _Visitor.prototype.visitIcuPlaceholder = /**
  19630. * @param {?} ph
  19631. * @param {?=} context
  19632. * @return {?}
  19633. */
  19634. function (ph, context) {
  19635. var /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [
  19636. new Text$2("{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}")
  19637. ]);
  19638. return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
  19639. };
  19640. /**
  19641. * @param {?} nodes
  19642. * @return {?}
  19643. */
  19644. _Visitor.prototype.serialize = /**
  19645. * @param {?} nodes
  19646. * @return {?}
  19647. */
  19648. function (nodes) {
  19649. var _this = this;
  19650. return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
  19651. };
  19652. return _Visitor;
  19653. }());
  19654. /**
  19655. * @param {?} message
  19656. * @return {?}
  19657. */
  19658. function digest$1(message) {
  19659. return decimalDigest(message);
  19660. }
  19661. var ExampleVisitor = /** @class */ (function () {
  19662. function ExampleVisitor() {
  19663. }
  19664. /**
  19665. * @param {?} node
  19666. * @return {?}
  19667. */
  19668. ExampleVisitor.prototype.addDefaultExamples = /**
  19669. * @param {?} node
  19670. * @return {?}
  19671. */
  19672. function (node) {
  19673. node.visit(this);
  19674. return node;
  19675. };
  19676. /**
  19677. * @param {?} tag
  19678. * @return {?}
  19679. */
  19680. ExampleVisitor.prototype.visitTag = /**
  19681. * @param {?} tag
  19682. * @return {?}
  19683. */
  19684. function (tag) {
  19685. var _this = this;
  19686. if (tag.name === _PLACEHOLDER_TAG$2) {
  19687. if (!tag.children || tag.children.length == 0) {
  19688. var /** @type {?} */ exText = new Text$2(tag.attrs['name'] || '...');
  19689. tag.children = [new Tag(_EXEMPLE_TAG, {}, [exText])];
  19690. }
  19691. }
  19692. else if (tag.children) {
  19693. tag.children.forEach(function (node) { return node.visit(_this); });
  19694. }
  19695. };
  19696. /**
  19697. * @param {?} text
  19698. * @return {?}
  19699. */
  19700. ExampleVisitor.prototype.visitText = /**
  19701. * @param {?} text
  19702. * @return {?}
  19703. */
  19704. function (text) { };
  19705. /**
  19706. * @param {?} decl
  19707. * @return {?}
  19708. */
  19709. ExampleVisitor.prototype.visitDeclaration = /**
  19710. * @param {?} decl
  19711. * @return {?}
  19712. */
  19713. function (decl) { };
  19714. /**
  19715. * @param {?} doctype
  19716. * @return {?}
  19717. */
  19718. ExampleVisitor.prototype.visitDoctype = /**
  19719. * @param {?} doctype
  19720. * @return {?}
  19721. */
  19722. function (doctype) { };
  19723. return ExampleVisitor;
  19724. }());
  19725. /**
  19726. * @param {?} internalName
  19727. * @return {?}
  19728. */
  19729. function toPublicName(internalName) {
  19730. return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_');
  19731. }
  19732. /**
  19733. * @fileoverview added by tsickle
  19734. * @suppress {checkTypes} checked by tsc
  19735. */
  19736. /**
  19737. * @license
  19738. * Copyright Google Inc. All Rights Reserved.
  19739. *
  19740. * Use of this source code is governed by an MIT-style license that can be
  19741. * found in the LICENSE file at https://angular.io/license
  19742. */
  19743. var _TRANSLATIONS_TAG = 'translationbundle';
  19744. var _TRANSLATION_TAG = 'translation';
  19745. var _PLACEHOLDER_TAG$3 = 'ph';
  19746. var Xtb = /** @class */ (function (_super) {
  19747. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xtb, _super);
  19748. function Xtb() {
  19749. return _super !== null && _super.apply(this, arguments) || this;
  19750. }
  19751. /**
  19752. * @param {?} messages
  19753. * @param {?} locale
  19754. * @return {?}
  19755. */
  19756. Xtb.prototype.write = /**
  19757. * @param {?} messages
  19758. * @param {?} locale
  19759. * @return {?}
  19760. */
  19761. function (messages, locale) { throw new Error('Unsupported'); };
  19762. /**
  19763. * @param {?} content
  19764. * @param {?} url
  19765. * @return {?}
  19766. */
  19767. Xtb.prototype.load = /**
  19768. * @param {?} content
  19769. * @param {?} url
  19770. * @return {?}
  19771. */
  19772. function (content, url) {
  19773. // xtb to xml nodes
  19774. var /** @type {?} */ xtbParser = new XtbParser();
  19775. var _a = xtbParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
  19776. // xml nodes to i18n nodes
  19777. var /** @type {?} */ i18nNodesByMsgId = {};
  19778. var /** @type {?} */ converter = new XmlToI18n$2();
  19779. // Because we should be able to load xtb files that rely on features not supported by angular,
  19780. // we need to delay the conversion of html to i18n nodes so that non angular messages are not
  19781. // converted
  19782. Object.keys(msgIdToHtml).forEach(function (msgId) {
  19783. var /** @type {?} */ valueFn = function () {
  19784. var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, errors = _a.errors;
  19785. if (errors.length) {
  19786. throw new Error("xtb parse errors:\n" + errors.join('\n'));
  19787. }
  19788. return i18nNodes;
  19789. };
  19790. createLazyProperty(i18nNodesByMsgId, msgId, valueFn);
  19791. });
  19792. if (errors.length) {
  19793. throw new Error("xtb parse errors:\n" + errors.join('\n'));
  19794. }
  19795. return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
  19796. };
  19797. /**
  19798. * @param {?} message
  19799. * @return {?}
  19800. */
  19801. Xtb.prototype.digest = /**
  19802. * @param {?} message
  19803. * @return {?}
  19804. */
  19805. function (message) { return digest$1(message); };
  19806. /**
  19807. * @param {?} message
  19808. * @return {?}
  19809. */
  19810. Xtb.prototype.createNameMapper = /**
  19811. * @param {?} message
  19812. * @return {?}
  19813. */
  19814. function (message) {
  19815. return new SimplePlaceholderMapper(message, toPublicName);
  19816. };
  19817. return Xtb;
  19818. }(Serializer));
  19819. /**
  19820. * @param {?} messages
  19821. * @param {?} id
  19822. * @param {?} valueFn
  19823. * @return {?}
  19824. */
  19825. function createLazyProperty(messages, id, valueFn) {
  19826. Object.defineProperty(messages, id, {
  19827. configurable: true,
  19828. enumerable: true,
  19829. get: function () {
  19830. var /** @type {?} */ value = valueFn();
  19831. Object.defineProperty(messages, id, { enumerable: true, value: value });
  19832. return value;
  19833. },
  19834. set: function (_) { throw new Error('Could not overwrite an XTB translation'); },
  19835. });
  19836. }
  19837. var XtbParser = /** @class */ (function () {
  19838. function XtbParser() {
  19839. this._locale = null;
  19840. }
  19841. /**
  19842. * @param {?} xtb
  19843. * @param {?} url
  19844. * @return {?}
  19845. */
  19846. XtbParser.prototype.parse = /**
  19847. * @param {?} xtb
  19848. * @param {?} url
  19849. * @return {?}
  19850. */
  19851. function (xtb, url) {
  19852. this._bundleDepth = 0;
  19853. this._msgIdToHtml = {};
  19854. // We can not parse the ICU messages at this point as some messages might not originate
  19855. // from Angular that could not be lex'd.
  19856. var /** @type {?} */ xml = new XmlParser().parse(xtb, url, false);
  19857. this._errors = xml.errors;
  19858. visitAll(this, xml.rootNodes);
  19859. return {
  19860. msgIdToHtml: this._msgIdToHtml,
  19861. errors: this._errors,
  19862. locale: this._locale,
  19863. };
  19864. };
  19865. /**
  19866. * @param {?} element
  19867. * @param {?} context
  19868. * @return {?}
  19869. */
  19870. XtbParser.prototype.visitElement = /**
  19871. * @param {?} element
  19872. * @param {?} context
  19873. * @return {?}
  19874. */
  19875. function (element, context) {
  19876. switch (element.name) {
  19877. case _TRANSLATIONS_TAG:
  19878. this._bundleDepth++;
  19879. if (this._bundleDepth > 1) {
  19880. this._addError(element, "<" + _TRANSLATIONS_TAG + "> elements can not be nested");
  19881. }
  19882. var /** @type {?} */ langAttr = element.attrs.find(function (attr) { return attr.name === 'lang'; });
  19883. if (langAttr) {
  19884. this._locale = langAttr.value;
  19885. }
  19886. visitAll(this, element.children, null);
  19887. this._bundleDepth--;
  19888. break;
  19889. case _TRANSLATION_TAG:
  19890. var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
  19891. if (!idAttr) {
  19892. this._addError(element, "<" + _TRANSLATION_TAG + "> misses the \"id\" attribute");
  19893. }
  19894. else {
  19895. var /** @type {?} */ id = idAttr.value;
  19896. if (this._msgIdToHtml.hasOwnProperty(id)) {
  19897. this._addError(element, "Duplicated translations for msg " + id);
  19898. }
  19899. else {
  19900. var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
  19901. var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
  19902. var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
  19903. var /** @type {?} */ innerText = content.slice(/** @type {?} */ ((innerTextStart)), /** @type {?} */ ((innerTextEnd)));
  19904. this._msgIdToHtml[id] = innerText;
  19905. }
  19906. }
  19907. break;
  19908. default:
  19909. this._addError(element, 'Unexpected tag');
  19910. }
  19911. };
  19912. /**
  19913. * @param {?} attribute
  19914. * @param {?} context
  19915. * @return {?}
  19916. */
  19917. XtbParser.prototype.visitAttribute = /**
  19918. * @param {?} attribute
  19919. * @param {?} context
  19920. * @return {?}
  19921. */
  19922. function (attribute, context) { };
  19923. /**
  19924. * @param {?} text
  19925. * @param {?} context
  19926. * @return {?}
  19927. */
  19928. XtbParser.prototype.visitText = /**
  19929. * @param {?} text
  19930. * @param {?} context
  19931. * @return {?}
  19932. */
  19933. function (text, context) { };
  19934. /**
  19935. * @param {?} comment
  19936. * @param {?} context
  19937. * @return {?}
  19938. */
  19939. XtbParser.prototype.visitComment = /**
  19940. * @param {?} comment
  19941. * @param {?} context
  19942. * @return {?}
  19943. */
  19944. function (comment, context) { };
  19945. /**
  19946. * @param {?} expansion
  19947. * @param {?} context
  19948. * @return {?}
  19949. */
  19950. XtbParser.prototype.visitExpansion = /**
  19951. * @param {?} expansion
  19952. * @param {?} context
  19953. * @return {?}
  19954. */
  19955. function (expansion, context) { };
  19956. /**
  19957. * @param {?} expansionCase
  19958. * @param {?} context
  19959. * @return {?}
  19960. */
  19961. XtbParser.prototype.visitExpansionCase = /**
  19962. * @param {?} expansionCase
  19963. * @param {?} context
  19964. * @return {?}
  19965. */
  19966. function (expansionCase, context) { };
  19967. /**
  19968. * @param {?} node
  19969. * @param {?} message
  19970. * @return {?}
  19971. */
  19972. XtbParser.prototype._addError = /**
  19973. * @param {?} node
  19974. * @param {?} message
  19975. * @return {?}
  19976. */
  19977. function (node, message) {
  19978. this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
  19979. };
  19980. return XtbParser;
  19981. }());
  19982. var XmlToI18n$2 = /** @class */ (function () {
  19983. function XmlToI18n() {
  19984. }
  19985. /**
  19986. * @param {?} message
  19987. * @param {?} url
  19988. * @return {?}
  19989. */
  19990. XmlToI18n.prototype.convert = /**
  19991. * @param {?} message
  19992. * @param {?} url
  19993. * @return {?}
  19994. */
  19995. function (message, url) {
  19996. var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
  19997. this._errors = xmlIcu.errors;
  19998. var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
  19999. [] :
  20000. visitAll(this, xmlIcu.rootNodes);
  20001. return {
  20002. i18nNodes: i18nNodes,
  20003. errors: this._errors,
  20004. };
  20005. };
  20006. /**
  20007. * @param {?} text
  20008. * @param {?} context
  20009. * @return {?}
  20010. */
  20011. XmlToI18n.prototype.visitText = /**
  20012. * @param {?} text
  20013. * @param {?} context
  20014. * @return {?}
  20015. */
  20016. function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); };
  20017. /**
  20018. * @param {?} icu
  20019. * @param {?} context
  20020. * @return {?}
  20021. */
  20022. XmlToI18n.prototype.visitExpansion = /**
  20023. * @param {?} icu
  20024. * @param {?} context
  20025. * @return {?}
  20026. */
  20027. function (icu, context) {
  20028. var /** @type {?} */ caseMap = {};
  20029. visitAll(this, icu.cases).forEach(function (c) {
  20030. caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
  20031. });
  20032. return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
  20033. };
  20034. /**
  20035. * @param {?} icuCase
  20036. * @param {?} context
  20037. * @return {?}
  20038. */
  20039. XmlToI18n.prototype.visitExpansionCase = /**
  20040. * @param {?} icuCase
  20041. * @param {?} context
  20042. * @return {?}
  20043. */
  20044. function (icuCase, context) {
  20045. return {
  20046. value: icuCase.value,
  20047. nodes: visitAll(this, icuCase.expression),
  20048. };
  20049. };
  20050. /**
  20051. * @param {?} el
  20052. * @param {?} context
  20053. * @return {?}
  20054. */
  20055. XmlToI18n.prototype.visitElement = /**
  20056. * @param {?} el
  20057. * @param {?} context
  20058. * @return {?}
  20059. */
  20060. function (el, context) {
  20061. if (el.name === _PLACEHOLDER_TAG$3) {
  20062. var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'name'; });
  20063. if (nameAttr) {
  20064. return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan)));
  20065. }
  20066. this._addError(el, "<" + _PLACEHOLDER_TAG$3 + "> misses the \"name\" attribute");
  20067. }
  20068. else {
  20069. this._addError(el, "Unexpected tag");
  20070. }
  20071. return null;
  20072. };
  20073. /**
  20074. * @param {?} comment
  20075. * @param {?} context
  20076. * @return {?}
  20077. */
  20078. XmlToI18n.prototype.visitComment = /**
  20079. * @param {?} comment
  20080. * @param {?} context
  20081. * @return {?}
  20082. */
  20083. function (comment, context) { };
  20084. /**
  20085. * @param {?} attribute
  20086. * @param {?} context
  20087. * @return {?}
  20088. */
  20089. XmlToI18n.prototype.visitAttribute = /**
  20090. * @param {?} attribute
  20091. * @param {?} context
  20092. * @return {?}
  20093. */
  20094. function (attribute, context) { };
  20095. /**
  20096. * @param {?} node
  20097. * @param {?} message
  20098. * @return {?}
  20099. */
  20100. XmlToI18n.prototype._addError = /**
  20101. * @param {?} node
  20102. * @param {?} message
  20103. * @return {?}
  20104. */
  20105. function (node, message) {
  20106. this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
  20107. };
  20108. return XmlToI18n;
  20109. }());
  20110. /**
  20111. * @fileoverview added by tsickle
  20112. * @suppress {checkTypes} checked by tsc
  20113. */
  20114. /**
  20115. * @license
  20116. * Copyright Google Inc. All Rights Reserved.
  20117. *
  20118. * Use of this source code is governed by an MIT-style license that can be
  20119. * found in the LICENSE file at https://angular.io/license
  20120. */
  20121. var HtmlParser = /** @class */ (function (_super) {
  20122. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(HtmlParser, _super);
  20123. function HtmlParser() {
  20124. return _super.call(this, getHtmlTagDefinition) || this;
  20125. }
  20126. /**
  20127. * @param {?} source
  20128. * @param {?} url
  20129. * @param {?=} parseExpansionForms
  20130. * @param {?=} interpolationConfig
  20131. * @return {?}
  20132. */
  20133. HtmlParser.prototype.parse = /**
  20134. * @param {?} source
  20135. * @param {?} url
  20136. * @param {?=} parseExpansionForms
  20137. * @param {?=} interpolationConfig
  20138. * @return {?}
  20139. */
  20140. function (source, url, parseExpansionForms, interpolationConfig) {
  20141. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  20142. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  20143. return _super.prototype.parse.call(this, source, url, parseExpansionForms, interpolationConfig);
  20144. };
  20145. return HtmlParser;
  20146. }(Parser$1));
  20147. /**
  20148. * @fileoverview added by tsickle
  20149. * @suppress {checkTypes} checked by tsc
  20150. */
  20151. /**
  20152. * @license
  20153. * Copyright Google Inc. All Rights Reserved.
  20154. *
  20155. * Use of this source code is governed by an MIT-style license that can be
  20156. * found in the LICENSE file at https://angular.io/license
  20157. */
  20158. /**
  20159. * A container for translated messages
  20160. */
  20161. var TranslationBundle = /** @class */ (function () {
  20162. function TranslationBundle(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console) {
  20163. if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
  20164. if (missingTranslationStrategy === void 0) { missingTranslationStrategy = MissingTranslationStrategy.Warning; }
  20165. this._i18nNodesByMsgId = _i18nNodesByMsgId;
  20166. this.digest = digest;
  20167. this.mapperFactory = mapperFactory;
  20168. this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, /** @type {?} */ ((mapperFactory)), missingTranslationStrategy, console);
  20169. }
  20170. // Creates a `TranslationBundle` by parsing the given `content` with the `serializer`.
  20171. /**
  20172. * @param {?} content
  20173. * @param {?} url
  20174. * @param {?} serializer
  20175. * @param {?} missingTranslationStrategy
  20176. * @param {?=} console
  20177. * @return {?}
  20178. */
  20179. TranslationBundle.load = /**
  20180. * @param {?} content
  20181. * @param {?} url
  20182. * @param {?} serializer
  20183. * @param {?} missingTranslationStrategy
  20184. * @param {?=} console
  20185. * @return {?}
  20186. */
  20187. function (content, url, serializer, missingTranslationStrategy, console) {
  20188. var _a = serializer.load(content, url), locale = _a.locale, i18nNodesByMsgId = _a.i18nNodesByMsgId;
  20189. var /** @type {?} */ digestFn = function (m) { return serializer.digest(m); };
  20190. var /** @type {?} */ mapperFactory = function (m) { return ((serializer.createNameMapper(m))); };
  20191. return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console);
  20192. };
  20193. // Returns the translation as HTML nodes from the given source message.
  20194. /**
  20195. * @param {?} srcMsg
  20196. * @return {?}
  20197. */
  20198. TranslationBundle.prototype.get = /**
  20199. * @param {?} srcMsg
  20200. * @return {?}
  20201. */
  20202. function (srcMsg) {
  20203. var /** @type {?} */ html = this._i18nToHtml.convert(srcMsg);
  20204. if (html.errors.length) {
  20205. throw new Error(html.errors.join('\n'));
  20206. }
  20207. return html.nodes;
  20208. };
  20209. /**
  20210. * @param {?} srcMsg
  20211. * @return {?}
  20212. */
  20213. TranslationBundle.prototype.has = /**
  20214. * @param {?} srcMsg
  20215. * @return {?}
  20216. */
  20217. function (srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; };
  20218. return TranslationBundle;
  20219. }());
  20220. var I18nToHtmlVisitor = /** @class */ (function () {
  20221. function I18nToHtmlVisitor(_i18nNodesByMsgId, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) {
  20222. if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
  20223. this._i18nNodesByMsgId = _i18nNodesByMsgId;
  20224. this._locale = _locale;
  20225. this._digest = _digest;
  20226. this._mapperFactory = _mapperFactory;
  20227. this._missingTranslationStrategy = _missingTranslationStrategy;
  20228. this._console = _console;
  20229. this._contextStack = [];
  20230. this._errors = [];
  20231. }
  20232. /**
  20233. * @param {?} srcMsg
  20234. * @return {?}
  20235. */
  20236. I18nToHtmlVisitor.prototype.convert = /**
  20237. * @param {?} srcMsg
  20238. * @return {?}
  20239. */
  20240. function (srcMsg) {
  20241. this._contextStack.length = 0;
  20242. this._errors.length = 0;
  20243. // i18n to text
  20244. var /** @type {?} */ text = this._convertToText(srcMsg);
  20245. // text to html
  20246. var /** @type {?} */ url = srcMsg.nodes[0].sourceSpan.start.file.url;
  20247. var /** @type {?} */ html = new HtmlParser().parse(text, url, true);
  20248. return {
  20249. nodes: html.rootNodes,
  20250. errors: this._errors.concat(html.errors),
  20251. };
  20252. };
  20253. /**
  20254. * @param {?} text
  20255. * @param {?=} context
  20256. * @return {?}
  20257. */
  20258. I18nToHtmlVisitor.prototype.visitText = /**
  20259. * @param {?} text
  20260. * @param {?=} context
  20261. * @return {?}
  20262. */
  20263. function (text, context) { return text.value; };
  20264. /**
  20265. * @param {?} container
  20266. * @param {?=} context
  20267. * @return {?}
  20268. */
  20269. I18nToHtmlVisitor.prototype.visitContainer = /**
  20270. * @param {?} container
  20271. * @param {?=} context
  20272. * @return {?}
  20273. */
  20274. function (container, context) {
  20275. var _this = this;
  20276. return container.children.map(function (n) { return n.visit(_this); }).join('');
  20277. };
  20278. /**
  20279. * @param {?} icu
  20280. * @param {?=} context
  20281. * @return {?}
  20282. */
  20283. I18nToHtmlVisitor.prototype.visitIcu = /**
  20284. * @param {?} icu
  20285. * @param {?=} context
  20286. * @return {?}
  20287. */
  20288. function (icu, context) {
  20289. var _this = this;
  20290. var /** @type {?} */ cases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
  20291. // TODO(vicb): Once all format switch to using expression placeholders
  20292. // we should throw when the placeholder is not in the source message
  20293. var /** @type {?} */ exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ?
  20294. this._srcMsg.placeholders[icu.expression] :
  20295. icu.expression;
  20296. return "{" + exp + ", " + icu.type + ", " + cases.join(' ') + "}";
  20297. };
  20298. /**
  20299. * @param {?} ph
  20300. * @param {?=} context
  20301. * @return {?}
  20302. */
  20303. I18nToHtmlVisitor.prototype.visitPlaceholder = /**
  20304. * @param {?} ph
  20305. * @param {?=} context
  20306. * @return {?}
  20307. */
  20308. function (ph, context) {
  20309. var /** @type {?} */ phName = this._mapper(ph.name);
  20310. if (this._srcMsg.placeholders.hasOwnProperty(phName)) {
  20311. return this._srcMsg.placeholders[phName];
  20312. }
  20313. if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) {
  20314. return this._convertToText(this._srcMsg.placeholderToMessage[phName]);
  20315. }
  20316. this._addError(ph, "Unknown placeholder \"" + ph.name + "\"");
  20317. return '';
  20318. };
  20319. // Loaded message contains only placeholders (vs tag and icu placeholders).
  20320. // However when a translation can not be found, we need to serialize the source message
  20321. // which can contain tag placeholders
  20322. /**
  20323. * @param {?} ph
  20324. * @param {?=} context
  20325. * @return {?}
  20326. */
  20327. I18nToHtmlVisitor.prototype.visitTagPlaceholder = /**
  20328. * @param {?} ph
  20329. * @param {?=} context
  20330. * @return {?}
  20331. */
  20332. function (ph, context) {
  20333. var _this = this;
  20334. var /** @type {?} */ tag = "" + ph.tag;
  20335. var /** @type {?} */ attrs = Object.keys(ph.attrs).map(function (name) { return name + "=\"" + ph.attrs[name] + "\""; }).join(' ');
  20336. if (ph.isVoid) {
  20337. return "<" + tag + " " + attrs + "/>";
  20338. }
  20339. var /** @type {?} */ children = ph.children.map(function (c) { return c.visit(_this); }).join('');
  20340. return "<" + tag + " " + attrs + ">" + children + "</" + tag + ">";
  20341. };
  20342. // Loaded message contains only placeholders (vs tag and icu placeholders).
  20343. // However when a translation can not be found, we need to serialize the source message
  20344. // which can contain tag placeholders
  20345. /**
  20346. * @param {?} ph
  20347. * @param {?=} context
  20348. * @return {?}
  20349. */
  20350. I18nToHtmlVisitor.prototype.visitIcuPlaceholder = /**
  20351. * @param {?} ph
  20352. * @param {?=} context
  20353. * @return {?}
  20354. */
  20355. function (ph, context) {
  20356. // An ICU placeholder references the source message to be serialized
  20357. return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]);
  20358. };
  20359. /**
  20360. * Convert a source message to a translated text string:
  20361. * - text nodes are replaced with their translation,
  20362. * - placeholders are replaced with their content,
  20363. * - ICU nodes are converted to ICU expressions.
  20364. * @param {?} srcMsg
  20365. * @return {?}
  20366. */
  20367. I18nToHtmlVisitor.prototype._convertToText = /**
  20368. * Convert a source message to a translated text string:
  20369. * - text nodes are replaced with their translation,
  20370. * - placeholders are replaced with their content,
  20371. * - ICU nodes are converted to ICU expressions.
  20372. * @param {?} srcMsg
  20373. * @return {?}
  20374. */
  20375. function (srcMsg) {
  20376. var _this = this;
  20377. var /** @type {?} */ id = this._digest(srcMsg);
  20378. var /** @type {?} */ mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null;
  20379. var /** @type {?} */ nodes;
  20380. this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper });
  20381. this._srcMsg = srcMsg;
  20382. if (this._i18nNodesByMsgId.hasOwnProperty(id)) {
  20383. // When there is a translation use its nodes as the source
  20384. // And create a mapper to convert serialized placeholder names to internal names
  20385. nodes = this._i18nNodesByMsgId[id];
  20386. this._mapper = function (name) { return mapper ? /** @type {?} */ ((mapper.toInternalName(name))) : name; };
  20387. }
  20388. else {
  20389. // When no translation has been found
  20390. // - report an error / a warning / nothing,
  20391. // - use the nodes from the original message
  20392. // - placeholders are already internal and need no mapper
  20393. if (this._missingTranslationStrategy === MissingTranslationStrategy.Error) {
  20394. var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
  20395. this._addError(srcMsg.nodes[0], "Missing translation for message \"" + id + "\"" + ctx);
  20396. }
  20397. else if (this._console &&
  20398. this._missingTranslationStrategy === MissingTranslationStrategy.Warning) {
  20399. var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
  20400. this._console.warn("Missing translation for message \"" + id + "\"" + ctx);
  20401. }
  20402. nodes = srcMsg.nodes;
  20403. this._mapper = function (name) { return name; };
  20404. }
  20405. var /** @type {?} */ text = nodes.map(function (node) { return node.visit(_this); }).join('');
  20406. var /** @type {?} */ context = /** @type {?} */ ((this._contextStack.pop()));
  20407. this._srcMsg = context.msg;
  20408. this._mapper = context.mapper;
  20409. return text;
  20410. };
  20411. /**
  20412. * @param {?} el
  20413. * @param {?} msg
  20414. * @return {?}
  20415. */
  20416. I18nToHtmlVisitor.prototype._addError = /**
  20417. * @param {?} el
  20418. * @param {?} msg
  20419. * @return {?}
  20420. */
  20421. function (el, msg) {
  20422. this._errors.push(new I18nError(el.sourceSpan, msg));
  20423. };
  20424. return I18nToHtmlVisitor;
  20425. }());
  20426. /**
  20427. * @fileoverview added by tsickle
  20428. * @suppress {checkTypes} checked by tsc
  20429. */
  20430. /**
  20431. * @license
  20432. * Copyright Google Inc. All Rights Reserved.
  20433. *
  20434. * Use of this source code is governed by an MIT-style license that can be
  20435. * found in the LICENSE file at https://angular.io/license
  20436. */
  20437. var I18NHtmlParser = /** @class */ (function () {
  20438. function I18NHtmlParser(_htmlParser, translations, translationsFormat, missingTranslation, console) {
  20439. if (missingTranslation === void 0) { missingTranslation = MissingTranslationStrategy.Warning; }
  20440. this._htmlParser = _htmlParser;
  20441. if (translations) {
  20442. var /** @type {?} */ serializer = createSerializer(translationsFormat);
  20443. this._translationBundle =
  20444. TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console);
  20445. }
  20446. else {
  20447. this._translationBundle =
  20448. new TranslationBundle({}, null, digest, undefined, missingTranslation, console);
  20449. }
  20450. }
  20451. /**
  20452. * @param {?} source
  20453. * @param {?} url
  20454. * @param {?=} parseExpansionForms
  20455. * @param {?=} interpolationConfig
  20456. * @return {?}
  20457. */
  20458. I18NHtmlParser.prototype.parse = /**
  20459. * @param {?} source
  20460. * @param {?} url
  20461. * @param {?=} parseExpansionForms
  20462. * @param {?=} interpolationConfig
  20463. * @return {?}
  20464. */
  20465. function (source, url, parseExpansionForms, interpolationConfig) {
  20466. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  20467. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  20468. var /** @type {?} */ parseResult = this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig);
  20469. if (parseResult.errors.length) {
  20470. return new ParseTreeResult(parseResult.rootNodes, parseResult.errors);
  20471. }
  20472. return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {});
  20473. };
  20474. return I18NHtmlParser;
  20475. }());
  20476. /**
  20477. * @param {?=} format
  20478. * @return {?}
  20479. */
  20480. function createSerializer(format) {
  20481. format = (format || 'xlf').toLowerCase();
  20482. switch (format) {
  20483. case 'xmb':
  20484. return new Xmb();
  20485. case 'xtb':
  20486. return new Xtb();
  20487. case 'xliff2':
  20488. case 'xlf2':
  20489. return new Xliff2();
  20490. case 'xliff':
  20491. case 'xlf':
  20492. default:
  20493. return new Xliff();
  20494. }
  20495. }
  20496. /**
  20497. * @fileoverview added by tsickle
  20498. * @suppress {checkTypes} checked by tsc
  20499. */
  20500. /**
  20501. * @license
  20502. * Copyright Google Inc. All Rights Reserved.
  20503. *
  20504. * Use of this source code is governed by an MIT-style license that can be
  20505. * found in the LICENSE file at https://angular.io/license
  20506. */
  20507. var STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
  20508. var GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./;
  20509. var JIT_SUMMARY_FILE = /\.ngsummary\./;
  20510. var JIT_SUMMARY_NAME = /NgSummary$/;
  20511. /**
  20512. * @param {?} filePath
  20513. * @param {?=} forceSourceFile
  20514. * @return {?}
  20515. */
  20516. function ngfactoryFilePath(filePath, forceSourceFile) {
  20517. if (forceSourceFile === void 0) { forceSourceFile = false; }
  20518. var /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile);
  20519. return urlWithSuffix[0] + ".ngfactory" + normalizeGenFileSuffix(urlWithSuffix[1]);
  20520. }
  20521. /**
  20522. * @param {?} filePath
  20523. * @return {?}
  20524. */
  20525. function stripGeneratedFileSuffix(filePath) {
  20526. return filePath.replace(GENERATED_FILE, '.');
  20527. }
  20528. /**
  20529. * @param {?} filePath
  20530. * @return {?}
  20531. */
  20532. function isGeneratedFile(filePath) {
  20533. return GENERATED_FILE.test(filePath);
  20534. }
  20535. /**
  20536. * @param {?} path
  20537. * @param {?=} forceSourceFile
  20538. * @return {?}
  20539. */
  20540. function splitTypescriptSuffix(path, forceSourceFile) {
  20541. if (forceSourceFile === void 0) { forceSourceFile = false; }
  20542. if (path.endsWith('.d.ts')) {
  20543. return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts'];
  20544. }
  20545. var /** @type {?} */ lastDot = path.lastIndexOf('.');
  20546. if (lastDot !== -1) {
  20547. return [path.substring(0, lastDot), path.substring(lastDot)];
  20548. }
  20549. return [path, ''];
  20550. }
  20551. /**
  20552. * @param {?} srcFileSuffix
  20553. * @return {?}
  20554. */
  20555. function normalizeGenFileSuffix(srcFileSuffix) {
  20556. return srcFileSuffix === '.tsx' ? '.ts' : srcFileSuffix;
  20557. }
  20558. /**
  20559. * @param {?} fileName
  20560. * @return {?}
  20561. */
  20562. function summaryFileName(fileName) {
  20563. var /** @type {?} */ fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, '');
  20564. return fileNameWithoutSuffix + ".ngsummary.json";
  20565. }
  20566. /**
  20567. * @param {?} fileName
  20568. * @param {?=} forceSourceFile
  20569. * @return {?}
  20570. */
  20571. function summaryForJitFileName(fileName, forceSourceFile) {
  20572. if (forceSourceFile === void 0) { forceSourceFile = false; }
  20573. var /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile);
  20574. return urlWithSuffix[0] + ".ngsummary" + urlWithSuffix[1];
  20575. }
  20576. /**
  20577. * @param {?} filePath
  20578. * @return {?}
  20579. */
  20580. function stripSummaryForJitFileSuffix(filePath) {
  20581. return filePath.replace(JIT_SUMMARY_FILE, '.');
  20582. }
  20583. /**
  20584. * @param {?} symbolName
  20585. * @return {?}
  20586. */
  20587. function summaryForJitName(symbolName) {
  20588. return symbolName + "NgSummary";
  20589. }
  20590. /**
  20591. * @param {?} symbolName
  20592. * @return {?}
  20593. */
  20594. function stripSummaryForJitNameSuffix(symbolName) {
  20595. return symbolName.replace(JIT_SUMMARY_NAME, '');
  20596. }
  20597. var LOWERED_SYMBOL = /\u0275\d+/;
  20598. /**
  20599. * @param {?} name
  20600. * @return {?}
  20601. */
  20602. function isLoweredSymbol(name) {
  20603. return LOWERED_SYMBOL.test(name);
  20604. }
  20605. /**
  20606. * @param {?} id
  20607. * @return {?}
  20608. */
  20609. function createLoweredSymbol(id) {
  20610. return "\u0275" + id;
  20611. }
  20612. /**
  20613. * @fileoverview added by tsickle
  20614. * @suppress {checkTypes} checked by tsc
  20615. */
  20616. /**
  20617. * @license
  20618. * Copyright Google Inc. All Rights Reserved.
  20619. *
  20620. * Use of this source code is governed by an MIT-style license that can be
  20621. * found in the LICENSE file at https://angular.io/license
  20622. */
  20623. var CORE = '@angular/core';
  20624. var Identifiers = /** @class */ (function () {
  20625. function Identifiers() {
  20626. }
  20627. Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = {
  20628. name: 'ANALYZE_FOR_ENTRY_COMPONENTS',
  20629. moduleName: CORE,
  20630. };
  20631. Identifiers.ElementRef = { name: 'ElementRef', moduleName: CORE };
  20632. Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleName: CORE };
  20633. Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleName: CORE };
  20634. Identifiers.ChangeDetectorRef = {
  20635. name: 'ChangeDetectorRef',
  20636. moduleName: CORE,
  20637. };
  20638. Identifiers.QueryList = { name: 'QueryList', moduleName: CORE };
  20639. Identifiers.TemplateRef = { name: 'TemplateRef', moduleName: CORE };
  20640. Identifiers.CodegenComponentFactoryResolver = {
  20641. name: 'ɵCodegenComponentFactoryResolver',
  20642. moduleName: CORE,
  20643. };
  20644. Identifiers.ComponentFactoryResolver = {
  20645. name: 'ComponentFactoryResolver',
  20646. moduleName: CORE,
  20647. };
  20648. Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleName: CORE };
  20649. Identifiers.ComponentRef = { name: 'ComponentRef', moduleName: CORE };
  20650. Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleName: CORE };
  20651. Identifiers.createModuleFactory = {
  20652. name: 'ɵcmf',
  20653. moduleName: CORE,
  20654. };
  20655. Identifiers.moduleDef = {
  20656. name: 'ɵmod',
  20657. moduleName: CORE,
  20658. };
  20659. Identifiers.moduleProviderDef = {
  20660. name: 'ɵmpd',
  20661. moduleName: CORE,
  20662. };
  20663. Identifiers.RegisterModuleFactoryFn = {
  20664. name: 'ɵregisterModuleFactory',
  20665. moduleName: CORE,
  20666. };
  20667. Identifiers.Injector = { name: 'Injector', moduleName: CORE };
  20668. Identifiers.ViewEncapsulation = {
  20669. name: 'ViewEncapsulation',
  20670. moduleName: CORE,
  20671. };
  20672. Identifiers.ChangeDetectionStrategy = {
  20673. name: 'ChangeDetectionStrategy',
  20674. moduleName: CORE,
  20675. };
  20676. Identifiers.SecurityContext = {
  20677. name: 'SecurityContext',
  20678. moduleName: CORE,
  20679. };
  20680. Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleName: CORE };
  20681. Identifiers.TRANSLATIONS_FORMAT = {
  20682. name: 'TRANSLATIONS_FORMAT',
  20683. moduleName: CORE,
  20684. };
  20685. Identifiers.inlineInterpolate = {
  20686. name: 'ɵinlineInterpolate',
  20687. moduleName: CORE,
  20688. };
  20689. Identifiers.interpolate = { name: 'ɵinterpolate', moduleName: CORE };
  20690. Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleName: CORE };
  20691. Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleName: CORE };
  20692. Identifiers.Renderer = { name: 'Renderer', moduleName: CORE };
  20693. Identifiers.viewDef = { name: 'ɵvid', moduleName: CORE };
  20694. Identifiers.elementDef = { name: 'ɵeld', moduleName: CORE };
  20695. Identifiers.anchorDef = { name: 'ɵand', moduleName: CORE };
  20696. Identifiers.textDef = { name: 'ɵted', moduleName: CORE };
  20697. Identifiers.directiveDef = { name: 'ɵdid', moduleName: CORE };
  20698. Identifiers.providerDef = { name: 'ɵprd', moduleName: CORE };
  20699. Identifiers.queryDef = { name: 'ɵqud', moduleName: CORE };
  20700. Identifiers.pureArrayDef = { name: 'ɵpad', moduleName: CORE };
  20701. Identifiers.pureObjectDef = { name: 'ɵpod', moduleName: CORE };
  20702. Identifiers.purePipeDef = { name: 'ɵppd', moduleName: CORE };
  20703. Identifiers.pipeDef = { name: 'ɵpid', moduleName: CORE };
  20704. Identifiers.nodeValue = { name: 'ɵnov', moduleName: CORE };
  20705. Identifiers.ngContentDef = { name: 'ɵncd', moduleName: CORE };
  20706. Identifiers.unwrapValue = { name: 'ɵunv', moduleName: CORE };
  20707. Identifiers.createRendererType2 = { name: 'ɵcrt', moduleName: CORE };
  20708. // type only
  20709. Identifiers.RendererType2 = {
  20710. name: 'RendererType2',
  20711. moduleName: CORE,
  20712. };
  20713. // type only
  20714. Identifiers.ViewDefinition = {
  20715. name: 'ɵViewDefinition',
  20716. moduleName: CORE,
  20717. };
  20718. Identifiers.createComponentFactory = { name: 'ɵccf', moduleName: CORE };
  20719. return Identifiers;
  20720. }());
  20721. /**
  20722. * @param {?} reference
  20723. * @return {?}
  20724. */
  20725. function createTokenForReference(reference) {
  20726. return { identifier: { reference: reference } };
  20727. }
  20728. /**
  20729. * @param {?} reflector
  20730. * @param {?} reference
  20731. * @return {?}
  20732. */
  20733. function createTokenForExternalReference(reflector, reference) {
  20734. return createTokenForReference(reflector.resolveExternalReference(reference));
  20735. }
  20736. /**
  20737. * @fileoverview added by tsickle
  20738. * @suppress {checkTypes} checked by tsc
  20739. */
  20740. /**
  20741. * @license
  20742. * Copyright Google Inc. All Rights Reserved.
  20743. *
  20744. * Use of this source code is governed by an MIT-style license that can be
  20745. * found in the LICENSE file at https://angular.io/license
  20746. */
  20747. /** @enum {number} */
  20748. var LifecycleHooks = {
  20749. OnInit: 0,
  20750. OnDestroy: 1,
  20751. DoCheck: 2,
  20752. OnChanges: 3,
  20753. AfterContentInit: 4,
  20754. AfterContentChecked: 5,
  20755. AfterViewInit: 6,
  20756. AfterViewChecked: 7,
  20757. };
  20758. LifecycleHooks[LifecycleHooks.OnInit] = "OnInit";
  20759. LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy";
  20760. LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck";
  20761. LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges";
  20762. LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit";
  20763. LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked";
  20764. LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit";
  20765. LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked";
  20766. var LIFECYCLE_HOOKS_VALUES = [
  20767. LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
  20768. LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
  20769. LifecycleHooks.AfterViewChecked
  20770. ];
  20771. /**
  20772. * @param {?} reflector
  20773. * @param {?} hook
  20774. * @param {?} token
  20775. * @return {?}
  20776. */
  20777. function hasLifecycleHook(reflector, hook, token) {
  20778. return reflector.hasLifecycleHook(token, getHookName(hook));
  20779. }
  20780. /**
  20781. * @param {?} reflector
  20782. * @param {?} token
  20783. * @return {?}
  20784. */
  20785. function getAllLifecycleHooks(reflector, token) {
  20786. return LIFECYCLE_HOOKS_VALUES.filter(function (hook) { return hasLifecycleHook(reflector, hook, token); });
  20787. }
  20788. /**
  20789. * @param {?} hook
  20790. * @return {?}
  20791. */
  20792. function getHookName(hook) {
  20793. switch (hook) {
  20794. case LifecycleHooks.OnInit:
  20795. return 'ngOnInit';
  20796. case LifecycleHooks.OnDestroy:
  20797. return 'ngOnDestroy';
  20798. case LifecycleHooks.DoCheck:
  20799. return 'ngDoCheck';
  20800. case LifecycleHooks.OnChanges:
  20801. return 'ngOnChanges';
  20802. case LifecycleHooks.AfterContentInit:
  20803. return 'ngAfterContentInit';
  20804. case LifecycleHooks.AfterContentChecked:
  20805. return 'ngAfterContentChecked';
  20806. case LifecycleHooks.AfterViewInit:
  20807. return 'ngAfterViewInit';
  20808. case LifecycleHooks.AfterViewChecked:
  20809. return 'ngAfterViewChecked';
  20810. }
  20811. }
  20812. /**
  20813. * @fileoverview added by tsickle
  20814. * @suppress {checkTypes} checked by tsc
  20815. */
  20816. /**
  20817. * @license
  20818. * Copyright Google Inc. All Rights Reserved.
  20819. *
  20820. * Use of this source code is governed by an MIT-style license that can be
  20821. * found in the LICENSE file at https://angular.io/license
  20822. */
  20823. var _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + //":not("
  20824. '([-\\w]+)|' + // "tag"
  20825. '(?:\\.([-\\w]+))|' + // ".class"
  20826. '(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name]", "[name=value]",
  20827. '(\\))|' + // ")"
  20828. '(\\s*,\\s*)', // ","
  20829. 'g');
  20830. /**
  20831. * A css selector contains an element name,
  20832. * css classes and attribute/value pairs with the purpose
  20833. * of selecting subsets out of them.
  20834. */
  20835. var CssSelector = /** @class */ (function () {
  20836. function CssSelector() {
  20837. this.element = null;
  20838. this.classNames = [];
  20839. this.attrs = [];
  20840. this.notSelectors = [];
  20841. }
  20842. /**
  20843. * @param {?} selector
  20844. * @return {?}
  20845. */
  20846. CssSelector.parse = /**
  20847. * @param {?} selector
  20848. * @return {?}
  20849. */
  20850. function (selector) {
  20851. var /** @type {?} */ results = [];
  20852. var /** @type {?} */ _addResult = function (res, cssSel) {
  20853. if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 &&
  20854. cssSel.attrs.length == 0) {
  20855. cssSel.element = '*';
  20856. }
  20857. res.push(cssSel);
  20858. };
  20859. var /** @type {?} */ cssSelector = new CssSelector();
  20860. var /** @type {?} */ match;
  20861. var /** @type {?} */ current = cssSelector;
  20862. var /** @type {?} */ inNot = false;
  20863. _SELECTOR_REGEXP.lastIndex = 0;
  20864. while (match = _SELECTOR_REGEXP.exec(selector)) {
  20865. if (match[1]) {
  20866. if (inNot) {
  20867. throw new Error('Nesting :not is not allowed in a selector');
  20868. }
  20869. inNot = true;
  20870. current = new CssSelector();
  20871. cssSelector.notSelectors.push(current);
  20872. }
  20873. if (match[2]) {
  20874. current.setElement(match[2]);
  20875. }
  20876. if (match[3]) {
  20877. current.addClassName(match[3]);
  20878. }
  20879. if (match[4]) {
  20880. current.addAttribute(match[4], match[6]);
  20881. }
  20882. if (match[7]) {
  20883. inNot = false;
  20884. current = cssSelector;
  20885. }
  20886. if (match[8]) {
  20887. if (inNot) {
  20888. throw new Error('Multiple selectors in :not are not supported');
  20889. }
  20890. _addResult(results, cssSelector);
  20891. cssSelector = current = new CssSelector();
  20892. }
  20893. }
  20894. _addResult(results, cssSelector);
  20895. return results;
  20896. };
  20897. /**
  20898. * @return {?}
  20899. */
  20900. CssSelector.prototype.isElementSelector = /**
  20901. * @return {?}
  20902. */
  20903. function () {
  20904. return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 &&
  20905. this.notSelectors.length === 0;
  20906. };
  20907. /**
  20908. * @return {?}
  20909. */
  20910. CssSelector.prototype.hasElementSelector = /**
  20911. * @return {?}
  20912. */
  20913. function () { return !!this.element; };
  20914. /**
  20915. * @param {?=} element
  20916. * @return {?}
  20917. */
  20918. CssSelector.prototype.setElement = /**
  20919. * @param {?=} element
  20920. * @return {?}
  20921. */
  20922. function (element) {
  20923. if (element === void 0) { element = null; }
  20924. this.element = element;
  20925. };
  20926. /** Gets a template string for an element that matches the selector. */
  20927. /**
  20928. * Gets a template string for an element that matches the selector.
  20929. * @return {?}
  20930. */
  20931. CssSelector.prototype.getMatchingElementTemplate = /**
  20932. * Gets a template string for an element that matches the selector.
  20933. * @return {?}
  20934. */
  20935. function () {
  20936. var /** @type {?} */ tagName = this.element || 'div';
  20937. var /** @type {?} */ classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : '';
  20938. var /** @type {?} */ attrs = '';
  20939. for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) {
  20940. var /** @type {?} */ attrName = this.attrs[i];
  20941. var /** @type {?} */ attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : '';
  20942. attrs += " " + attrName + attrValue;
  20943. }
  20944. return getHtmlTagDefinition(tagName).isVoid ? "<" + tagName + classAttr + attrs + "/>" :
  20945. "<" + tagName + classAttr + attrs + "></" + tagName + ">";
  20946. };
  20947. /**
  20948. * @param {?} name
  20949. * @param {?=} value
  20950. * @return {?}
  20951. */
  20952. CssSelector.prototype.addAttribute = /**
  20953. * @param {?} name
  20954. * @param {?=} value
  20955. * @return {?}
  20956. */
  20957. function (name, value) {
  20958. if (value === void 0) { value = ''; }
  20959. this.attrs.push(name, value && value.toLowerCase() || '');
  20960. };
  20961. /**
  20962. * @param {?} name
  20963. * @return {?}
  20964. */
  20965. CssSelector.prototype.addClassName = /**
  20966. * @param {?} name
  20967. * @return {?}
  20968. */
  20969. function (name) { this.classNames.push(name.toLowerCase()); };
  20970. /**
  20971. * @return {?}
  20972. */
  20973. CssSelector.prototype.toString = /**
  20974. * @return {?}
  20975. */
  20976. function () {
  20977. var /** @type {?} */ res = this.element || '';
  20978. if (this.classNames) {
  20979. this.classNames.forEach(function (klass) { return res += "." + klass; });
  20980. }
  20981. if (this.attrs) {
  20982. for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) {
  20983. var /** @type {?} */ name_1 = this.attrs[i];
  20984. var /** @type {?} */ value = this.attrs[i + 1];
  20985. res += "[" + name_1 + (value ? '=' + value : '') + "]";
  20986. }
  20987. }
  20988. this.notSelectors.forEach(function (notSelector) { return res += ":not(" + notSelector + ")"; });
  20989. return res;
  20990. };
  20991. return CssSelector;
  20992. }());
  20993. /**
  20994. * Reads a list of CssSelectors and allows to calculate which ones
  20995. * are contained in a given CssSelector.
  20996. */
  20997. var SelectorMatcher = /** @class */ (function () {
  20998. function SelectorMatcher() {
  20999. this._elementMap = new Map();
  21000. this._elementPartialMap = new Map();
  21001. this._classMap = new Map();
  21002. this._classPartialMap = new Map();
  21003. this._attrValueMap = new Map();
  21004. this._attrValuePartialMap = new Map();
  21005. this._listContexts = [];
  21006. }
  21007. /**
  21008. * @param {?} notSelectors
  21009. * @return {?}
  21010. */
  21011. SelectorMatcher.createNotMatcher = /**
  21012. * @param {?} notSelectors
  21013. * @return {?}
  21014. */
  21015. function (notSelectors) {
  21016. var /** @type {?} */ notMatcher = new SelectorMatcher();
  21017. notMatcher.addSelectables(notSelectors, null);
  21018. return notMatcher;
  21019. };
  21020. /**
  21021. * @param {?} cssSelectors
  21022. * @param {?=} callbackCtxt
  21023. * @return {?}
  21024. */
  21025. SelectorMatcher.prototype.addSelectables = /**
  21026. * @param {?} cssSelectors
  21027. * @param {?=} callbackCtxt
  21028. * @return {?}
  21029. */
  21030. function (cssSelectors, callbackCtxt) {
  21031. var /** @type {?} */ listContext = /** @type {?} */ ((null));
  21032. if (cssSelectors.length > 1) {
  21033. listContext = new SelectorListContext(cssSelectors);
  21034. this._listContexts.push(listContext);
  21035. }
  21036. for (var /** @type {?} */ i = 0; i < cssSelectors.length; i++) {
  21037. this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
  21038. }
  21039. };
  21040. /**
  21041. * Add an object that can be found later on by calling `match`.
  21042. * @param {?} cssSelector A css selector
  21043. * @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function
  21044. * @param {?} listContext
  21045. * @return {?}
  21046. */
  21047. SelectorMatcher.prototype._addSelectable = /**
  21048. * Add an object that can be found later on by calling `match`.
  21049. * @param {?} cssSelector A css selector
  21050. * @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function
  21051. * @param {?} listContext
  21052. * @return {?}
  21053. */
  21054. function (cssSelector, callbackCtxt, listContext) {
  21055. var /** @type {?} */ matcher = this;
  21056. var /** @type {?} */ element = cssSelector.element;
  21057. var /** @type {?} */ classNames = cssSelector.classNames;
  21058. var /** @type {?} */ attrs = cssSelector.attrs;
  21059. var /** @type {?} */ selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
  21060. if (element) {
  21061. var /** @type {?} */ isTerminal = attrs.length === 0 && classNames.length === 0;
  21062. if (isTerminal) {
  21063. this._addTerminal(matcher._elementMap, element, selectable);
  21064. }
  21065. else {
  21066. matcher = this._addPartial(matcher._elementPartialMap, element);
  21067. }
  21068. }
  21069. if (classNames) {
  21070. for (var /** @type {?} */ i = 0; i < classNames.length; i++) {
  21071. var /** @type {?} */ isTerminal = attrs.length === 0 && i === classNames.length - 1;
  21072. var /** @type {?} */ className = classNames[i];
  21073. if (isTerminal) {
  21074. this._addTerminal(matcher._classMap, className, selectable);
  21075. }
  21076. else {
  21077. matcher = this._addPartial(matcher._classPartialMap, className);
  21078. }
  21079. }
  21080. }
  21081. if (attrs) {
  21082. for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
  21083. var /** @type {?} */ isTerminal = i === attrs.length - 2;
  21084. var /** @type {?} */ name_2 = attrs[i];
  21085. var /** @type {?} */ value = attrs[i + 1];
  21086. if (isTerminal) {
  21087. var /** @type {?} */ terminalMap = matcher._attrValueMap;
  21088. var /** @type {?} */ terminalValuesMap = terminalMap.get(name_2);
  21089. if (!terminalValuesMap) {
  21090. terminalValuesMap = new Map();
  21091. terminalMap.set(name_2, terminalValuesMap);
  21092. }
  21093. this._addTerminal(terminalValuesMap, value, selectable);
  21094. }
  21095. else {
  21096. var /** @type {?} */ partialMap = matcher._attrValuePartialMap;
  21097. var /** @type {?} */ partialValuesMap = partialMap.get(name_2);
  21098. if (!partialValuesMap) {
  21099. partialValuesMap = new Map();
  21100. partialMap.set(name_2, partialValuesMap);
  21101. }
  21102. matcher = this._addPartial(partialValuesMap, value);
  21103. }
  21104. }
  21105. }
  21106. };
  21107. /**
  21108. * @param {?} map
  21109. * @param {?} name
  21110. * @param {?} selectable
  21111. * @return {?}
  21112. */
  21113. SelectorMatcher.prototype._addTerminal = /**
  21114. * @param {?} map
  21115. * @param {?} name
  21116. * @param {?} selectable
  21117. * @return {?}
  21118. */
  21119. function (map, name, selectable) {
  21120. var /** @type {?} */ terminalList = map.get(name);
  21121. if (!terminalList) {
  21122. terminalList = [];
  21123. map.set(name, terminalList);
  21124. }
  21125. terminalList.push(selectable);
  21126. };
  21127. /**
  21128. * @param {?} map
  21129. * @param {?} name
  21130. * @return {?}
  21131. */
  21132. SelectorMatcher.prototype._addPartial = /**
  21133. * @param {?} map
  21134. * @param {?} name
  21135. * @return {?}
  21136. */
  21137. function (map, name) {
  21138. var /** @type {?} */ matcher = map.get(name);
  21139. if (!matcher) {
  21140. matcher = new SelectorMatcher();
  21141. map.set(name, matcher);
  21142. }
  21143. return matcher;
  21144. };
  21145. /**
  21146. * Find the objects that have been added via `addSelectable`
  21147. * whose css selector is contained in the given css selector.
  21148. * @param cssSelector A css selector
  21149. * @param matchedCallback This callback will be called with the object handed into `addSelectable`
  21150. * @return boolean true if a match was found
  21151. */
  21152. /**
  21153. * Find the objects that have been added via `addSelectable`
  21154. * whose css selector is contained in the given css selector.
  21155. * @param {?} cssSelector A css selector
  21156. * @param {?} matchedCallback This callback will be called with the object handed into `addSelectable`
  21157. * @return {?} boolean true if a match was found
  21158. */
  21159. SelectorMatcher.prototype.match = /**
  21160. * Find the objects that have been added via `addSelectable`
  21161. * whose css selector is contained in the given css selector.
  21162. * @param {?} cssSelector A css selector
  21163. * @param {?} matchedCallback This callback will be called with the object handed into `addSelectable`
  21164. * @return {?} boolean true if a match was found
  21165. */
  21166. function (cssSelector, matchedCallback) {
  21167. var /** @type {?} */ result = false;
  21168. var /** @type {?} */ element = /** @type {?} */ ((cssSelector.element));
  21169. var /** @type {?} */ classNames = cssSelector.classNames;
  21170. var /** @type {?} */ attrs = cssSelector.attrs;
  21171. for (var /** @type {?} */ i = 0; i < this._listContexts.length; i++) {
  21172. this._listContexts[i].alreadyMatched = false;
  21173. }
  21174. result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
  21175. result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) ||
  21176. result;
  21177. if (classNames) {
  21178. for (var /** @type {?} */ i = 0; i < classNames.length; i++) {
  21179. var /** @type {?} */ className = classNames[i];
  21180. result =
  21181. this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
  21182. result =
  21183. this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) ||
  21184. result;
  21185. }
  21186. }
  21187. if (attrs) {
  21188. for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
  21189. var /** @type {?} */ name_3 = attrs[i];
  21190. var /** @type {?} */ value = attrs[i + 1];
  21191. var /** @type {?} */ terminalValuesMap = /** @type {?} */ ((this._attrValueMap.get(name_3)));
  21192. if (value) {
  21193. result =
  21194. this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result;
  21195. }
  21196. result =
  21197. this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
  21198. var /** @type {?} */ partialValuesMap = /** @type {?} */ ((this._attrValuePartialMap.get(name_3)));
  21199. if (value) {
  21200. result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;
  21201. }
  21202. result =
  21203. this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
  21204. }
  21205. }
  21206. return result;
  21207. };
  21208. /** @internal */
  21209. /**
  21210. * \@internal
  21211. * @param {?} map
  21212. * @param {?} name
  21213. * @param {?} cssSelector
  21214. * @param {?} matchedCallback
  21215. * @return {?}
  21216. */
  21217. SelectorMatcher.prototype._matchTerminal = /**
  21218. * \@internal
  21219. * @param {?} map
  21220. * @param {?} name
  21221. * @param {?} cssSelector
  21222. * @param {?} matchedCallback
  21223. * @return {?}
  21224. */
  21225. function (map, name, cssSelector, matchedCallback) {
  21226. if (!map || typeof name !== 'string') {
  21227. return false;
  21228. }
  21229. var /** @type {?} */ selectables = map.get(name) || [];
  21230. var /** @type {?} */ starSelectables = /** @type {?} */ ((map.get('*')));
  21231. if (starSelectables) {
  21232. selectables = selectables.concat(starSelectables);
  21233. }
  21234. if (selectables.length === 0) {
  21235. return false;
  21236. }
  21237. var /** @type {?} */ selectable;
  21238. var /** @type {?} */ result = false;
  21239. for (var /** @type {?} */ i = 0; i < selectables.length; i++) {
  21240. selectable = selectables[i];
  21241. result = selectable.finalize(cssSelector, matchedCallback) || result;
  21242. }
  21243. return result;
  21244. };
  21245. /** @internal */
  21246. /**
  21247. * \@internal
  21248. * @param {?} map
  21249. * @param {?} name
  21250. * @param {?} cssSelector
  21251. * @param {?} matchedCallback
  21252. * @return {?}
  21253. */
  21254. SelectorMatcher.prototype._matchPartial = /**
  21255. * \@internal
  21256. * @param {?} map
  21257. * @param {?} name
  21258. * @param {?} cssSelector
  21259. * @param {?} matchedCallback
  21260. * @return {?}
  21261. */
  21262. function (map, name, cssSelector, matchedCallback) {
  21263. if (!map || typeof name !== 'string') {
  21264. return false;
  21265. }
  21266. var /** @type {?} */ nestedSelector = map.get(name);
  21267. if (!nestedSelector) {
  21268. return false;
  21269. }
  21270. // TODO(perf): get rid of recursion and measure again
  21271. // TODO(perf): don't pass the whole selector into the recursion,
  21272. // but only the not processed parts
  21273. return nestedSelector.match(cssSelector, matchedCallback);
  21274. };
  21275. return SelectorMatcher;
  21276. }());
  21277. var SelectorListContext = /** @class */ (function () {
  21278. function SelectorListContext(selectors) {
  21279. this.selectors = selectors;
  21280. this.alreadyMatched = false;
  21281. }
  21282. return SelectorListContext;
  21283. }());
  21284. var SelectorContext = /** @class */ (function () {
  21285. function SelectorContext(selector, cbContext, listContext) {
  21286. this.selector = selector;
  21287. this.cbContext = cbContext;
  21288. this.listContext = listContext;
  21289. this.notSelectors = selector.notSelectors;
  21290. }
  21291. /**
  21292. * @param {?} cssSelector
  21293. * @param {?} callback
  21294. * @return {?}
  21295. */
  21296. SelectorContext.prototype.finalize = /**
  21297. * @param {?} cssSelector
  21298. * @param {?} callback
  21299. * @return {?}
  21300. */
  21301. function (cssSelector, callback) {
  21302. var /** @type {?} */ result = true;
  21303. if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
  21304. var /** @type {?} */ notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
  21305. result = !notMatcher.match(cssSelector, null);
  21306. }
  21307. if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
  21308. if (this.listContext) {
  21309. this.listContext.alreadyMatched = true;
  21310. }
  21311. callback(this.selector, this.cbContext);
  21312. }
  21313. return result;
  21314. };
  21315. return SelectorContext;
  21316. }());
  21317. /**
  21318. * @fileoverview added by tsickle
  21319. * @suppress {checkTypes} checked by tsc
  21320. */
  21321. /**
  21322. * @license
  21323. * Copyright Google Inc. All Rights Reserved.
  21324. *
  21325. * Use of this source code is governed by an MIT-style license that can be
  21326. * found in the LICENSE file at https://angular.io/license
  21327. */
  21328. var ERROR_COMPONENT_TYPE = 'ngComponentType';
  21329. var CompileMetadataResolver = /** @class */ (function () {
  21330. function CompileMetadataResolver(_config, _htmlParser, _ngModuleResolver, _directiveResolver, _pipeResolver, _summaryResolver, _schemaRegistry, _directiveNormalizer, _console, _staticSymbolCache, _reflector, _errorCollector) {
  21331. this._config = _config;
  21332. this._htmlParser = _htmlParser;
  21333. this._ngModuleResolver = _ngModuleResolver;
  21334. this._directiveResolver = _directiveResolver;
  21335. this._pipeResolver = _pipeResolver;
  21336. this._summaryResolver = _summaryResolver;
  21337. this._schemaRegistry = _schemaRegistry;
  21338. this._directiveNormalizer = _directiveNormalizer;
  21339. this._console = _console;
  21340. this._staticSymbolCache = _staticSymbolCache;
  21341. this._reflector = _reflector;
  21342. this._errorCollector = _errorCollector;
  21343. this._nonNormalizedDirectiveCache = new Map();
  21344. this._directiveCache = new Map();
  21345. this._summaryCache = new Map();
  21346. this._pipeCache = new Map();
  21347. this._ngModuleCache = new Map();
  21348. this._ngModuleOfTypes = new Map();
  21349. }
  21350. /**
  21351. * @return {?}
  21352. */
  21353. CompileMetadataResolver.prototype.getReflector = /**
  21354. * @return {?}
  21355. */
  21356. function () { return this._reflector; };
  21357. /**
  21358. * @param {?} type
  21359. * @return {?}
  21360. */
  21361. CompileMetadataResolver.prototype.clearCacheFor = /**
  21362. * @param {?} type
  21363. * @return {?}
  21364. */
  21365. function (type) {
  21366. var /** @type {?} */ dirMeta = this._directiveCache.get(type);
  21367. this._directiveCache.delete(type);
  21368. this._nonNormalizedDirectiveCache.delete(type);
  21369. this._summaryCache.delete(type);
  21370. this._pipeCache.delete(type);
  21371. this._ngModuleOfTypes.delete(type);
  21372. // Clear all of the NgModule as they contain transitive information!
  21373. this._ngModuleCache.clear();
  21374. if (dirMeta) {
  21375. this._directiveNormalizer.clearCacheFor(dirMeta);
  21376. }
  21377. };
  21378. /**
  21379. * @return {?}
  21380. */
  21381. CompileMetadataResolver.prototype.clearCache = /**
  21382. * @return {?}
  21383. */
  21384. function () {
  21385. this._directiveCache.clear();
  21386. this._nonNormalizedDirectiveCache.clear();
  21387. this._summaryCache.clear();
  21388. this._pipeCache.clear();
  21389. this._ngModuleCache.clear();
  21390. this._ngModuleOfTypes.clear();
  21391. this._directiveNormalizer.clearCache();
  21392. };
  21393. /**
  21394. * @param {?} baseType
  21395. * @param {?} name
  21396. * @return {?}
  21397. */
  21398. CompileMetadataResolver.prototype._createProxyClass = /**
  21399. * @param {?} baseType
  21400. * @param {?} name
  21401. * @return {?}
  21402. */
  21403. function (baseType, name) {
  21404. var /** @type {?} */ delegate = null;
  21405. var /** @type {?} */ proxyClass = /** @type {?} */ (function () {
  21406. if (!delegate) {
  21407. throw new Error("Illegal state: Class " + name + " for type " + stringify(baseType) + " is not compiled yet!");
  21408. }
  21409. return delegate.apply(this, arguments);
  21410. });
  21411. proxyClass.setDelegate = function (d) {
  21412. delegate = d;
  21413. (/** @type {?} */ (proxyClass)).prototype = d.prototype;
  21414. };
  21415. // Make stringify work correctly
  21416. (/** @type {?} */ (proxyClass)).overriddenName = name;
  21417. return proxyClass;
  21418. };
  21419. /**
  21420. * @param {?} dirType
  21421. * @param {?} name
  21422. * @return {?}
  21423. */
  21424. CompileMetadataResolver.prototype.getGeneratedClass = /**
  21425. * @param {?} dirType
  21426. * @param {?} name
  21427. * @return {?}
  21428. */
  21429. function (dirType, name) {
  21430. if (dirType instanceof StaticSymbol) {
  21431. return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), name);
  21432. }
  21433. else {
  21434. return this._createProxyClass(dirType, name);
  21435. }
  21436. };
  21437. /**
  21438. * @param {?} dirType
  21439. * @return {?}
  21440. */
  21441. CompileMetadataResolver.prototype.getComponentViewClass = /**
  21442. * @param {?} dirType
  21443. * @return {?}
  21444. */
  21445. function (dirType) {
  21446. return this.getGeneratedClass(dirType, viewClassName(dirType, 0));
  21447. };
  21448. /**
  21449. * @param {?} dirType
  21450. * @return {?}
  21451. */
  21452. CompileMetadataResolver.prototype.getHostComponentViewClass = /**
  21453. * @param {?} dirType
  21454. * @return {?}
  21455. */
  21456. function (dirType) {
  21457. return this.getGeneratedClass(dirType, hostViewClassName(dirType));
  21458. };
  21459. /**
  21460. * @param {?} dirType
  21461. * @return {?}
  21462. */
  21463. CompileMetadataResolver.prototype.getHostComponentType = /**
  21464. * @param {?} dirType
  21465. * @return {?}
  21466. */
  21467. function (dirType) {
  21468. var /** @type {?} */ name = identifierName({ reference: dirType }) + "_Host";
  21469. if (dirType instanceof StaticSymbol) {
  21470. return this._staticSymbolCache.get(dirType.filePath, name);
  21471. }
  21472. else {
  21473. var /** @type {?} */ HostClass = /** @type {?} */ (function HostClass() { });
  21474. HostClass.overriddenName = name;
  21475. return HostClass;
  21476. }
  21477. };
  21478. /**
  21479. * @param {?} dirType
  21480. * @return {?}
  21481. */
  21482. CompileMetadataResolver.prototype.getRendererType = /**
  21483. * @param {?} dirType
  21484. * @return {?}
  21485. */
  21486. function (dirType) {
  21487. if (dirType instanceof StaticSymbol) {
  21488. return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), rendererTypeName(dirType));
  21489. }
  21490. else {
  21491. // returning an object as proxy,
  21492. // that we fill later during runtime compilation.
  21493. return /** @type {?} */ ({});
  21494. }
  21495. };
  21496. /**
  21497. * @param {?} selector
  21498. * @param {?} dirType
  21499. * @param {?} inputs
  21500. * @param {?} outputs
  21501. * @return {?}
  21502. */
  21503. CompileMetadataResolver.prototype.getComponentFactory = /**
  21504. * @param {?} selector
  21505. * @param {?} dirType
  21506. * @param {?} inputs
  21507. * @param {?} outputs
  21508. * @return {?}
  21509. */
  21510. function (selector, dirType, inputs, outputs) {
  21511. if (dirType instanceof StaticSymbol) {
  21512. return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), componentFactoryName(dirType));
  21513. }
  21514. else {
  21515. var /** @type {?} */ hostView = this.getHostComponentViewClass(dirType);
  21516. // Note: ngContentSelectors will be filled later once the template is
  21517. // loaded.
  21518. var /** @type {?} */ createComponentFactory = this._reflector.resolveExternalReference(Identifiers.createComponentFactory);
  21519. return createComponentFactory(selector, dirType, /** @type {?} */ (hostView), inputs, outputs, []);
  21520. }
  21521. };
  21522. /**
  21523. * @param {?} factory
  21524. * @param {?} ngContentSelectors
  21525. * @return {?}
  21526. */
  21527. CompileMetadataResolver.prototype.initComponentFactory = /**
  21528. * @param {?} factory
  21529. * @param {?} ngContentSelectors
  21530. * @return {?}
  21531. */
  21532. function (factory, ngContentSelectors) {
  21533. if (!(factory instanceof StaticSymbol)) {
  21534. (_a = (/** @type {?} */ (factory)).ngContentSelectors).push.apply(_a, ngContentSelectors);
  21535. }
  21536. var _a;
  21537. };
  21538. /**
  21539. * @param {?} type
  21540. * @param {?} kind
  21541. * @return {?}
  21542. */
  21543. CompileMetadataResolver.prototype._loadSummary = /**
  21544. * @param {?} type
  21545. * @param {?} kind
  21546. * @return {?}
  21547. */
  21548. function (type, kind) {
  21549. var /** @type {?} */ typeSummary = this._summaryCache.get(type);
  21550. if (!typeSummary) {
  21551. var /** @type {?} */ summary = this._summaryResolver.resolveSummary(type);
  21552. typeSummary = summary ? summary.type : null;
  21553. this._summaryCache.set(type, typeSummary || null);
  21554. }
  21555. return typeSummary && typeSummary.summaryKind === kind ? typeSummary : null;
  21556. };
  21557. /**
  21558. * @param {?} compMeta
  21559. * @param {?=} hostViewType
  21560. * @return {?}
  21561. */
  21562. CompileMetadataResolver.prototype.getHostComponentMetadata = /**
  21563. * @param {?} compMeta
  21564. * @param {?=} hostViewType
  21565. * @return {?}
  21566. */
  21567. function (compMeta, hostViewType) {
  21568. var /** @type {?} */ hostType = this.getHostComponentType(compMeta.type.reference);
  21569. if (!hostViewType) {
  21570. hostViewType = this.getHostComponentViewClass(hostType);
  21571. }
  21572. // Note: ! is ok here as this method should only be called with normalized directive
  21573. // metadata, which always fills in the selector.
  21574. var /** @type {?} */ template = CssSelector.parse(/** @type {?} */ ((compMeta.selector)))[0].getMatchingElementTemplate();
  21575. var /** @type {?} */ templateUrl = '';
  21576. var /** @type {?} */ htmlAst = this._htmlParser.parse(template, templateUrl);
  21577. return CompileDirectiveMetadata.create({
  21578. isHost: true,
  21579. type: { reference: hostType, diDeps: [], lifecycleHooks: [] },
  21580. template: new CompileTemplateMetadata({
  21581. encapsulation: ViewEncapsulation.None,
  21582. template: template,
  21583. templateUrl: templateUrl,
  21584. htmlAst: htmlAst,
  21585. styles: [],
  21586. styleUrls: [],
  21587. ngContentSelectors: [],
  21588. animations: [],
  21589. isInline: true,
  21590. externalStylesheets: [],
  21591. interpolation: null,
  21592. preserveWhitespaces: false,
  21593. }),
  21594. exportAs: null,
  21595. changeDetection: ChangeDetectionStrategy.Default,
  21596. inputs: [],
  21597. outputs: [],
  21598. host: {},
  21599. isComponent: true,
  21600. selector: '*',
  21601. providers: [],
  21602. viewProviders: [],
  21603. queries: [],
  21604. guards: {},
  21605. viewQueries: [],
  21606. componentViewType: hostViewType,
  21607. rendererType: /** @type {?} */ ({ id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {} }),
  21608. entryComponents: [],
  21609. componentFactory: null
  21610. });
  21611. };
  21612. /**
  21613. * @param {?} ngModuleType
  21614. * @param {?} directiveType
  21615. * @param {?} isSync
  21616. * @return {?}
  21617. */
  21618. CompileMetadataResolver.prototype.loadDirectiveMetadata = /**
  21619. * @param {?} ngModuleType
  21620. * @param {?} directiveType
  21621. * @param {?} isSync
  21622. * @return {?}
  21623. */
  21624. function (ngModuleType, directiveType, isSync) {
  21625. var _this = this;
  21626. if (this._directiveCache.has(directiveType)) {
  21627. return null;
  21628. }
  21629. directiveType = resolveForwardRef(directiveType);
  21630. var _a = /** @type {?} */ ((this.getNonNormalizedDirectiveMetadata(directiveType))), annotation = _a.annotation, metadata = _a.metadata;
  21631. var /** @type {?} */ createDirectiveMetadata = function (templateMetadata) {
  21632. var /** @type {?} */ normalizedDirMeta = new CompileDirectiveMetadata({
  21633. isHost: false,
  21634. type: metadata.type,
  21635. isComponent: metadata.isComponent,
  21636. selector: metadata.selector,
  21637. exportAs: metadata.exportAs,
  21638. changeDetection: metadata.changeDetection,
  21639. inputs: metadata.inputs,
  21640. outputs: metadata.outputs,
  21641. hostListeners: metadata.hostListeners,
  21642. hostProperties: metadata.hostProperties,
  21643. hostAttributes: metadata.hostAttributes,
  21644. providers: metadata.providers,
  21645. viewProviders: metadata.viewProviders,
  21646. queries: metadata.queries,
  21647. guards: metadata.guards,
  21648. viewQueries: metadata.viewQueries,
  21649. entryComponents: metadata.entryComponents,
  21650. componentViewType: metadata.componentViewType,
  21651. rendererType: metadata.rendererType,
  21652. componentFactory: metadata.componentFactory,
  21653. template: templateMetadata
  21654. });
  21655. if (templateMetadata) {
  21656. _this.initComponentFactory(/** @type {?} */ ((metadata.componentFactory)), templateMetadata.ngContentSelectors);
  21657. }
  21658. _this._directiveCache.set(directiveType, normalizedDirMeta);
  21659. _this._summaryCache.set(directiveType, normalizedDirMeta.toSummary());
  21660. return null;
  21661. };
  21662. if (metadata.isComponent) {
  21663. var /** @type {?} */ template = /** @type {?} */ ((metadata.template));
  21664. var /** @type {?} */ templateMeta = this._directiveNormalizer.normalizeTemplate({
  21665. ngModuleType: ngModuleType,
  21666. componentType: directiveType,
  21667. moduleUrl: this._reflector.componentModuleUrl(directiveType, annotation),
  21668. encapsulation: template.encapsulation,
  21669. template: template.template,
  21670. templateUrl: template.templateUrl,
  21671. styles: template.styles,
  21672. styleUrls: template.styleUrls,
  21673. animations: template.animations,
  21674. interpolation: template.interpolation,
  21675. preserveWhitespaces: template.preserveWhitespaces
  21676. });
  21677. if (isPromise(templateMeta) && isSync) {
  21678. this._reportError(componentStillLoadingError(directiveType), directiveType);
  21679. return null;
  21680. }
  21681. return SyncAsync.then(templateMeta, createDirectiveMetadata);
  21682. }
  21683. else {
  21684. // directive
  21685. createDirectiveMetadata(null);
  21686. return null;
  21687. }
  21688. };
  21689. /**
  21690. * @param {?} directiveType
  21691. * @return {?}
  21692. */
  21693. CompileMetadataResolver.prototype.getNonNormalizedDirectiveMetadata = /**
  21694. * @param {?} directiveType
  21695. * @return {?}
  21696. */
  21697. function (directiveType) {
  21698. var _this = this;
  21699. directiveType = resolveForwardRef(directiveType);
  21700. if (!directiveType) {
  21701. return null;
  21702. }
  21703. var /** @type {?} */ cacheEntry = this._nonNormalizedDirectiveCache.get(directiveType);
  21704. if (cacheEntry) {
  21705. return cacheEntry;
  21706. }
  21707. var /** @type {?} */ dirMeta = this._directiveResolver.resolve(directiveType, false);
  21708. if (!dirMeta) {
  21709. return null;
  21710. }
  21711. var /** @type {?} */ nonNormalizedTemplateMetadata = /** @type {?} */ ((undefined));
  21712. if (createComponent.isTypeOf(dirMeta)) {
  21713. // component
  21714. var /** @type {?} */ compMeta = /** @type {?} */ (dirMeta);
  21715. assertArrayOfStrings('styles', compMeta.styles);
  21716. assertArrayOfStrings('styleUrls', compMeta.styleUrls);
  21717. assertInterpolationSymbols('interpolation', compMeta.interpolation);
  21718. var /** @type {?} */ animations = compMeta.animations;
  21719. nonNormalizedTemplateMetadata = new CompileTemplateMetadata({
  21720. encapsulation: noUndefined(compMeta.encapsulation),
  21721. template: noUndefined(compMeta.template),
  21722. templateUrl: noUndefined(compMeta.templateUrl),
  21723. htmlAst: null,
  21724. styles: compMeta.styles || [],
  21725. styleUrls: compMeta.styleUrls || [],
  21726. animations: animations || [],
  21727. interpolation: noUndefined(compMeta.interpolation),
  21728. isInline: !!compMeta.template,
  21729. externalStylesheets: [],
  21730. ngContentSelectors: [],
  21731. preserveWhitespaces: noUndefined(dirMeta.preserveWhitespaces),
  21732. });
  21733. }
  21734. var /** @type {?} */ changeDetectionStrategy = /** @type {?} */ ((null));
  21735. var /** @type {?} */ viewProviders = [];
  21736. var /** @type {?} */ entryComponentMetadata = [];
  21737. var /** @type {?} */ selector = dirMeta.selector;
  21738. if (createComponent.isTypeOf(dirMeta)) {
  21739. // Component
  21740. var /** @type {?} */ compMeta = /** @type {?} */ (dirMeta);
  21741. changeDetectionStrategy = /** @type {?} */ ((compMeta.changeDetection));
  21742. if (compMeta.viewProviders) {
  21743. viewProviders = this._getProvidersMetadata(compMeta.viewProviders, entryComponentMetadata, "viewProviders for \"" + stringifyType(directiveType) + "\"", [], directiveType);
  21744. }
  21745. if (compMeta.entryComponents) {
  21746. entryComponentMetadata = flattenAndDedupeArray(compMeta.entryComponents)
  21747. .map(function (type) { return ((_this._getEntryComponentMetadata(type))); })
  21748. .concat(entryComponentMetadata);
  21749. }
  21750. if (!selector) {
  21751. selector = this._schemaRegistry.getDefaultComponentElementName();
  21752. }
  21753. }
  21754. else {
  21755. // Directive
  21756. if (!selector) {
  21757. this._reportError(syntaxError("Directive " + stringifyType(directiveType) + " has no selector, please add it!"), directiveType);
  21758. selector = 'error';
  21759. }
  21760. }
  21761. var /** @type {?} */ providers = [];
  21762. if (dirMeta.providers != null) {
  21763. providers = this._getProvidersMetadata(dirMeta.providers, entryComponentMetadata, "providers for \"" + stringifyType(directiveType) + "\"", [], directiveType);
  21764. }
  21765. var /** @type {?} */ queries = [];
  21766. var /** @type {?} */ viewQueries = [];
  21767. if (dirMeta.queries != null) {
  21768. queries = this._getQueriesMetadata(dirMeta.queries, false, directiveType);
  21769. viewQueries = this._getQueriesMetadata(dirMeta.queries, true, directiveType);
  21770. }
  21771. var /** @type {?} */ metadata = CompileDirectiveMetadata.create({
  21772. isHost: false,
  21773. selector: selector,
  21774. exportAs: noUndefined(dirMeta.exportAs),
  21775. isComponent: !!nonNormalizedTemplateMetadata,
  21776. type: this._getTypeMetadata(directiveType),
  21777. template: nonNormalizedTemplateMetadata,
  21778. changeDetection: changeDetectionStrategy,
  21779. inputs: dirMeta.inputs || [],
  21780. outputs: dirMeta.outputs || [],
  21781. host: dirMeta.host || {},
  21782. providers: providers || [],
  21783. viewProviders: viewProviders || [],
  21784. queries: queries || [],
  21785. guards: dirMeta.guards || {},
  21786. viewQueries: viewQueries || [],
  21787. entryComponents: entryComponentMetadata,
  21788. componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
  21789. null,
  21790. rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : null,
  21791. componentFactory: null
  21792. });
  21793. if (nonNormalizedTemplateMetadata) {
  21794. metadata.componentFactory =
  21795. this.getComponentFactory(selector, directiveType, metadata.inputs, metadata.outputs);
  21796. }
  21797. cacheEntry = { metadata: metadata, annotation: dirMeta };
  21798. this._nonNormalizedDirectiveCache.set(directiveType, cacheEntry);
  21799. return cacheEntry;
  21800. };
  21801. /**
  21802. * Gets the metadata for the given directive.
  21803. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  21804. */
  21805. /**
  21806. * Gets the metadata for the given directive.
  21807. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  21808. * @param {?} directiveType
  21809. * @return {?}
  21810. */
  21811. CompileMetadataResolver.prototype.getDirectiveMetadata = /**
  21812. * Gets the metadata for the given directive.
  21813. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  21814. * @param {?} directiveType
  21815. * @return {?}
  21816. */
  21817. function (directiveType) {
  21818. var /** @type {?} */ dirMeta = /** @type {?} */ ((this._directiveCache.get(directiveType)));
  21819. if (!dirMeta) {
  21820. this._reportError(syntaxError("Illegal state: getDirectiveMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Directive " + stringifyType(directiveType) + "."), directiveType);
  21821. }
  21822. return dirMeta;
  21823. };
  21824. /**
  21825. * @param {?} dirType
  21826. * @return {?}
  21827. */
  21828. CompileMetadataResolver.prototype.getDirectiveSummary = /**
  21829. * @param {?} dirType
  21830. * @return {?}
  21831. */
  21832. function (dirType) {
  21833. var /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive));
  21834. if (!dirSummary) {
  21835. this._reportError(syntaxError("Illegal state: Could not load the summary for directive " + stringifyType(dirType) + "."), dirType);
  21836. }
  21837. return dirSummary;
  21838. };
  21839. /**
  21840. * @param {?} type
  21841. * @return {?}
  21842. */
  21843. CompileMetadataResolver.prototype.isDirective = /**
  21844. * @param {?} type
  21845. * @return {?}
  21846. */
  21847. function (type) {
  21848. return !!this._loadSummary(type, CompileSummaryKind.Directive) ||
  21849. this._directiveResolver.isDirective(type);
  21850. };
  21851. /**
  21852. * @param {?} type
  21853. * @return {?}
  21854. */
  21855. CompileMetadataResolver.prototype.isPipe = /**
  21856. * @param {?} type
  21857. * @return {?}
  21858. */
  21859. function (type) {
  21860. return !!this._loadSummary(type, CompileSummaryKind.Pipe) ||
  21861. this._pipeResolver.isPipe(type);
  21862. };
  21863. /**
  21864. * @param {?} type
  21865. * @return {?}
  21866. */
  21867. CompileMetadataResolver.prototype.isNgModule = /**
  21868. * @param {?} type
  21869. * @return {?}
  21870. */
  21871. function (type) {
  21872. return !!this._loadSummary(type, CompileSummaryKind.NgModule) ||
  21873. this._ngModuleResolver.isNgModule(type);
  21874. };
  21875. /**
  21876. * @param {?} moduleType
  21877. * @param {?=} alreadyCollecting
  21878. * @return {?}
  21879. */
  21880. CompileMetadataResolver.prototype.getNgModuleSummary = /**
  21881. * @param {?} moduleType
  21882. * @param {?=} alreadyCollecting
  21883. * @return {?}
  21884. */
  21885. function (moduleType, alreadyCollecting) {
  21886. if (alreadyCollecting === void 0) { alreadyCollecting = null; }
  21887. var /** @type {?} */ moduleSummary = /** @type {?} */ (this._loadSummary(moduleType, CompileSummaryKind.NgModule));
  21888. if (!moduleSummary) {
  21889. var /** @type {?} */ moduleMeta = this.getNgModuleMetadata(moduleType, false, alreadyCollecting);
  21890. moduleSummary = moduleMeta ? moduleMeta.toSummary() : null;
  21891. if (moduleSummary) {
  21892. this._summaryCache.set(moduleType, moduleSummary);
  21893. }
  21894. }
  21895. return moduleSummary;
  21896. };
  21897. /**
  21898. * Loads the declared directives and pipes of an NgModule.
  21899. */
  21900. /**
  21901. * Loads the declared directives and pipes of an NgModule.
  21902. * @param {?} moduleType
  21903. * @param {?} isSync
  21904. * @param {?=} throwIfNotFound
  21905. * @return {?}
  21906. */
  21907. CompileMetadataResolver.prototype.loadNgModuleDirectiveAndPipeMetadata = /**
  21908. * Loads the declared directives and pipes of an NgModule.
  21909. * @param {?} moduleType
  21910. * @param {?} isSync
  21911. * @param {?=} throwIfNotFound
  21912. * @return {?}
  21913. */
  21914. function (moduleType, isSync, throwIfNotFound) {
  21915. var _this = this;
  21916. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  21917. var /** @type {?} */ ngModule = this.getNgModuleMetadata(moduleType, throwIfNotFound);
  21918. var /** @type {?} */ loading = [];
  21919. if (ngModule) {
  21920. ngModule.declaredDirectives.forEach(function (id) {
  21921. var /** @type {?} */ promise = _this.loadDirectiveMetadata(moduleType, id.reference, isSync);
  21922. if (promise) {
  21923. loading.push(promise);
  21924. }
  21925. });
  21926. ngModule.declaredPipes.forEach(function (id) { return _this._loadPipeMetadata(id.reference); });
  21927. }
  21928. return Promise.all(loading);
  21929. };
  21930. /**
  21931. * @param {?} moduleType
  21932. * @param {?=} throwIfNotFound
  21933. * @param {?=} alreadyCollecting
  21934. * @return {?}
  21935. */
  21936. CompileMetadataResolver.prototype.getNgModuleMetadata = /**
  21937. * @param {?} moduleType
  21938. * @param {?=} throwIfNotFound
  21939. * @param {?=} alreadyCollecting
  21940. * @return {?}
  21941. */
  21942. function (moduleType, throwIfNotFound, alreadyCollecting) {
  21943. var _this = this;
  21944. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  21945. if (alreadyCollecting === void 0) { alreadyCollecting = null; }
  21946. moduleType = resolveForwardRef(moduleType);
  21947. var /** @type {?} */ compileMeta = this._ngModuleCache.get(moduleType);
  21948. if (compileMeta) {
  21949. return compileMeta;
  21950. }
  21951. var /** @type {?} */ meta = this._ngModuleResolver.resolve(moduleType, throwIfNotFound);
  21952. if (!meta) {
  21953. return null;
  21954. }
  21955. var /** @type {?} */ declaredDirectives = [];
  21956. var /** @type {?} */ exportedNonModuleIdentifiers = [];
  21957. var /** @type {?} */ declaredPipes = [];
  21958. var /** @type {?} */ importedModules = [];
  21959. var /** @type {?} */ exportedModules = [];
  21960. var /** @type {?} */ providers = [];
  21961. var /** @type {?} */ entryComponents = [];
  21962. var /** @type {?} */ bootstrapComponents = [];
  21963. var /** @type {?} */ schemas = [];
  21964. if (meta.imports) {
  21965. flattenAndDedupeArray(meta.imports).forEach(function (importedType) {
  21966. var /** @type {?} */ importedModuleType = /** @type {?} */ ((undefined));
  21967. if (isValidType(importedType)) {
  21968. importedModuleType = importedType;
  21969. }
  21970. else if (importedType && importedType.ngModule) {
  21971. var /** @type {?} */ moduleWithProviders = importedType;
  21972. importedModuleType = moduleWithProviders.ngModule;
  21973. if (moduleWithProviders.providers) {
  21974. providers.push.apply(providers, _this._getProvidersMetadata(moduleWithProviders.providers, entryComponents, "provider for the NgModule '" + stringifyType(importedModuleType) + "'", [], importedType));
  21975. }
  21976. }
  21977. if (importedModuleType) {
  21978. if (_this._checkSelfImport(moduleType, importedModuleType))
  21979. return;
  21980. if (!alreadyCollecting)
  21981. alreadyCollecting = new Set();
  21982. if (alreadyCollecting.has(importedModuleType)) {
  21983. _this._reportError(syntaxError(_this._getTypeDescriptor(importedModuleType) + " '" + stringifyType(importedType) + "' is imported recursively by the module '" + stringifyType(moduleType) + "'."), moduleType);
  21984. return;
  21985. }
  21986. alreadyCollecting.add(importedModuleType);
  21987. var /** @type {?} */ importedModuleSummary = _this.getNgModuleSummary(importedModuleType, alreadyCollecting);
  21988. alreadyCollecting.delete(importedModuleType);
  21989. if (!importedModuleSummary) {
  21990. _this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(importedType) + " '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'. Please add a @NgModule annotation."), moduleType);
  21991. return;
  21992. }
  21993. importedModules.push(importedModuleSummary);
  21994. }
  21995. else {
  21996. _this._reportError(syntaxError("Unexpected value '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'"), moduleType);
  21997. return;
  21998. }
  21999. });
  22000. }
  22001. if (meta.exports) {
  22002. flattenAndDedupeArray(meta.exports).forEach(function (exportedType) {
  22003. if (!isValidType(exportedType)) {
  22004. _this._reportError(syntaxError("Unexpected value '" + stringifyType(exportedType) + "' exported by the module '" + stringifyType(moduleType) + "'"), moduleType);
  22005. return;
  22006. }
  22007. if (!alreadyCollecting)
  22008. alreadyCollecting = new Set();
  22009. if (alreadyCollecting.has(exportedType)) {
  22010. _this._reportError(syntaxError(_this._getTypeDescriptor(exportedType) + " '" + stringify(exportedType) + "' is exported recursively by the module '" + stringifyType(moduleType) + "'"), moduleType);
  22011. return;
  22012. }
  22013. alreadyCollecting.add(exportedType);
  22014. var /** @type {?} */ exportedModuleSummary = _this.getNgModuleSummary(exportedType, alreadyCollecting);
  22015. alreadyCollecting.delete(exportedType);
  22016. if (exportedModuleSummary) {
  22017. exportedModules.push(exportedModuleSummary);
  22018. }
  22019. else {
  22020. exportedNonModuleIdentifiers.push(_this._getIdentifierMetadata(exportedType));
  22021. }
  22022. });
  22023. }
  22024. // Note: This will be modified later, so we rely on
  22025. // getting a new instance every time!
  22026. var /** @type {?} */ transitiveModule = this._getTransitiveNgModuleMetadata(importedModules, exportedModules);
  22027. if (meta.declarations) {
  22028. flattenAndDedupeArray(meta.declarations).forEach(function (declaredType) {
  22029. if (!isValidType(declaredType)) {
  22030. _this._reportError(syntaxError("Unexpected value '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'"), moduleType);
  22031. return;
  22032. }
  22033. var /** @type {?} */ declaredIdentifier = _this._getIdentifierMetadata(declaredType);
  22034. if (_this.isDirective(declaredType)) {
  22035. transitiveModule.addDirective(declaredIdentifier);
  22036. declaredDirectives.push(declaredIdentifier);
  22037. _this._addTypeToModule(declaredType, moduleType);
  22038. }
  22039. else if (_this.isPipe(declaredType)) {
  22040. transitiveModule.addPipe(declaredIdentifier);
  22041. transitiveModule.pipes.push(declaredIdentifier);
  22042. declaredPipes.push(declaredIdentifier);
  22043. _this._addTypeToModule(declaredType, moduleType);
  22044. }
  22045. else {
  22046. _this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(declaredType) + " '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'. Please add a @Pipe/@Directive/@Component annotation."), moduleType);
  22047. return;
  22048. }
  22049. });
  22050. }
  22051. var /** @type {?} */ exportedDirectives = [];
  22052. var /** @type {?} */ exportedPipes = [];
  22053. exportedNonModuleIdentifiers.forEach(function (exportedId) {
  22054. if (transitiveModule.directivesSet.has(exportedId.reference)) {
  22055. exportedDirectives.push(exportedId);
  22056. transitiveModule.addExportedDirective(exportedId);
  22057. }
  22058. else if (transitiveModule.pipesSet.has(exportedId.reference)) {
  22059. exportedPipes.push(exportedId);
  22060. transitiveModule.addExportedPipe(exportedId);
  22061. }
  22062. else {
  22063. _this._reportError(syntaxError("Can't export " + _this._getTypeDescriptor(exportedId.reference) + " " + stringifyType(exportedId.reference) + " from " + stringifyType(moduleType) + " as it was neither declared nor imported!"), moduleType);
  22064. return;
  22065. }
  22066. });
  22067. // The providers of the module have to go last
  22068. // so that they overwrite any other provider we already added.
  22069. if (meta.providers) {
  22070. providers.push.apply(providers, this._getProvidersMetadata(meta.providers, entryComponents, "provider for the NgModule '" + stringifyType(moduleType) + "'", [], moduleType));
  22071. }
  22072. if (meta.entryComponents) {
  22073. entryComponents.push.apply(entryComponents, flattenAndDedupeArray(meta.entryComponents)
  22074. .map(function (type) { return ((_this._getEntryComponentMetadata(type))); }));
  22075. }
  22076. if (meta.bootstrap) {
  22077. flattenAndDedupeArray(meta.bootstrap).forEach(function (type) {
  22078. if (!isValidType(type)) {
  22079. _this._reportError(syntaxError("Unexpected value '" + stringifyType(type) + "' used in the bootstrap property of module '" + stringifyType(moduleType) + "'"), moduleType);
  22080. return;
  22081. }
  22082. bootstrapComponents.push(_this._getIdentifierMetadata(type));
  22083. });
  22084. }
  22085. entryComponents.push.apply(entryComponents, bootstrapComponents.map(function (type) { return ((_this._getEntryComponentMetadata(type.reference))); }));
  22086. if (meta.schemas) {
  22087. schemas.push.apply(schemas, flattenAndDedupeArray(meta.schemas));
  22088. }
  22089. compileMeta = new CompileNgModuleMetadata({
  22090. type: this._getTypeMetadata(moduleType),
  22091. providers: providers,
  22092. entryComponents: entryComponents,
  22093. bootstrapComponents: bootstrapComponents,
  22094. schemas: schemas,
  22095. declaredDirectives: declaredDirectives,
  22096. exportedDirectives: exportedDirectives,
  22097. declaredPipes: declaredPipes,
  22098. exportedPipes: exportedPipes,
  22099. importedModules: importedModules,
  22100. exportedModules: exportedModules,
  22101. transitiveModule: transitiveModule,
  22102. id: meta.id || null,
  22103. });
  22104. entryComponents.forEach(function (id) { return transitiveModule.addEntryComponent(id); });
  22105. providers.forEach(function (provider) { return transitiveModule.addProvider(provider, /** @type {?} */ ((compileMeta)).type); });
  22106. transitiveModule.addModule(compileMeta.type);
  22107. this._ngModuleCache.set(moduleType, compileMeta);
  22108. return compileMeta;
  22109. };
  22110. /**
  22111. * @param {?} moduleType
  22112. * @param {?} importedModuleType
  22113. * @return {?}
  22114. */
  22115. CompileMetadataResolver.prototype._checkSelfImport = /**
  22116. * @param {?} moduleType
  22117. * @param {?} importedModuleType
  22118. * @return {?}
  22119. */
  22120. function (moduleType, importedModuleType) {
  22121. if (moduleType === importedModuleType) {
  22122. this._reportError(syntaxError("'" + stringifyType(moduleType) + "' module can't import itself"), moduleType);
  22123. return true;
  22124. }
  22125. return false;
  22126. };
  22127. /**
  22128. * @param {?} type
  22129. * @return {?}
  22130. */
  22131. CompileMetadataResolver.prototype._getTypeDescriptor = /**
  22132. * @param {?} type
  22133. * @return {?}
  22134. */
  22135. function (type) {
  22136. if (isValidType(type)) {
  22137. if (this.isDirective(type)) {
  22138. return 'directive';
  22139. }
  22140. if (this.isPipe(type)) {
  22141. return 'pipe';
  22142. }
  22143. if (this.isNgModule(type)) {
  22144. return 'module';
  22145. }
  22146. }
  22147. if ((/** @type {?} */ (type)).provide) {
  22148. return 'provider';
  22149. }
  22150. return 'value';
  22151. };
  22152. /**
  22153. * @param {?} type
  22154. * @param {?} moduleType
  22155. * @return {?}
  22156. */
  22157. CompileMetadataResolver.prototype._addTypeToModule = /**
  22158. * @param {?} type
  22159. * @param {?} moduleType
  22160. * @return {?}
  22161. */
  22162. function (type, moduleType) {
  22163. var /** @type {?} */ oldModule = this._ngModuleOfTypes.get(type);
  22164. if (oldModule && oldModule !== moduleType) {
  22165. this._reportError(syntaxError("Type " + stringifyType(type) + " is part of the declarations of 2 modules: " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + "! " +
  22166. ("Please consider moving " + stringifyType(type) + " to a higher module that imports " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ". ") +
  22167. ("You can also create a new NgModule that exports and includes " + stringifyType(type) + " then import that NgModule in " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ".")), moduleType);
  22168. return;
  22169. }
  22170. this._ngModuleOfTypes.set(type, moduleType);
  22171. };
  22172. /**
  22173. * @param {?} importedModules
  22174. * @param {?} exportedModules
  22175. * @return {?}
  22176. */
  22177. CompileMetadataResolver.prototype._getTransitiveNgModuleMetadata = /**
  22178. * @param {?} importedModules
  22179. * @param {?} exportedModules
  22180. * @return {?}
  22181. */
  22182. function (importedModules, exportedModules) {
  22183. // collect `providers` / `entryComponents` from all imported and all exported modules
  22184. var /** @type {?} */ result = new TransitiveCompileNgModuleMetadata();
  22185. var /** @type {?} */ modulesByToken = new Map();
  22186. importedModules.concat(exportedModules).forEach(function (modSummary) {
  22187. modSummary.modules.forEach(function (mod) { return result.addModule(mod); });
  22188. modSummary.entryComponents.forEach(function (comp) { return result.addEntryComponent(comp); });
  22189. var /** @type {?} */ addedTokens = new Set();
  22190. modSummary.providers.forEach(function (entry) {
  22191. var /** @type {?} */ tokenRef = tokenReference(entry.provider.token);
  22192. var /** @type {?} */ prevModules = modulesByToken.get(tokenRef);
  22193. if (!prevModules) {
  22194. prevModules = new Set();
  22195. modulesByToken.set(tokenRef, prevModules);
  22196. }
  22197. var /** @type {?} */ moduleRef = entry.module.reference;
  22198. // Note: the providers of one module may still contain multiple providers
  22199. // per token (e.g. for multi providers), and we need to preserve these.
  22200. if (addedTokens.has(tokenRef) || !prevModules.has(moduleRef)) {
  22201. prevModules.add(moduleRef);
  22202. addedTokens.add(tokenRef);
  22203. result.addProvider(entry.provider, entry.module);
  22204. }
  22205. });
  22206. });
  22207. exportedModules.forEach(function (modSummary) {
  22208. modSummary.exportedDirectives.forEach(function (id) { return result.addExportedDirective(id); });
  22209. modSummary.exportedPipes.forEach(function (id) { return result.addExportedPipe(id); });
  22210. });
  22211. importedModules.forEach(function (modSummary) {
  22212. modSummary.exportedDirectives.forEach(function (id) { return result.addDirective(id); });
  22213. modSummary.exportedPipes.forEach(function (id) { return result.addPipe(id); });
  22214. });
  22215. return result;
  22216. };
  22217. /**
  22218. * @param {?} type
  22219. * @return {?}
  22220. */
  22221. CompileMetadataResolver.prototype._getIdentifierMetadata = /**
  22222. * @param {?} type
  22223. * @return {?}
  22224. */
  22225. function (type) {
  22226. type = resolveForwardRef(type);
  22227. return { reference: type };
  22228. };
  22229. /**
  22230. * @param {?} type
  22231. * @return {?}
  22232. */
  22233. CompileMetadataResolver.prototype.isInjectable = /**
  22234. * @param {?} type
  22235. * @return {?}
  22236. */
  22237. function (type) {
  22238. var /** @type {?} */ annotations = this._reflector.annotations(type);
  22239. return annotations.some(function (ann) { return createInjectable.isTypeOf(ann); });
  22240. };
  22241. /**
  22242. * @param {?} type
  22243. * @return {?}
  22244. */
  22245. CompileMetadataResolver.prototype.getInjectableSummary = /**
  22246. * @param {?} type
  22247. * @return {?}
  22248. */
  22249. function (type) {
  22250. return {
  22251. summaryKind: CompileSummaryKind.Injectable,
  22252. type: this._getTypeMetadata(type, null, false)
  22253. };
  22254. };
  22255. /**
  22256. * @param {?} type
  22257. * @param {?=} dependencies
  22258. * @return {?}
  22259. */
  22260. CompileMetadataResolver.prototype._getInjectableMetadata = /**
  22261. * @param {?} type
  22262. * @param {?=} dependencies
  22263. * @return {?}
  22264. */
  22265. function (type, dependencies) {
  22266. if (dependencies === void 0) { dependencies = null; }
  22267. var /** @type {?} */ typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable);
  22268. if (typeSummary) {
  22269. return typeSummary.type;
  22270. }
  22271. return this._getTypeMetadata(type, dependencies);
  22272. };
  22273. /**
  22274. * @param {?} type
  22275. * @param {?=} dependencies
  22276. * @param {?=} throwOnUnknownDeps
  22277. * @return {?}
  22278. */
  22279. CompileMetadataResolver.prototype._getTypeMetadata = /**
  22280. * @param {?} type
  22281. * @param {?=} dependencies
  22282. * @param {?=} throwOnUnknownDeps
  22283. * @return {?}
  22284. */
  22285. function (type, dependencies, throwOnUnknownDeps) {
  22286. if (dependencies === void 0) { dependencies = null; }
  22287. if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
  22288. var /** @type {?} */ identifier = this._getIdentifierMetadata(type);
  22289. return {
  22290. reference: identifier.reference,
  22291. diDeps: this._getDependenciesMetadata(identifier.reference, dependencies, throwOnUnknownDeps),
  22292. lifecycleHooks: getAllLifecycleHooks(this._reflector, identifier.reference),
  22293. };
  22294. };
  22295. /**
  22296. * @param {?} factory
  22297. * @param {?=} dependencies
  22298. * @return {?}
  22299. */
  22300. CompileMetadataResolver.prototype._getFactoryMetadata = /**
  22301. * @param {?} factory
  22302. * @param {?=} dependencies
  22303. * @return {?}
  22304. */
  22305. function (factory, dependencies) {
  22306. if (dependencies === void 0) { dependencies = null; }
  22307. factory = resolveForwardRef(factory);
  22308. return { reference: factory, diDeps: this._getDependenciesMetadata(factory, dependencies) };
  22309. };
  22310. /**
  22311. * Gets the metadata for the given pipe.
  22312. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  22313. */
  22314. /**
  22315. * Gets the metadata for the given pipe.
  22316. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  22317. * @param {?} pipeType
  22318. * @return {?}
  22319. */
  22320. CompileMetadataResolver.prototype.getPipeMetadata = /**
  22321. * Gets the metadata for the given pipe.
  22322. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  22323. * @param {?} pipeType
  22324. * @return {?}
  22325. */
  22326. function (pipeType) {
  22327. var /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType);
  22328. if (!pipeMeta) {
  22329. this._reportError(syntaxError("Illegal state: getPipeMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Pipe " + stringifyType(pipeType) + "."), pipeType);
  22330. }
  22331. return pipeMeta || null;
  22332. };
  22333. /**
  22334. * @param {?} pipeType
  22335. * @return {?}
  22336. */
  22337. CompileMetadataResolver.prototype.getPipeSummary = /**
  22338. * @param {?} pipeType
  22339. * @return {?}
  22340. */
  22341. function (pipeType) {
  22342. var /** @type {?} */ pipeSummary = /** @type {?} */ (this._loadSummary(pipeType, CompileSummaryKind.Pipe));
  22343. if (!pipeSummary) {
  22344. this._reportError(syntaxError("Illegal state: Could not load the summary for pipe " + stringifyType(pipeType) + "."), pipeType);
  22345. }
  22346. return pipeSummary;
  22347. };
  22348. /**
  22349. * @param {?} pipeType
  22350. * @return {?}
  22351. */
  22352. CompileMetadataResolver.prototype.getOrLoadPipeMetadata = /**
  22353. * @param {?} pipeType
  22354. * @return {?}
  22355. */
  22356. function (pipeType) {
  22357. var /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType);
  22358. if (!pipeMeta) {
  22359. pipeMeta = this._loadPipeMetadata(pipeType);
  22360. }
  22361. return pipeMeta;
  22362. };
  22363. /**
  22364. * @param {?} pipeType
  22365. * @return {?}
  22366. */
  22367. CompileMetadataResolver.prototype._loadPipeMetadata = /**
  22368. * @param {?} pipeType
  22369. * @return {?}
  22370. */
  22371. function (pipeType) {
  22372. pipeType = resolveForwardRef(pipeType);
  22373. var /** @type {?} */ pipeAnnotation = /** @type {?} */ ((this._pipeResolver.resolve(pipeType)));
  22374. var /** @type {?} */ pipeMeta = new CompilePipeMetadata({
  22375. type: this._getTypeMetadata(pipeType),
  22376. name: pipeAnnotation.name,
  22377. pure: !!pipeAnnotation.pure
  22378. });
  22379. this._pipeCache.set(pipeType, pipeMeta);
  22380. this._summaryCache.set(pipeType, pipeMeta.toSummary());
  22381. return pipeMeta;
  22382. };
  22383. /**
  22384. * @param {?} typeOrFunc
  22385. * @param {?} dependencies
  22386. * @param {?=} throwOnUnknownDeps
  22387. * @return {?}
  22388. */
  22389. CompileMetadataResolver.prototype._getDependenciesMetadata = /**
  22390. * @param {?} typeOrFunc
  22391. * @param {?} dependencies
  22392. * @param {?=} throwOnUnknownDeps
  22393. * @return {?}
  22394. */
  22395. function (typeOrFunc, dependencies, throwOnUnknownDeps) {
  22396. var _this = this;
  22397. if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
  22398. var /** @type {?} */ hasUnknownDeps = false;
  22399. var /** @type {?} */ params = dependencies || this._reflector.parameters(typeOrFunc) || [];
  22400. var /** @type {?} */ dependenciesMetadata = params.map(function (param) {
  22401. var /** @type {?} */ isAttribute = false;
  22402. var /** @type {?} */ isHost = false;
  22403. var /** @type {?} */ isSelf = false;
  22404. var /** @type {?} */ isSkipSelf = false;
  22405. var /** @type {?} */ isOptional = false;
  22406. var /** @type {?} */ token = null;
  22407. if (Array.isArray(param)) {
  22408. param.forEach(function (paramEntry) {
  22409. if (createHost.isTypeOf(paramEntry)) {
  22410. isHost = true;
  22411. }
  22412. else if (createSelf.isTypeOf(paramEntry)) {
  22413. isSelf = true;
  22414. }
  22415. else if (createSkipSelf.isTypeOf(paramEntry)) {
  22416. isSkipSelf = true;
  22417. }
  22418. else if (createOptional.isTypeOf(paramEntry)) {
  22419. isOptional = true;
  22420. }
  22421. else if (createAttribute.isTypeOf(paramEntry)) {
  22422. isAttribute = true;
  22423. token = paramEntry.attributeName;
  22424. }
  22425. else if (createInject.isTypeOf(paramEntry)) {
  22426. token = paramEntry.token;
  22427. }
  22428. else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) {
  22429. token = paramEntry;
  22430. }
  22431. else if (isValidType(paramEntry) && token == null) {
  22432. token = paramEntry;
  22433. }
  22434. });
  22435. }
  22436. else {
  22437. token = param;
  22438. }
  22439. if (token == null) {
  22440. hasUnknownDeps = true;
  22441. return /** @type {?} */ ((null));
  22442. }
  22443. return {
  22444. isAttribute: isAttribute,
  22445. isHost: isHost,
  22446. isSelf: isSelf,
  22447. isSkipSelf: isSkipSelf,
  22448. isOptional: isOptional,
  22449. token: _this._getTokenMetadata(token)
  22450. };
  22451. });
  22452. if (hasUnknownDeps) {
  22453. var /** @type {?} */ depsTokens = dependenciesMetadata.map(function (dep) { return dep ? stringifyType(dep.token) : '?'; }).join(', ');
  22454. var /** @type {?} */ message = "Can't resolve all parameters for " + stringifyType(typeOrFunc) + ": (" + depsTokens + ").";
  22455. if (throwOnUnknownDeps || this._config.strictInjectionParameters) {
  22456. this._reportError(syntaxError(message), typeOrFunc);
  22457. }
  22458. else {
  22459. this._console.warn("Warning: " + message + " This will become an error in Angular v6.x");
  22460. }
  22461. }
  22462. return dependenciesMetadata;
  22463. };
  22464. /**
  22465. * @param {?} token
  22466. * @return {?}
  22467. */
  22468. CompileMetadataResolver.prototype._getTokenMetadata = /**
  22469. * @param {?} token
  22470. * @return {?}
  22471. */
  22472. function (token) {
  22473. token = resolveForwardRef(token);
  22474. var /** @type {?} */ compileToken;
  22475. if (typeof token === 'string') {
  22476. compileToken = { value: token };
  22477. }
  22478. else {
  22479. compileToken = { identifier: { reference: token } };
  22480. }
  22481. return compileToken;
  22482. };
  22483. /**
  22484. * @param {?} providers
  22485. * @param {?} targetEntryComponents
  22486. * @param {?=} debugInfo
  22487. * @param {?=} compileProviders
  22488. * @param {?=} type
  22489. * @return {?}
  22490. */
  22491. CompileMetadataResolver.prototype._getProvidersMetadata = /**
  22492. * @param {?} providers
  22493. * @param {?} targetEntryComponents
  22494. * @param {?=} debugInfo
  22495. * @param {?=} compileProviders
  22496. * @param {?=} type
  22497. * @return {?}
  22498. */
  22499. function (providers, targetEntryComponents, debugInfo, compileProviders, type) {
  22500. var _this = this;
  22501. if (compileProviders === void 0) { compileProviders = []; }
  22502. providers.forEach(function (provider, providerIdx) {
  22503. if (Array.isArray(provider)) {
  22504. _this._getProvidersMetadata(provider, targetEntryComponents, debugInfo, compileProviders);
  22505. }
  22506. else {
  22507. provider = resolveForwardRef(provider);
  22508. var /** @type {?} */ providerMeta = /** @type {?} */ ((undefined));
  22509. if (provider && typeof provider === 'object' && provider.hasOwnProperty('provide')) {
  22510. _this._validateProvider(provider);
  22511. providerMeta = new ProviderMeta(provider.provide, provider);
  22512. }
  22513. else if (isValidType(provider)) {
  22514. providerMeta = new ProviderMeta(provider, { useClass: provider });
  22515. }
  22516. else if (provider === void 0) {
  22517. _this._reportError(syntaxError("Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files."));
  22518. return;
  22519. }
  22520. else {
  22521. var /** @type {?} */ providersInfo = (/** @type {?} */ (providers.reduce(function (soFar, seenProvider, seenProviderIdx) {
  22522. if (seenProviderIdx < providerIdx) {
  22523. soFar.push("" + stringifyType(seenProvider));
  22524. }
  22525. else if (seenProviderIdx == providerIdx) {
  22526. soFar.push("?" + stringifyType(seenProvider) + "?");
  22527. }
  22528. else if (seenProviderIdx == providerIdx + 1) {
  22529. soFar.push('...');
  22530. }
  22531. return soFar;
  22532. }, [])))
  22533. .join(', ');
  22534. _this._reportError(syntaxError("Invalid " + (debugInfo ? debugInfo : 'provider') + " - only instances of Provider and Type are allowed, got: [" + providersInfo + "]"), type);
  22535. return;
  22536. }
  22537. if (providerMeta.token ===
  22538. _this._reflector.resolveExternalReference(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS)) {
  22539. targetEntryComponents.push.apply(targetEntryComponents, _this._getEntryComponentsFromProvider(providerMeta, type));
  22540. }
  22541. else {
  22542. compileProviders.push(_this.getProviderMetadata(providerMeta));
  22543. }
  22544. }
  22545. });
  22546. return compileProviders;
  22547. };
  22548. /**
  22549. * @param {?} provider
  22550. * @return {?}
  22551. */
  22552. CompileMetadataResolver.prototype._validateProvider = /**
  22553. * @param {?} provider
  22554. * @return {?}
  22555. */
  22556. function (provider) {
  22557. if (provider.hasOwnProperty('useClass') && provider.useClass == null) {
  22558. this._reportError(syntaxError("Invalid provider for " + stringifyType(provider.provide) + ". useClass cannot be " + provider.useClass + ".\n Usually it happens when:\n 1. There's a circular dependency (might be caused by using index.ts (barrel) files).\n 2. Class was used before it was declared. Use forwardRef in this case."));
  22559. }
  22560. };
  22561. /**
  22562. * @param {?} provider
  22563. * @param {?=} type
  22564. * @return {?}
  22565. */
  22566. CompileMetadataResolver.prototype._getEntryComponentsFromProvider = /**
  22567. * @param {?} provider
  22568. * @param {?=} type
  22569. * @return {?}
  22570. */
  22571. function (provider, type) {
  22572. var _this = this;
  22573. var /** @type {?} */ components = [];
  22574. var /** @type {?} */ collectedIdentifiers = [];
  22575. if (provider.useFactory || provider.useExisting || provider.useClass) {
  22576. this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports useValue!"), type);
  22577. return [];
  22578. }
  22579. if (!provider.multi) {
  22580. this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports 'multi = true'!"), type);
  22581. return [];
  22582. }
  22583. extractIdentifiers(provider.useValue, collectedIdentifiers);
  22584. collectedIdentifiers.forEach(function (identifier) {
  22585. var /** @type {?} */ entry = _this._getEntryComponentMetadata(identifier.reference, false);
  22586. if (entry) {
  22587. components.push(entry);
  22588. }
  22589. });
  22590. return components;
  22591. };
  22592. /**
  22593. * @param {?} dirType
  22594. * @param {?=} throwIfNotFound
  22595. * @return {?}
  22596. */
  22597. CompileMetadataResolver.prototype._getEntryComponentMetadata = /**
  22598. * @param {?} dirType
  22599. * @param {?=} throwIfNotFound
  22600. * @return {?}
  22601. */
  22602. function (dirType, throwIfNotFound) {
  22603. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  22604. var /** @type {?} */ dirMeta = this.getNonNormalizedDirectiveMetadata(dirType);
  22605. if (dirMeta && dirMeta.metadata.isComponent) {
  22606. return { componentType: dirType, componentFactory: /** @type {?} */ ((dirMeta.metadata.componentFactory)) };
  22607. }
  22608. var /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive));
  22609. if (dirSummary && dirSummary.isComponent) {
  22610. return { componentType: dirType, componentFactory: /** @type {?} */ ((dirSummary.componentFactory)) };
  22611. }
  22612. if (throwIfNotFound) {
  22613. throw syntaxError(dirType.name + " cannot be used as an entry component.");
  22614. }
  22615. return null;
  22616. };
  22617. /**
  22618. * @param {?} provider
  22619. * @return {?}
  22620. */
  22621. CompileMetadataResolver.prototype.getProviderMetadata = /**
  22622. * @param {?} provider
  22623. * @return {?}
  22624. */
  22625. function (provider) {
  22626. var /** @type {?} */ compileDeps = /** @type {?} */ ((undefined));
  22627. var /** @type {?} */ compileTypeMetadata = /** @type {?} */ ((null));
  22628. var /** @type {?} */ compileFactoryMetadata = /** @type {?} */ ((null));
  22629. var /** @type {?} */ token = this._getTokenMetadata(provider.token);
  22630. if (provider.useClass) {
  22631. compileTypeMetadata = this._getInjectableMetadata(provider.useClass, provider.dependencies);
  22632. compileDeps = compileTypeMetadata.diDeps;
  22633. if (provider.token === provider.useClass) {
  22634. // use the compileTypeMetadata as it contains information about lifecycleHooks...
  22635. token = { identifier: compileTypeMetadata };
  22636. }
  22637. }
  22638. else if (provider.useFactory) {
  22639. compileFactoryMetadata = this._getFactoryMetadata(provider.useFactory, provider.dependencies);
  22640. compileDeps = compileFactoryMetadata.diDeps;
  22641. }
  22642. return {
  22643. token: token,
  22644. useClass: compileTypeMetadata,
  22645. useValue: provider.useValue,
  22646. useFactory: compileFactoryMetadata,
  22647. useExisting: provider.useExisting ? this._getTokenMetadata(provider.useExisting) : undefined,
  22648. deps: compileDeps,
  22649. multi: provider.multi
  22650. };
  22651. };
  22652. /**
  22653. * @param {?} queries
  22654. * @param {?} isViewQuery
  22655. * @param {?} directiveType
  22656. * @return {?}
  22657. */
  22658. CompileMetadataResolver.prototype._getQueriesMetadata = /**
  22659. * @param {?} queries
  22660. * @param {?} isViewQuery
  22661. * @param {?} directiveType
  22662. * @return {?}
  22663. */
  22664. function (queries, isViewQuery, directiveType) {
  22665. var _this = this;
  22666. var /** @type {?} */ res = [];
  22667. Object.keys(queries).forEach(function (propertyName) {
  22668. var /** @type {?} */ query = queries[propertyName];
  22669. if (query.isViewQuery === isViewQuery) {
  22670. res.push(_this._getQueryMetadata(query, propertyName, directiveType));
  22671. }
  22672. });
  22673. return res;
  22674. };
  22675. /**
  22676. * @param {?} selector
  22677. * @return {?}
  22678. */
  22679. CompileMetadataResolver.prototype._queryVarBindings = /**
  22680. * @param {?} selector
  22681. * @return {?}
  22682. */
  22683. function (selector) { return selector.split(/\s*,\s*/); };
  22684. /**
  22685. * @param {?} q
  22686. * @param {?} propertyName
  22687. * @param {?} typeOrFunc
  22688. * @return {?}
  22689. */
  22690. CompileMetadataResolver.prototype._getQueryMetadata = /**
  22691. * @param {?} q
  22692. * @param {?} propertyName
  22693. * @param {?} typeOrFunc
  22694. * @return {?}
  22695. */
  22696. function (q, propertyName, typeOrFunc) {
  22697. var _this = this;
  22698. var /** @type {?} */ selectors;
  22699. if (typeof q.selector === 'string') {
  22700. selectors =
  22701. this._queryVarBindings(q.selector).map(function (varName) { return _this._getTokenMetadata(varName); });
  22702. }
  22703. else {
  22704. if (!q.selector) {
  22705. this._reportError(syntaxError("Can't construct a query for the property \"" + propertyName + "\" of \"" + stringifyType(typeOrFunc) + "\" since the query selector wasn't defined."), typeOrFunc);
  22706. selectors = [];
  22707. }
  22708. else {
  22709. selectors = [this._getTokenMetadata(q.selector)];
  22710. }
  22711. }
  22712. return {
  22713. selectors: selectors,
  22714. first: q.first,
  22715. descendants: q.descendants, propertyName: propertyName,
  22716. read: q.read ? this._getTokenMetadata(q.read) : /** @type {?} */ ((null))
  22717. };
  22718. };
  22719. /**
  22720. * @param {?} error
  22721. * @param {?=} type
  22722. * @param {?=} otherType
  22723. * @return {?}
  22724. */
  22725. CompileMetadataResolver.prototype._reportError = /**
  22726. * @param {?} error
  22727. * @param {?=} type
  22728. * @param {?=} otherType
  22729. * @return {?}
  22730. */
  22731. function (error, type, otherType) {
  22732. if (this._errorCollector) {
  22733. this._errorCollector(error, type);
  22734. if (otherType) {
  22735. this._errorCollector(error, otherType);
  22736. }
  22737. }
  22738. else {
  22739. throw error;
  22740. }
  22741. };
  22742. return CompileMetadataResolver;
  22743. }());
  22744. /**
  22745. * @param {?} tree
  22746. * @param {?=} out
  22747. * @return {?}
  22748. */
  22749. function flattenArray(tree, out) {
  22750. if (out === void 0) { out = []; }
  22751. if (tree) {
  22752. for (var /** @type {?} */ i = 0; i < tree.length; i++) {
  22753. var /** @type {?} */ item = resolveForwardRef(tree[i]);
  22754. if (Array.isArray(item)) {
  22755. flattenArray(item, out);
  22756. }
  22757. else {
  22758. out.push(item);
  22759. }
  22760. }
  22761. }
  22762. return out;
  22763. }
  22764. /**
  22765. * @param {?} array
  22766. * @return {?}
  22767. */
  22768. function dedupeArray(array) {
  22769. if (array) {
  22770. return Array.from(new Set(array));
  22771. }
  22772. return [];
  22773. }
  22774. /**
  22775. * @param {?} tree
  22776. * @return {?}
  22777. */
  22778. function flattenAndDedupeArray(tree) {
  22779. return dedupeArray(flattenArray(tree));
  22780. }
  22781. /**
  22782. * @param {?} value
  22783. * @return {?}
  22784. */
  22785. function isValidType(value) {
  22786. return (value instanceof StaticSymbol) || (value instanceof Type);
  22787. }
  22788. /**
  22789. * @param {?} value
  22790. * @param {?} targetIdentifiers
  22791. * @return {?}
  22792. */
  22793. function extractIdentifiers(value, targetIdentifiers) {
  22794. visitValue(value, new _CompileValueConverter(), targetIdentifiers);
  22795. }
  22796. var _CompileValueConverter = /** @class */ (function (_super) {
  22797. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_CompileValueConverter, _super);
  22798. function _CompileValueConverter() {
  22799. return _super !== null && _super.apply(this, arguments) || this;
  22800. }
  22801. /**
  22802. * @param {?} value
  22803. * @param {?} targetIdentifiers
  22804. * @return {?}
  22805. */
  22806. _CompileValueConverter.prototype.visitOther = /**
  22807. * @param {?} value
  22808. * @param {?} targetIdentifiers
  22809. * @return {?}
  22810. */
  22811. function (value, targetIdentifiers) {
  22812. targetIdentifiers.push({ reference: value });
  22813. };
  22814. return _CompileValueConverter;
  22815. }(ValueTransformer));
  22816. /**
  22817. * @param {?} type
  22818. * @return {?}
  22819. */
  22820. function stringifyType(type) {
  22821. if (type instanceof StaticSymbol) {
  22822. return type.name + " in " + type.filePath;
  22823. }
  22824. else {
  22825. return stringify(type);
  22826. }
  22827. }
  22828. /**
  22829. * Indicates that a component is still being loaded in a synchronous compile.
  22830. * @param {?} compType
  22831. * @return {?}
  22832. */
  22833. function componentStillLoadingError(compType) {
  22834. var /** @type {?} */ error = Error("Can't compile synchronously as " + stringify(compType) + " is still being loaded!");
  22835. (/** @type {?} */ (error))[ERROR_COMPONENT_TYPE] = compType;
  22836. return error;
  22837. }
  22838. /**
  22839. * @fileoverview added by tsickle
  22840. * @suppress {checkTypes} checked by tsc
  22841. */
  22842. /**
  22843. * @license
  22844. * Copyright Google Inc. All Rights Reserved.
  22845. *
  22846. * Use of this source code is governed by an MIT-style license that can be
  22847. * found in the LICENSE file at https://angular.io/license
  22848. */
  22849. /** @enum {number} */
  22850. var TypeModifier = {
  22851. Const: 0,
  22852. };
  22853. TypeModifier[TypeModifier.Const] = "Const";
  22854. /**
  22855. * @abstract
  22856. */
  22857. var Type$1 = /** @class */ (function () {
  22858. function Type(modifiers) {
  22859. if (modifiers === void 0) { modifiers = null; }
  22860. this.modifiers = modifiers;
  22861. if (!modifiers) {
  22862. this.modifiers = [];
  22863. }
  22864. }
  22865. /**
  22866. * @param {?} modifier
  22867. * @return {?}
  22868. */
  22869. Type.prototype.hasModifier = /**
  22870. * @param {?} modifier
  22871. * @return {?}
  22872. */
  22873. function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
  22874. return Type;
  22875. }());
  22876. /** @enum {number} */
  22877. var BuiltinTypeName = {
  22878. Dynamic: 0,
  22879. Bool: 1,
  22880. String: 2,
  22881. Int: 3,
  22882. Number: 4,
  22883. Function: 5,
  22884. Inferred: 6,
  22885. };
  22886. BuiltinTypeName[BuiltinTypeName.Dynamic] = "Dynamic";
  22887. BuiltinTypeName[BuiltinTypeName.Bool] = "Bool";
  22888. BuiltinTypeName[BuiltinTypeName.String] = "String";
  22889. BuiltinTypeName[BuiltinTypeName.Int] = "Int";
  22890. BuiltinTypeName[BuiltinTypeName.Number] = "Number";
  22891. BuiltinTypeName[BuiltinTypeName.Function] = "Function";
  22892. BuiltinTypeName[BuiltinTypeName.Inferred] = "Inferred";
  22893. var BuiltinType = /** @class */ (function (_super) {
  22894. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BuiltinType, _super);
  22895. function BuiltinType(name, modifiers) {
  22896. if (modifiers === void 0) { modifiers = null; }
  22897. var _this = _super.call(this, modifiers) || this;
  22898. _this.name = name;
  22899. return _this;
  22900. }
  22901. /**
  22902. * @param {?} visitor
  22903. * @param {?} context
  22904. * @return {?}
  22905. */
  22906. BuiltinType.prototype.visitType = /**
  22907. * @param {?} visitor
  22908. * @param {?} context
  22909. * @return {?}
  22910. */
  22911. function (visitor, context) {
  22912. return visitor.visitBuiltintType(this, context);
  22913. };
  22914. return BuiltinType;
  22915. }(Type$1));
  22916. var ExpressionType = /** @class */ (function (_super) {
  22917. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpressionType, _super);
  22918. function ExpressionType(value, modifiers) {
  22919. if (modifiers === void 0) { modifiers = null; }
  22920. var _this = _super.call(this, modifiers) || this;
  22921. _this.value = value;
  22922. return _this;
  22923. }
  22924. /**
  22925. * @param {?} visitor
  22926. * @param {?} context
  22927. * @return {?}
  22928. */
  22929. ExpressionType.prototype.visitType = /**
  22930. * @param {?} visitor
  22931. * @param {?} context
  22932. * @return {?}
  22933. */
  22934. function (visitor, context) {
  22935. return visitor.visitExpressionType(this, context);
  22936. };
  22937. return ExpressionType;
  22938. }(Type$1));
  22939. var ArrayType = /** @class */ (function (_super) {
  22940. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ArrayType, _super);
  22941. function ArrayType(of, modifiers) {
  22942. if (modifiers === void 0) { modifiers = null; }
  22943. var _this = _super.call(this, modifiers) || this;
  22944. _this.of = of;
  22945. return _this;
  22946. }
  22947. /**
  22948. * @param {?} visitor
  22949. * @param {?} context
  22950. * @return {?}
  22951. */
  22952. ArrayType.prototype.visitType = /**
  22953. * @param {?} visitor
  22954. * @param {?} context
  22955. * @return {?}
  22956. */
  22957. function (visitor, context) {
  22958. return visitor.visitArrayType(this, context);
  22959. };
  22960. return ArrayType;
  22961. }(Type$1));
  22962. var MapType = /** @class */ (function (_super) {
  22963. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MapType, _super);
  22964. function MapType(valueType, modifiers) {
  22965. if (modifiers === void 0) { modifiers = null; }
  22966. var _this = _super.call(this, modifiers) || this;
  22967. _this.valueType = valueType || null;
  22968. return _this;
  22969. }
  22970. /**
  22971. * @param {?} visitor
  22972. * @param {?} context
  22973. * @return {?}
  22974. */
  22975. MapType.prototype.visitType = /**
  22976. * @param {?} visitor
  22977. * @param {?} context
  22978. * @return {?}
  22979. */
  22980. function (visitor, context) { return visitor.visitMapType(this, context); };
  22981. return MapType;
  22982. }(Type$1));
  22983. var DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic);
  22984. var INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);
  22985. var BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool);
  22986. var INT_TYPE = new BuiltinType(BuiltinTypeName.Int);
  22987. var NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number);
  22988. var STRING_TYPE = new BuiltinType(BuiltinTypeName.String);
  22989. var FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function);
  22990. /**
  22991. * @record
  22992. */
  22993. /** @enum {number} */
  22994. var BinaryOperator = {
  22995. Equals: 0,
  22996. NotEquals: 1,
  22997. Identical: 2,
  22998. NotIdentical: 3,
  22999. Minus: 4,
  23000. Plus: 5,
  23001. Divide: 6,
  23002. Multiply: 7,
  23003. Modulo: 8,
  23004. And: 9,
  23005. Or: 10,
  23006. Lower: 11,
  23007. LowerEquals: 12,
  23008. Bigger: 13,
  23009. BiggerEquals: 14,
  23010. };
  23011. BinaryOperator[BinaryOperator.Equals] = "Equals";
  23012. BinaryOperator[BinaryOperator.NotEquals] = "NotEquals";
  23013. BinaryOperator[BinaryOperator.Identical] = "Identical";
  23014. BinaryOperator[BinaryOperator.NotIdentical] = "NotIdentical";
  23015. BinaryOperator[BinaryOperator.Minus] = "Minus";
  23016. BinaryOperator[BinaryOperator.Plus] = "Plus";
  23017. BinaryOperator[BinaryOperator.Divide] = "Divide";
  23018. BinaryOperator[BinaryOperator.Multiply] = "Multiply";
  23019. BinaryOperator[BinaryOperator.Modulo] = "Modulo";
  23020. BinaryOperator[BinaryOperator.And] = "And";
  23021. BinaryOperator[BinaryOperator.Or] = "Or";
  23022. BinaryOperator[BinaryOperator.Lower] = "Lower";
  23023. BinaryOperator[BinaryOperator.LowerEquals] = "LowerEquals";
  23024. BinaryOperator[BinaryOperator.Bigger] = "Bigger";
  23025. BinaryOperator[BinaryOperator.BiggerEquals] = "BiggerEquals";
  23026. /**
  23027. * @template T
  23028. * @param {?} base
  23029. * @param {?} other
  23030. * @return {?}
  23031. */
  23032. function nullSafeIsEquivalent(base, other) {
  23033. if (base == null || other == null) {
  23034. return base == other;
  23035. }
  23036. return base.isEquivalent(other);
  23037. }
  23038. /**
  23039. * @template T
  23040. * @param {?} base
  23041. * @param {?} other
  23042. * @return {?}
  23043. */
  23044. function areAllEquivalent(base, other) {
  23045. var /** @type {?} */ len = base.length;
  23046. if (len !== other.length) {
  23047. return false;
  23048. }
  23049. for (var /** @type {?} */ i = 0; i < len; i++) {
  23050. if (!base[i].isEquivalent(other[i])) {
  23051. return false;
  23052. }
  23053. }
  23054. return true;
  23055. }
  23056. /**
  23057. * @abstract
  23058. */
  23059. var Expression = /** @class */ (function () {
  23060. function Expression(type, sourceSpan) {
  23061. this.type = type || null;
  23062. this.sourceSpan = sourceSpan || null;
  23063. }
  23064. /**
  23065. * @param {?} name
  23066. * @param {?=} sourceSpan
  23067. * @return {?}
  23068. */
  23069. Expression.prototype.prop = /**
  23070. * @param {?} name
  23071. * @param {?=} sourceSpan
  23072. * @return {?}
  23073. */
  23074. function (name, sourceSpan) {
  23075. return new ReadPropExpr(this, name, null, sourceSpan);
  23076. };
  23077. /**
  23078. * @param {?} index
  23079. * @param {?=} type
  23080. * @param {?=} sourceSpan
  23081. * @return {?}
  23082. */
  23083. Expression.prototype.key = /**
  23084. * @param {?} index
  23085. * @param {?=} type
  23086. * @param {?=} sourceSpan
  23087. * @return {?}
  23088. */
  23089. function (index, type, sourceSpan) {
  23090. return new ReadKeyExpr(this, index, type, sourceSpan);
  23091. };
  23092. /**
  23093. * @param {?} name
  23094. * @param {?} params
  23095. * @param {?=} sourceSpan
  23096. * @return {?}
  23097. */
  23098. Expression.prototype.callMethod = /**
  23099. * @param {?} name
  23100. * @param {?} params
  23101. * @param {?=} sourceSpan
  23102. * @return {?}
  23103. */
  23104. function (name, params, sourceSpan) {
  23105. return new InvokeMethodExpr(this, name, params, null, sourceSpan);
  23106. };
  23107. /**
  23108. * @param {?} params
  23109. * @param {?=} sourceSpan
  23110. * @return {?}
  23111. */
  23112. Expression.prototype.callFn = /**
  23113. * @param {?} params
  23114. * @param {?=} sourceSpan
  23115. * @return {?}
  23116. */
  23117. function (params, sourceSpan) {
  23118. return new InvokeFunctionExpr(this, params, null, sourceSpan);
  23119. };
  23120. /**
  23121. * @param {?} params
  23122. * @param {?=} type
  23123. * @param {?=} sourceSpan
  23124. * @return {?}
  23125. */
  23126. Expression.prototype.instantiate = /**
  23127. * @param {?} params
  23128. * @param {?=} type
  23129. * @param {?=} sourceSpan
  23130. * @return {?}
  23131. */
  23132. function (params, type, sourceSpan) {
  23133. return new InstantiateExpr(this, params, type, sourceSpan);
  23134. };
  23135. /**
  23136. * @param {?} trueCase
  23137. * @param {?=} falseCase
  23138. * @param {?=} sourceSpan
  23139. * @return {?}
  23140. */
  23141. Expression.prototype.conditional = /**
  23142. * @param {?} trueCase
  23143. * @param {?=} falseCase
  23144. * @param {?=} sourceSpan
  23145. * @return {?}
  23146. */
  23147. function (trueCase, falseCase, sourceSpan) {
  23148. if (falseCase === void 0) { falseCase = null; }
  23149. return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
  23150. };
  23151. /**
  23152. * @param {?} rhs
  23153. * @param {?=} sourceSpan
  23154. * @return {?}
  23155. */
  23156. Expression.prototype.equals = /**
  23157. * @param {?} rhs
  23158. * @param {?=} sourceSpan
  23159. * @return {?}
  23160. */
  23161. function (rhs, sourceSpan) {
  23162. return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
  23163. };
  23164. /**
  23165. * @param {?} rhs
  23166. * @param {?=} sourceSpan
  23167. * @return {?}
  23168. */
  23169. Expression.prototype.notEquals = /**
  23170. * @param {?} rhs
  23171. * @param {?=} sourceSpan
  23172. * @return {?}
  23173. */
  23174. function (rhs, sourceSpan) {
  23175. return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
  23176. };
  23177. /**
  23178. * @param {?} rhs
  23179. * @param {?=} sourceSpan
  23180. * @return {?}
  23181. */
  23182. Expression.prototype.identical = /**
  23183. * @param {?} rhs
  23184. * @param {?=} sourceSpan
  23185. * @return {?}
  23186. */
  23187. function (rhs, sourceSpan) {
  23188. return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
  23189. };
  23190. /**
  23191. * @param {?} rhs
  23192. * @param {?=} sourceSpan
  23193. * @return {?}
  23194. */
  23195. Expression.prototype.notIdentical = /**
  23196. * @param {?} rhs
  23197. * @param {?=} sourceSpan
  23198. * @return {?}
  23199. */
  23200. function (rhs, sourceSpan) {
  23201. return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
  23202. };
  23203. /**
  23204. * @param {?} rhs
  23205. * @param {?=} sourceSpan
  23206. * @return {?}
  23207. */
  23208. Expression.prototype.minus = /**
  23209. * @param {?} rhs
  23210. * @param {?=} sourceSpan
  23211. * @return {?}
  23212. */
  23213. function (rhs, sourceSpan) {
  23214. return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
  23215. };
  23216. /**
  23217. * @param {?} rhs
  23218. * @param {?=} sourceSpan
  23219. * @return {?}
  23220. */
  23221. Expression.prototype.plus = /**
  23222. * @param {?} rhs
  23223. * @param {?=} sourceSpan
  23224. * @return {?}
  23225. */
  23226. function (rhs, sourceSpan) {
  23227. return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
  23228. };
  23229. /**
  23230. * @param {?} rhs
  23231. * @param {?=} sourceSpan
  23232. * @return {?}
  23233. */
  23234. Expression.prototype.divide = /**
  23235. * @param {?} rhs
  23236. * @param {?=} sourceSpan
  23237. * @return {?}
  23238. */
  23239. function (rhs, sourceSpan) {
  23240. return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
  23241. };
  23242. /**
  23243. * @param {?} rhs
  23244. * @param {?=} sourceSpan
  23245. * @return {?}
  23246. */
  23247. Expression.prototype.multiply = /**
  23248. * @param {?} rhs
  23249. * @param {?=} sourceSpan
  23250. * @return {?}
  23251. */
  23252. function (rhs, sourceSpan) {
  23253. return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);
  23254. };
  23255. /**
  23256. * @param {?} rhs
  23257. * @param {?=} sourceSpan
  23258. * @return {?}
  23259. */
  23260. Expression.prototype.modulo = /**
  23261. * @param {?} rhs
  23262. * @param {?=} sourceSpan
  23263. * @return {?}
  23264. */
  23265. function (rhs, sourceSpan) {
  23266. return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
  23267. };
  23268. /**
  23269. * @param {?} rhs
  23270. * @param {?=} sourceSpan
  23271. * @return {?}
  23272. */
  23273. Expression.prototype.and = /**
  23274. * @param {?} rhs
  23275. * @param {?=} sourceSpan
  23276. * @return {?}
  23277. */
  23278. function (rhs, sourceSpan) {
  23279. return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
  23280. };
  23281. /**
  23282. * @param {?} rhs
  23283. * @param {?=} sourceSpan
  23284. * @return {?}
  23285. */
  23286. Expression.prototype.or = /**
  23287. * @param {?} rhs
  23288. * @param {?=} sourceSpan
  23289. * @return {?}
  23290. */
  23291. function (rhs, sourceSpan) {
  23292. return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
  23293. };
  23294. /**
  23295. * @param {?} rhs
  23296. * @param {?=} sourceSpan
  23297. * @return {?}
  23298. */
  23299. Expression.prototype.lower = /**
  23300. * @param {?} rhs
  23301. * @param {?=} sourceSpan
  23302. * @return {?}
  23303. */
  23304. function (rhs, sourceSpan) {
  23305. return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan);
  23306. };
  23307. /**
  23308. * @param {?} rhs
  23309. * @param {?=} sourceSpan
  23310. * @return {?}
  23311. */
  23312. Expression.prototype.lowerEquals = /**
  23313. * @param {?} rhs
  23314. * @param {?=} sourceSpan
  23315. * @return {?}
  23316. */
  23317. function (rhs, sourceSpan) {
  23318. return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan);
  23319. };
  23320. /**
  23321. * @param {?} rhs
  23322. * @param {?=} sourceSpan
  23323. * @return {?}
  23324. */
  23325. Expression.prototype.bigger = /**
  23326. * @param {?} rhs
  23327. * @param {?=} sourceSpan
  23328. * @return {?}
  23329. */
  23330. function (rhs, sourceSpan) {
  23331. return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan);
  23332. };
  23333. /**
  23334. * @param {?} rhs
  23335. * @param {?=} sourceSpan
  23336. * @return {?}
  23337. */
  23338. Expression.prototype.biggerEquals = /**
  23339. * @param {?} rhs
  23340. * @param {?=} sourceSpan
  23341. * @return {?}
  23342. */
  23343. function (rhs, sourceSpan) {
  23344. return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan);
  23345. };
  23346. /**
  23347. * @param {?=} sourceSpan
  23348. * @return {?}
  23349. */
  23350. Expression.prototype.isBlank = /**
  23351. * @param {?=} sourceSpan
  23352. * @return {?}
  23353. */
  23354. function (sourceSpan) {
  23355. // Note: We use equals by purpose here to compare to null and undefined in JS.
  23356. // We use the typed null to allow strictNullChecks to narrow types.
  23357. return this.equals(TYPED_NULL_EXPR, sourceSpan);
  23358. };
  23359. /**
  23360. * @param {?} type
  23361. * @param {?=} sourceSpan
  23362. * @return {?}
  23363. */
  23364. Expression.prototype.cast = /**
  23365. * @param {?} type
  23366. * @param {?=} sourceSpan
  23367. * @return {?}
  23368. */
  23369. function (type, sourceSpan) {
  23370. return new CastExpr(this, type, sourceSpan);
  23371. };
  23372. /**
  23373. * @return {?}
  23374. */
  23375. Expression.prototype.toStmt = /**
  23376. * @return {?}
  23377. */
  23378. function () { return new ExpressionStatement(this, null); };
  23379. return Expression;
  23380. }());
  23381. /** @enum {number} */
  23382. var BuiltinVar = {
  23383. This: 0,
  23384. Super: 1,
  23385. CatchError: 2,
  23386. CatchStack: 3,
  23387. };
  23388. BuiltinVar[BuiltinVar.This] = "This";
  23389. BuiltinVar[BuiltinVar.Super] = "Super";
  23390. BuiltinVar[BuiltinVar.CatchError] = "CatchError";
  23391. BuiltinVar[BuiltinVar.CatchStack] = "CatchStack";
  23392. var ReadVarExpr = /** @class */ (function (_super) {
  23393. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadVarExpr, _super);
  23394. function ReadVarExpr(name, type, sourceSpan) {
  23395. var _this = _super.call(this, type, sourceSpan) || this;
  23396. if (typeof name === 'string') {
  23397. _this.name = name;
  23398. _this.builtin = null;
  23399. }
  23400. else {
  23401. _this.name = null;
  23402. _this.builtin = /** @type {?} */ (name);
  23403. }
  23404. return _this;
  23405. }
  23406. /**
  23407. * @param {?} e
  23408. * @return {?}
  23409. */
  23410. ReadVarExpr.prototype.isEquivalent = /**
  23411. * @param {?} e
  23412. * @return {?}
  23413. */
  23414. function (e) {
  23415. return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin;
  23416. };
  23417. /**
  23418. * @param {?} visitor
  23419. * @param {?} context
  23420. * @return {?}
  23421. */
  23422. ReadVarExpr.prototype.visitExpression = /**
  23423. * @param {?} visitor
  23424. * @param {?} context
  23425. * @return {?}
  23426. */
  23427. function (visitor, context) {
  23428. return visitor.visitReadVarExpr(this, context);
  23429. };
  23430. /**
  23431. * @param {?} value
  23432. * @return {?}
  23433. */
  23434. ReadVarExpr.prototype.set = /**
  23435. * @param {?} value
  23436. * @return {?}
  23437. */
  23438. function (value) {
  23439. if (!this.name) {
  23440. throw new Error("Built in variable " + this.builtin + " can not be assigned to.");
  23441. }
  23442. return new WriteVarExpr(this.name, value, null, this.sourceSpan);
  23443. };
  23444. return ReadVarExpr;
  23445. }(Expression));
  23446. var WriteVarExpr = /** @class */ (function (_super) {
  23447. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WriteVarExpr, _super);
  23448. function WriteVarExpr(name, value, type, sourceSpan) {
  23449. var _this = _super.call(this, type || value.type, sourceSpan) || this;
  23450. _this.name = name;
  23451. _this.value = value;
  23452. return _this;
  23453. }
  23454. /**
  23455. * @param {?} e
  23456. * @return {?}
  23457. */
  23458. WriteVarExpr.prototype.isEquivalent = /**
  23459. * @param {?} e
  23460. * @return {?}
  23461. */
  23462. function (e) {
  23463. return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);
  23464. };
  23465. /**
  23466. * @param {?} visitor
  23467. * @param {?} context
  23468. * @return {?}
  23469. */
  23470. WriteVarExpr.prototype.visitExpression = /**
  23471. * @param {?} visitor
  23472. * @param {?} context
  23473. * @return {?}
  23474. */
  23475. function (visitor, context) {
  23476. return visitor.visitWriteVarExpr(this, context);
  23477. };
  23478. /**
  23479. * @param {?=} type
  23480. * @param {?=} modifiers
  23481. * @return {?}
  23482. */
  23483. WriteVarExpr.prototype.toDeclStmt = /**
  23484. * @param {?=} type
  23485. * @param {?=} modifiers
  23486. * @return {?}
  23487. */
  23488. function (type, modifiers) {
  23489. return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
  23490. };
  23491. return WriteVarExpr;
  23492. }(Expression));
  23493. var WriteKeyExpr = /** @class */ (function (_super) {
  23494. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WriteKeyExpr, _super);
  23495. function WriteKeyExpr(receiver, index, value, type, sourceSpan) {
  23496. var _this = _super.call(this, type || value.type, sourceSpan) || this;
  23497. _this.receiver = receiver;
  23498. _this.index = index;
  23499. _this.value = value;
  23500. return _this;
  23501. }
  23502. /**
  23503. * @param {?} e
  23504. * @return {?}
  23505. */
  23506. WriteKeyExpr.prototype.isEquivalent = /**
  23507. * @param {?} e
  23508. * @return {?}
  23509. */
  23510. function (e) {
  23511. return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) &&
  23512. this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value);
  23513. };
  23514. /**
  23515. * @param {?} visitor
  23516. * @param {?} context
  23517. * @return {?}
  23518. */
  23519. WriteKeyExpr.prototype.visitExpression = /**
  23520. * @param {?} visitor
  23521. * @param {?} context
  23522. * @return {?}
  23523. */
  23524. function (visitor, context) {
  23525. return visitor.visitWriteKeyExpr(this, context);
  23526. };
  23527. return WriteKeyExpr;
  23528. }(Expression));
  23529. var WritePropExpr = /** @class */ (function (_super) {
  23530. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WritePropExpr, _super);
  23531. function WritePropExpr(receiver, name, value, type, sourceSpan) {
  23532. var _this = _super.call(this, type || value.type, sourceSpan) || this;
  23533. _this.receiver = receiver;
  23534. _this.name = name;
  23535. _this.value = value;
  23536. return _this;
  23537. }
  23538. /**
  23539. * @param {?} e
  23540. * @return {?}
  23541. */
  23542. WritePropExpr.prototype.isEquivalent = /**
  23543. * @param {?} e
  23544. * @return {?}
  23545. */
  23546. function (e) {
  23547. return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) &&
  23548. this.name === e.name && this.value.isEquivalent(e.value);
  23549. };
  23550. /**
  23551. * @param {?} visitor
  23552. * @param {?} context
  23553. * @return {?}
  23554. */
  23555. WritePropExpr.prototype.visitExpression = /**
  23556. * @param {?} visitor
  23557. * @param {?} context
  23558. * @return {?}
  23559. */
  23560. function (visitor, context) {
  23561. return visitor.visitWritePropExpr(this, context);
  23562. };
  23563. return WritePropExpr;
  23564. }(Expression));
  23565. /** @enum {number} */
  23566. var BuiltinMethod = {
  23567. ConcatArray: 0,
  23568. SubscribeObservable: 1,
  23569. Bind: 2,
  23570. };
  23571. BuiltinMethod[BuiltinMethod.ConcatArray] = "ConcatArray";
  23572. BuiltinMethod[BuiltinMethod.SubscribeObservable] = "SubscribeObservable";
  23573. BuiltinMethod[BuiltinMethod.Bind] = "Bind";
  23574. var InvokeMethodExpr = /** @class */ (function (_super) {
  23575. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InvokeMethodExpr, _super);
  23576. function InvokeMethodExpr(receiver, method, args, type, sourceSpan) {
  23577. var _this = _super.call(this, type, sourceSpan) || this;
  23578. _this.receiver = receiver;
  23579. _this.args = args;
  23580. if (typeof method === 'string') {
  23581. _this.name = method;
  23582. _this.builtin = null;
  23583. }
  23584. else {
  23585. _this.name = null;
  23586. _this.builtin = /** @type {?} */ (method);
  23587. }
  23588. return _this;
  23589. }
  23590. /**
  23591. * @param {?} e
  23592. * @return {?}
  23593. */
  23594. InvokeMethodExpr.prototype.isEquivalent = /**
  23595. * @param {?} e
  23596. * @return {?}
  23597. */
  23598. function (e) {
  23599. return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) &&
  23600. this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args);
  23601. };
  23602. /**
  23603. * @param {?} visitor
  23604. * @param {?} context
  23605. * @return {?}
  23606. */
  23607. InvokeMethodExpr.prototype.visitExpression = /**
  23608. * @param {?} visitor
  23609. * @param {?} context
  23610. * @return {?}
  23611. */
  23612. function (visitor, context) {
  23613. return visitor.visitInvokeMethodExpr(this, context);
  23614. };
  23615. return InvokeMethodExpr;
  23616. }(Expression));
  23617. var InvokeFunctionExpr = /** @class */ (function (_super) {
  23618. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InvokeFunctionExpr, _super);
  23619. function InvokeFunctionExpr(fn, args, type, sourceSpan) {
  23620. var _this = _super.call(this, type, sourceSpan) || this;
  23621. _this.fn = fn;
  23622. _this.args = args;
  23623. return _this;
  23624. }
  23625. /**
  23626. * @param {?} e
  23627. * @return {?}
  23628. */
  23629. InvokeFunctionExpr.prototype.isEquivalent = /**
  23630. * @param {?} e
  23631. * @return {?}
  23632. */
  23633. function (e) {
  23634. return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
  23635. areAllEquivalent(this.args, e.args);
  23636. };
  23637. /**
  23638. * @param {?} visitor
  23639. * @param {?} context
  23640. * @return {?}
  23641. */
  23642. InvokeFunctionExpr.prototype.visitExpression = /**
  23643. * @param {?} visitor
  23644. * @param {?} context
  23645. * @return {?}
  23646. */
  23647. function (visitor, context) {
  23648. return visitor.visitInvokeFunctionExpr(this, context);
  23649. };
  23650. return InvokeFunctionExpr;
  23651. }(Expression));
  23652. var InstantiateExpr = /** @class */ (function (_super) {
  23653. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InstantiateExpr, _super);
  23654. function InstantiateExpr(classExpr, args, type, sourceSpan) {
  23655. var _this = _super.call(this, type, sourceSpan) || this;
  23656. _this.classExpr = classExpr;
  23657. _this.args = args;
  23658. return _this;
  23659. }
  23660. /**
  23661. * @param {?} e
  23662. * @return {?}
  23663. */
  23664. InstantiateExpr.prototype.isEquivalent = /**
  23665. * @param {?} e
  23666. * @return {?}
  23667. */
  23668. function (e) {
  23669. return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) &&
  23670. areAllEquivalent(this.args, e.args);
  23671. };
  23672. /**
  23673. * @param {?} visitor
  23674. * @param {?} context
  23675. * @return {?}
  23676. */
  23677. InstantiateExpr.prototype.visitExpression = /**
  23678. * @param {?} visitor
  23679. * @param {?} context
  23680. * @return {?}
  23681. */
  23682. function (visitor, context) {
  23683. return visitor.visitInstantiateExpr(this, context);
  23684. };
  23685. return InstantiateExpr;
  23686. }(Expression));
  23687. var LiteralExpr = /** @class */ (function (_super) {
  23688. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralExpr, _super);
  23689. function LiteralExpr(value, type, sourceSpan) {
  23690. var _this = _super.call(this, type, sourceSpan) || this;
  23691. _this.value = value;
  23692. return _this;
  23693. }
  23694. /**
  23695. * @param {?} e
  23696. * @return {?}
  23697. */
  23698. LiteralExpr.prototype.isEquivalent = /**
  23699. * @param {?} e
  23700. * @return {?}
  23701. */
  23702. function (e) {
  23703. return e instanceof LiteralExpr && this.value === e.value;
  23704. };
  23705. /**
  23706. * @param {?} visitor
  23707. * @param {?} context
  23708. * @return {?}
  23709. */
  23710. LiteralExpr.prototype.visitExpression = /**
  23711. * @param {?} visitor
  23712. * @param {?} context
  23713. * @return {?}
  23714. */
  23715. function (visitor, context) {
  23716. return visitor.visitLiteralExpr(this, context);
  23717. };
  23718. return LiteralExpr;
  23719. }(Expression));
  23720. var ExternalExpr = /** @class */ (function (_super) {
  23721. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExternalExpr, _super);
  23722. function ExternalExpr(value, type, typeParams, sourceSpan) {
  23723. if (typeParams === void 0) { typeParams = null; }
  23724. var _this = _super.call(this, type, sourceSpan) || this;
  23725. _this.value = value;
  23726. _this.typeParams = typeParams;
  23727. return _this;
  23728. }
  23729. /**
  23730. * @param {?} e
  23731. * @return {?}
  23732. */
  23733. ExternalExpr.prototype.isEquivalent = /**
  23734. * @param {?} e
  23735. * @return {?}
  23736. */
  23737. function (e) {
  23738. return e instanceof ExternalExpr && this.value.name === e.value.name &&
  23739. this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime;
  23740. };
  23741. /**
  23742. * @param {?} visitor
  23743. * @param {?} context
  23744. * @return {?}
  23745. */
  23746. ExternalExpr.prototype.visitExpression = /**
  23747. * @param {?} visitor
  23748. * @param {?} context
  23749. * @return {?}
  23750. */
  23751. function (visitor, context) {
  23752. return visitor.visitExternalExpr(this, context);
  23753. };
  23754. return ExternalExpr;
  23755. }(Expression));
  23756. var ExternalReference = /** @class */ (function () {
  23757. function ExternalReference(moduleName, name, runtime) {
  23758. this.moduleName = moduleName;
  23759. this.name = name;
  23760. this.runtime = runtime;
  23761. }
  23762. return ExternalReference;
  23763. }());
  23764. var ConditionalExpr = /** @class */ (function (_super) {
  23765. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ConditionalExpr, _super);
  23766. function ConditionalExpr(condition, trueCase, falseCase, type, sourceSpan) {
  23767. if (falseCase === void 0) { falseCase = null; }
  23768. var _this = _super.call(this, type || trueCase.type, sourceSpan) || this;
  23769. _this.condition = condition;
  23770. _this.falseCase = falseCase;
  23771. _this.trueCase = trueCase;
  23772. return _this;
  23773. }
  23774. /**
  23775. * @param {?} e
  23776. * @return {?}
  23777. */
  23778. ConditionalExpr.prototype.isEquivalent = /**
  23779. * @param {?} e
  23780. * @return {?}
  23781. */
  23782. function (e) {
  23783. return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) &&
  23784. this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase);
  23785. };
  23786. /**
  23787. * @param {?} visitor
  23788. * @param {?} context
  23789. * @return {?}
  23790. */
  23791. ConditionalExpr.prototype.visitExpression = /**
  23792. * @param {?} visitor
  23793. * @param {?} context
  23794. * @return {?}
  23795. */
  23796. function (visitor, context) {
  23797. return visitor.visitConditionalExpr(this, context);
  23798. };
  23799. return ConditionalExpr;
  23800. }(Expression));
  23801. var NotExpr = /** @class */ (function (_super) {
  23802. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NotExpr, _super);
  23803. function NotExpr(condition, sourceSpan) {
  23804. var _this = _super.call(this, BOOL_TYPE, sourceSpan) || this;
  23805. _this.condition = condition;
  23806. return _this;
  23807. }
  23808. /**
  23809. * @param {?} e
  23810. * @return {?}
  23811. */
  23812. NotExpr.prototype.isEquivalent = /**
  23813. * @param {?} e
  23814. * @return {?}
  23815. */
  23816. function (e) {
  23817. return e instanceof NotExpr && this.condition.isEquivalent(e.condition);
  23818. };
  23819. /**
  23820. * @param {?} visitor
  23821. * @param {?} context
  23822. * @return {?}
  23823. */
  23824. NotExpr.prototype.visitExpression = /**
  23825. * @param {?} visitor
  23826. * @param {?} context
  23827. * @return {?}
  23828. */
  23829. function (visitor, context) {
  23830. return visitor.visitNotExpr(this, context);
  23831. };
  23832. return NotExpr;
  23833. }(Expression));
  23834. var AssertNotNull = /** @class */ (function (_super) {
  23835. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AssertNotNull, _super);
  23836. function AssertNotNull(condition, sourceSpan) {
  23837. var _this = _super.call(this, condition.type, sourceSpan) || this;
  23838. _this.condition = condition;
  23839. return _this;
  23840. }
  23841. /**
  23842. * @param {?} e
  23843. * @return {?}
  23844. */
  23845. AssertNotNull.prototype.isEquivalent = /**
  23846. * @param {?} e
  23847. * @return {?}
  23848. */
  23849. function (e) {
  23850. return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition);
  23851. };
  23852. /**
  23853. * @param {?} visitor
  23854. * @param {?} context
  23855. * @return {?}
  23856. */
  23857. AssertNotNull.prototype.visitExpression = /**
  23858. * @param {?} visitor
  23859. * @param {?} context
  23860. * @return {?}
  23861. */
  23862. function (visitor, context) {
  23863. return visitor.visitAssertNotNullExpr(this, context);
  23864. };
  23865. return AssertNotNull;
  23866. }(Expression));
  23867. var CastExpr = /** @class */ (function (_super) {
  23868. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CastExpr, _super);
  23869. function CastExpr(value, type, sourceSpan) {
  23870. var _this = _super.call(this, type, sourceSpan) || this;
  23871. _this.value = value;
  23872. return _this;
  23873. }
  23874. /**
  23875. * @param {?} e
  23876. * @return {?}
  23877. */
  23878. CastExpr.prototype.isEquivalent = /**
  23879. * @param {?} e
  23880. * @return {?}
  23881. */
  23882. function (e) {
  23883. return e instanceof CastExpr && this.value.isEquivalent(e.value);
  23884. };
  23885. /**
  23886. * @param {?} visitor
  23887. * @param {?} context
  23888. * @return {?}
  23889. */
  23890. CastExpr.prototype.visitExpression = /**
  23891. * @param {?} visitor
  23892. * @param {?} context
  23893. * @return {?}
  23894. */
  23895. function (visitor, context) {
  23896. return visitor.visitCastExpr(this, context);
  23897. };
  23898. return CastExpr;
  23899. }(Expression));
  23900. var FnParam = /** @class */ (function () {
  23901. function FnParam(name, type) {
  23902. if (type === void 0) { type = null; }
  23903. this.name = name;
  23904. this.type = type;
  23905. }
  23906. /**
  23907. * @param {?} param
  23908. * @return {?}
  23909. */
  23910. FnParam.prototype.isEquivalent = /**
  23911. * @param {?} param
  23912. * @return {?}
  23913. */
  23914. function (param) { return this.name === param.name; };
  23915. return FnParam;
  23916. }());
  23917. var FunctionExpr = /** @class */ (function (_super) {
  23918. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FunctionExpr, _super);
  23919. function FunctionExpr(params, statements, type, sourceSpan) {
  23920. var _this = _super.call(this, type, sourceSpan) || this;
  23921. _this.params = params;
  23922. _this.statements = statements;
  23923. return _this;
  23924. }
  23925. /**
  23926. * @param {?} e
  23927. * @return {?}
  23928. */
  23929. FunctionExpr.prototype.isEquivalent = /**
  23930. * @param {?} e
  23931. * @return {?}
  23932. */
  23933. function (e) {
  23934. return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) &&
  23935. areAllEquivalent(this.statements, e.statements);
  23936. };
  23937. /**
  23938. * @param {?} visitor
  23939. * @param {?} context
  23940. * @return {?}
  23941. */
  23942. FunctionExpr.prototype.visitExpression = /**
  23943. * @param {?} visitor
  23944. * @param {?} context
  23945. * @return {?}
  23946. */
  23947. function (visitor, context) {
  23948. return visitor.visitFunctionExpr(this, context);
  23949. };
  23950. /**
  23951. * @param {?} name
  23952. * @param {?=} modifiers
  23953. * @return {?}
  23954. */
  23955. FunctionExpr.prototype.toDeclStmt = /**
  23956. * @param {?} name
  23957. * @param {?=} modifiers
  23958. * @return {?}
  23959. */
  23960. function (name, modifiers) {
  23961. if (modifiers === void 0) { modifiers = null; }
  23962. return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
  23963. };
  23964. return FunctionExpr;
  23965. }(Expression));
  23966. var BinaryOperatorExpr = /** @class */ (function (_super) {
  23967. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BinaryOperatorExpr, _super);
  23968. function BinaryOperatorExpr(operator, lhs, rhs, type, sourceSpan) {
  23969. var _this = _super.call(this, type || lhs.type, sourceSpan) || this;
  23970. _this.operator = operator;
  23971. _this.rhs = rhs;
  23972. _this.lhs = lhs;
  23973. return _this;
  23974. }
  23975. /**
  23976. * @param {?} e
  23977. * @return {?}
  23978. */
  23979. BinaryOperatorExpr.prototype.isEquivalent = /**
  23980. * @param {?} e
  23981. * @return {?}
  23982. */
  23983. function (e) {
  23984. return e instanceof BinaryOperatorExpr && this.operator === e.operator &&
  23985. this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs);
  23986. };
  23987. /**
  23988. * @param {?} visitor
  23989. * @param {?} context
  23990. * @return {?}
  23991. */
  23992. BinaryOperatorExpr.prototype.visitExpression = /**
  23993. * @param {?} visitor
  23994. * @param {?} context
  23995. * @return {?}
  23996. */
  23997. function (visitor, context) {
  23998. return visitor.visitBinaryOperatorExpr(this, context);
  23999. };
  24000. return BinaryOperatorExpr;
  24001. }(Expression));
  24002. var ReadPropExpr = /** @class */ (function (_super) {
  24003. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadPropExpr, _super);
  24004. function ReadPropExpr(receiver, name, type, sourceSpan) {
  24005. var _this = _super.call(this, type, sourceSpan) || this;
  24006. _this.receiver = receiver;
  24007. _this.name = name;
  24008. return _this;
  24009. }
  24010. /**
  24011. * @param {?} e
  24012. * @return {?}
  24013. */
  24014. ReadPropExpr.prototype.isEquivalent = /**
  24015. * @param {?} e
  24016. * @return {?}
  24017. */
  24018. function (e) {
  24019. return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
  24020. this.name === e.name;
  24021. };
  24022. /**
  24023. * @param {?} visitor
  24024. * @param {?} context
  24025. * @return {?}
  24026. */
  24027. ReadPropExpr.prototype.visitExpression = /**
  24028. * @param {?} visitor
  24029. * @param {?} context
  24030. * @return {?}
  24031. */
  24032. function (visitor, context) {
  24033. return visitor.visitReadPropExpr(this, context);
  24034. };
  24035. /**
  24036. * @param {?} value
  24037. * @return {?}
  24038. */
  24039. ReadPropExpr.prototype.set = /**
  24040. * @param {?} value
  24041. * @return {?}
  24042. */
  24043. function (value) {
  24044. return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
  24045. };
  24046. return ReadPropExpr;
  24047. }(Expression));
  24048. var ReadKeyExpr = /** @class */ (function (_super) {
  24049. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadKeyExpr, _super);
  24050. function ReadKeyExpr(receiver, index, type, sourceSpan) {
  24051. var _this = _super.call(this, type, sourceSpan) || this;
  24052. _this.receiver = receiver;
  24053. _this.index = index;
  24054. return _this;
  24055. }
  24056. /**
  24057. * @param {?} e
  24058. * @return {?}
  24059. */
  24060. ReadKeyExpr.prototype.isEquivalent = /**
  24061. * @param {?} e
  24062. * @return {?}
  24063. */
  24064. function (e) {
  24065. return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) &&
  24066. this.index.isEquivalent(e.index);
  24067. };
  24068. /**
  24069. * @param {?} visitor
  24070. * @param {?} context
  24071. * @return {?}
  24072. */
  24073. ReadKeyExpr.prototype.visitExpression = /**
  24074. * @param {?} visitor
  24075. * @param {?} context
  24076. * @return {?}
  24077. */
  24078. function (visitor, context) {
  24079. return visitor.visitReadKeyExpr(this, context);
  24080. };
  24081. /**
  24082. * @param {?} value
  24083. * @return {?}
  24084. */
  24085. ReadKeyExpr.prototype.set = /**
  24086. * @param {?} value
  24087. * @return {?}
  24088. */
  24089. function (value) {
  24090. return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
  24091. };
  24092. return ReadKeyExpr;
  24093. }(Expression));
  24094. var LiteralArrayExpr = /** @class */ (function (_super) {
  24095. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralArrayExpr, _super);
  24096. function LiteralArrayExpr(entries, type, sourceSpan) {
  24097. var _this = _super.call(this, type, sourceSpan) || this;
  24098. _this.entries = entries;
  24099. return _this;
  24100. }
  24101. /**
  24102. * @param {?} e
  24103. * @return {?}
  24104. */
  24105. LiteralArrayExpr.prototype.isEquivalent = /**
  24106. * @param {?} e
  24107. * @return {?}
  24108. */
  24109. function (e) {
  24110. return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries);
  24111. };
  24112. /**
  24113. * @param {?} visitor
  24114. * @param {?} context
  24115. * @return {?}
  24116. */
  24117. LiteralArrayExpr.prototype.visitExpression = /**
  24118. * @param {?} visitor
  24119. * @param {?} context
  24120. * @return {?}
  24121. */
  24122. function (visitor, context) {
  24123. return visitor.visitLiteralArrayExpr(this, context);
  24124. };
  24125. return LiteralArrayExpr;
  24126. }(Expression));
  24127. var LiteralMapEntry = /** @class */ (function () {
  24128. function LiteralMapEntry(key, value, quoted) {
  24129. this.key = key;
  24130. this.value = value;
  24131. this.quoted = quoted;
  24132. }
  24133. /**
  24134. * @param {?} e
  24135. * @return {?}
  24136. */
  24137. LiteralMapEntry.prototype.isEquivalent = /**
  24138. * @param {?} e
  24139. * @return {?}
  24140. */
  24141. function (e) {
  24142. return this.key === e.key && this.value.isEquivalent(e.value);
  24143. };
  24144. return LiteralMapEntry;
  24145. }());
  24146. var LiteralMapExpr = /** @class */ (function (_super) {
  24147. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralMapExpr, _super);
  24148. function LiteralMapExpr(entries, type, sourceSpan) {
  24149. var _this = _super.call(this, type, sourceSpan) || this;
  24150. _this.entries = entries;
  24151. _this.valueType = null;
  24152. if (type) {
  24153. _this.valueType = type.valueType;
  24154. }
  24155. return _this;
  24156. }
  24157. /**
  24158. * @param {?} e
  24159. * @return {?}
  24160. */
  24161. LiteralMapExpr.prototype.isEquivalent = /**
  24162. * @param {?} e
  24163. * @return {?}
  24164. */
  24165. function (e) {
  24166. return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);
  24167. };
  24168. /**
  24169. * @param {?} visitor
  24170. * @param {?} context
  24171. * @return {?}
  24172. */
  24173. LiteralMapExpr.prototype.visitExpression = /**
  24174. * @param {?} visitor
  24175. * @param {?} context
  24176. * @return {?}
  24177. */
  24178. function (visitor, context) {
  24179. return visitor.visitLiteralMapExpr(this, context);
  24180. };
  24181. return LiteralMapExpr;
  24182. }(Expression));
  24183. var CommaExpr = /** @class */ (function (_super) {
  24184. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CommaExpr, _super);
  24185. function CommaExpr(parts, sourceSpan) {
  24186. var _this = _super.call(this, parts[parts.length - 1].type, sourceSpan) || this;
  24187. _this.parts = parts;
  24188. return _this;
  24189. }
  24190. /**
  24191. * @param {?} e
  24192. * @return {?}
  24193. */
  24194. CommaExpr.prototype.isEquivalent = /**
  24195. * @param {?} e
  24196. * @return {?}
  24197. */
  24198. function (e) {
  24199. return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);
  24200. };
  24201. /**
  24202. * @param {?} visitor
  24203. * @param {?} context
  24204. * @return {?}
  24205. */
  24206. CommaExpr.prototype.visitExpression = /**
  24207. * @param {?} visitor
  24208. * @param {?} context
  24209. * @return {?}
  24210. */
  24211. function (visitor, context) {
  24212. return visitor.visitCommaExpr(this, context);
  24213. };
  24214. return CommaExpr;
  24215. }(Expression));
  24216. /**
  24217. * @record
  24218. */
  24219. var THIS_EXPR = new ReadVarExpr(BuiltinVar.This, null, null);
  24220. var SUPER_EXPR = new ReadVarExpr(BuiltinVar.Super, null, null);
  24221. var CATCH_ERROR_VAR = new ReadVarExpr(BuiltinVar.CatchError, null, null);
  24222. var CATCH_STACK_VAR = new ReadVarExpr(BuiltinVar.CatchStack, null, null);
  24223. var NULL_EXPR = new LiteralExpr(null, null, null);
  24224. var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
  24225. /** @enum {number} */
  24226. var StmtModifier = {
  24227. Final: 0,
  24228. Private: 1,
  24229. Exported: 2,
  24230. };
  24231. StmtModifier[StmtModifier.Final] = "Final";
  24232. StmtModifier[StmtModifier.Private] = "Private";
  24233. StmtModifier[StmtModifier.Exported] = "Exported";
  24234. /**
  24235. * @abstract
  24236. */
  24237. var Statement = /** @class */ (function () {
  24238. function Statement(modifiers, sourceSpan) {
  24239. this.modifiers = modifiers || [];
  24240. this.sourceSpan = sourceSpan || null;
  24241. }
  24242. /**
  24243. * @param {?} modifier
  24244. * @return {?}
  24245. */
  24246. Statement.prototype.hasModifier = /**
  24247. * @param {?} modifier
  24248. * @return {?}
  24249. */
  24250. function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
  24251. return Statement;
  24252. }());
  24253. var DeclareVarStmt = /** @class */ (function (_super) {
  24254. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DeclareVarStmt, _super);
  24255. function DeclareVarStmt(name, value, type, modifiers, sourceSpan) {
  24256. if (modifiers === void 0) { modifiers = null; }
  24257. var _this = _super.call(this, modifiers, sourceSpan) || this;
  24258. _this.name = name;
  24259. _this.value = value;
  24260. _this.type = type || value.type;
  24261. return _this;
  24262. }
  24263. /**
  24264. * @param {?} stmt
  24265. * @return {?}
  24266. */
  24267. DeclareVarStmt.prototype.isEquivalent = /**
  24268. * @param {?} stmt
  24269. * @return {?}
  24270. */
  24271. function (stmt) {
  24272. return stmt instanceof DeclareVarStmt && this.name === stmt.name &&
  24273. this.value.isEquivalent(stmt.value);
  24274. };
  24275. /**
  24276. * @param {?} visitor
  24277. * @param {?} context
  24278. * @return {?}
  24279. */
  24280. DeclareVarStmt.prototype.visitStatement = /**
  24281. * @param {?} visitor
  24282. * @param {?} context
  24283. * @return {?}
  24284. */
  24285. function (visitor, context) {
  24286. return visitor.visitDeclareVarStmt(this, context);
  24287. };
  24288. return DeclareVarStmt;
  24289. }(Statement));
  24290. var DeclareFunctionStmt = /** @class */ (function (_super) {
  24291. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DeclareFunctionStmt, _super);
  24292. function DeclareFunctionStmt(name, params, statements, type, modifiers, sourceSpan) {
  24293. if (modifiers === void 0) { modifiers = null; }
  24294. var _this = _super.call(this, modifiers, sourceSpan) || this;
  24295. _this.name = name;
  24296. _this.params = params;
  24297. _this.statements = statements;
  24298. _this.type = type || null;
  24299. return _this;
  24300. }
  24301. /**
  24302. * @param {?} stmt
  24303. * @return {?}
  24304. */
  24305. DeclareFunctionStmt.prototype.isEquivalent = /**
  24306. * @param {?} stmt
  24307. * @return {?}
  24308. */
  24309. function (stmt) {
  24310. return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) &&
  24311. areAllEquivalent(this.statements, stmt.statements);
  24312. };
  24313. /**
  24314. * @param {?} visitor
  24315. * @param {?} context
  24316. * @return {?}
  24317. */
  24318. DeclareFunctionStmt.prototype.visitStatement = /**
  24319. * @param {?} visitor
  24320. * @param {?} context
  24321. * @return {?}
  24322. */
  24323. function (visitor, context) {
  24324. return visitor.visitDeclareFunctionStmt(this, context);
  24325. };
  24326. return DeclareFunctionStmt;
  24327. }(Statement));
  24328. var ExpressionStatement = /** @class */ (function (_super) {
  24329. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpressionStatement, _super);
  24330. function ExpressionStatement(expr, sourceSpan) {
  24331. var _this = _super.call(this, null, sourceSpan) || this;
  24332. _this.expr = expr;
  24333. return _this;
  24334. }
  24335. /**
  24336. * @param {?} stmt
  24337. * @return {?}
  24338. */
  24339. ExpressionStatement.prototype.isEquivalent = /**
  24340. * @param {?} stmt
  24341. * @return {?}
  24342. */
  24343. function (stmt) {
  24344. return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);
  24345. };
  24346. /**
  24347. * @param {?} visitor
  24348. * @param {?} context
  24349. * @return {?}
  24350. */
  24351. ExpressionStatement.prototype.visitStatement = /**
  24352. * @param {?} visitor
  24353. * @param {?} context
  24354. * @return {?}
  24355. */
  24356. function (visitor, context) {
  24357. return visitor.visitExpressionStmt(this, context);
  24358. };
  24359. return ExpressionStatement;
  24360. }(Statement));
  24361. var ReturnStatement = /** @class */ (function (_super) {
  24362. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReturnStatement, _super);
  24363. function ReturnStatement(value, sourceSpan) {
  24364. var _this = _super.call(this, null, sourceSpan) || this;
  24365. _this.value = value;
  24366. return _this;
  24367. }
  24368. /**
  24369. * @param {?} stmt
  24370. * @return {?}
  24371. */
  24372. ReturnStatement.prototype.isEquivalent = /**
  24373. * @param {?} stmt
  24374. * @return {?}
  24375. */
  24376. function (stmt) {
  24377. return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value);
  24378. };
  24379. /**
  24380. * @param {?} visitor
  24381. * @param {?} context
  24382. * @return {?}
  24383. */
  24384. ReturnStatement.prototype.visitStatement = /**
  24385. * @param {?} visitor
  24386. * @param {?} context
  24387. * @return {?}
  24388. */
  24389. function (visitor, context) {
  24390. return visitor.visitReturnStmt(this, context);
  24391. };
  24392. return ReturnStatement;
  24393. }(Statement));
  24394. var AbstractClassPart = /** @class */ (function () {
  24395. function AbstractClassPart(type, modifiers) {
  24396. this.modifiers = modifiers;
  24397. if (!modifiers) {
  24398. this.modifiers = [];
  24399. }
  24400. this.type = type || null;
  24401. }
  24402. /**
  24403. * @param {?} modifier
  24404. * @return {?}
  24405. */
  24406. AbstractClassPart.prototype.hasModifier = /**
  24407. * @param {?} modifier
  24408. * @return {?}
  24409. */
  24410. function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
  24411. return AbstractClassPart;
  24412. }());
  24413. var ClassField = /** @class */ (function (_super) {
  24414. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassField, _super);
  24415. function ClassField(name, type, modifiers) {
  24416. if (modifiers === void 0) { modifiers = null; }
  24417. var _this = _super.call(this, type, modifiers) || this;
  24418. _this.name = name;
  24419. return _this;
  24420. }
  24421. /**
  24422. * @param {?} f
  24423. * @return {?}
  24424. */
  24425. ClassField.prototype.isEquivalent = /**
  24426. * @param {?} f
  24427. * @return {?}
  24428. */
  24429. function (f) { return this.name === f.name; };
  24430. return ClassField;
  24431. }(AbstractClassPart));
  24432. var ClassMethod = /** @class */ (function (_super) {
  24433. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassMethod, _super);
  24434. function ClassMethod(name, params, body, type, modifiers) {
  24435. if (modifiers === void 0) { modifiers = null; }
  24436. var _this = _super.call(this, type, modifiers) || this;
  24437. _this.name = name;
  24438. _this.params = params;
  24439. _this.body = body;
  24440. return _this;
  24441. }
  24442. /**
  24443. * @param {?} m
  24444. * @return {?}
  24445. */
  24446. ClassMethod.prototype.isEquivalent = /**
  24447. * @param {?} m
  24448. * @return {?}
  24449. */
  24450. function (m) {
  24451. return this.name === m.name && areAllEquivalent(this.body, m.body);
  24452. };
  24453. return ClassMethod;
  24454. }(AbstractClassPart));
  24455. var ClassGetter = /** @class */ (function (_super) {
  24456. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassGetter, _super);
  24457. function ClassGetter(name, body, type, modifiers) {
  24458. if (modifiers === void 0) { modifiers = null; }
  24459. var _this = _super.call(this, type, modifiers) || this;
  24460. _this.name = name;
  24461. _this.body = body;
  24462. return _this;
  24463. }
  24464. /**
  24465. * @param {?} m
  24466. * @return {?}
  24467. */
  24468. ClassGetter.prototype.isEquivalent = /**
  24469. * @param {?} m
  24470. * @return {?}
  24471. */
  24472. function (m) {
  24473. return this.name === m.name && areAllEquivalent(this.body, m.body);
  24474. };
  24475. return ClassGetter;
  24476. }(AbstractClassPart));
  24477. var ClassStmt = /** @class */ (function (_super) {
  24478. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassStmt, _super);
  24479. function ClassStmt(name, parent, fields, getters, constructorMethod, methods, modifiers, sourceSpan) {
  24480. if (modifiers === void 0) { modifiers = null; }
  24481. var _this = _super.call(this, modifiers, sourceSpan) || this;
  24482. _this.name = name;
  24483. _this.parent = parent;
  24484. _this.fields = fields;
  24485. _this.getters = getters;
  24486. _this.constructorMethod = constructorMethod;
  24487. _this.methods = methods;
  24488. return _this;
  24489. }
  24490. /**
  24491. * @param {?} stmt
  24492. * @return {?}
  24493. */
  24494. ClassStmt.prototype.isEquivalent = /**
  24495. * @param {?} stmt
  24496. * @return {?}
  24497. */
  24498. function (stmt) {
  24499. return stmt instanceof ClassStmt && this.name === stmt.name &&
  24500. nullSafeIsEquivalent(this.parent, stmt.parent) &&
  24501. areAllEquivalent(this.fields, stmt.fields) &&
  24502. areAllEquivalent(this.getters, stmt.getters) &&
  24503. this.constructorMethod.isEquivalent(stmt.constructorMethod) &&
  24504. areAllEquivalent(this.methods, stmt.methods);
  24505. };
  24506. /**
  24507. * @param {?} visitor
  24508. * @param {?} context
  24509. * @return {?}
  24510. */
  24511. ClassStmt.prototype.visitStatement = /**
  24512. * @param {?} visitor
  24513. * @param {?} context
  24514. * @return {?}
  24515. */
  24516. function (visitor, context) {
  24517. return visitor.visitDeclareClassStmt(this, context);
  24518. };
  24519. return ClassStmt;
  24520. }(Statement));
  24521. var IfStmt = /** @class */ (function (_super) {
  24522. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(IfStmt, _super);
  24523. function IfStmt(condition, trueCase, falseCase, sourceSpan) {
  24524. if (falseCase === void 0) { falseCase = []; }
  24525. var _this = _super.call(this, null, sourceSpan) || this;
  24526. _this.condition = condition;
  24527. _this.trueCase = trueCase;
  24528. _this.falseCase = falseCase;
  24529. return _this;
  24530. }
  24531. /**
  24532. * @param {?} stmt
  24533. * @return {?}
  24534. */
  24535. IfStmt.prototype.isEquivalent = /**
  24536. * @param {?} stmt
  24537. * @return {?}
  24538. */
  24539. function (stmt) {
  24540. return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) &&
  24541. areAllEquivalent(this.trueCase, stmt.trueCase) &&
  24542. areAllEquivalent(this.falseCase, stmt.falseCase);
  24543. };
  24544. /**
  24545. * @param {?} visitor
  24546. * @param {?} context
  24547. * @return {?}
  24548. */
  24549. IfStmt.prototype.visitStatement = /**
  24550. * @param {?} visitor
  24551. * @param {?} context
  24552. * @return {?}
  24553. */
  24554. function (visitor, context) {
  24555. return visitor.visitIfStmt(this, context);
  24556. };
  24557. return IfStmt;
  24558. }(Statement));
  24559. var CommentStmt = /** @class */ (function (_super) {
  24560. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CommentStmt, _super);
  24561. function CommentStmt(comment, sourceSpan) {
  24562. var _this = _super.call(this, null, sourceSpan) || this;
  24563. _this.comment = comment;
  24564. return _this;
  24565. }
  24566. /**
  24567. * @param {?} stmt
  24568. * @return {?}
  24569. */
  24570. CommentStmt.prototype.isEquivalent = /**
  24571. * @param {?} stmt
  24572. * @return {?}
  24573. */
  24574. function (stmt) { return stmt instanceof CommentStmt; };
  24575. /**
  24576. * @param {?} visitor
  24577. * @param {?} context
  24578. * @return {?}
  24579. */
  24580. CommentStmt.prototype.visitStatement = /**
  24581. * @param {?} visitor
  24582. * @param {?} context
  24583. * @return {?}
  24584. */
  24585. function (visitor, context) {
  24586. return visitor.visitCommentStmt(this, context);
  24587. };
  24588. return CommentStmt;
  24589. }(Statement));
  24590. var TryCatchStmt = /** @class */ (function (_super) {
  24591. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TryCatchStmt, _super);
  24592. function TryCatchStmt(bodyStmts, catchStmts, sourceSpan) {
  24593. var _this = _super.call(this, null, sourceSpan) || this;
  24594. _this.bodyStmts = bodyStmts;
  24595. _this.catchStmts = catchStmts;
  24596. return _this;
  24597. }
  24598. /**
  24599. * @param {?} stmt
  24600. * @return {?}
  24601. */
  24602. TryCatchStmt.prototype.isEquivalent = /**
  24603. * @param {?} stmt
  24604. * @return {?}
  24605. */
  24606. function (stmt) {
  24607. return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) &&
  24608. areAllEquivalent(this.catchStmts, stmt.catchStmts);
  24609. };
  24610. /**
  24611. * @param {?} visitor
  24612. * @param {?} context
  24613. * @return {?}
  24614. */
  24615. TryCatchStmt.prototype.visitStatement = /**
  24616. * @param {?} visitor
  24617. * @param {?} context
  24618. * @return {?}
  24619. */
  24620. function (visitor, context) {
  24621. return visitor.visitTryCatchStmt(this, context);
  24622. };
  24623. return TryCatchStmt;
  24624. }(Statement));
  24625. var ThrowStmt = /** @class */ (function (_super) {
  24626. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ThrowStmt, _super);
  24627. function ThrowStmt(error, sourceSpan) {
  24628. var _this = _super.call(this, null, sourceSpan) || this;
  24629. _this.error = error;
  24630. return _this;
  24631. }
  24632. /**
  24633. * @param {?} stmt
  24634. * @return {?}
  24635. */
  24636. ThrowStmt.prototype.isEquivalent = /**
  24637. * @param {?} stmt
  24638. * @return {?}
  24639. */
  24640. function (stmt) {
  24641. return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error);
  24642. };
  24643. /**
  24644. * @param {?} visitor
  24645. * @param {?} context
  24646. * @return {?}
  24647. */
  24648. ThrowStmt.prototype.visitStatement = /**
  24649. * @param {?} visitor
  24650. * @param {?} context
  24651. * @return {?}
  24652. */
  24653. function (visitor, context) {
  24654. return visitor.visitThrowStmt(this, context);
  24655. };
  24656. return ThrowStmt;
  24657. }(Statement));
  24658. /**
  24659. * @record
  24660. */
  24661. var AstTransformer$1 = /** @class */ (function () {
  24662. function AstTransformer() {
  24663. }
  24664. /**
  24665. * @param {?} expr
  24666. * @param {?} context
  24667. * @return {?}
  24668. */
  24669. AstTransformer.prototype.transformExpr = /**
  24670. * @param {?} expr
  24671. * @param {?} context
  24672. * @return {?}
  24673. */
  24674. function (expr, context) { return expr; };
  24675. /**
  24676. * @param {?} stmt
  24677. * @param {?} context
  24678. * @return {?}
  24679. */
  24680. AstTransformer.prototype.transformStmt = /**
  24681. * @param {?} stmt
  24682. * @param {?} context
  24683. * @return {?}
  24684. */
  24685. function (stmt, context) { return stmt; };
  24686. /**
  24687. * @param {?} ast
  24688. * @param {?} context
  24689. * @return {?}
  24690. */
  24691. AstTransformer.prototype.visitReadVarExpr = /**
  24692. * @param {?} ast
  24693. * @param {?} context
  24694. * @return {?}
  24695. */
  24696. function (ast, context) { return this.transformExpr(ast, context); };
  24697. /**
  24698. * @param {?} expr
  24699. * @param {?} context
  24700. * @return {?}
  24701. */
  24702. AstTransformer.prototype.visitWriteVarExpr = /**
  24703. * @param {?} expr
  24704. * @param {?} context
  24705. * @return {?}
  24706. */
  24707. function (expr, context) {
  24708. return this.transformExpr(new WriteVarExpr(expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
  24709. };
  24710. /**
  24711. * @param {?} expr
  24712. * @param {?} context
  24713. * @return {?}
  24714. */
  24715. AstTransformer.prototype.visitWriteKeyExpr = /**
  24716. * @param {?} expr
  24717. * @param {?} context
  24718. * @return {?}
  24719. */
  24720. function (expr, context) {
  24721. return this.transformExpr(new WriteKeyExpr(expr.receiver.visitExpression(this, context), expr.index.visitExpression(this, context), expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
  24722. };
  24723. /**
  24724. * @param {?} expr
  24725. * @param {?} context
  24726. * @return {?}
  24727. */
  24728. AstTransformer.prototype.visitWritePropExpr = /**
  24729. * @param {?} expr
  24730. * @param {?} context
  24731. * @return {?}
  24732. */
  24733. function (expr, context) {
  24734. return this.transformExpr(new WritePropExpr(expr.receiver.visitExpression(this, context), expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
  24735. };
  24736. /**
  24737. * @param {?} ast
  24738. * @param {?} context
  24739. * @return {?}
  24740. */
  24741. AstTransformer.prototype.visitInvokeMethodExpr = /**
  24742. * @param {?} ast
  24743. * @param {?} context
  24744. * @return {?}
  24745. */
  24746. function (ast, context) {
  24747. var /** @type {?} */ method = ast.builtin || ast.name;
  24748. return this.transformExpr(new InvokeMethodExpr(ast.receiver.visitExpression(this, context), /** @type {?} */ ((method)), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
  24749. };
  24750. /**
  24751. * @param {?} ast
  24752. * @param {?} context
  24753. * @return {?}
  24754. */
  24755. AstTransformer.prototype.visitInvokeFunctionExpr = /**
  24756. * @param {?} ast
  24757. * @param {?} context
  24758. * @return {?}
  24759. */
  24760. function (ast, context) {
  24761. return this.transformExpr(new InvokeFunctionExpr(ast.fn.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
  24762. };
  24763. /**
  24764. * @param {?} ast
  24765. * @param {?} context
  24766. * @return {?}
  24767. */
  24768. AstTransformer.prototype.visitInstantiateExpr = /**
  24769. * @param {?} ast
  24770. * @param {?} context
  24771. * @return {?}
  24772. */
  24773. function (ast, context) {
  24774. return this.transformExpr(new InstantiateExpr(ast.classExpr.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
  24775. };
  24776. /**
  24777. * @param {?} ast
  24778. * @param {?} context
  24779. * @return {?}
  24780. */
  24781. AstTransformer.prototype.visitLiteralExpr = /**
  24782. * @param {?} ast
  24783. * @param {?} context
  24784. * @return {?}
  24785. */
  24786. function (ast, context) { return this.transformExpr(ast, context); };
  24787. /**
  24788. * @param {?} ast
  24789. * @param {?} context
  24790. * @return {?}
  24791. */
  24792. AstTransformer.prototype.visitExternalExpr = /**
  24793. * @param {?} ast
  24794. * @param {?} context
  24795. * @return {?}
  24796. */
  24797. function (ast, context) {
  24798. return this.transformExpr(ast, context);
  24799. };
  24800. /**
  24801. * @param {?} ast
  24802. * @param {?} context
  24803. * @return {?}
  24804. */
  24805. AstTransformer.prototype.visitConditionalExpr = /**
  24806. * @param {?} ast
  24807. * @param {?} context
  24808. * @return {?}
  24809. */
  24810. function (ast, context) {
  24811. return this.transformExpr(new ConditionalExpr(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), /** @type {?} */ ((ast.falseCase)).visitExpression(this, context), ast.type, ast.sourceSpan), context);
  24812. };
  24813. /**
  24814. * @param {?} ast
  24815. * @param {?} context
  24816. * @return {?}
  24817. */
  24818. AstTransformer.prototype.visitNotExpr = /**
  24819. * @param {?} ast
  24820. * @param {?} context
  24821. * @return {?}
  24822. */
  24823. function (ast, context) {
  24824. return this.transformExpr(new NotExpr(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
  24825. };
  24826. /**
  24827. * @param {?} ast
  24828. * @param {?} context
  24829. * @return {?}
  24830. */
  24831. AstTransformer.prototype.visitAssertNotNullExpr = /**
  24832. * @param {?} ast
  24833. * @param {?} context
  24834. * @return {?}
  24835. */
  24836. function (ast, context) {
  24837. return this.transformExpr(new AssertNotNull(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
  24838. };
  24839. /**
  24840. * @param {?} ast
  24841. * @param {?} context
  24842. * @return {?}
  24843. */
  24844. AstTransformer.prototype.visitCastExpr = /**
  24845. * @param {?} ast
  24846. * @param {?} context
  24847. * @return {?}
  24848. */
  24849. function (ast, context) {
  24850. return this.transformExpr(new CastExpr(ast.value.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  24851. };
  24852. /**
  24853. * @param {?} ast
  24854. * @param {?} context
  24855. * @return {?}
  24856. */
  24857. AstTransformer.prototype.visitFunctionExpr = /**
  24858. * @param {?} ast
  24859. * @param {?} context
  24860. * @return {?}
  24861. */
  24862. function (ast, context) {
  24863. return this.transformExpr(new FunctionExpr(ast.params, this.visitAllStatements(ast.statements, context), ast.type, ast.sourceSpan), context);
  24864. };
  24865. /**
  24866. * @param {?} ast
  24867. * @param {?} context
  24868. * @return {?}
  24869. */
  24870. AstTransformer.prototype.visitBinaryOperatorExpr = /**
  24871. * @param {?} ast
  24872. * @param {?} context
  24873. * @return {?}
  24874. */
  24875. function (ast, context) {
  24876. return this.transformExpr(new BinaryOperatorExpr(ast.operator, ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  24877. };
  24878. /**
  24879. * @param {?} ast
  24880. * @param {?} context
  24881. * @return {?}
  24882. */
  24883. AstTransformer.prototype.visitReadPropExpr = /**
  24884. * @param {?} ast
  24885. * @param {?} context
  24886. * @return {?}
  24887. */
  24888. function (ast, context) {
  24889. return this.transformExpr(new ReadPropExpr(ast.receiver.visitExpression(this, context), ast.name, ast.type, ast.sourceSpan), context);
  24890. };
  24891. /**
  24892. * @param {?} ast
  24893. * @param {?} context
  24894. * @return {?}
  24895. */
  24896. AstTransformer.prototype.visitReadKeyExpr = /**
  24897. * @param {?} ast
  24898. * @param {?} context
  24899. * @return {?}
  24900. */
  24901. function (ast, context) {
  24902. return this.transformExpr(new ReadKeyExpr(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  24903. };
  24904. /**
  24905. * @param {?} ast
  24906. * @param {?} context
  24907. * @return {?}
  24908. */
  24909. AstTransformer.prototype.visitLiteralArrayExpr = /**
  24910. * @param {?} ast
  24911. * @param {?} context
  24912. * @return {?}
  24913. */
  24914. function (ast, context) {
  24915. return this.transformExpr(new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context), ast.type, ast.sourceSpan), context);
  24916. };
  24917. /**
  24918. * @param {?} ast
  24919. * @param {?} context
  24920. * @return {?}
  24921. */
  24922. AstTransformer.prototype.visitLiteralMapExpr = /**
  24923. * @param {?} ast
  24924. * @param {?} context
  24925. * @return {?}
  24926. */
  24927. function (ast, context) {
  24928. var _this = this;
  24929. var /** @type {?} */ entries = ast.entries.map(function (entry) {
  24930. return new LiteralMapEntry(entry.key, entry.value.visitExpression(_this, context), entry.quoted);
  24931. });
  24932. var /** @type {?} */ mapType = new MapType(ast.valueType, null);
  24933. return this.transformExpr(new LiteralMapExpr(entries, mapType, ast.sourceSpan), context);
  24934. };
  24935. /**
  24936. * @param {?} ast
  24937. * @param {?} context
  24938. * @return {?}
  24939. */
  24940. AstTransformer.prototype.visitCommaExpr = /**
  24941. * @param {?} ast
  24942. * @param {?} context
  24943. * @return {?}
  24944. */
  24945. function (ast, context) {
  24946. return this.transformExpr(new CommaExpr(this.visitAllExpressions(ast.parts, context), ast.sourceSpan), context);
  24947. };
  24948. /**
  24949. * @param {?} exprs
  24950. * @param {?} context
  24951. * @return {?}
  24952. */
  24953. AstTransformer.prototype.visitAllExpressions = /**
  24954. * @param {?} exprs
  24955. * @param {?} context
  24956. * @return {?}
  24957. */
  24958. function (exprs, context) {
  24959. var _this = this;
  24960. return exprs.map(function (expr) { return expr.visitExpression(_this, context); });
  24961. };
  24962. /**
  24963. * @param {?} stmt
  24964. * @param {?} context
  24965. * @return {?}
  24966. */
  24967. AstTransformer.prototype.visitDeclareVarStmt = /**
  24968. * @param {?} stmt
  24969. * @param {?} context
  24970. * @return {?}
  24971. */
  24972. function (stmt, context) {
  24973. return this.transformStmt(new DeclareVarStmt(stmt.name, stmt.value.visitExpression(this, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
  24974. };
  24975. /**
  24976. * @param {?} stmt
  24977. * @param {?} context
  24978. * @return {?}
  24979. */
  24980. AstTransformer.prototype.visitDeclareFunctionStmt = /**
  24981. * @param {?} stmt
  24982. * @param {?} context
  24983. * @return {?}
  24984. */
  24985. function (stmt, context) {
  24986. return this.transformStmt(new DeclareFunctionStmt(stmt.name, stmt.params, this.visitAllStatements(stmt.statements, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
  24987. };
  24988. /**
  24989. * @param {?} stmt
  24990. * @param {?} context
  24991. * @return {?}
  24992. */
  24993. AstTransformer.prototype.visitExpressionStmt = /**
  24994. * @param {?} stmt
  24995. * @param {?} context
  24996. * @return {?}
  24997. */
  24998. function (stmt, context) {
  24999. return this.transformStmt(new ExpressionStatement(stmt.expr.visitExpression(this, context), stmt.sourceSpan), context);
  25000. };
  25001. /**
  25002. * @param {?} stmt
  25003. * @param {?} context
  25004. * @return {?}
  25005. */
  25006. AstTransformer.prototype.visitReturnStmt = /**
  25007. * @param {?} stmt
  25008. * @param {?} context
  25009. * @return {?}
  25010. */
  25011. function (stmt, context) {
  25012. return this.transformStmt(new ReturnStatement(stmt.value.visitExpression(this, context), stmt.sourceSpan), context);
  25013. };
  25014. /**
  25015. * @param {?} stmt
  25016. * @param {?} context
  25017. * @return {?}
  25018. */
  25019. AstTransformer.prototype.visitDeclareClassStmt = /**
  25020. * @param {?} stmt
  25021. * @param {?} context
  25022. * @return {?}
  25023. */
  25024. function (stmt, context) {
  25025. var _this = this;
  25026. var /** @type {?} */ parent = /** @type {?} */ ((stmt.parent)).visitExpression(this, context);
  25027. var /** @type {?} */ getters = stmt.getters.map(function (getter) {
  25028. return new ClassGetter(getter.name, _this.visitAllStatements(getter.body, context), getter.type, getter.modifiers);
  25029. });
  25030. var /** @type {?} */ ctorMethod = stmt.constructorMethod &&
  25031. new ClassMethod(stmt.constructorMethod.name, stmt.constructorMethod.params, this.visitAllStatements(stmt.constructorMethod.body, context), stmt.constructorMethod.type, stmt.constructorMethod.modifiers);
  25032. var /** @type {?} */ methods = stmt.methods.map(function (method) {
  25033. return new ClassMethod(method.name, method.params, _this.visitAllStatements(method.body, context), method.type, method.modifiers);
  25034. });
  25035. return this.transformStmt(new ClassStmt(stmt.name, parent, stmt.fields, getters, ctorMethod, methods, stmt.modifiers, stmt.sourceSpan), context);
  25036. };
  25037. /**
  25038. * @param {?} stmt
  25039. * @param {?} context
  25040. * @return {?}
  25041. */
  25042. AstTransformer.prototype.visitIfStmt = /**
  25043. * @param {?} stmt
  25044. * @param {?} context
  25045. * @return {?}
  25046. */
  25047. function (stmt, context) {
  25048. return this.transformStmt(new IfStmt(stmt.condition.visitExpression(this, context), this.visitAllStatements(stmt.trueCase, context), this.visitAllStatements(stmt.falseCase, context), stmt.sourceSpan), context);
  25049. };
  25050. /**
  25051. * @param {?} stmt
  25052. * @param {?} context
  25053. * @return {?}
  25054. */
  25055. AstTransformer.prototype.visitTryCatchStmt = /**
  25056. * @param {?} stmt
  25057. * @param {?} context
  25058. * @return {?}
  25059. */
  25060. function (stmt, context) {
  25061. return this.transformStmt(new TryCatchStmt(this.visitAllStatements(stmt.bodyStmts, context), this.visitAllStatements(stmt.catchStmts, context), stmt.sourceSpan), context);
  25062. };
  25063. /**
  25064. * @param {?} stmt
  25065. * @param {?} context
  25066. * @return {?}
  25067. */
  25068. AstTransformer.prototype.visitThrowStmt = /**
  25069. * @param {?} stmt
  25070. * @param {?} context
  25071. * @return {?}
  25072. */
  25073. function (stmt, context) {
  25074. return this.transformStmt(new ThrowStmt(stmt.error.visitExpression(this, context), stmt.sourceSpan), context);
  25075. };
  25076. /**
  25077. * @param {?} stmt
  25078. * @param {?} context
  25079. * @return {?}
  25080. */
  25081. AstTransformer.prototype.visitCommentStmt = /**
  25082. * @param {?} stmt
  25083. * @param {?} context
  25084. * @return {?}
  25085. */
  25086. function (stmt, context) {
  25087. return this.transformStmt(stmt, context);
  25088. };
  25089. /**
  25090. * @param {?} stmts
  25091. * @param {?} context
  25092. * @return {?}
  25093. */
  25094. AstTransformer.prototype.visitAllStatements = /**
  25095. * @param {?} stmts
  25096. * @param {?} context
  25097. * @return {?}
  25098. */
  25099. function (stmts, context) {
  25100. var _this = this;
  25101. return stmts.map(function (stmt) { return stmt.visitStatement(_this, context); });
  25102. };
  25103. return AstTransformer;
  25104. }());
  25105. var RecursiveAstVisitor$1 = /** @class */ (function () {
  25106. function RecursiveAstVisitor() {
  25107. }
  25108. /**
  25109. * @param {?} ast
  25110. * @param {?} context
  25111. * @return {?}
  25112. */
  25113. RecursiveAstVisitor.prototype.visitType = /**
  25114. * @param {?} ast
  25115. * @param {?} context
  25116. * @return {?}
  25117. */
  25118. function (ast, context) { return ast; };
  25119. /**
  25120. * @param {?} ast
  25121. * @param {?} context
  25122. * @return {?}
  25123. */
  25124. RecursiveAstVisitor.prototype.visitExpression = /**
  25125. * @param {?} ast
  25126. * @param {?} context
  25127. * @return {?}
  25128. */
  25129. function (ast, context) {
  25130. if (ast.type) {
  25131. ast.type.visitType(this, context);
  25132. }
  25133. return ast;
  25134. };
  25135. /**
  25136. * @param {?} type
  25137. * @param {?} context
  25138. * @return {?}
  25139. */
  25140. RecursiveAstVisitor.prototype.visitBuiltintType = /**
  25141. * @param {?} type
  25142. * @param {?} context
  25143. * @return {?}
  25144. */
  25145. function (type, context) { return this.visitType(type, context); };
  25146. /**
  25147. * @param {?} type
  25148. * @param {?} context
  25149. * @return {?}
  25150. */
  25151. RecursiveAstVisitor.prototype.visitExpressionType = /**
  25152. * @param {?} type
  25153. * @param {?} context
  25154. * @return {?}
  25155. */
  25156. function (type, context) {
  25157. type.value.visitExpression(this, context);
  25158. return this.visitType(type, context);
  25159. };
  25160. /**
  25161. * @param {?} type
  25162. * @param {?} context
  25163. * @return {?}
  25164. */
  25165. RecursiveAstVisitor.prototype.visitArrayType = /**
  25166. * @param {?} type
  25167. * @param {?} context
  25168. * @return {?}
  25169. */
  25170. function (type, context) { return this.visitType(type, context); };
  25171. /**
  25172. * @param {?} type
  25173. * @param {?} context
  25174. * @return {?}
  25175. */
  25176. RecursiveAstVisitor.prototype.visitMapType = /**
  25177. * @param {?} type
  25178. * @param {?} context
  25179. * @return {?}
  25180. */
  25181. function (type, context) { return this.visitType(type, context); };
  25182. /**
  25183. * @param {?} ast
  25184. * @param {?} context
  25185. * @return {?}
  25186. */
  25187. RecursiveAstVisitor.prototype.visitReadVarExpr = /**
  25188. * @param {?} ast
  25189. * @param {?} context
  25190. * @return {?}
  25191. */
  25192. function (ast, context) {
  25193. return this.visitExpression(ast, context);
  25194. };
  25195. /**
  25196. * @param {?} ast
  25197. * @param {?} context
  25198. * @return {?}
  25199. */
  25200. RecursiveAstVisitor.prototype.visitWriteVarExpr = /**
  25201. * @param {?} ast
  25202. * @param {?} context
  25203. * @return {?}
  25204. */
  25205. function (ast, context) {
  25206. ast.value.visitExpression(this, context);
  25207. return this.visitExpression(ast, context);
  25208. };
  25209. /**
  25210. * @param {?} ast
  25211. * @param {?} context
  25212. * @return {?}
  25213. */
  25214. RecursiveAstVisitor.prototype.visitWriteKeyExpr = /**
  25215. * @param {?} ast
  25216. * @param {?} context
  25217. * @return {?}
  25218. */
  25219. function (ast, context) {
  25220. ast.receiver.visitExpression(this, context);
  25221. ast.index.visitExpression(this, context);
  25222. ast.value.visitExpression(this, context);
  25223. return this.visitExpression(ast, context);
  25224. };
  25225. /**
  25226. * @param {?} ast
  25227. * @param {?} context
  25228. * @return {?}
  25229. */
  25230. RecursiveAstVisitor.prototype.visitWritePropExpr = /**
  25231. * @param {?} ast
  25232. * @param {?} context
  25233. * @return {?}
  25234. */
  25235. function (ast, context) {
  25236. ast.receiver.visitExpression(this, context);
  25237. ast.value.visitExpression(this, context);
  25238. return this.visitExpression(ast, context);
  25239. };
  25240. /**
  25241. * @param {?} ast
  25242. * @param {?} context
  25243. * @return {?}
  25244. */
  25245. RecursiveAstVisitor.prototype.visitInvokeMethodExpr = /**
  25246. * @param {?} ast
  25247. * @param {?} context
  25248. * @return {?}
  25249. */
  25250. function (ast, context) {
  25251. ast.receiver.visitExpression(this, context);
  25252. this.visitAllExpressions(ast.args, context);
  25253. return this.visitExpression(ast, context);
  25254. };
  25255. /**
  25256. * @param {?} ast
  25257. * @param {?} context
  25258. * @return {?}
  25259. */
  25260. RecursiveAstVisitor.prototype.visitInvokeFunctionExpr = /**
  25261. * @param {?} ast
  25262. * @param {?} context
  25263. * @return {?}
  25264. */
  25265. function (ast, context) {
  25266. ast.fn.visitExpression(this, context);
  25267. this.visitAllExpressions(ast.args, context);
  25268. return this.visitExpression(ast, context);
  25269. };
  25270. /**
  25271. * @param {?} ast
  25272. * @param {?} context
  25273. * @return {?}
  25274. */
  25275. RecursiveAstVisitor.prototype.visitInstantiateExpr = /**
  25276. * @param {?} ast
  25277. * @param {?} context
  25278. * @return {?}
  25279. */
  25280. function (ast, context) {
  25281. ast.classExpr.visitExpression(this, context);
  25282. this.visitAllExpressions(ast.args, context);
  25283. return this.visitExpression(ast, context);
  25284. };
  25285. /**
  25286. * @param {?} ast
  25287. * @param {?} context
  25288. * @return {?}
  25289. */
  25290. RecursiveAstVisitor.prototype.visitLiteralExpr = /**
  25291. * @param {?} ast
  25292. * @param {?} context
  25293. * @return {?}
  25294. */
  25295. function (ast, context) {
  25296. return this.visitExpression(ast, context);
  25297. };
  25298. /**
  25299. * @param {?} ast
  25300. * @param {?} context
  25301. * @return {?}
  25302. */
  25303. RecursiveAstVisitor.prototype.visitExternalExpr = /**
  25304. * @param {?} ast
  25305. * @param {?} context
  25306. * @return {?}
  25307. */
  25308. function (ast, context) {
  25309. var _this = this;
  25310. if (ast.typeParams) {
  25311. ast.typeParams.forEach(function (type) { return type.visitType(_this, context); });
  25312. }
  25313. return this.visitExpression(ast, context);
  25314. };
  25315. /**
  25316. * @param {?} ast
  25317. * @param {?} context
  25318. * @return {?}
  25319. */
  25320. RecursiveAstVisitor.prototype.visitConditionalExpr = /**
  25321. * @param {?} ast
  25322. * @param {?} context
  25323. * @return {?}
  25324. */
  25325. function (ast, context) {
  25326. ast.condition.visitExpression(this, context);
  25327. ast.trueCase.visitExpression(this, context); /** @type {?} */
  25328. ((ast.falseCase)).visitExpression(this, context);
  25329. return this.visitExpression(ast, context);
  25330. };
  25331. /**
  25332. * @param {?} ast
  25333. * @param {?} context
  25334. * @return {?}
  25335. */
  25336. RecursiveAstVisitor.prototype.visitNotExpr = /**
  25337. * @param {?} ast
  25338. * @param {?} context
  25339. * @return {?}
  25340. */
  25341. function (ast, context) {
  25342. ast.condition.visitExpression(this, context);
  25343. return this.visitExpression(ast, context);
  25344. };
  25345. /**
  25346. * @param {?} ast
  25347. * @param {?} context
  25348. * @return {?}
  25349. */
  25350. RecursiveAstVisitor.prototype.visitAssertNotNullExpr = /**
  25351. * @param {?} ast
  25352. * @param {?} context
  25353. * @return {?}
  25354. */
  25355. function (ast, context) {
  25356. ast.condition.visitExpression(this, context);
  25357. return this.visitExpression(ast, context);
  25358. };
  25359. /**
  25360. * @param {?} ast
  25361. * @param {?} context
  25362. * @return {?}
  25363. */
  25364. RecursiveAstVisitor.prototype.visitCastExpr = /**
  25365. * @param {?} ast
  25366. * @param {?} context
  25367. * @return {?}
  25368. */
  25369. function (ast, context) {
  25370. ast.value.visitExpression(this, context);
  25371. return this.visitExpression(ast, context);
  25372. };
  25373. /**
  25374. * @param {?} ast
  25375. * @param {?} context
  25376. * @return {?}
  25377. */
  25378. RecursiveAstVisitor.prototype.visitFunctionExpr = /**
  25379. * @param {?} ast
  25380. * @param {?} context
  25381. * @return {?}
  25382. */
  25383. function (ast, context) {
  25384. this.visitAllStatements(ast.statements, context);
  25385. return this.visitExpression(ast, context);
  25386. };
  25387. /**
  25388. * @param {?} ast
  25389. * @param {?} context
  25390. * @return {?}
  25391. */
  25392. RecursiveAstVisitor.prototype.visitBinaryOperatorExpr = /**
  25393. * @param {?} ast
  25394. * @param {?} context
  25395. * @return {?}
  25396. */
  25397. function (ast, context) {
  25398. ast.lhs.visitExpression(this, context);
  25399. ast.rhs.visitExpression(this, context);
  25400. return this.visitExpression(ast, context);
  25401. };
  25402. /**
  25403. * @param {?} ast
  25404. * @param {?} context
  25405. * @return {?}
  25406. */
  25407. RecursiveAstVisitor.prototype.visitReadPropExpr = /**
  25408. * @param {?} ast
  25409. * @param {?} context
  25410. * @return {?}
  25411. */
  25412. function (ast, context) {
  25413. ast.receiver.visitExpression(this, context);
  25414. return this.visitExpression(ast, context);
  25415. };
  25416. /**
  25417. * @param {?} ast
  25418. * @param {?} context
  25419. * @return {?}
  25420. */
  25421. RecursiveAstVisitor.prototype.visitReadKeyExpr = /**
  25422. * @param {?} ast
  25423. * @param {?} context
  25424. * @return {?}
  25425. */
  25426. function (ast, context) {
  25427. ast.receiver.visitExpression(this, context);
  25428. ast.index.visitExpression(this, context);
  25429. return this.visitExpression(ast, context);
  25430. };
  25431. /**
  25432. * @param {?} ast
  25433. * @param {?} context
  25434. * @return {?}
  25435. */
  25436. RecursiveAstVisitor.prototype.visitLiteralArrayExpr = /**
  25437. * @param {?} ast
  25438. * @param {?} context
  25439. * @return {?}
  25440. */
  25441. function (ast, context) {
  25442. this.visitAllExpressions(ast.entries, context);
  25443. return this.visitExpression(ast, context);
  25444. };
  25445. /**
  25446. * @param {?} ast
  25447. * @param {?} context
  25448. * @return {?}
  25449. */
  25450. RecursiveAstVisitor.prototype.visitLiteralMapExpr = /**
  25451. * @param {?} ast
  25452. * @param {?} context
  25453. * @return {?}
  25454. */
  25455. function (ast, context) {
  25456. var _this = this;
  25457. ast.entries.forEach(function (entry) { return entry.value.visitExpression(_this, context); });
  25458. return this.visitExpression(ast, context);
  25459. };
  25460. /**
  25461. * @param {?} ast
  25462. * @param {?} context
  25463. * @return {?}
  25464. */
  25465. RecursiveAstVisitor.prototype.visitCommaExpr = /**
  25466. * @param {?} ast
  25467. * @param {?} context
  25468. * @return {?}
  25469. */
  25470. function (ast, context) {
  25471. this.visitAllExpressions(ast.parts, context);
  25472. return this.visitExpression(ast, context);
  25473. };
  25474. /**
  25475. * @param {?} exprs
  25476. * @param {?} context
  25477. * @return {?}
  25478. */
  25479. RecursiveAstVisitor.prototype.visitAllExpressions = /**
  25480. * @param {?} exprs
  25481. * @param {?} context
  25482. * @return {?}
  25483. */
  25484. function (exprs, context) {
  25485. var _this = this;
  25486. exprs.forEach(function (expr) { return expr.visitExpression(_this, context); });
  25487. };
  25488. /**
  25489. * @param {?} stmt
  25490. * @param {?} context
  25491. * @return {?}
  25492. */
  25493. RecursiveAstVisitor.prototype.visitDeclareVarStmt = /**
  25494. * @param {?} stmt
  25495. * @param {?} context
  25496. * @return {?}
  25497. */
  25498. function (stmt, context) {
  25499. stmt.value.visitExpression(this, context);
  25500. if (stmt.type) {
  25501. stmt.type.visitType(this, context);
  25502. }
  25503. return stmt;
  25504. };
  25505. /**
  25506. * @param {?} stmt
  25507. * @param {?} context
  25508. * @return {?}
  25509. */
  25510. RecursiveAstVisitor.prototype.visitDeclareFunctionStmt = /**
  25511. * @param {?} stmt
  25512. * @param {?} context
  25513. * @return {?}
  25514. */
  25515. function (stmt, context) {
  25516. this.visitAllStatements(stmt.statements, context);
  25517. if (stmt.type) {
  25518. stmt.type.visitType(this, context);
  25519. }
  25520. return stmt;
  25521. };
  25522. /**
  25523. * @param {?} stmt
  25524. * @param {?} context
  25525. * @return {?}
  25526. */
  25527. RecursiveAstVisitor.prototype.visitExpressionStmt = /**
  25528. * @param {?} stmt
  25529. * @param {?} context
  25530. * @return {?}
  25531. */
  25532. function (stmt, context) {
  25533. stmt.expr.visitExpression(this, context);
  25534. return stmt;
  25535. };
  25536. /**
  25537. * @param {?} stmt
  25538. * @param {?} context
  25539. * @return {?}
  25540. */
  25541. RecursiveAstVisitor.prototype.visitReturnStmt = /**
  25542. * @param {?} stmt
  25543. * @param {?} context
  25544. * @return {?}
  25545. */
  25546. function (stmt, context) {
  25547. stmt.value.visitExpression(this, context);
  25548. return stmt;
  25549. };
  25550. /**
  25551. * @param {?} stmt
  25552. * @param {?} context
  25553. * @return {?}
  25554. */
  25555. RecursiveAstVisitor.prototype.visitDeclareClassStmt = /**
  25556. * @param {?} stmt
  25557. * @param {?} context
  25558. * @return {?}
  25559. */
  25560. function (stmt, context) {
  25561. var _this = this;
  25562. /** @type {?} */ ((stmt.parent)).visitExpression(this, context);
  25563. stmt.getters.forEach(function (getter) { return _this.visitAllStatements(getter.body, context); });
  25564. if (stmt.constructorMethod) {
  25565. this.visitAllStatements(stmt.constructorMethod.body, context);
  25566. }
  25567. stmt.methods.forEach(function (method) { return _this.visitAllStatements(method.body, context); });
  25568. return stmt;
  25569. };
  25570. /**
  25571. * @param {?} stmt
  25572. * @param {?} context
  25573. * @return {?}
  25574. */
  25575. RecursiveAstVisitor.prototype.visitIfStmt = /**
  25576. * @param {?} stmt
  25577. * @param {?} context
  25578. * @return {?}
  25579. */
  25580. function (stmt, context) {
  25581. stmt.condition.visitExpression(this, context);
  25582. this.visitAllStatements(stmt.trueCase, context);
  25583. this.visitAllStatements(stmt.falseCase, context);
  25584. return stmt;
  25585. };
  25586. /**
  25587. * @param {?} stmt
  25588. * @param {?} context
  25589. * @return {?}
  25590. */
  25591. RecursiveAstVisitor.prototype.visitTryCatchStmt = /**
  25592. * @param {?} stmt
  25593. * @param {?} context
  25594. * @return {?}
  25595. */
  25596. function (stmt, context) {
  25597. this.visitAllStatements(stmt.bodyStmts, context);
  25598. this.visitAllStatements(stmt.catchStmts, context);
  25599. return stmt;
  25600. };
  25601. /**
  25602. * @param {?} stmt
  25603. * @param {?} context
  25604. * @return {?}
  25605. */
  25606. RecursiveAstVisitor.prototype.visitThrowStmt = /**
  25607. * @param {?} stmt
  25608. * @param {?} context
  25609. * @return {?}
  25610. */
  25611. function (stmt, context) {
  25612. stmt.error.visitExpression(this, context);
  25613. return stmt;
  25614. };
  25615. /**
  25616. * @param {?} stmt
  25617. * @param {?} context
  25618. * @return {?}
  25619. */
  25620. RecursiveAstVisitor.prototype.visitCommentStmt = /**
  25621. * @param {?} stmt
  25622. * @param {?} context
  25623. * @return {?}
  25624. */
  25625. function (stmt, context) { return stmt; };
  25626. /**
  25627. * @param {?} stmts
  25628. * @param {?} context
  25629. * @return {?}
  25630. */
  25631. RecursiveAstVisitor.prototype.visitAllStatements = /**
  25632. * @param {?} stmts
  25633. * @param {?} context
  25634. * @return {?}
  25635. */
  25636. function (stmts, context) {
  25637. var _this = this;
  25638. stmts.forEach(function (stmt) { return stmt.visitStatement(_this, context); });
  25639. };
  25640. return RecursiveAstVisitor;
  25641. }());
  25642. /**
  25643. * @param {?} stmts
  25644. * @return {?}
  25645. */
  25646. function findReadVarNames(stmts) {
  25647. var /** @type {?} */ visitor = new _ReadVarVisitor();
  25648. visitor.visitAllStatements(stmts, null);
  25649. return visitor.varNames;
  25650. }
  25651. var _ReadVarVisitor = /** @class */ (function (_super) {
  25652. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_ReadVarVisitor, _super);
  25653. function _ReadVarVisitor() {
  25654. var _this = _super !== null && _super.apply(this, arguments) || this;
  25655. _this.varNames = new Set();
  25656. return _this;
  25657. }
  25658. /**
  25659. * @param {?} stmt
  25660. * @param {?} context
  25661. * @return {?}
  25662. */
  25663. _ReadVarVisitor.prototype.visitDeclareFunctionStmt = /**
  25664. * @param {?} stmt
  25665. * @param {?} context
  25666. * @return {?}
  25667. */
  25668. function (stmt, context) {
  25669. // Don't descend into nested functions
  25670. return stmt;
  25671. };
  25672. /**
  25673. * @param {?} stmt
  25674. * @param {?} context
  25675. * @return {?}
  25676. */
  25677. _ReadVarVisitor.prototype.visitDeclareClassStmt = /**
  25678. * @param {?} stmt
  25679. * @param {?} context
  25680. * @return {?}
  25681. */
  25682. function (stmt, context) {
  25683. // Don't descend into nested classes
  25684. return stmt;
  25685. };
  25686. /**
  25687. * @param {?} ast
  25688. * @param {?} context
  25689. * @return {?}
  25690. */
  25691. _ReadVarVisitor.prototype.visitReadVarExpr = /**
  25692. * @param {?} ast
  25693. * @param {?} context
  25694. * @return {?}
  25695. */
  25696. function (ast, context) {
  25697. if (ast.name) {
  25698. this.varNames.add(ast.name);
  25699. }
  25700. return null;
  25701. };
  25702. return _ReadVarVisitor;
  25703. }(RecursiveAstVisitor$1));
  25704. /**
  25705. * @param {?} stmts
  25706. * @return {?}
  25707. */
  25708. function collectExternalReferences(stmts) {
  25709. var /** @type {?} */ visitor = new _FindExternalReferencesVisitor();
  25710. visitor.visitAllStatements(stmts, null);
  25711. return visitor.externalReferences;
  25712. }
  25713. var _FindExternalReferencesVisitor = /** @class */ (function (_super) {
  25714. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_FindExternalReferencesVisitor, _super);
  25715. function _FindExternalReferencesVisitor() {
  25716. var _this = _super !== null && _super.apply(this, arguments) || this;
  25717. _this.externalReferences = [];
  25718. return _this;
  25719. }
  25720. /**
  25721. * @param {?} e
  25722. * @param {?} context
  25723. * @return {?}
  25724. */
  25725. _FindExternalReferencesVisitor.prototype.visitExternalExpr = /**
  25726. * @param {?} e
  25727. * @param {?} context
  25728. * @return {?}
  25729. */
  25730. function (e, context) {
  25731. this.externalReferences.push(e.value);
  25732. return _super.prototype.visitExternalExpr.call(this, e, context);
  25733. };
  25734. return _FindExternalReferencesVisitor;
  25735. }(RecursiveAstVisitor$1));
  25736. /**
  25737. * @param {?} stmt
  25738. * @param {?} sourceSpan
  25739. * @return {?}
  25740. */
  25741. function applySourceSpanToStatementIfNeeded(stmt, sourceSpan) {
  25742. if (!sourceSpan) {
  25743. return stmt;
  25744. }
  25745. var /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan);
  25746. return stmt.visitStatement(transformer, null);
  25747. }
  25748. /**
  25749. * @param {?} expr
  25750. * @param {?} sourceSpan
  25751. * @return {?}
  25752. */
  25753. function applySourceSpanToExpressionIfNeeded(expr, sourceSpan) {
  25754. if (!sourceSpan) {
  25755. return expr;
  25756. }
  25757. var /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan);
  25758. return expr.visitExpression(transformer, null);
  25759. }
  25760. var _ApplySourceSpanTransformer = /** @class */ (function (_super) {
  25761. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_ApplySourceSpanTransformer, _super);
  25762. function _ApplySourceSpanTransformer(sourceSpan) {
  25763. var _this = _super.call(this) || this;
  25764. _this.sourceSpan = sourceSpan;
  25765. return _this;
  25766. }
  25767. /**
  25768. * @param {?} obj
  25769. * @return {?}
  25770. */
  25771. _ApplySourceSpanTransformer.prototype._clone = /**
  25772. * @param {?} obj
  25773. * @return {?}
  25774. */
  25775. function (obj) {
  25776. var /** @type {?} */ clone = Object.create(obj.constructor.prototype);
  25777. for (var /** @type {?} */ prop in obj) {
  25778. clone[prop] = obj[prop];
  25779. }
  25780. return clone;
  25781. };
  25782. /**
  25783. * @param {?} expr
  25784. * @param {?} context
  25785. * @return {?}
  25786. */
  25787. _ApplySourceSpanTransformer.prototype.transformExpr = /**
  25788. * @param {?} expr
  25789. * @param {?} context
  25790. * @return {?}
  25791. */
  25792. function (expr, context) {
  25793. if (!expr.sourceSpan) {
  25794. expr = this._clone(expr);
  25795. expr.sourceSpan = this.sourceSpan;
  25796. }
  25797. return expr;
  25798. };
  25799. /**
  25800. * @param {?} stmt
  25801. * @param {?} context
  25802. * @return {?}
  25803. */
  25804. _ApplySourceSpanTransformer.prototype.transformStmt = /**
  25805. * @param {?} stmt
  25806. * @param {?} context
  25807. * @return {?}
  25808. */
  25809. function (stmt, context) {
  25810. if (!stmt.sourceSpan) {
  25811. stmt = this._clone(stmt);
  25812. stmt.sourceSpan = this.sourceSpan;
  25813. }
  25814. return stmt;
  25815. };
  25816. return _ApplySourceSpanTransformer;
  25817. }(AstTransformer$1));
  25818. /**
  25819. * @param {?} name
  25820. * @param {?=} type
  25821. * @param {?=} sourceSpan
  25822. * @return {?}
  25823. */
  25824. function variable(name, type, sourceSpan) {
  25825. return new ReadVarExpr(name, type, sourceSpan);
  25826. }
  25827. /**
  25828. * @param {?} id
  25829. * @param {?=} typeParams
  25830. * @param {?=} sourceSpan
  25831. * @return {?}
  25832. */
  25833. function importExpr(id, typeParams, sourceSpan) {
  25834. if (typeParams === void 0) { typeParams = null; }
  25835. return new ExternalExpr(id, null, typeParams, sourceSpan);
  25836. }
  25837. /**
  25838. * @param {?} id
  25839. * @param {?=} typeParams
  25840. * @param {?=} typeModifiers
  25841. * @return {?}
  25842. */
  25843. function importType(id, typeParams, typeModifiers) {
  25844. if (typeParams === void 0) { typeParams = null; }
  25845. if (typeModifiers === void 0) { typeModifiers = null; }
  25846. return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null;
  25847. }
  25848. /**
  25849. * @param {?} expr
  25850. * @param {?=} typeModifiers
  25851. * @return {?}
  25852. */
  25853. function expressionType(expr, typeModifiers) {
  25854. if (typeModifiers === void 0) { typeModifiers = null; }
  25855. return new ExpressionType(expr, typeModifiers);
  25856. }
  25857. /**
  25858. * @param {?} values
  25859. * @param {?=} type
  25860. * @param {?=} sourceSpan
  25861. * @return {?}
  25862. */
  25863. function literalArr(values, type, sourceSpan) {
  25864. return new LiteralArrayExpr(values, type, sourceSpan);
  25865. }
  25866. /**
  25867. * @param {?} values
  25868. * @param {?=} type
  25869. * @return {?}
  25870. */
  25871. function literalMap(values, type) {
  25872. if (type === void 0) { type = null; }
  25873. return new LiteralMapExpr(values.map(function (e) { return new LiteralMapEntry(e.key, e.value, e.quoted); }), type, null);
  25874. }
  25875. /**
  25876. * @param {?} expr
  25877. * @param {?=} sourceSpan
  25878. * @return {?}
  25879. */
  25880. function not(expr, sourceSpan) {
  25881. return new NotExpr(expr, sourceSpan);
  25882. }
  25883. /**
  25884. * @param {?} expr
  25885. * @param {?=} sourceSpan
  25886. * @return {?}
  25887. */
  25888. function assertNotNull(expr, sourceSpan) {
  25889. return new AssertNotNull(expr, sourceSpan);
  25890. }
  25891. /**
  25892. * @param {?} params
  25893. * @param {?} body
  25894. * @param {?=} type
  25895. * @param {?=} sourceSpan
  25896. * @return {?}
  25897. */
  25898. function fn(params, body, type, sourceSpan) {
  25899. return new FunctionExpr(params, body, type, sourceSpan);
  25900. }
  25901. /**
  25902. * @param {?} value
  25903. * @param {?=} type
  25904. * @param {?=} sourceSpan
  25905. * @return {?}
  25906. */
  25907. function literal(value, type, sourceSpan) {
  25908. return new LiteralExpr(value, type, sourceSpan);
  25909. }
  25910. /**
  25911. * @fileoverview added by tsickle
  25912. * @suppress {checkTypes} checked by tsc
  25913. */
  25914. /**
  25915. * @license
  25916. * Copyright Google Inc. All Rights Reserved.
  25917. *
  25918. * Use of this source code is governed by an MIT-style license that can be
  25919. * found in the LICENSE file at https://angular.io/license
  25920. */
  25921. var ProviderError = /** @class */ (function (_super) {
  25922. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ProviderError, _super);
  25923. function ProviderError(message, span) {
  25924. return _super.call(this, span, message) || this;
  25925. }
  25926. return ProviderError;
  25927. }(ParseError));
  25928. /**
  25929. * @record
  25930. */
  25931. var ProviderViewContext = /** @class */ (function () {
  25932. function ProviderViewContext(reflector, component) {
  25933. var _this = this;
  25934. this.reflector = reflector;
  25935. this.component = component;
  25936. this.errors = [];
  25937. this.viewQueries = _getViewQueries(component);
  25938. this.viewProviders = new Map();
  25939. component.viewProviders.forEach(function (provider) {
  25940. if (_this.viewProviders.get(tokenReference(provider.token)) == null) {
  25941. _this.viewProviders.set(tokenReference(provider.token), true);
  25942. }
  25943. });
  25944. }
  25945. return ProviderViewContext;
  25946. }());
  25947. var ProviderElementContext = /** @class */ (function () {
  25948. function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) {
  25949. var _this = this;
  25950. this.viewContext = viewContext;
  25951. this._parent = _parent;
  25952. this._isViewRoot = _isViewRoot;
  25953. this._directiveAsts = _directiveAsts;
  25954. this._sourceSpan = _sourceSpan;
  25955. this._transformedProviders = new Map();
  25956. this._seenProviders = new Map();
  25957. this._queriedTokens = new Map();
  25958. this.transformedHasViewContainer = false;
  25959. this._attrs = {};
  25960. attrs.forEach(function (attrAst) { return _this._attrs[attrAst.name] = attrAst.value; });
  25961. var /** @type {?} */ directivesMeta = _directiveAsts.map(function (directiveAst) { return directiveAst.directive; });
  25962. this._allProviders =
  25963. _resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors);
  25964. this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta);
  25965. Array.from(this._allProviders.values()).forEach(function (provider) {
  25966. _this._addQueryReadsTo(provider.token, provider.token, _this._queriedTokens);
  25967. });
  25968. if (isTemplate) {
  25969. var /** @type {?} */ templateRefId = createTokenForExternalReference(this.viewContext.reflector, Identifiers.TemplateRef);
  25970. this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens);
  25971. }
  25972. refs.forEach(function (refAst) {
  25973. var /** @type {?} */ defaultQueryValue = refAst.value ||
  25974. createTokenForExternalReference(_this.viewContext.reflector, Identifiers.ElementRef);
  25975. _this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this._queriedTokens);
  25976. });
  25977. if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef))) {
  25978. this.transformedHasViewContainer = true;
  25979. }
  25980. // create the providers that we know are eager first
  25981. Array.from(this._allProviders.values()).forEach(function (provider) {
  25982. var /** @type {?} */ eager = provider.eager || _this._queriedTokens.get(tokenReference(provider.token));
  25983. if (eager) {
  25984. _this._getOrCreateLocalProvider(provider.providerType, provider.token, true);
  25985. }
  25986. });
  25987. }
  25988. /**
  25989. * @return {?}
  25990. */
  25991. ProviderElementContext.prototype.afterElement = /**
  25992. * @return {?}
  25993. */
  25994. function () {
  25995. var _this = this;
  25996. // collect lazy providers
  25997. Array.from(this._allProviders.values()).forEach(function (provider) {
  25998. _this._getOrCreateLocalProvider(provider.providerType, provider.token, false);
  25999. });
  26000. };
  26001. Object.defineProperty(ProviderElementContext.prototype, "transformProviders", {
  26002. get: /**
  26003. * @return {?}
  26004. */
  26005. function () {
  26006. // Note: Maps keep their insertion order.
  26007. var /** @type {?} */ lazyProviders = [];
  26008. var /** @type {?} */ eagerProviders = [];
  26009. this._transformedProviders.forEach(function (provider) {
  26010. if (provider.eager) {
  26011. eagerProviders.push(provider);
  26012. }
  26013. else {
  26014. lazyProviders.push(provider);
  26015. }
  26016. });
  26017. return lazyProviders.concat(eagerProviders);
  26018. },
  26019. enumerable: true,
  26020. configurable: true
  26021. });
  26022. Object.defineProperty(ProviderElementContext.prototype, "transformedDirectiveAsts", {
  26023. get: /**
  26024. * @return {?}
  26025. */
  26026. function () {
  26027. var /** @type {?} */ sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; });
  26028. var /** @type {?} */ sortedDirectives = this._directiveAsts.slice();
  26029. sortedDirectives.sort(function (dir1, dir2) {
  26030. return sortedProviderTypes.indexOf(dir1.directive.type) -
  26031. sortedProviderTypes.indexOf(dir2.directive.type);
  26032. });
  26033. return sortedDirectives;
  26034. },
  26035. enumerable: true,
  26036. configurable: true
  26037. });
  26038. Object.defineProperty(ProviderElementContext.prototype, "queryMatches", {
  26039. get: /**
  26040. * @return {?}
  26041. */
  26042. function () {
  26043. var /** @type {?} */ allMatches = [];
  26044. this._queriedTokens.forEach(function (matches) { allMatches.push.apply(allMatches, matches); });
  26045. return allMatches;
  26046. },
  26047. enumerable: true,
  26048. configurable: true
  26049. });
  26050. /**
  26051. * @param {?} token
  26052. * @param {?} defaultValue
  26053. * @param {?} queryReadTokens
  26054. * @return {?}
  26055. */
  26056. ProviderElementContext.prototype._addQueryReadsTo = /**
  26057. * @param {?} token
  26058. * @param {?} defaultValue
  26059. * @param {?} queryReadTokens
  26060. * @return {?}
  26061. */
  26062. function (token, defaultValue, queryReadTokens) {
  26063. this._getQueriesFor(token).forEach(function (query) {
  26064. var /** @type {?} */ queryValue = query.meta.read || defaultValue;
  26065. var /** @type {?} */ tokenRef = tokenReference(queryValue);
  26066. var /** @type {?} */ queryMatches = queryReadTokens.get(tokenRef);
  26067. if (!queryMatches) {
  26068. queryMatches = [];
  26069. queryReadTokens.set(tokenRef, queryMatches);
  26070. }
  26071. queryMatches.push({ queryId: query.queryId, value: queryValue });
  26072. });
  26073. };
  26074. /**
  26075. * @param {?} token
  26076. * @return {?}
  26077. */
  26078. ProviderElementContext.prototype._getQueriesFor = /**
  26079. * @param {?} token
  26080. * @return {?}
  26081. */
  26082. function (token) {
  26083. var /** @type {?} */ result = [];
  26084. var /** @type {?} */ currentEl = this;
  26085. var /** @type {?} */ distance = 0;
  26086. var /** @type {?} */ queries;
  26087. while (currentEl !== null) {
  26088. queries = currentEl._contentQueries.get(tokenReference(token));
  26089. if (queries) {
  26090. result.push.apply(result, queries.filter(function (query) { return query.meta.descendants || distance <= 1; }));
  26091. }
  26092. if (currentEl._directiveAsts.length > 0) {
  26093. distance++;
  26094. }
  26095. currentEl = currentEl._parent;
  26096. }
  26097. queries = this.viewContext.viewQueries.get(tokenReference(token));
  26098. if (queries) {
  26099. result.push.apply(result, queries);
  26100. }
  26101. return result;
  26102. };
  26103. /**
  26104. * @param {?} requestingProviderType
  26105. * @param {?} token
  26106. * @param {?} eager
  26107. * @return {?}
  26108. */
  26109. ProviderElementContext.prototype._getOrCreateLocalProvider = /**
  26110. * @param {?} requestingProviderType
  26111. * @param {?} token
  26112. * @param {?} eager
  26113. * @return {?}
  26114. */
  26115. function (requestingProviderType, token, eager) {
  26116. var _this = this;
  26117. var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token));
  26118. if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive ||
  26119. requestingProviderType === ProviderAstType.PublicService) &&
  26120. resolvedProvider.providerType === ProviderAstType.PrivateService) ||
  26121. ((requestingProviderType === ProviderAstType.PrivateService ||
  26122. requestingProviderType === ProviderAstType.PublicService) &&
  26123. resolvedProvider.providerType === ProviderAstType.Builtin)) {
  26124. return null;
  26125. }
  26126. var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token));
  26127. if (transformedProviderAst) {
  26128. return transformedProviderAst;
  26129. }
  26130. if (this._seenProviders.get(tokenReference(token)) != null) {
  26131. this.viewContext.errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), this._sourceSpan));
  26132. return null;
  26133. }
  26134. this._seenProviders.set(tokenReference(token), true);
  26135. var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) {
  26136. var /** @type {?} */ transformedUseValue = provider.useValue;
  26137. var /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting));
  26138. var /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined));
  26139. if (provider.useExisting != null) {
  26140. var /** @type {?} */ existingDiDep = /** @type {?} */ ((_this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager)));
  26141. if (existingDiDep.token != null) {
  26142. transformedUseExisting = existingDiDep.token;
  26143. }
  26144. else {
  26145. transformedUseExisting = /** @type {?} */ ((null));
  26146. transformedUseValue = existingDiDep.value;
  26147. }
  26148. }
  26149. else if (provider.useFactory) {
  26150. var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps;
  26151. transformedDeps =
  26152. deps.map(function (dep) { return ((_this._getDependency(resolvedProvider.providerType, dep, eager))); });
  26153. }
  26154. else if (provider.useClass) {
  26155. var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps;
  26156. transformedDeps =
  26157. deps.map(function (dep) { return ((_this._getDependency(resolvedProvider.providerType, dep, eager))); });
  26158. }
  26159. return _transformProvider(provider, {
  26160. useExisting: transformedUseExisting,
  26161. useValue: transformedUseValue,
  26162. deps: transformedDeps
  26163. });
  26164. });
  26165. transformedProviderAst =
  26166. _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
  26167. this._transformedProviders.set(tokenReference(token), transformedProviderAst);
  26168. return transformedProviderAst;
  26169. };
  26170. /**
  26171. * @param {?} requestingProviderType
  26172. * @param {?} dep
  26173. * @param {?=} eager
  26174. * @return {?}
  26175. */
  26176. ProviderElementContext.prototype._getLocalDependency = /**
  26177. * @param {?} requestingProviderType
  26178. * @param {?} dep
  26179. * @param {?=} eager
  26180. * @return {?}
  26181. */
  26182. function (requestingProviderType, dep, eager) {
  26183. if (eager === void 0) { eager = false; }
  26184. if (dep.isAttribute) {
  26185. var /** @type {?} */ attrValue = this._attrs[/** @type {?} */ ((dep.token)).value];
  26186. return { isValue: true, value: attrValue == null ? null : attrValue };
  26187. }
  26188. if (dep.token != null) {
  26189. // access builtints
  26190. if ((requestingProviderType === ProviderAstType.Directive ||
  26191. requestingProviderType === ProviderAstType.Component)) {
  26192. if (tokenReference(dep.token) ===
  26193. this.viewContext.reflector.resolveExternalReference(Identifiers.Renderer) ||
  26194. tokenReference(dep.token) ===
  26195. this.viewContext.reflector.resolveExternalReference(Identifiers.ElementRef) ||
  26196. tokenReference(dep.token) ===
  26197. this.viewContext.reflector.resolveExternalReference(Identifiers.ChangeDetectorRef) ||
  26198. tokenReference(dep.token) ===
  26199. this.viewContext.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
  26200. return dep;
  26201. }
  26202. if (tokenReference(dep.token) ===
  26203. this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
  26204. (/** @type {?} */ (this)).transformedHasViewContainer = true;
  26205. }
  26206. }
  26207. // access the injector
  26208. if (tokenReference(dep.token) ===
  26209. this.viewContext.reflector.resolveExternalReference(Identifiers.Injector)) {
  26210. return dep;
  26211. }
  26212. // access providers
  26213. if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) {
  26214. return dep;
  26215. }
  26216. }
  26217. return null;
  26218. };
  26219. /**
  26220. * @param {?} requestingProviderType
  26221. * @param {?} dep
  26222. * @param {?=} eager
  26223. * @return {?}
  26224. */
  26225. ProviderElementContext.prototype._getDependency = /**
  26226. * @param {?} requestingProviderType
  26227. * @param {?} dep
  26228. * @param {?=} eager
  26229. * @return {?}
  26230. */
  26231. function (requestingProviderType, dep, eager) {
  26232. if (eager === void 0) { eager = false; }
  26233. var /** @type {?} */ currElement = this;
  26234. var /** @type {?} */ currEager = eager;
  26235. var /** @type {?} */ result = null;
  26236. if (!dep.isSkipSelf) {
  26237. result = this._getLocalDependency(requestingProviderType, dep, eager);
  26238. }
  26239. if (dep.isSelf) {
  26240. if (!result && dep.isOptional) {
  26241. result = { isValue: true, value: null };
  26242. }
  26243. }
  26244. else {
  26245. // check parent elements
  26246. while (!result && currElement._parent) {
  26247. var /** @type {?} */ prevElement = currElement;
  26248. currElement = currElement._parent;
  26249. if (prevElement._isViewRoot) {
  26250. currEager = false;
  26251. }
  26252. result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager);
  26253. }
  26254. // check @Host restriction
  26255. if (!result) {
  26256. if (!dep.isHost || this.viewContext.component.isHost ||
  26257. this.viewContext.component.type.reference === tokenReference(/** @type {?} */ ((dep.token))) ||
  26258. this.viewContext.viewProviders.get(tokenReference(/** @type {?} */ ((dep.token)))) != null) {
  26259. result = dep;
  26260. }
  26261. else {
  26262. result = dep.isOptional ? result = { isValue: true, value: null } : null;
  26263. }
  26264. }
  26265. }
  26266. if (!result) {
  26267. this.viewContext.errors.push(new ProviderError("No provider for " + tokenName((/** @type {?} */ ((dep.token)))), this._sourceSpan));
  26268. }
  26269. return result;
  26270. };
  26271. return ProviderElementContext;
  26272. }());
  26273. var NgModuleProviderAnalyzer = /** @class */ (function () {
  26274. function NgModuleProviderAnalyzer(reflector, ngModule, extraProviders, sourceSpan) {
  26275. var _this = this;
  26276. this.reflector = reflector;
  26277. this._transformedProviders = new Map();
  26278. this._seenProviders = new Map();
  26279. this._errors = [];
  26280. this._allProviders = new Map();
  26281. ngModule.transitiveModule.modules.forEach(function (ngModuleType) {
  26282. var /** @type {?} */ ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType };
  26283. _resolveProviders([ngModuleProvider], ProviderAstType.PublicService, true, sourceSpan, _this._errors, _this._allProviders);
  26284. });
  26285. _resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders);
  26286. }
  26287. /**
  26288. * @return {?}
  26289. */
  26290. NgModuleProviderAnalyzer.prototype.parse = /**
  26291. * @return {?}
  26292. */
  26293. function () {
  26294. var _this = this;
  26295. Array.from(this._allProviders.values()).forEach(function (provider) {
  26296. _this._getOrCreateLocalProvider(provider.token, provider.eager);
  26297. });
  26298. if (this._errors.length > 0) {
  26299. var /** @type {?} */ errorString = this._errors.join('\n');
  26300. throw new Error("Provider parse errors:\n" + errorString);
  26301. }
  26302. // Note: Maps keep their insertion order.
  26303. var /** @type {?} */ lazyProviders = [];
  26304. var /** @type {?} */ eagerProviders = [];
  26305. this._transformedProviders.forEach(function (provider) {
  26306. if (provider.eager) {
  26307. eagerProviders.push(provider);
  26308. }
  26309. else {
  26310. lazyProviders.push(provider);
  26311. }
  26312. });
  26313. return lazyProviders.concat(eagerProviders);
  26314. };
  26315. /**
  26316. * @param {?} token
  26317. * @param {?} eager
  26318. * @return {?}
  26319. */
  26320. NgModuleProviderAnalyzer.prototype._getOrCreateLocalProvider = /**
  26321. * @param {?} token
  26322. * @param {?} eager
  26323. * @return {?}
  26324. */
  26325. function (token, eager) {
  26326. var _this = this;
  26327. var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token));
  26328. if (!resolvedProvider) {
  26329. return null;
  26330. }
  26331. var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token));
  26332. if (transformedProviderAst) {
  26333. return transformedProviderAst;
  26334. }
  26335. if (this._seenProviders.get(tokenReference(token)) != null) {
  26336. this._errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), resolvedProvider.sourceSpan));
  26337. return null;
  26338. }
  26339. this._seenProviders.set(tokenReference(token), true);
  26340. var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) {
  26341. var /** @type {?} */ transformedUseValue = provider.useValue;
  26342. var /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting));
  26343. var /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined));
  26344. if (provider.useExisting != null) {
  26345. var /** @type {?} */ existingDiDep = _this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan);
  26346. if (existingDiDep.token != null) {
  26347. transformedUseExisting = existingDiDep.token;
  26348. }
  26349. else {
  26350. transformedUseExisting = /** @type {?} */ ((null));
  26351. transformedUseValue = existingDiDep.value;
  26352. }
  26353. }
  26354. else if (provider.useFactory) {
  26355. var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps;
  26356. transformedDeps =
  26357. deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
  26358. }
  26359. else if (provider.useClass) {
  26360. var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps;
  26361. transformedDeps =
  26362. deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
  26363. }
  26364. return _transformProvider(provider, {
  26365. useExisting: transformedUseExisting,
  26366. useValue: transformedUseValue,
  26367. deps: transformedDeps
  26368. });
  26369. });
  26370. transformedProviderAst =
  26371. _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
  26372. this._transformedProviders.set(tokenReference(token), transformedProviderAst);
  26373. return transformedProviderAst;
  26374. };
  26375. /**
  26376. * @param {?} dep
  26377. * @param {?=} eager
  26378. * @param {?=} requestorSourceSpan
  26379. * @return {?}
  26380. */
  26381. NgModuleProviderAnalyzer.prototype._getDependency = /**
  26382. * @param {?} dep
  26383. * @param {?=} eager
  26384. * @param {?=} requestorSourceSpan
  26385. * @return {?}
  26386. */
  26387. function (dep, eager, requestorSourceSpan) {
  26388. if (eager === void 0) { eager = false; }
  26389. var /** @type {?} */ foundLocal = false;
  26390. if (!dep.isSkipSelf && dep.token != null) {
  26391. // access the injector
  26392. if (tokenReference(dep.token) ===
  26393. this.reflector.resolveExternalReference(Identifiers.Injector) ||
  26394. tokenReference(dep.token) ===
  26395. this.reflector.resolveExternalReference(Identifiers.ComponentFactoryResolver)) {
  26396. foundLocal = true;
  26397. // access providers
  26398. }
  26399. else if (this._getOrCreateLocalProvider(dep.token, eager) != null) {
  26400. foundLocal = true;
  26401. }
  26402. }
  26403. var /** @type {?} */ result = dep;
  26404. if (dep.isSelf && !foundLocal) {
  26405. if (dep.isOptional) {
  26406. result = { isValue: true, value: null };
  26407. }
  26408. else {
  26409. this._errors.push(new ProviderError("No provider for " + tokenName((/** @type {?} */ ((dep.token)))), requestorSourceSpan));
  26410. }
  26411. }
  26412. return result;
  26413. };
  26414. return NgModuleProviderAnalyzer;
  26415. }());
  26416. /**
  26417. * @param {?} provider
  26418. * @param {?} __1
  26419. * @return {?}
  26420. */
  26421. function _transformProvider(provider, _a) {
  26422. var useExisting = _a.useExisting, useValue = _a.useValue, deps = _a.deps;
  26423. return {
  26424. token: provider.token,
  26425. useClass: provider.useClass,
  26426. useExisting: useExisting,
  26427. useFactory: provider.useFactory,
  26428. useValue: useValue,
  26429. deps: deps,
  26430. multi: provider.multi
  26431. };
  26432. }
  26433. /**
  26434. * @param {?} provider
  26435. * @param {?} __1
  26436. * @return {?}
  26437. */
  26438. function _transformProviderAst(provider, _a) {
  26439. var eager = _a.eager, providers = _a.providers;
  26440. return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan);
  26441. }
  26442. /**
  26443. * @param {?} directives
  26444. * @param {?} sourceSpan
  26445. * @param {?} targetErrors
  26446. * @return {?}
  26447. */
  26448. function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) {
  26449. var /** @type {?} */ providersByToken = new Map();
  26450. directives.forEach(function (directive) {
  26451. var /** @type {?} */ dirProvider = { token: { identifier: directive.type }, useClass: directive.type };
  26452. _resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken);
  26453. });
  26454. // Note: directives need to be able to overwrite providers of a component!
  26455. var /** @type {?} */ directivesWithComponentFirst = directives.filter(function (dir) { return dir.isComponent; }).concat(directives.filter(function (dir) { return !dir.isComponent; }));
  26456. directivesWithComponentFirst.forEach(function (directive) {
  26457. _resolveProviders(directive.providers, ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken);
  26458. _resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken);
  26459. });
  26460. return providersByToken;
  26461. }
  26462. /**
  26463. * @param {?} providers
  26464. * @param {?} providerType
  26465. * @param {?} eager
  26466. * @param {?} sourceSpan
  26467. * @param {?} targetErrors
  26468. * @param {?} targetProvidersByToken
  26469. * @return {?}
  26470. */
  26471. function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken) {
  26472. providers.forEach(function (provider) {
  26473. var /** @type {?} */ resolvedProvider = targetProvidersByToken.get(tokenReference(provider.token));
  26474. if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) {
  26475. targetErrors.push(new ProviderError("Mixing multi and non multi provider is not possible for token " + tokenName(resolvedProvider.token), sourceSpan));
  26476. }
  26477. if (!resolvedProvider) {
  26478. var /** @type {?} */ lifecycleHooks = provider.token.identifier &&
  26479. (/** @type {?} */ (provider.token.identifier)).lifecycleHooks ?
  26480. (/** @type {?} */ (provider.token.identifier)).lifecycleHooks :
  26481. [];
  26482. var /** @type {?} */ isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory);
  26483. resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan);
  26484. targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider);
  26485. }
  26486. else {
  26487. if (!provider.multi) {
  26488. resolvedProvider.providers.length = 0;
  26489. }
  26490. resolvedProvider.providers.push(provider);
  26491. }
  26492. });
  26493. }
  26494. /**
  26495. * @param {?} component
  26496. * @return {?}
  26497. */
  26498. function _getViewQueries(component) {
  26499. // Note: queries start with id 1 so we can use the number in a Bloom filter!
  26500. var /** @type {?} */ viewQueryId = 1;
  26501. var /** @type {?} */ viewQueries = new Map();
  26502. if (component.viewQueries) {
  26503. component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); });
  26504. }
  26505. return viewQueries;
  26506. }
  26507. /**
  26508. * @param {?} contentQueryStartId
  26509. * @param {?} directives
  26510. * @return {?}
  26511. */
  26512. function _getContentQueries(contentQueryStartId, directives) {
  26513. var /** @type {?} */ contentQueryId = contentQueryStartId;
  26514. var /** @type {?} */ contentQueries = new Map();
  26515. directives.forEach(function (directive, directiveIndex) {
  26516. if (directive.queries) {
  26517. directive.queries.forEach(function (query) { return _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ }); });
  26518. }
  26519. });
  26520. return contentQueries;
  26521. }
  26522. /**
  26523. * @param {?} map
  26524. * @param {?} query
  26525. * @return {?}
  26526. */
  26527. function _addQueryToTokenMap(map, query) {
  26528. query.meta.selectors.forEach(function (token) {
  26529. var /** @type {?} */ entry = map.get(tokenReference(token));
  26530. if (!entry) {
  26531. entry = [];
  26532. map.set(tokenReference(token), entry);
  26533. }
  26534. entry.push(query);
  26535. });
  26536. }
  26537. /**
  26538. * @fileoverview added by tsickle
  26539. * @suppress {checkTypes} checked by tsc
  26540. */
  26541. /**
  26542. * @license
  26543. * Copyright Google Inc. All Rights Reserved.
  26544. *
  26545. * Use of this source code is governed by an MIT-style license that can be
  26546. * found in the LICENSE file at https://angular.io/license
  26547. */
  26548. var QUOTED_KEYS = '$quoted$';
  26549. /**
  26550. * @param {?} ctx
  26551. * @param {?} value
  26552. * @param {?=} type
  26553. * @return {?}
  26554. */
  26555. function convertValueToOutputAst(ctx, value, type) {
  26556. if (type === void 0) { type = null; }
  26557. return visitValue(value, new _ValueOutputAstTransformer(ctx), type);
  26558. }
  26559. var _ValueOutputAstTransformer = /** @class */ (function () {
  26560. function _ValueOutputAstTransformer(ctx) {
  26561. this.ctx = ctx;
  26562. }
  26563. /**
  26564. * @param {?} arr
  26565. * @param {?} type
  26566. * @return {?}
  26567. */
  26568. _ValueOutputAstTransformer.prototype.visitArray = /**
  26569. * @param {?} arr
  26570. * @param {?} type
  26571. * @return {?}
  26572. */
  26573. function (arr, type) {
  26574. var _this = this;
  26575. return literalArr(arr.map(function (value) { return visitValue(value, _this, null); }), type);
  26576. };
  26577. /**
  26578. * @param {?} map
  26579. * @param {?} type
  26580. * @return {?}
  26581. */
  26582. _ValueOutputAstTransformer.prototype.visitStringMap = /**
  26583. * @param {?} map
  26584. * @param {?} type
  26585. * @return {?}
  26586. */
  26587. function (map, type) {
  26588. var _this = this;
  26589. var /** @type {?} */ entries = [];
  26590. var /** @type {?} */ quotedSet = new Set(map && map[QUOTED_KEYS]);
  26591. Object.keys(map).forEach(function (key) {
  26592. entries.push(new LiteralMapEntry(key, visitValue(map[key], _this, null), quotedSet.has(key)));
  26593. });
  26594. return new LiteralMapExpr(entries, type);
  26595. };
  26596. /**
  26597. * @param {?} value
  26598. * @param {?} type
  26599. * @return {?}
  26600. */
  26601. _ValueOutputAstTransformer.prototype.visitPrimitive = /**
  26602. * @param {?} value
  26603. * @param {?} type
  26604. * @return {?}
  26605. */
  26606. function (value, type) { return literal(value, type); };
  26607. /**
  26608. * @param {?} value
  26609. * @param {?} type
  26610. * @return {?}
  26611. */
  26612. _ValueOutputAstTransformer.prototype.visitOther = /**
  26613. * @param {?} value
  26614. * @param {?} type
  26615. * @return {?}
  26616. */
  26617. function (value, type) {
  26618. if (value instanceof Expression) {
  26619. return value;
  26620. }
  26621. else {
  26622. return this.ctx.importExpr(value);
  26623. }
  26624. };
  26625. return _ValueOutputAstTransformer;
  26626. }());
  26627. /**
  26628. * @fileoverview added by tsickle
  26629. * @suppress {checkTypes} checked by tsc
  26630. */
  26631. /**
  26632. * @license
  26633. * Copyright Google Inc. All Rights Reserved.
  26634. *
  26635. * Use of this source code is governed by an MIT-style license that can be
  26636. * found in the LICENSE file at https://angular.io/license
  26637. */
  26638. /**
  26639. * @param {?} ctx
  26640. * @param {?} providerAst
  26641. * @return {?}
  26642. */
  26643. function providerDef(ctx, providerAst) {
  26644. var /** @type {?} */ flags = 0;
  26645. if (!providerAst.eager) {
  26646. flags |= 4096 /* LazyProvider */;
  26647. }
  26648. if (providerAst.providerType === ProviderAstType.PrivateService) {
  26649. flags |= 8192 /* PrivateProvider */;
  26650. }
  26651. providerAst.lifecycleHooks.forEach(function (lifecycleHook) {
  26652. // for regular providers, we only support ngOnDestroy
  26653. if (lifecycleHook === LifecycleHooks.OnDestroy ||
  26654. providerAst.providerType === ProviderAstType.Directive ||
  26655. providerAst.providerType === ProviderAstType.Component) {
  26656. flags |= lifecycleHookToNodeFlag(lifecycleHook);
  26657. }
  26658. });
  26659. var _a = providerAst.multiProvider ?
  26660. multiProviderDef(ctx, flags, providerAst.providers) :
  26661. singleProviderDef(ctx, flags, providerAst.providerType, providerAst.providers[0]), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
  26662. return {
  26663. providerExpr: providerExpr,
  26664. flags: providerFlags, depsExpr: depsExpr,
  26665. tokenExpr: tokenExpr(ctx, providerAst.token),
  26666. };
  26667. }
  26668. /**
  26669. * @param {?} ctx
  26670. * @param {?} flags
  26671. * @param {?} providers
  26672. * @return {?}
  26673. */
  26674. function multiProviderDef(ctx, flags, providers) {
  26675. var /** @type {?} */ allDepDefs = [];
  26676. var /** @type {?} */ allParams = [];
  26677. var /** @type {?} */ exprs = providers.map(function (provider, providerIndex) {
  26678. var /** @type {?} */ expr;
  26679. if (provider.useClass) {
  26680. var /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useClass.diDeps);
  26681. expr = ctx.importExpr(provider.useClass.reference).instantiate(depExprs);
  26682. }
  26683. else if (provider.useFactory) {
  26684. var /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useFactory.diDeps);
  26685. expr = ctx.importExpr(provider.useFactory.reference).callFn(depExprs);
  26686. }
  26687. else if (provider.useExisting) {
  26688. var /** @type {?} */ depExprs = convertDeps(providerIndex, [{ token: provider.useExisting }]);
  26689. expr = depExprs[0];
  26690. }
  26691. else {
  26692. expr = convertValueToOutputAst(ctx, provider.useValue);
  26693. }
  26694. return expr;
  26695. });
  26696. var /** @type {?} */ providerExpr = fn(allParams, [new ReturnStatement(literalArr(exprs))], INFERRED_TYPE);
  26697. return {
  26698. providerExpr: providerExpr,
  26699. flags: flags | 1024 /* TypeFactoryProvider */,
  26700. depsExpr: literalArr(allDepDefs)
  26701. };
  26702. /**
  26703. * @param {?} providerIndex
  26704. * @param {?} deps
  26705. * @return {?}
  26706. */
  26707. function convertDeps(providerIndex, deps) {
  26708. return deps.map(function (dep, depIndex) {
  26709. var /** @type {?} */ paramName = "p" + providerIndex + "_" + depIndex;
  26710. allParams.push(new FnParam(paramName, DYNAMIC_TYPE));
  26711. allDepDefs.push(depDef(ctx, dep));
  26712. return variable(paramName);
  26713. });
  26714. }
  26715. }
  26716. /**
  26717. * @param {?} ctx
  26718. * @param {?} flags
  26719. * @param {?} providerType
  26720. * @param {?} providerMeta
  26721. * @return {?}
  26722. */
  26723. function singleProviderDef(ctx, flags, providerType, providerMeta) {
  26724. var /** @type {?} */ providerExpr;
  26725. var /** @type {?} */ deps;
  26726. if (providerType === ProviderAstType.Directive || providerType === ProviderAstType.Component) {
  26727. providerExpr = ctx.importExpr(/** @type {?} */ ((providerMeta.useClass)).reference);
  26728. flags |= 16384 /* TypeDirective */;
  26729. deps = providerMeta.deps || /** @type {?} */ ((providerMeta.useClass)).diDeps;
  26730. }
  26731. else {
  26732. if (providerMeta.useClass) {
  26733. providerExpr = ctx.importExpr(providerMeta.useClass.reference);
  26734. flags |= 512 /* TypeClassProvider */;
  26735. deps = providerMeta.deps || providerMeta.useClass.diDeps;
  26736. }
  26737. else if (providerMeta.useFactory) {
  26738. providerExpr = ctx.importExpr(providerMeta.useFactory.reference);
  26739. flags |= 1024 /* TypeFactoryProvider */;
  26740. deps = providerMeta.deps || providerMeta.useFactory.diDeps;
  26741. }
  26742. else if (providerMeta.useExisting) {
  26743. providerExpr = NULL_EXPR;
  26744. flags |= 2048 /* TypeUseExistingProvider */;
  26745. deps = [{ token: providerMeta.useExisting }];
  26746. }
  26747. else {
  26748. providerExpr = convertValueToOutputAst(ctx, providerMeta.useValue);
  26749. flags |= 256 /* TypeValueProvider */;
  26750. deps = [];
  26751. }
  26752. }
  26753. var /** @type {?} */ depsExpr = literalArr(deps.map(function (dep) { return depDef(ctx, dep); }));
  26754. return { providerExpr: providerExpr, flags: flags, depsExpr: depsExpr };
  26755. }
  26756. /**
  26757. * @param {?} ctx
  26758. * @param {?} tokenMeta
  26759. * @return {?}
  26760. */
  26761. function tokenExpr(ctx, tokenMeta) {
  26762. return tokenMeta.identifier ? ctx.importExpr(tokenMeta.identifier.reference) :
  26763. literal(tokenMeta.value);
  26764. }
  26765. /**
  26766. * @param {?} ctx
  26767. * @param {?} dep
  26768. * @return {?}
  26769. */
  26770. function depDef(ctx, dep) {
  26771. // Note: the following fields have already been normalized out by provider_analyzer:
  26772. // - isAttribute, isSelf, isHost
  26773. var /** @type {?} */ expr = dep.isValue ? convertValueToOutputAst(ctx, dep.value) : tokenExpr(ctx, /** @type {?} */ ((dep.token)));
  26774. var /** @type {?} */ flags = 0;
  26775. if (dep.isSkipSelf) {
  26776. flags |= 1 /* SkipSelf */;
  26777. }
  26778. if (dep.isOptional) {
  26779. flags |= 2 /* Optional */;
  26780. }
  26781. if (dep.isValue) {
  26782. flags |= 8 /* Value */;
  26783. }
  26784. return flags === 0 /* None */ ? expr : literalArr([literal(flags), expr]);
  26785. }
  26786. /**
  26787. * @param {?} lifecycleHook
  26788. * @return {?}
  26789. */
  26790. function lifecycleHookToNodeFlag(lifecycleHook) {
  26791. var /** @type {?} */ nodeFlag = 0;
  26792. switch (lifecycleHook) {
  26793. case LifecycleHooks.AfterContentChecked:
  26794. nodeFlag = 2097152 /* AfterContentChecked */;
  26795. break;
  26796. case LifecycleHooks.AfterContentInit:
  26797. nodeFlag = 1048576 /* AfterContentInit */;
  26798. break;
  26799. case LifecycleHooks.AfterViewChecked:
  26800. nodeFlag = 8388608 /* AfterViewChecked */;
  26801. break;
  26802. case LifecycleHooks.AfterViewInit:
  26803. nodeFlag = 4194304 /* AfterViewInit */;
  26804. break;
  26805. case LifecycleHooks.DoCheck:
  26806. nodeFlag = 262144 /* DoCheck */;
  26807. break;
  26808. case LifecycleHooks.OnChanges:
  26809. nodeFlag = 524288 /* OnChanges */;
  26810. break;
  26811. case LifecycleHooks.OnDestroy:
  26812. nodeFlag = 131072 /* OnDestroy */;
  26813. break;
  26814. case LifecycleHooks.OnInit:
  26815. nodeFlag = 65536 /* OnInit */;
  26816. break;
  26817. }
  26818. return nodeFlag;
  26819. }
  26820. /**
  26821. * @param {?} reflector
  26822. * @param {?} ctx
  26823. * @param {?} flags
  26824. * @param {?} entryComponents
  26825. * @return {?}
  26826. */
  26827. function componentFactoryResolverProviderDef(reflector, ctx, flags, entryComponents) {
  26828. var /** @type {?} */ entryComponentFactories = entryComponents.map(function (entryComponent) { return ctx.importExpr(entryComponent.componentFactory); });
  26829. var /** @type {?} */ token = createTokenForExternalReference(reflector, Identifiers.ComponentFactoryResolver);
  26830. var /** @type {?} */ classMeta = {
  26831. diDeps: [
  26832. { isValue: true, value: literalArr(entryComponentFactories) },
  26833. { token: token, isSkipSelf: true, isOptional: true },
  26834. { token: createTokenForExternalReference(reflector, Identifiers.NgModuleRef) },
  26835. ],
  26836. lifecycleHooks: [],
  26837. reference: reflector.resolveExternalReference(Identifiers.CodegenComponentFactoryResolver)
  26838. };
  26839. var _a = singleProviderDef(ctx, flags, ProviderAstType.PrivateService, {
  26840. token: token,
  26841. multi: false,
  26842. useClass: classMeta,
  26843. }), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
  26844. return { providerExpr: providerExpr, flags: providerFlags, depsExpr: depsExpr, tokenExpr: tokenExpr(ctx, token) };
  26845. }
  26846. /**
  26847. * @fileoverview added by tsickle
  26848. * @suppress {checkTypes} checked by tsc
  26849. */
  26850. /**
  26851. * @license
  26852. * Copyright Google Inc. All Rights Reserved.
  26853. *
  26854. * Use of this source code is governed by an MIT-style license that can be
  26855. * found in the LICENSE file at https://angular.io/license
  26856. */
  26857. var NgModuleCompileResult = /** @class */ (function () {
  26858. function NgModuleCompileResult(ngModuleFactoryVar) {
  26859. this.ngModuleFactoryVar = ngModuleFactoryVar;
  26860. }
  26861. return NgModuleCompileResult;
  26862. }());
  26863. var LOG_VAR = variable('_l');
  26864. var NgModuleCompiler = /** @class */ (function () {
  26865. function NgModuleCompiler(reflector) {
  26866. this.reflector = reflector;
  26867. }
  26868. /**
  26869. * @param {?} ctx
  26870. * @param {?} ngModuleMeta
  26871. * @param {?} extraProviders
  26872. * @return {?}
  26873. */
  26874. NgModuleCompiler.prototype.compile = /**
  26875. * @param {?} ctx
  26876. * @param {?} ngModuleMeta
  26877. * @param {?} extraProviders
  26878. * @return {?}
  26879. */
  26880. function (ctx, ngModuleMeta, extraProviders) {
  26881. var /** @type {?} */ sourceSpan = typeSourceSpan('NgModule', ngModuleMeta.type);
  26882. var /** @type {?} */ entryComponentFactories = ngModuleMeta.transitiveModule.entryComponents;
  26883. var /** @type {?} */ bootstrapComponents = ngModuleMeta.bootstrapComponents;
  26884. var /** @type {?} */ providerParser = new NgModuleProviderAnalyzer(this.reflector, ngModuleMeta, extraProviders, sourceSpan);
  26885. var /** @type {?} */ providerDefs = [componentFactoryResolverProviderDef(this.reflector, ctx, 0 /* None */, entryComponentFactories)]
  26886. .concat(providerParser.parse().map(function (provider) { return providerDef(ctx, provider); }))
  26887. .map(function (_a) {
  26888. var providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
  26889. return importExpr(Identifiers.moduleProviderDef).callFn([
  26890. literal(flags), tokenExpr, providerExpr, depsExpr
  26891. ]);
  26892. });
  26893. var /** @type {?} */ ngModuleDef = importExpr(Identifiers.moduleDef).callFn([literalArr(providerDefs)]);
  26894. var /** @type {?} */ ngModuleDefFactory = fn([new FnParam(/** @type {?} */ ((LOG_VAR.name)))], [new ReturnStatement(ngModuleDef)], INFERRED_TYPE);
  26895. var /** @type {?} */ ngModuleFactoryVar = identifierName(ngModuleMeta.type) + "NgFactory";
  26896. this._createNgModuleFactory(ctx, ngModuleMeta.type.reference, importExpr(Identifiers.createModuleFactory).callFn([
  26897. ctx.importExpr(ngModuleMeta.type.reference),
  26898. literalArr(bootstrapComponents.map(function (id) { return ctx.importExpr(id.reference); })),
  26899. ngModuleDefFactory
  26900. ]));
  26901. if (ngModuleMeta.id) {
  26902. var /** @type {?} */ registerFactoryStmt = importExpr(Identifiers.RegisterModuleFactoryFn)
  26903. .callFn([literal(ngModuleMeta.id), variable(ngModuleFactoryVar)])
  26904. .toStmt();
  26905. ctx.statements.push(registerFactoryStmt);
  26906. }
  26907. return new NgModuleCompileResult(ngModuleFactoryVar);
  26908. };
  26909. /**
  26910. * @param {?} ctx
  26911. * @param {?} ngModuleReference
  26912. * @return {?}
  26913. */
  26914. NgModuleCompiler.prototype.createStub = /**
  26915. * @param {?} ctx
  26916. * @param {?} ngModuleReference
  26917. * @return {?}
  26918. */
  26919. function (ctx, ngModuleReference) {
  26920. this._createNgModuleFactory(ctx, ngModuleReference, NULL_EXPR);
  26921. };
  26922. /**
  26923. * @param {?} ctx
  26924. * @param {?} reference
  26925. * @param {?} value
  26926. * @return {?}
  26927. */
  26928. NgModuleCompiler.prototype._createNgModuleFactory = /**
  26929. * @param {?} ctx
  26930. * @param {?} reference
  26931. * @param {?} value
  26932. * @return {?}
  26933. */
  26934. function (ctx, reference, value) {
  26935. var /** @type {?} */ ngModuleFactoryVar = identifierName({ reference: reference }) + "NgFactory";
  26936. var /** @type {?} */ ngModuleFactoryStmt = variable(ngModuleFactoryVar)
  26937. .set(value)
  26938. .toDeclStmt(importType(Identifiers.NgModuleFactory, [/** @type {?} */ ((expressionType(ctx.importExpr(reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]);
  26939. ctx.statements.push(ngModuleFactoryStmt);
  26940. };
  26941. return NgModuleCompiler;
  26942. }());
  26943. /**
  26944. * @fileoverview added by tsickle
  26945. * @suppress {checkTypes} checked by tsc
  26946. */
  26947. /**
  26948. * @license
  26949. * Copyright Google Inc. All Rights Reserved.
  26950. *
  26951. * Use of this source code is governed by an MIT-style license that can be
  26952. * found in the LICENSE file at https://angular.io/license
  26953. */
  26954. /**
  26955. * Resolves types to {\@link NgModule}.
  26956. */
  26957. var NgModuleResolver = /** @class */ (function () {
  26958. function NgModuleResolver(_reflector) {
  26959. this._reflector = _reflector;
  26960. }
  26961. /**
  26962. * @param {?} type
  26963. * @return {?}
  26964. */
  26965. NgModuleResolver.prototype.isNgModule = /**
  26966. * @param {?} type
  26967. * @return {?}
  26968. */
  26969. function (type) { return this._reflector.annotations(type).some(createNgModule.isTypeOf); };
  26970. /**
  26971. * @param {?} type
  26972. * @param {?=} throwIfNotFound
  26973. * @return {?}
  26974. */
  26975. NgModuleResolver.prototype.resolve = /**
  26976. * @param {?} type
  26977. * @param {?=} throwIfNotFound
  26978. * @return {?}
  26979. */
  26980. function (type, throwIfNotFound) {
  26981. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  26982. var /** @type {?} */ ngModuleMeta = findLast(this._reflector.annotations(type), createNgModule.isTypeOf);
  26983. if (ngModuleMeta) {
  26984. return ngModuleMeta;
  26985. }
  26986. else {
  26987. if (throwIfNotFound) {
  26988. throw new Error("No NgModule metadata found for '" + stringify(type) + "'.");
  26989. }
  26990. return null;
  26991. }
  26992. };
  26993. return NgModuleResolver;
  26994. }());
  26995. /**
  26996. * @fileoverview added by tsickle
  26997. * @suppress {checkTypes} checked by tsc
  26998. */
  26999. /**
  27000. * @license
  27001. * Copyright Google Inc. All Rights Reserved.
  27002. *
  27003. * Use of this source code is governed by an MIT-style license that can be
  27004. * found in the LICENSE file at https://angular.io/license
  27005. */
  27006. // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
  27007. var VERSION$1 = 3;
  27008. var JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,';
  27009. var SourceMapGenerator = /** @class */ (function () {
  27010. function SourceMapGenerator(file) {
  27011. if (file === void 0) { file = null; }
  27012. this.file = file;
  27013. this.sourcesContent = new Map();
  27014. this.lines = [];
  27015. this.lastCol0 = 0;
  27016. this.hasMappings = false;
  27017. }
  27018. // The content is `null` when the content is expected to be loaded using the URL
  27019. /**
  27020. * @param {?} url
  27021. * @param {?=} content
  27022. * @return {?}
  27023. */
  27024. SourceMapGenerator.prototype.addSource = /**
  27025. * @param {?} url
  27026. * @param {?=} content
  27027. * @return {?}
  27028. */
  27029. function (url, content) {
  27030. if (content === void 0) { content = null; }
  27031. if (!this.sourcesContent.has(url)) {
  27032. this.sourcesContent.set(url, content);
  27033. }
  27034. return this;
  27035. };
  27036. /**
  27037. * @return {?}
  27038. */
  27039. SourceMapGenerator.prototype.addLine = /**
  27040. * @return {?}
  27041. */
  27042. function () {
  27043. this.lines.push([]);
  27044. this.lastCol0 = 0;
  27045. return this;
  27046. };
  27047. /**
  27048. * @param {?} col0
  27049. * @param {?=} sourceUrl
  27050. * @param {?=} sourceLine0
  27051. * @param {?=} sourceCol0
  27052. * @return {?}
  27053. */
  27054. SourceMapGenerator.prototype.addMapping = /**
  27055. * @param {?} col0
  27056. * @param {?=} sourceUrl
  27057. * @param {?=} sourceLine0
  27058. * @param {?=} sourceCol0
  27059. * @return {?}
  27060. */
  27061. function (col0, sourceUrl, sourceLine0, sourceCol0) {
  27062. if (!this.currentLine) {
  27063. throw new Error("A line must be added before mappings can be added");
  27064. }
  27065. if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) {
  27066. throw new Error("Unknown source file \"" + sourceUrl + "\"");
  27067. }
  27068. if (col0 == null) {
  27069. throw new Error("The column in the generated code must be provided");
  27070. }
  27071. if (col0 < this.lastCol0) {
  27072. throw new Error("Mapping should be added in output order");
  27073. }
  27074. if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) {
  27075. throw new Error("The source location must be provided when a source url is provided");
  27076. }
  27077. this.hasMappings = true;
  27078. this.lastCol0 = col0;
  27079. this.currentLine.push({ col0: col0, sourceUrl: sourceUrl, sourceLine0: sourceLine0, sourceCol0: sourceCol0 });
  27080. return this;
  27081. };
  27082. Object.defineProperty(SourceMapGenerator.prototype, "currentLine", {
  27083. get: /**
  27084. * @return {?}
  27085. */
  27086. function () { return this.lines.slice(-1)[0]; },
  27087. enumerable: true,
  27088. configurable: true
  27089. });
  27090. /**
  27091. * @return {?}
  27092. */
  27093. SourceMapGenerator.prototype.toJSON = /**
  27094. * @return {?}
  27095. */
  27096. function () {
  27097. var _this = this;
  27098. if (!this.hasMappings) {
  27099. return null;
  27100. }
  27101. var /** @type {?} */ sourcesIndex = new Map();
  27102. var /** @type {?} */ sources = [];
  27103. var /** @type {?} */ sourcesContent = [];
  27104. Array.from(this.sourcesContent.keys()).forEach(function (url, i) {
  27105. sourcesIndex.set(url, i);
  27106. sources.push(url);
  27107. sourcesContent.push(_this.sourcesContent.get(url) || null);
  27108. });
  27109. var /** @type {?} */ mappings = '';
  27110. var /** @type {?} */ lastCol0 = 0;
  27111. var /** @type {?} */ lastSourceIndex = 0;
  27112. var /** @type {?} */ lastSourceLine0 = 0;
  27113. var /** @type {?} */ lastSourceCol0 = 0;
  27114. this.lines.forEach(function (segments) {
  27115. lastCol0 = 0;
  27116. mappings += segments
  27117. .map(function (segment) {
  27118. // zero-based starting column of the line in the generated code
  27119. var /** @type {?} */ segAsStr = toBase64VLQ(segment.col0 - lastCol0);
  27120. lastCol0 = segment.col0;
  27121. if (segment.sourceUrl != null) {
  27122. // zero-based index into the “sources” list
  27123. segAsStr +=
  27124. toBase64VLQ(/** @type {?} */ ((sourcesIndex.get(segment.sourceUrl))) - lastSourceIndex);
  27125. lastSourceIndex = /** @type {?} */ ((sourcesIndex.get(segment.sourceUrl)));
  27126. // the zero-based starting line in the original source
  27127. segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceLine0)) - lastSourceLine0);
  27128. lastSourceLine0 = /** @type {?} */ ((segment.sourceLine0));
  27129. // the zero-based starting column in the original source
  27130. segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceCol0)) - lastSourceCol0);
  27131. lastSourceCol0 = /** @type {?} */ ((segment.sourceCol0));
  27132. }
  27133. return segAsStr;
  27134. })
  27135. .join(',');
  27136. mappings += ';';
  27137. });
  27138. mappings = mappings.slice(0, -1);
  27139. return {
  27140. 'file': this.file || '',
  27141. 'version': VERSION$1,
  27142. 'sourceRoot': '',
  27143. 'sources': sources,
  27144. 'sourcesContent': sourcesContent,
  27145. 'mappings': mappings,
  27146. };
  27147. };
  27148. /**
  27149. * @return {?}
  27150. */
  27151. SourceMapGenerator.prototype.toJsComment = /**
  27152. * @return {?}
  27153. */
  27154. function () {
  27155. return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) :
  27156. '';
  27157. };
  27158. return SourceMapGenerator;
  27159. }());
  27160. /**
  27161. * @param {?} value
  27162. * @return {?}
  27163. */
  27164. function toBase64String(value) {
  27165. var /** @type {?} */ b64 = '';
  27166. value = utf8Encode(value);
  27167. for (var /** @type {?} */ i = 0; i < value.length;) {
  27168. var /** @type {?} */ i1 = value.charCodeAt(i++);
  27169. var /** @type {?} */ i2 = value.charCodeAt(i++);
  27170. var /** @type {?} */ i3 = value.charCodeAt(i++);
  27171. b64 += toBase64Digit(i1 >> 2);
  27172. b64 += toBase64Digit(((i1 & 3) << 4) | (isNaN(i2) ? 0 : i2 >> 4));
  27173. b64 += isNaN(i2) ? '=' : toBase64Digit(((i2 & 15) << 2) | (i3 >> 6));
  27174. b64 += isNaN(i2) || isNaN(i3) ? '=' : toBase64Digit(i3 & 63);
  27175. }
  27176. return b64;
  27177. }
  27178. /**
  27179. * @param {?} value
  27180. * @return {?}
  27181. */
  27182. function toBase64VLQ(value) {
  27183. value = value < 0 ? ((-value) << 1) + 1 : value << 1;
  27184. var /** @type {?} */ out = '';
  27185. do {
  27186. var /** @type {?} */ digit = value & 31;
  27187. value = value >> 5;
  27188. if (value > 0) {
  27189. digit = digit | 32;
  27190. }
  27191. out += toBase64Digit(digit);
  27192. } while (value > 0);
  27193. return out;
  27194. }
  27195. var B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  27196. /**
  27197. * @param {?} value
  27198. * @return {?}
  27199. */
  27200. function toBase64Digit(value) {
  27201. if (value < 0 || value >= 64) {
  27202. throw new Error("Can only encode value in the range [0, 63]");
  27203. }
  27204. return B64_DIGITS[value];
  27205. }
  27206. /**
  27207. * @fileoverview added by tsickle
  27208. * @suppress {checkTypes} checked by tsc
  27209. */
  27210. /**
  27211. * @license
  27212. * Copyright Google Inc. All Rights Reserved.
  27213. *
  27214. * Use of this source code is governed by an MIT-style license that can be
  27215. * found in the LICENSE file at https://angular.io/license
  27216. */
  27217. var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
  27218. var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
  27219. var _INDENT_WITH = ' ';
  27220. var CATCH_ERROR_VAR$1 = variable('error', null, null);
  27221. var CATCH_STACK_VAR$1 = variable('stack', null, null);
  27222. /**
  27223. * @record
  27224. */
  27225. var _EmittedLine = /** @class */ (function () {
  27226. function _EmittedLine(indent) {
  27227. this.indent = indent;
  27228. this.partsLength = 0;
  27229. this.parts = [];
  27230. this.srcSpans = [];
  27231. }
  27232. return _EmittedLine;
  27233. }());
  27234. var EmitterVisitorContext = /** @class */ (function () {
  27235. function EmitterVisitorContext(_indent) {
  27236. this._indent = _indent;
  27237. this._classes = [];
  27238. this._preambleLineCount = 0;
  27239. this._lines = [new _EmittedLine(_indent)];
  27240. }
  27241. /**
  27242. * @return {?}
  27243. */
  27244. EmitterVisitorContext.createRoot = /**
  27245. * @return {?}
  27246. */
  27247. function () { return new EmitterVisitorContext(0); };
  27248. Object.defineProperty(EmitterVisitorContext.prototype, "_currentLine", {
  27249. get: /**
  27250. * @return {?}
  27251. */
  27252. function () { return this._lines[this._lines.length - 1]; },
  27253. enumerable: true,
  27254. configurable: true
  27255. });
  27256. /**
  27257. * @param {?=} from
  27258. * @param {?=} lastPart
  27259. * @return {?}
  27260. */
  27261. EmitterVisitorContext.prototype.println = /**
  27262. * @param {?=} from
  27263. * @param {?=} lastPart
  27264. * @return {?}
  27265. */
  27266. function (from, lastPart) {
  27267. if (lastPart === void 0) { lastPart = ''; }
  27268. this.print(from || null, lastPart, true);
  27269. };
  27270. /**
  27271. * @return {?}
  27272. */
  27273. EmitterVisitorContext.prototype.lineIsEmpty = /**
  27274. * @return {?}
  27275. */
  27276. function () { return this._currentLine.parts.length === 0; };
  27277. /**
  27278. * @return {?}
  27279. */
  27280. EmitterVisitorContext.prototype.lineLength = /**
  27281. * @return {?}
  27282. */
  27283. function () {
  27284. return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength;
  27285. };
  27286. /**
  27287. * @param {?} from
  27288. * @param {?} part
  27289. * @param {?=} newLine
  27290. * @return {?}
  27291. */
  27292. EmitterVisitorContext.prototype.print = /**
  27293. * @param {?} from
  27294. * @param {?} part
  27295. * @param {?=} newLine
  27296. * @return {?}
  27297. */
  27298. function (from, part, newLine) {
  27299. if (newLine === void 0) { newLine = false; }
  27300. if (part.length > 0) {
  27301. this._currentLine.parts.push(part);
  27302. this._currentLine.partsLength += part.length;
  27303. this._currentLine.srcSpans.push(from && from.sourceSpan || null);
  27304. }
  27305. if (newLine) {
  27306. this._lines.push(new _EmittedLine(this._indent));
  27307. }
  27308. };
  27309. /**
  27310. * @return {?}
  27311. */
  27312. EmitterVisitorContext.prototype.removeEmptyLastLine = /**
  27313. * @return {?}
  27314. */
  27315. function () {
  27316. if (this.lineIsEmpty()) {
  27317. this._lines.pop();
  27318. }
  27319. };
  27320. /**
  27321. * @return {?}
  27322. */
  27323. EmitterVisitorContext.prototype.incIndent = /**
  27324. * @return {?}
  27325. */
  27326. function () {
  27327. this._indent++;
  27328. if (this.lineIsEmpty()) {
  27329. this._currentLine.indent = this._indent;
  27330. }
  27331. };
  27332. /**
  27333. * @return {?}
  27334. */
  27335. EmitterVisitorContext.prototype.decIndent = /**
  27336. * @return {?}
  27337. */
  27338. function () {
  27339. this._indent--;
  27340. if (this.lineIsEmpty()) {
  27341. this._currentLine.indent = this._indent;
  27342. }
  27343. };
  27344. /**
  27345. * @param {?} clazz
  27346. * @return {?}
  27347. */
  27348. EmitterVisitorContext.prototype.pushClass = /**
  27349. * @param {?} clazz
  27350. * @return {?}
  27351. */
  27352. function (clazz) { this._classes.push(clazz); };
  27353. /**
  27354. * @return {?}
  27355. */
  27356. EmitterVisitorContext.prototype.popClass = /**
  27357. * @return {?}
  27358. */
  27359. function () { return /** @type {?} */ ((this._classes.pop())); };
  27360. Object.defineProperty(EmitterVisitorContext.prototype, "currentClass", {
  27361. get: /**
  27362. * @return {?}
  27363. */
  27364. function () {
  27365. return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null;
  27366. },
  27367. enumerable: true,
  27368. configurable: true
  27369. });
  27370. /**
  27371. * @return {?}
  27372. */
  27373. EmitterVisitorContext.prototype.toSource = /**
  27374. * @return {?}
  27375. */
  27376. function () {
  27377. return this.sourceLines
  27378. .map(function (l) { return l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : ''; })
  27379. .join('\n');
  27380. };
  27381. /**
  27382. * @param {?} genFilePath
  27383. * @param {?=} startsAtLine
  27384. * @return {?}
  27385. */
  27386. EmitterVisitorContext.prototype.toSourceMapGenerator = /**
  27387. * @param {?} genFilePath
  27388. * @param {?=} startsAtLine
  27389. * @return {?}
  27390. */
  27391. function (genFilePath, startsAtLine) {
  27392. if (startsAtLine === void 0) { startsAtLine = 0; }
  27393. var /** @type {?} */ map = new SourceMapGenerator(genFilePath);
  27394. var /** @type {?} */ firstOffsetMapped = false;
  27395. var /** @type {?} */ mapFirstOffsetIfNeeded = function () {
  27396. if (!firstOffsetMapped) {
  27397. // Add a single space so that tools won't try to load the file from disk.
  27398. // Note: We are using virtual urls like `ng:///`, so we have to
  27399. // provide a content here.
  27400. map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0);
  27401. firstOffsetMapped = true;
  27402. }
  27403. };
  27404. for (var /** @type {?} */ i = 0; i < startsAtLine; i++) {
  27405. map.addLine();
  27406. mapFirstOffsetIfNeeded();
  27407. }
  27408. this.sourceLines.forEach(function (line, lineIdx) {
  27409. map.addLine();
  27410. var /** @type {?} */ spans = line.srcSpans;
  27411. var /** @type {?} */ parts = line.parts;
  27412. var /** @type {?} */ col0 = line.indent * _INDENT_WITH.length;
  27413. var /** @type {?} */ spanIdx = 0;
  27414. // skip leading parts without source spans
  27415. while (spanIdx < spans.length && !spans[spanIdx]) {
  27416. col0 += parts[spanIdx].length;
  27417. spanIdx++;
  27418. }
  27419. if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) {
  27420. firstOffsetMapped = true;
  27421. }
  27422. else {
  27423. mapFirstOffsetIfNeeded();
  27424. }
  27425. while (spanIdx < spans.length) {
  27426. var /** @type {?} */ span = /** @type {?} */ ((spans[spanIdx]));
  27427. var /** @type {?} */ source = span.start.file;
  27428. var /** @type {?} */ sourceLine = span.start.line;
  27429. var /** @type {?} */ sourceCol = span.start.col;
  27430. map.addSource(source.url, source.content)
  27431. .addMapping(col0, source.url, sourceLine, sourceCol);
  27432. col0 += parts[spanIdx].length;
  27433. spanIdx++;
  27434. // assign parts without span or the same span to the previous segment
  27435. while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) {
  27436. col0 += parts[spanIdx].length;
  27437. spanIdx++;
  27438. }
  27439. }
  27440. });
  27441. return map;
  27442. };
  27443. /**
  27444. * @param {?} count
  27445. * @return {?}
  27446. */
  27447. EmitterVisitorContext.prototype.setPreambleLineCount = /**
  27448. * @param {?} count
  27449. * @return {?}
  27450. */
  27451. function (count) { return this._preambleLineCount = count; };
  27452. /**
  27453. * @param {?} line
  27454. * @param {?} column
  27455. * @return {?}
  27456. */
  27457. EmitterVisitorContext.prototype.spanOf = /**
  27458. * @param {?} line
  27459. * @param {?} column
  27460. * @return {?}
  27461. */
  27462. function (line, column) {
  27463. var /** @type {?} */ emittedLine = this._lines[line - this._preambleLineCount];
  27464. if (emittedLine) {
  27465. var /** @type {?} */ columnsLeft = column - _createIndent(emittedLine.indent).length;
  27466. for (var /** @type {?} */ partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {
  27467. var /** @type {?} */ part = emittedLine.parts[partIndex];
  27468. if (part.length > columnsLeft) {
  27469. return emittedLine.srcSpans[partIndex];
  27470. }
  27471. columnsLeft -= part.length;
  27472. }
  27473. }
  27474. return null;
  27475. };
  27476. Object.defineProperty(EmitterVisitorContext.prototype, "sourceLines", {
  27477. get: /**
  27478. * @return {?}
  27479. */
  27480. function () {
  27481. if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {
  27482. return this._lines.slice(0, -1);
  27483. }
  27484. return this._lines;
  27485. },
  27486. enumerable: true,
  27487. configurable: true
  27488. });
  27489. return EmitterVisitorContext;
  27490. }());
  27491. /**
  27492. * @abstract
  27493. */
  27494. var AbstractEmitterVisitor = /** @class */ (function () {
  27495. function AbstractEmitterVisitor(_escapeDollarInStrings) {
  27496. this._escapeDollarInStrings = _escapeDollarInStrings;
  27497. }
  27498. /**
  27499. * @param {?} stmt
  27500. * @param {?} ctx
  27501. * @return {?}
  27502. */
  27503. AbstractEmitterVisitor.prototype.visitExpressionStmt = /**
  27504. * @param {?} stmt
  27505. * @param {?} ctx
  27506. * @return {?}
  27507. */
  27508. function (stmt, ctx) {
  27509. stmt.expr.visitExpression(this, ctx);
  27510. ctx.println(stmt, ';');
  27511. return null;
  27512. };
  27513. /**
  27514. * @param {?} stmt
  27515. * @param {?} ctx
  27516. * @return {?}
  27517. */
  27518. AbstractEmitterVisitor.prototype.visitReturnStmt = /**
  27519. * @param {?} stmt
  27520. * @param {?} ctx
  27521. * @return {?}
  27522. */
  27523. function (stmt, ctx) {
  27524. ctx.print(stmt, "return ");
  27525. stmt.value.visitExpression(this, ctx);
  27526. ctx.println(stmt, ';');
  27527. return null;
  27528. };
  27529. /**
  27530. * @param {?} stmt
  27531. * @param {?} ctx
  27532. * @return {?}
  27533. */
  27534. AbstractEmitterVisitor.prototype.visitIfStmt = /**
  27535. * @param {?} stmt
  27536. * @param {?} ctx
  27537. * @return {?}
  27538. */
  27539. function (stmt, ctx) {
  27540. ctx.print(stmt, "if (");
  27541. stmt.condition.visitExpression(this, ctx);
  27542. ctx.print(stmt, ") {");
  27543. var /** @type {?} */ hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
  27544. if (stmt.trueCase.length <= 1 && !hasElseCase) {
  27545. ctx.print(stmt, " ");
  27546. this.visitAllStatements(stmt.trueCase, ctx);
  27547. ctx.removeEmptyLastLine();
  27548. ctx.print(stmt, " ");
  27549. }
  27550. else {
  27551. ctx.println();
  27552. ctx.incIndent();
  27553. this.visitAllStatements(stmt.trueCase, ctx);
  27554. ctx.decIndent();
  27555. if (hasElseCase) {
  27556. ctx.println(stmt, "} else {");
  27557. ctx.incIndent();
  27558. this.visitAllStatements(stmt.falseCase, ctx);
  27559. ctx.decIndent();
  27560. }
  27561. }
  27562. ctx.println(stmt, "}");
  27563. return null;
  27564. };
  27565. /**
  27566. * @param {?} stmt
  27567. * @param {?} ctx
  27568. * @return {?}
  27569. */
  27570. AbstractEmitterVisitor.prototype.visitThrowStmt = /**
  27571. * @param {?} stmt
  27572. * @param {?} ctx
  27573. * @return {?}
  27574. */
  27575. function (stmt, ctx) {
  27576. ctx.print(stmt, "throw ");
  27577. stmt.error.visitExpression(this, ctx);
  27578. ctx.println(stmt, ";");
  27579. return null;
  27580. };
  27581. /**
  27582. * @param {?} stmt
  27583. * @param {?} ctx
  27584. * @return {?}
  27585. */
  27586. AbstractEmitterVisitor.prototype.visitCommentStmt = /**
  27587. * @param {?} stmt
  27588. * @param {?} ctx
  27589. * @return {?}
  27590. */
  27591. function (stmt, ctx) {
  27592. var /** @type {?} */ lines = stmt.comment.split('\n');
  27593. lines.forEach(function (line) { ctx.println(stmt, "// " + line); });
  27594. return null;
  27595. };
  27596. /**
  27597. * @param {?} expr
  27598. * @param {?} ctx
  27599. * @return {?}
  27600. */
  27601. AbstractEmitterVisitor.prototype.visitWriteVarExpr = /**
  27602. * @param {?} expr
  27603. * @param {?} ctx
  27604. * @return {?}
  27605. */
  27606. function (expr, ctx) {
  27607. var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
  27608. if (!lineWasEmpty) {
  27609. ctx.print(expr, '(');
  27610. }
  27611. ctx.print(expr, expr.name + " = ");
  27612. expr.value.visitExpression(this, ctx);
  27613. if (!lineWasEmpty) {
  27614. ctx.print(expr, ')');
  27615. }
  27616. return null;
  27617. };
  27618. /**
  27619. * @param {?} expr
  27620. * @param {?} ctx
  27621. * @return {?}
  27622. */
  27623. AbstractEmitterVisitor.prototype.visitWriteKeyExpr = /**
  27624. * @param {?} expr
  27625. * @param {?} ctx
  27626. * @return {?}
  27627. */
  27628. function (expr, ctx) {
  27629. var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
  27630. if (!lineWasEmpty) {
  27631. ctx.print(expr, '(');
  27632. }
  27633. expr.receiver.visitExpression(this, ctx);
  27634. ctx.print(expr, "[");
  27635. expr.index.visitExpression(this, ctx);
  27636. ctx.print(expr, "] = ");
  27637. expr.value.visitExpression(this, ctx);
  27638. if (!lineWasEmpty) {
  27639. ctx.print(expr, ')');
  27640. }
  27641. return null;
  27642. };
  27643. /**
  27644. * @param {?} expr
  27645. * @param {?} ctx
  27646. * @return {?}
  27647. */
  27648. AbstractEmitterVisitor.prototype.visitWritePropExpr = /**
  27649. * @param {?} expr
  27650. * @param {?} ctx
  27651. * @return {?}
  27652. */
  27653. function (expr, ctx) {
  27654. var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
  27655. if (!lineWasEmpty) {
  27656. ctx.print(expr, '(');
  27657. }
  27658. expr.receiver.visitExpression(this, ctx);
  27659. ctx.print(expr, "." + expr.name + " = ");
  27660. expr.value.visitExpression(this, ctx);
  27661. if (!lineWasEmpty) {
  27662. ctx.print(expr, ')');
  27663. }
  27664. return null;
  27665. };
  27666. /**
  27667. * @param {?} expr
  27668. * @param {?} ctx
  27669. * @return {?}
  27670. */
  27671. AbstractEmitterVisitor.prototype.visitInvokeMethodExpr = /**
  27672. * @param {?} expr
  27673. * @param {?} ctx
  27674. * @return {?}
  27675. */
  27676. function (expr, ctx) {
  27677. expr.receiver.visitExpression(this, ctx);
  27678. var /** @type {?} */ name = expr.name;
  27679. if (expr.builtin != null) {
  27680. name = this.getBuiltinMethodName(expr.builtin);
  27681. if (name == null) {
  27682. // some builtins just mean to skip the call.
  27683. return null;
  27684. }
  27685. }
  27686. ctx.print(expr, "." + name + "(");
  27687. this.visitAllExpressions(expr.args, ctx, ",");
  27688. ctx.print(expr, ")");
  27689. return null;
  27690. };
  27691. /**
  27692. * @param {?} expr
  27693. * @param {?} ctx
  27694. * @return {?}
  27695. */
  27696. AbstractEmitterVisitor.prototype.visitInvokeFunctionExpr = /**
  27697. * @param {?} expr
  27698. * @param {?} ctx
  27699. * @return {?}
  27700. */
  27701. function (expr, ctx) {
  27702. expr.fn.visitExpression(this, ctx);
  27703. ctx.print(expr, "(");
  27704. this.visitAllExpressions(expr.args, ctx, ',');
  27705. ctx.print(expr, ")");
  27706. return null;
  27707. };
  27708. /**
  27709. * @param {?} ast
  27710. * @param {?} ctx
  27711. * @return {?}
  27712. */
  27713. AbstractEmitterVisitor.prototype.visitReadVarExpr = /**
  27714. * @param {?} ast
  27715. * @param {?} ctx
  27716. * @return {?}
  27717. */
  27718. function (ast, ctx) {
  27719. var /** @type {?} */ varName = /** @type {?} */ ((ast.name));
  27720. if (ast.builtin != null) {
  27721. switch (ast.builtin) {
  27722. case BuiltinVar.Super:
  27723. varName = 'super';
  27724. break;
  27725. case BuiltinVar.This:
  27726. varName = 'this';
  27727. break;
  27728. case BuiltinVar.CatchError:
  27729. varName = /** @type {?} */ ((CATCH_ERROR_VAR$1.name));
  27730. break;
  27731. case BuiltinVar.CatchStack:
  27732. varName = /** @type {?} */ ((CATCH_STACK_VAR$1.name));
  27733. break;
  27734. default:
  27735. throw new Error("Unknown builtin variable " + ast.builtin);
  27736. }
  27737. }
  27738. ctx.print(ast, varName);
  27739. return null;
  27740. };
  27741. /**
  27742. * @param {?} ast
  27743. * @param {?} ctx
  27744. * @return {?}
  27745. */
  27746. AbstractEmitterVisitor.prototype.visitInstantiateExpr = /**
  27747. * @param {?} ast
  27748. * @param {?} ctx
  27749. * @return {?}
  27750. */
  27751. function (ast, ctx) {
  27752. ctx.print(ast, "new ");
  27753. ast.classExpr.visitExpression(this, ctx);
  27754. ctx.print(ast, "(");
  27755. this.visitAllExpressions(ast.args, ctx, ',');
  27756. ctx.print(ast, ")");
  27757. return null;
  27758. };
  27759. /**
  27760. * @param {?} ast
  27761. * @param {?} ctx
  27762. * @return {?}
  27763. */
  27764. AbstractEmitterVisitor.prototype.visitLiteralExpr = /**
  27765. * @param {?} ast
  27766. * @param {?} ctx
  27767. * @return {?}
  27768. */
  27769. function (ast, ctx) {
  27770. var /** @type {?} */ value = ast.value;
  27771. if (typeof value === 'string') {
  27772. ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings));
  27773. }
  27774. else {
  27775. ctx.print(ast, "" + value);
  27776. }
  27777. return null;
  27778. };
  27779. /**
  27780. * @param {?} ast
  27781. * @param {?} ctx
  27782. * @return {?}
  27783. */
  27784. AbstractEmitterVisitor.prototype.visitConditionalExpr = /**
  27785. * @param {?} ast
  27786. * @param {?} ctx
  27787. * @return {?}
  27788. */
  27789. function (ast, ctx) {
  27790. ctx.print(ast, "(");
  27791. ast.condition.visitExpression(this, ctx);
  27792. ctx.print(ast, '? ');
  27793. ast.trueCase.visitExpression(this, ctx);
  27794. ctx.print(ast, ': '); /** @type {?} */
  27795. ((ast.falseCase)).visitExpression(this, ctx);
  27796. ctx.print(ast, ")");
  27797. return null;
  27798. };
  27799. /**
  27800. * @param {?} ast
  27801. * @param {?} ctx
  27802. * @return {?}
  27803. */
  27804. AbstractEmitterVisitor.prototype.visitNotExpr = /**
  27805. * @param {?} ast
  27806. * @param {?} ctx
  27807. * @return {?}
  27808. */
  27809. function (ast, ctx) {
  27810. ctx.print(ast, '!');
  27811. ast.condition.visitExpression(this, ctx);
  27812. return null;
  27813. };
  27814. /**
  27815. * @param {?} ast
  27816. * @param {?} ctx
  27817. * @return {?}
  27818. */
  27819. AbstractEmitterVisitor.prototype.visitAssertNotNullExpr = /**
  27820. * @param {?} ast
  27821. * @param {?} ctx
  27822. * @return {?}
  27823. */
  27824. function (ast, ctx) {
  27825. ast.condition.visitExpression(this, ctx);
  27826. return null;
  27827. };
  27828. /**
  27829. * @param {?} ast
  27830. * @param {?} ctx
  27831. * @return {?}
  27832. */
  27833. AbstractEmitterVisitor.prototype.visitBinaryOperatorExpr = /**
  27834. * @param {?} ast
  27835. * @param {?} ctx
  27836. * @return {?}
  27837. */
  27838. function (ast, ctx) {
  27839. var /** @type {?} */ opStr;
  27840. switch (ast.operator) {
  27841. case BinaryOperator.Equals:
  27842. opStr = '==';
  27843. break;
  27844. case BinaryOperator.Identical:
  27845. opStr = '===';
  27846. break;
  27847. case BinaryOperator.NotEquals:
  27848. opStr = '!=';
  27849. break;
  27850. case BinaryOperator.NotIdentical:
  27851. opStr = '!==';
  27852. break;
  27853. case BinaryOperator.And:
  27854. opStr = '&&';
  27855. break;
  27856. case BinaryOperator.Or:
  27857. opStr = '||';
  27858. break;
  27859. case BinaryOperator.Plus:
  27860. opStr = '+';
  27861. break;
  27862. case BinaryOperator.Minus:
  27863. opStr = '-';
  27864. break;
  27865. case BinaryOperator.Divide:
  27866. opStr = '/';
  27867. break;
  27868. case BinaryOperator.Multiply:
  27869. opStr = '*';
  27870. break;
  27871. case BinaryOperator.Modulo:
  27872. opStr = '%';
  27873. break;
  27874. case BinaryOperator.Lower:
  27875. opStr = '<';
  27876. break;
  27877. case BinaryOperator.LowerEquals:
  27878. opStr = '<=';
  27879. break;
  27880. case BinaryOperator.Bigger:
  27881. opStr = '>';
  27882. break;
  27883. case BinaryOperator.BiggerEquals:
  27884. opStr = '>=';
  27885. break;
  27886. default:
  27887. throw new Error("Unknown operator " + ast.operator);
  27888. }
  27889. ctx.print(ast, "(");
  27890. ast.lhs.visitExpression(this, ctx);
  27891. ctx.print(ast, " " + opStr + " ");
  27892. ast.rhs.visitExpression(this, ctx);
  27893. ctx.print(ast, ")");
  27894. return null;
  27895. };
  27896. /**
  27897. * @param {?} ast
  27898. * @param {?} ctx
  27899. * @return {?}
  27900. */
  27901. AbstractEmitterVisitor.prototype.visitReadPropExpr = /**
  27902. * @param {?} ast
  27903. * @param {?} ctx
  27904. * @return {?}
  27905. */
  27906. function (ast, ctx) {
  27907. ast.receiver.visitExpression(this, ctx);
  27908. ctx.print(ast, ".");
  27909. ctx.print(ast, ast.name);
  27910. return null;
  27911. };
  27912. /**
  27913. * @param {?} ast
  27914. * @param {?} ctx
  27915. * @return {?}
  27916. */
  27917. AbstractEmitterVisitor.prototype.visitReadKeyExpr = /**
  27918. * @param {?} ast
  27919. * @param {?} ctx
  27920. * @return {?}
  27921. */
  27922. function (ast, ctx) {
  27923. ast.receiver.visitExpression(this, ctx);
  27924. ctx.print(ast, "[");
  27925. ast.index.visitExpression(this, ctx);
  27926. ctx.print(ast, "]");
  27927. return null;
  27928. };
  27929. /**
  27930. * @param {?} ast
  27931. * @param {?} ctx
  27932. * @return {?}
  27933. */
  27934. AbstractEmitterVisitor.prototype.visitLiteralArrayExpr = /**
  27935. * @param {?} ast
  27936. * @param {?} ctx
  27937. * @return {?}
  27938. */
  27939. function (ast, ctx) {
  27940. ctx.print(ast, "[");
  27941. this.visitAllExpressions(ast.entries, ctx, ',');
  27942. ctx.print(ast, "]");
  27943. return null;
  27944. };
  27945. /**
  27946. * @param {?} ast
  27947. * @param {?} ctx
  27948. * @return {?}
  27949. */
  27950. AbstractEmitterVisitor.prototype.visitLiteralMapExpr = /**
  27951. * @param {?} ast
  27952. * @param {?} ctx
  27953. * @return {?}
  27954. */
  27955. function (ast, ctx) {
  27956. var _this = this;
  27957. ctx.print(ast, "{");
  27958. this.visitAllObjects(function (entry) {
  27959. ctx.print(ast, escapeIdentifier(entry.key, _this._escapeDollarInStrings, entry.quoted) + ":");
  27960. entry.value.visitExpression(_this, ctx);
  27961. }, ast.entries, ctx, ',');
  27962. ctx.print(ast, "}");
  27963. return null;
  27964. };
  27965. /**
  27966. * @param {?} ast
  27967. * @param {?} ctx
  27968. * @return {?}
  27969. */
  27970. AbstractEmitterVisitor.prototype.visitCommaExpr = /**
  27971. * @param {?} ast
  27972. * @param {?} ctx
  27973. * @return {?}
  27974. */
  27975. function (ast, ctx) {
  27976. ctx.print(ast, '(');
  27977. this.visitAllExpressions(ast.parts, ctx, ',');
  27978. ctx.print(ast, ')');
  27979. return null;
  27980. };
  27981. /**
  27982. * @param {?} expressions
  27983. * @param {?} ctx
  27984. * @param {?} separator
  27985. * @return {?}
  27986. */
  27987. AbstractEmitterVisitor.prototype.visitAllExpressions = /**
  27988. * @param {?} expressions
  27989. * @param {?} ctx
  27990. * @param {?} separator
  27991. * @return {?}
  27992. */
  27993. function (expressions, ctx, separator) {
  27994. var _this = this;
  27995. this.visitAllObjects(function (expr) { return expr.visitExpression(_this, ctx); }, expressions, ctx, separator);
  27996. };
  27997. /**
  27998. * @template T
  27999. * @param {?} handler
  28000. * @param {?} expressions
  28001. * @param {?} ctx
  28002. * @param {?} separator
  28003. * @return {?}
  28004. */
  28005. AbstractEmitterVisitor.prototype.visitAllObjects = /**
  28006. * @template T
  28007. * @param {?} handler
  28008. * @param {?} expressions
  28009. * @param {?} ctx
  28010. * @param {?} separator
  28011. * @return {?}
  28012. */
  28013. function (handler, expressions, ctx, separator) {
  28014. var /** @type {?} */ incrementedIndent = false;
  28015. for (var /** @type {?} */ i = 0; i < expressions.length; i++) {
  28016. if (i > 0) {
  28017. if (ctx.lineLength() > 80) {
  28018. ctx.print(null, separator, true);
  28019. if (!incrementedIndent) {
  28020. // continuation are marked with double indent.
  28021. ctx.incIndent();
  28022. ctx.incIndent();
  28023. incrementedIndent = true;
  28024. }
  28025. }
  28026. else {
  28027. ctx.print(null, separator, false);
  28028. }
  28029. }
  28030. handler(expressions[i]);
  28031. }
  28032. if (incrementedIndent) {
  28033. // continuation are marked with double indent.
  28034. ctx.decIndent();
  28035. ctx.decIndent();
  28036. }
  28037. };
  28038. /**
  28039. * @param {?} statements
  28040. * @param {?} ctx
  28041. * @return {?}
  28042. */
  28043. AbstractEmitterVisitor.prototype.visitAllStatements = /**
  28044. * @param {?} statements
  28045. * @param {?} ctx
  28046. * @return {?}
  28047. */
  28048. function (statements, ctx) {
  28049. var _this = this;
  28050. statements.forEach(function (stmt) { return stmt.visitStatement(_this, ctx); });
  28051. };
  28052. return AbstractEmitterVisitor;
  28053. }());
  28054. /**
  28055. * @param {?} input
  28056. * @param {?} escapeDollar
  28057. * @param {?=} alwaysQuote
  28058. * @return {?}
  28059. */
  28060. function escapeIdentifier(input, escapeDollar, alwaysQuote) {
  28061. if (alwaysQuote === void 0) { alwaysQuote = true; }
  28062. if (input == null) {
  28063. return null;
  28064. }
  28065. var /** @type {?} */ body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, function () {
  28066. var match = [];
  28067. for (var _i = 0; _i < arguments.length; _i++) {
  28068. match[_i] = arguments[_i];
  28069. }
  28070. if (match[0] == '$') {
  28071. return escapeDollar ? '\\$' : '$';
  28072. }
  28073. else if (match[0] == '\n') {
  28074. return '\\n';
  28075. }
  28076. else if (match[0] == '\r') {
  28077. return '\\r';
  28078. }
  28079. else {
  28080. return "\\" + match[0];
  28081. }
  28082. });
  28083. var /** @type {?} */ requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body);
  28084. return requiresQuotes ? "'" + body + "'" : body;
  28085. }
  28086. /**
  28087. * @param {?} count
  28088. * @return {?}
  28089. */
  28090. function _createIndent(count) {
  28091. var /** @type {?} */ res = '';
  28092. for (var /** @type {?} */ i = 0; i < count; i++) {
  28093. res += _INDENT_WITH;
  28094. }
  28095. return res;
  28096. }
  28097. /**
  28098. * @fileoverview added by tsickle
  28099. * @suppress {checkTypes} checked by tsc
  28100. */
  28101. /**
  28102. * @license
  28103. * Copyright Google Inc. All Rights Reserved.
  28104. *
  28105. * Use of this source code is governed by an MIT-style license that can be
  28106. * found in the LICENSE file at https://angular.io/license
  28107. */
  28108. /**
  28109. * @param {?} ast
  28110. * @return {?}
  28111. */
  28112. function debugOutputAstAsTypeScript(ast) {
  28113. var /** @type {?} */ converter = new _TsEmitterVisitor();
  28114. var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
  28115. var /** @type {?} */ asts = Array.isArray(ast) ? ast : [ast];
  28116. asts.forEach(function (ast) {
  28117. if (ast instanceof Statement) {
  28118. ast.visitStatement(converter, ctx);
  28119. }
  28120. else if (ast instanceof Expression) {
  28121. ast.visitExpression(converter, ctx);
  28122. }
  28123. else if (ast instanceof Type$1) {
  28124. ast.visitType(converter, ctx);
  28125. }
  28126. else {
  28127. throw new Error("Don't know how to print debug info for " + ast);
  28128. }
  28129. });
  28130. return ctx.toSource();
  28131. }
  28132. var TypeScriptEmitter = /** @class */ (function () {
  28133. function TypeScriptEmitter() {
  28134. }
  28135. /**
  28136. * @param {?} genFilePath
  28137. * @param {?} stmts
  28138. * @param {?=} preamble
  28139. * @param {?=} emitSourceMaps
  28140. * @param {?=} referenceFilter
  28141. * @return {?}
  28142. */
  28143. TypeScriptEmitter.prototype.emitStatementsAndContext = /**
  28144. * @param {?} genFilePath
  28145. * @param {?} stmts
  28146. * @param {?=} preamble
  28147. * @param {?=} emitSourceMaps
  28148. * @param {?=} referenceFilter
  28149. * @return {?}
  28150. */
  28151. function (genFilePath, stmts, preamble, emitSourceMaps, referenceFilter) {
  28152. if (preamble === void 0) { preamble = ''; }
  28153. if (emitSourceMaps === void 0) { emitSourceMaps = true; }
  28154. var /** @type {?} */ converter = new _TsEmitterVisitor(referenceFilter);
  28155. var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
  28156. converter.visitAllStatements(stmts, ctx);
  28157. var /** @type {?} */ preambleLines = preamble ? preamble.split('\n') : [];
  28158. converter.reexports.forEach(function (reexports, exportedModuleName) {
  28159. var /** @type {?} */ reexportsCode = reexports.map(function (reexport) { return reexport.name + " as " + reexport.as; }).join(',');
  28160. preambleLines.push("export {" + reexportsCode + "} from '" + exportedModuleName + "';");
  28161. });
  28162. converter.importsWithPrefixes.forEach(function (prefix, importedModuleName) {
  28163. // Note: can't write the real word for import as it screws up system.js auto detection...
  28164. preambleLines.push("imp" +
  28165. ("ort * as " + prefix + " from '" + importedModuleName + "';"));
  28166. });
  28167. var /** @type {?} */ sm = emitSourceMaps ?
  28168. ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() :
  28169. '';
  28170. var /** @type {?} */ lines = preambleLines.concat([ctx.toSource(), sm]);
  28171. if (sm) {
  28172. // always add a newline at the end, as some tools have bugs without it.
  28173. lines.push('');
  28174. }
  28175. ctx.setPreambleLineCount(preambleLines.length);
  28176. return { sourceText: lines.join('\n'), context: ctx };
  28177. };
  28178. /**
  28179. * @param {?} genFilePath
  28180. * @param {?} stmts
  28181. * @param {?=} preamble
  28182. * @return {?}
  28183. */
  28184. TypeScriptEmitter.prototype.emitStatements = /**
  28185. * @param {?} genFilePath
  28186. * @param {?} stmts
  28187. * @param {?=} preamble
  28188. * @return {?}
  28189. */
  28190. function (genFilePath, stmts, preamble) {
  28191. if (preamble === void 0) { preamble = ''; }
  28192. return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText;
  28193. };
  28194. return TypeScriptEmitter;
  28195. }());
  28196. var _TsEmitterVisitor = /** @class */ (function (_super) {
  28197. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_TsEmitterVisitor, _super);
  28198. function _TsEmitterVisitor(referenceFilter) {
  28199. var _this = _super.call(this, false) || this;
  28200. _this.referenceFilter = referenceFilter;
  28201. _this.typeExpression = 0;
  28202. _this.importsWithPrefixes = new Map();
  28203. _this.reexports = new Map();
  28204. return _this;
  28205. }
  28206. /**
  28207. * @param {?} t
  28208. * @param {?} ctx
  28209. * @param {?=} defaultType
  28210. * @return {?}
  28211. */
  28212. _TsEmitterVisitor.prototype.visitType = /**
  28213. * @param {?} t
  28214. * @param {?} ctx
  28215. * @param {?=} defaultType
  28216. * @return {?}
  28217. */
  28218. function (t, ctx, defaultType) {
  28219. if (defaultType === void 0) { defaultType = 'any'; }
  28220. if (t) {
  28221. this.typeExpression++;
  28222. t.visitType(this, ctx);
  28223. this.typeExpression--;
  28224. }
  28225. else {
  28226. ctx.print(null, defaultType);
  28227. }
  28228. };
  28229. /**
  28230. * @param {?} ast
  28231. * @param {?} ctx
  28232. * @return {?}
  28233. */
  28234. _TsEmitterVisitor.prototype.visitLiteralExpr = /**
  28235. * @param {?} ast
  28236. * @param {?} ctx
  28237. * @return {?}
  28238. */
  28239. function (ast, ctx) {
  28240. var /** @type {?} */ value = ast.value;
  28241. if (value == null && ast.type != INFERRED_TYPE) {
  28242. ctx.print(ast, "(" + value + " as any)");
  28243. return null;
  28244. }
  28245. return _super.prototype.visitLiteralExpr.call(this, ast, ctx);
  28246. };
  28247. // Temporary workaround to support strictNullCheck enabled consumers of ngc emit.
  28248. // In SNC mode, [] have the type never[], so we cast here to any[].
  28249. // TODO: narrow the cast to a more explicit type, or use a pattern that does not
  28250. // start with [].concat. see https://github.com/angular/angular/pull/11846
  28251. /**
  28252. * @param {?} ast
  28253. * @param {?} ctx
  28254. * @return {?}
  28255. */
  28256. _TsEmitterVisitor.prototype.visitLiteralArrayExpr = /**
  28257. * @param {?} ast
  28258. * @param {?} ctx
  28259. * @return {?}
  28260. */
  28261. function (ast, ctx) {
  28262. if (ast.entries.length === 0) {
  28263. ctx.print(ast, '(');
  28264. }
  28265. var /** @type {?} */ result = _super.prototype.visitLiteralArrayExpr.call(this, ast, ctx);
  28266. if (ast.entries.length === 0) {
  28267. ctx.print(ast, ' as any[])');
  28268. }
  28269. return result;
  28270. };
  28271. /**
  28272. * @param {?} ast
  28273. * @param {?} ctx
  28274. * @return {?}
  28275. */
  28276. _TsEmitterVisitor.prototype.visitExternalExpr = /**
  28277. * @param {?} ast
  28278. * @param {?} ctx
  28279. * @return {?}
  28280. */
  28281. function (ast, ctx) {
  28282. this._visitIdentifier(ast.value, ast.typeParams, ctx);
  28283. return null;
  28284. };
  28285. /**
  28286. * @param {?} ast
  28287. * @param {?} ctx
  28288. * @return {?}
  28289. */
  28290. _TsEmitterVisitor.prototype.visitAssertNotNullExpr = /**
  28291. * @param {?} ast
  28292. * @param {?} ctx
  28293. * @return {?}
  28294. */
  28295. function (ast, ctx) {
  28296. var /** @type {?} */ result = _super.prototype.visitAssertNotNullExpr.call(this, ast, ctx);
  28297. ctx.print(ast, '!');
  28298. return result;
  28299. };
  28300. /**
  28301. * @param {?} stmt
  28302. * @param {?} ctx
  28303. * @return {?}
  28304. */
  28305. _TsEmitterVisitor.prototype.visitDeclareVarStmt = /**
  28306. * @param {?} stmt
  28307. * @param {?} ctx
  28308. * @return {?}
  28309. */
  28310. function (stmt, ctx) {
  28311. if (stmt.hasModifier(StmtModifier.Exported) && stmt.value instanceof ExternalExpr &&
  28312. !stmt.type) {
  28313. // check for a reexport
  28314. var _a = stmt.value.value, name_1 = _a.name, moduleName = _a.moduleName;
  28315. if (moduleName) {
  28316. var /** @type {?} */ reexports = this.reexports.get(moduleName);
  28317. if (!reexports) {
  28318. reexports = [];
  28319. this.reexports.set(moduleName, reexports);
  28320. }
  28321. reexports.push({ name: /** @type {?} */ ((name_1)), as: stmt.name });
  28322. return null;
  28323. }
  28324. }
  28325. if (stmt.hasModifier(StmtModifier.Exported)) {
  28326. ctx.print(stmt, "export ");
  28327. }
  28328. if (stmt.hasModifier(StmtModifier.Final)) {
  28329. ctx.print(stmt, "const");
  28330. }
  28331. else {
  28332. ctx.print(stmt, "var");
  28333. }
  28334. ctx.print(stmt, " " + stmt.name);
  28335. this._printColonType(stmt.type, ctx);
  28336. ctx.print(stmt, " = ");
  28337. stmt.value.visitExpression(this, ctx);
  28338. ctx.println(stmt, ";");
  28339. return null;
  28340. };
  28341. /**
  28342. * @param {?} ast
  28343. * @param {?} ctx
  28344. * @return {?}
  28345. */
  28346. _TsEmitterVisitor.prototype.visitCastExpr = /**
  28347. * @param {?} ast
  28348. * @param {?} ctx
  28349. * @return {?}
  28350. */
  28351. function (ast, ctx) {
  28352. ctx.print(ast, "(<"); /** @type {?} */
  28353. ((ast.type)).visitType(this, ctx);
  28354. ctx.print(ast, ">");
  28355. ast.value.visitExpression(this, ctx);
  28356. ctx.print(ast, ")");
  28357. return null;
  28358. };
  28359. /**
  28360. * @param {?} ast
  28361. * @param {?} ctx
  28362. * @return {?}
  28363. */
  28364. _TsEmitterVisitor.prototype.visitInstantiateExpr = /**
  28365. * @param {?} ast
  28366. * @param {?} ctx
  28367. * @return {?}
  28368. */
  28369. function (ast, ctx) {
  28370. ctx.print(ast, "new ");
  28371. this.typeExpression++;
  28372. ast.classExpr.visitExpression(this, ctx);
  28373. this.typeExpression--;
  28374. ctx.print(ast, "(");
  28375. this.visitAllExpressions(ast.args, ctx, ',');
  28376. ctx.print(ast, ")");
  28377. return null;
  28378. };
  28379. /**
  28380. * @param {?} stmt
  28381. * @param {?} ctx
  28382. * @return {?}
  28383. */
  28384. _TsEmitterVisitor.prototype.visitDeclareClassStmt = /**
  28385. * @param {?} stmt
  28386. * @param {?} ctx
  28387. * @return {?}
  28388. */
  28389. function (stmt, ctx) {
  28390. var _this = this;
  28391. ctx.pushClass(stmt);
  28392. if (stmt.hasModifier(StmtModifier.Exported)) {
  28393. ctx.print(stmt, "export ");
  28394. }
  28395. ctx.print(stmt, "class " + stmt.name);
  28396. if (stmt.parent != null) {
  28397. ctx.print(stmt, " extends ");
  28398. this.typeExpression++;
  28399. stmt.parent.visitExpression(this, ctx);
  28400. this.typeExpression--;
  28401. }
  28402. ctx.println(stmt, " {");
  28403. ctx.incIndent();
  28404. stmt.fields.forEach(function (field) { return _this._visitClassField(field, ctx); });
  28405. if (stmt.constructorMethod != null) {
  28406. this._visitClassConstructor(stmt, ctx);
  28407. }
  28408. stmt.getters.forEach(function (getter) { return _this._visitClassGetter(getter, ctx); });
  28409. stmt.methods.forEach(function (method) { return _this._visitClassMethod(method, ctx); });
  28410. ctx.decIndent();
  28411. ctx.println(stmt, "}");
  28412. ctx.popClass();
  28413. return null;
  28414. };
  28415. /**
  28416. * @param {?} field
  28417. * @param {?} ctx
  28418. * @return {?}
  28419. */
  28420. _TsEmitterVisitor.prototype._visitClassField = /**
  28421. * @param {?} field
  28422. * @param {?} ctx
  28423. * @return {?}
  28424. */
  28425. function (field, ctx) {
  28426. if (field.hasModifier(StmtModifier.Private)) {
  28427. // comment out as a workaround for #10967
  28428. ctx.print(null, "/*private*/ ");
  28429. }
  28430. ctx.print(null, field.name);
  28431. this._printColonType(field.type, ctx);
  28432. ctx.println(null, ";");
  28433. };
  28434. /**
  28435. * @param {?} getter
  28436. * @param {?} ctx
  28437. * @return {?}
  28438. */
  28439. _TsEmitterVisitor.prototype._visitClassGetter = /**
  28440. * @param {?} getter
  28441. * @param {?} ctx
  28442. * @return {?}
  28443. */
  28444. function (getter, ctx) {
  28445. if (getter.hasModifier(StmtModifier.Private)) {
  28446. ctx.print(null, "private ");
  28447. }
  28448. ctx.print(null, "get " + getter.name + "()");
  28449. this._printColonType(getter.type, ctx);
  28450. ctx.println(null, " {");
  28451. ctx.incIndent();
  28452. this.visitAllStatements(getter.body, ctx);
  28453. ctx.decIndent();
  28454. ctx.println(null, "}");
  28455. };
  28456. /**
  28457. * @param {?} stmt
  28458. * @param {?} ctx
  28459. * @return {?}
  28460. */
  28461. _TsEmitterVisitor.prototype._visitClassConstructor = /**
  28462. * @param {?} stmt
  28463. * @param {?} ctx
  28464. * @return {?}
  28465. */
  28466. function (stmt, ctx) {
  28467. ctx.print(stmt, "constructor(");
  28468. this._visitParams(stmt.constructorMethod.params, ctx);
  28469. ctx.println(stmt, ") {");
  28470. ctx.incIndent();
  28471. this.visitAllStatements(stmt.constructorMethod.body, ctx);
  28472. ctx.decIndent();
  28473. ctx.println(stmt, "}");
  28474. };
  28475. /**
  28476. * @param {?} method
  28477. * @param {?} ctx
  28478. * @return {?}
  28479. */
  28480. _TsEmitterVisitor.prototype._visitClassMethod = /**
  28481. * @param {?} method
  28482. * @param {?} ctx
  28483. * @return {?}
  28484. */
  28485. function (method, ctx) {
  28486. if (method.hasModifier(StmtModifier.Private)) {
  28487. ctx.print(null, "private ");
  28488. }
  28489. ctx.print(null, method.name + "(");
  28490. this._visitParams(method.params, ctx);
  28491. ctx.print(null, ")");
  28492. this._printColonType(method.type, ctx, 'void');
  28493. ctx.println(null, " {");
  28494. ctx.incIndent();
  28495. this.visitAllStatements(method.body, ctx);
  28496. ctx.decIndent();
  28497. ctx.println(null, "}");
  28498. };
  28499. /**
  28500. * @param {?} ast
  28501. * @param {?} ctx
  28502. * @return {?}
  28503. */
  28504. _TsEmitterVisitor.prototype.visitFunctionExpr = /**
  28505. * @param {?} ast
  28506. * @param {?} ctx
  28507. * @return {?}
  28508. */
  28509. function (ast, ctx) {
  28510. ctx.print(ast, "(");
  28511. this._visitParams(ast.params, ctx);
  28512. ctx.print(ast, ")");
  28513. this._printColonType(ast.type, ctx, 'void');
  28514. ctx.println(ast, " => {");
  28515. ctx.incIndent();
  28516. this.visitAllStatements(ast.statements, ctx);
  28517. ctx.decIndent();
  28518. ctx.print(ast, "}");
  28519. return null;
  28520. };
  28521. /**
  28522. * @param {?} stmt
  28523. * @param {?} ctx
  28524. * @return {?}
  28525. */
  28526. _TsEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
  28527. * @param {?} stmt
  28528. * @param {?} ctx
  28529. * @return {?}
  28530. */
  28531. function (stmt, ctx) {
  28532. if (stmt.hasModifier(StmtModifier.Exported)) {
  28533. ctx.print(stmt, "export ");
  28534. }
  28535. ctx.print(stmt, "function " + stmt.name + "(");
  28536. this._visitParams(stmt.params, ctx);
  28537. ctx.print(stmt, ")");
  28538. this._printColonType(stmt.type, ctx, 'void');
  28539. ctx.println(stmt, " {");
  28540. ctx.incIndent();
  28541. this.visitAllStatements(stmt.statements, ctx);
  28542. ctx.decIndent();
  28543. ctx.println(stmt, "}");
  28544. return null;
  28545. };
  28546. /**
  28547. * @param {?} stmt
  28548. * @param {?} ctx
  28549. * @return {?}
  28550. */
  28551. _TsEmitterVisitor.prototype.visitTryCatchStmt = /**
  28552. * @param {?} stmt
  28553. * @param {?} ctx
  28554. * @return {?}
  28555. */
  28556. function (stmt, ctx) {
  28557. ctx.println(stmt, "try {");
  28558. ctx.incIndent();
  28559. this.visitAllStatements(stmt.bodyStmts, ctx);
  28560. ctx.decIndent();
  28561. ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
  28562. ctx.incIndent();
  28563. var /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack', null)).toDeclStmt(null, [
  28564. StmtModifier.Final
  28565. ]))].concat(stmt.catchStmts);
  28566. this.visitAllStatements(catchStmts, ctx);
  28567. ctx.decIndent();
  28568. ctx.println(stmt, "}");
  28569. return null;
  28570. };
  28571. /**
  28572. * @param {?} type
  28573. * @param {?} ctx
  28574. * @return {?}
  28575. */
  28576. _TsEmitterVisitor.prototype.visitBuiltintType = /**
  28577. * @param {?} type
  28578. * @param {?} ctx
  28579. * @return {?}
  28580. */
  28581. function (type, ctx) {
  28582. var /** @type {?} */ typeStr;
  28583. switch (type.name) {
  28584. case BuiltinTypeName.Bool:
  28585. typeStr = 'boolean';
  28586. break;
  28587. case BuiltinTypeName.Dynamic:
  28588. typeStr = 'any';
  28589. break;
  28590. case BuiltinTypeName.Function:
  28591. typeStr = 'Function';
  28592. break;
  28593. case BuiltinTypeName.Number:
  28594. typeStr = 'number';
  28595. break;
  28596. case BuiltinTypeName.Int:
  28597. typeStr = 'number';
  28598. break;
  28599. case BuiltinTypeName.String:
  28600. typeStr = 'string';
  28601. break;
  28602. default:
  28603. throw new Error("Unsupported builtin type " + type.name);
  28604. }
  28605. ctx.print(null, typeStr);
  28606. return null;
  28607. };
  28608. /**
  28609. * @param {?} ast
  28610. * @param {?} ctx
  28611. * @return {?}
  28612. */
  28613. _TsEmitterVisitor.prototype.visitExpressionType = /**
  28614. * @param {?} ast
  28615. * @param {?} ctx
  28616. * @return {?}
  28617. */
  28618. function (ast, ctx) {
  28619. ast.value.visitExpression(this, ctx);
  28620. return null;
  28621. };
  28622. /**
  28623. * @param {?} type
  28624. * @param {?} ctx
  28625. * @return {?}
  28626. */
  28627. _TsEmitterVisitor.prototype.visitArrayType = /**
  28628. * @param {?} type
  28629. * @param {?} ctx
  28630. * @return {?}
  28631. */
  28632. function (type, ctx) {
  28633. this.visitType(type.of, ctx);
  28634. ctx.print(null, "[]");
  28635. return null;
  28636. };
  28637. /**
  28638. * @param {?} type
  28639. * @param {?} ctx
  28640. * @return {?}
  28641. */
  28642. _TsEmitterVisitor.prototype.visitMapType = /**
  28643. * @param {?} type
  28644. * @param {?} ctx
  28645. * @return {?}
  28646. */
  28647. function (type, ctx) {
  28648. ctx.print(null, "{[key: string]:");
  28649. this.visitType(type.valueType, ctx);
  28650. ctx.print(null, "}");
  28651. return null;
  28652. };
  28653. /**
  28654. * @param {?} method
  28655. * @return {?}
  28656. */
  28657. _TsEmitterVisitor.prototype.getBuiltinMethodName = /**
  28658. * @param {?} method
  28659. * @return {?}
  28660. */
  28661. function (method) {
  28662. var /** @type {?} */ name;
  28663. switch (method) {
  28664. case BuiltinMethod.ConcatArray:
  28665. name = 'concat';
  28666. break;
  28667. case BuiltinMethod.SubscribeObservable:
  28668. name = 'subscribe';
  28669. break;
  28670. case BuiltinMethod.Bind:
  28671. name = 'bind';
  28672. break;
  28673. default:
  28674. throw new Error("Unknown builtin method: " + method);
  28675. }
  28676. return name;
  28677. };
  28678. /**
  28679. * @param {?} params
  28680. * @param {?} ctx
  28681. * @return {?}
  28682. */
  28683. _TsEmitterVisitor.prototype._visitParams = /**
  28684. * @param {?} params
  28685. * @param {?} ctx
  28686. * @return {?}
  28687. */
  28688. function (params, ctx) {
  28689. var _this = this;
  28690. this.visitAllObjects(function (param) {
  28691. ctx.print(null, param.name);
  28692. _this._printColonType(param.type, ctx);
  28693. }, params, ctx, ',');
  28694. };
  28695. /**
  28696. * @param {?} value
  28697. * @param {?} typeParams
  28698. * @param {?} ctx
  28699. * @return {?}
  28700. */
  28701. _TsEmitterVisitor.prototype._visitIdentifier = /**
  28702. * @param {?} value
  28703. * @param {?} typeParams
  28704. * @param {?} ctx
  28705. * @return {?}
  28706. */
  28707. function (value, typeParams, ctx) {
  28708. var _this = this;
  28709. var name = value.name, moduleName = value.moduleName;
  28710. if (this.referenceFilter && this.referenceFilter(value)) {
  28711. ctx.print(null, '(null as any)');
  28712. return;
  28713. }
  28714. if (moduleName) {
  28715. var /** @type {?} */ prefix = this.importsWithPrefixes.get(moduleName);
  28716. if (prefix == null) {
  28717. prefix = "i" + this.importsWithPrefixes.size;
  28718. this.importsWithPrefixes.set(moduleName, prefix);
  28719. }
  28720. ctx.print(null, prefix + ".");
  28721. }
  28722. ctx.print(null, /** @type {?} */ ((name)));
  28723. if (this.typeExpression > 0) {
  28724. // If we are in a type expression that refers to a generic type then supply
  28725. // the required type parameters. If there were not enough type parameters
  28726. // supplied, supply any as the type. Outside a type expression the reference
  28727. // should not supply type parameters and be treated as a simple value reference
  28728. // to the constructor function itself.
  28729. var /** @type {?} */ suppliedParameters = typeParams || [];
  28730. if (suppliedParameters.length > 0) {
  28731. ctx.print(null, "<");
  28732. this.visitAllObjects(function (type) { return type.visitType(_this, ctx); }, /** @type {?} */ ((typeParams)), ctx, ',');
  28733. ctx.print(null, ">");
  28734. }
  28735. }
  28736. };
  28737. /**
  28738. * @param {?} type
  28739. * @param {?} ctx
  28740. * @param {?=} defaultType
  28741. * @return {?}
  28742. */
  28743. _TsEmitterVisitor.prototype._printColonType = /**
  28744. * @param {?} type
  28745. * @param {?} ctx
  28746. * @param {?=} defaultType
  28747. * @return {?}
  28748. */
  28749. function (type, ctx, defaultType) {
  28750. if (type !== INFERRED_TYPE) {
  28751. ctx.print(null, ':');
  28752. this.visitType(type, ctx, defaultType);
  28753. }
  28754. };
  28755. return _TsEmitterVisitor;
  28756. }(AbstractEmitterVisitor));
  28757. /**
  28758. * @fileoverview added by tsickle
  28759. * @suppress {checkTypes} checked by tsc
  28760. */
  28761. /**
  28762. * @license
  28763. * Copyright Google Inc. All Rights Reserved.
  28764. *
  28765. * Use of this source code is governed by an MIT-style license that can be
  28766. * found in the LICENSE file at https://angular.io/license
  28767. */
  28768. /**
  28769. * Resolve a `Type` for {\@link Pipe}.
  28770. *
  28771. * This interface can be overridden by the application developer to create custom behavior.
  28772. *
  28773. * See {\@link Compiler}
  28774. */
  28775. var PipeResolver = /** @class */ (function () {
  28776. function PipeResolver(_reflector) {
  28777. this._reflector = _reflector;
  28778. }
  28779. /**
  28780. * @param {?} type
  28781. * @return {?}
  28782. */
  28783. PipeResolver.prototype.isPipe = /**
  28784. * @param {?} type
  28785. * @return {?}
  28786. */
  28787. function (type) {
  28788. var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
  28789. return typeMetadata && typeMetadata.some(createPipe.isTypeOf);
  28790. };
  28791. /**
  28792. * Return {@link Pipe} for a given `Type`.
  28793. */
  28794. /**
  28795. * Return {\@link Pipe} for a given `Type`.
  28796. * @param {?} type
  28797. * @param {?=} throwIfNotFound
  28798. * @return {?}
  28799. */
  28800. PipeResolver.prototype.resolve = /**
  28801. * Return {\@link Pipe} for a given `Type`.
  28802. * @param {?} type
  28803. * @param {?=} throwIfNotFound
  28804. * @return {?}
  28805. */
  28806. function (type, throwIfNotFound) {
  28807. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  28808. var /** @type {?} */ metas = this._reflector.annotations(resolveForwardRef(type));
  28809. if (metas) {
  28810. var /** @type {?} */ annotation = findLast(metas, createPipe.isTypeOf);
  28811. if (annotation) {
  28812. return annotation;
  28813. }
  28814. }
  28815. if (throwIfNotFound) {
  28816. throw new Error("No Pipe decorator found on " + stringify(type));
  28817. }
  28818. return null;
  28819. };
  28820. return PipeResolver;
  28821. }());
  28822. /**
  28823. * @fileoverview added by tsickle
  28824. * @suppress {checkTypes} checked by tsc
  28825. */
  28826. /**
  28827. * @license
  28828. * Copyright Google Inc. All Rights Reserved.
  28829. *
  28830. * Use of this source code is governed by an MIT-style license that can be
  28831. * found in the LICENSE file at https://angular.io/license
  28832. */
  28833. /**
  28834. * Map from tagName|propertyName SecurityContext. Properties applying to all tags use '*'.
  28835. */
  28836. var SECURITY_SCHEMA = {};
  28837. /**
  28838. * @param {?} ctx
  28839. * @param {?} specs
  28840. * @return {?}
  28841. */
  28842. function registerContext(ctx, specs) {
  28843. for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
  28844. var spec = specs_1[_i];
  28845. SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
  28846. }
  28847. }
  28848. // Case is insignificant below, all element and attribute names are lower-cased for lookup.
  28849. registerContext(SecurityContext.HTML, [
  28850. 'iframe|srcdoc',
  28851. '*|innerHTML',
  28852. '*|outerHTML',
  28853. ]);
  28854. registerContext(SecurityContext.STYLE, ['*|style']);
  28855. // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
  28856. registerContext(SecurityContext.URL, [
  28857. '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
  28858. 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
  28859. 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
  28860. 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
  28861. ]);
  28862. registerContext(SecurityContext.RESOURCE_URL, [
  28863. 'applet|code',
  28864. 'applet|codebase',
  28865. 'base|href',
  28866. 'embed|src',
  28867. 'frame|src',
  28868. 'head|profile',
  28869. 'html|manifest',
  28870. 'iframe|src',
  28871. 'link|href',
  28872. 'media|src',
  28873. 'object|codebase',
  28874. 'object|data',
  28875. 'script|src',
  28876. ]);
  28877. /**
  28878. * @fileoverview added by tsickle
  28879. * @suppress {checkTypes} checked by tsc
  28880. */
  28881. /**
  28882. * @license
  28883. * Copyright Google Inc. All Rights Reserved.
  28884. *
  28885. * Use of this source code is governed by an MIT-style license that can be
  28886. * found in the LICENSE file at https://angular.io/license
  28887. */
  28888. /**
  28889. * @abstract
  28890. */
  28891. var ElementSchemaRegistry = /** @class */ (function () {
  28892. function ElementSchemaRegistry() {
  28893. }
  28894. return ElementSchemaRegistry;
  28895. }());
  28896. /**
  28897. * @fileoverview added by tsickle
  28898. * @suppress {checkTypes} checked by tsc
  28899. */
  28900. /**
  28901. * @license
  28902. * Copyright Google Inc. All Rights Reserved.
  28903. *
  28904. * Use of this source code is governed by an MIT-style license that can be
  28905. * found in the LICENSE file at https://angular.io/license
  28906. */
  28907. var BOOLEAN = 'boolean';
  28908. var NUMBER = 'number';
  28909. var STRING = 'string';
  28910. var OBJECT = 'object';
  28911. /**
  28912. * This array represents the DOM schema. It encodes inheritance, properties, and events.
  28913. *
  28914. * ## Overview
  28915. *
  28916. * Each line represents one kind of element. The `element_inheritance` and properties are joined
  28917. * using `element_inheritance|properties` syntax.
  28918. *
  28919. * ## Element Inheritance
  28920. *
  28921. * The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`.
  28922. * Here the individual elements are separated by `,` (commas). Every element in the list
  28923. * has identical properties.
  28924. *
  28925. * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is
  28926. * specified then `""` (blank) element is assumed.
  28927. *
  28928. * NOTE: The blank element inherits from root `[Element]` element, the super element of all
  28929. * elements.
  28930. *
  28931. * NOTE an element prefix such as `:svg:` has no special meaning to the schema.
  28932. *
  28933. * ## Properties
  28934. *
  28935. * Each element has a set of properties separated by `,` (commas). Each property can be prefixed
  28936. * by a special character designating its type:
  28937. *
  28938. * - (no prefix): property is a string.
  28939. * - `*`: property represents an event.
  28940. * - `!`: property is a boolean.
  28941. * - `#`: property is a number.
  28942. * - `%`: property is an object.
  28943. *
  28944. * ## Query
  28945. *
  28946. * The class creates an internal squas representation which allows to easily answer the query of
  28947. * if a given property exist on a given element.
  28948. *
  28949. * NOTE: We don't yet support querying for types or events.
  28950. * NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder,
  28951. * see dom_element_schema_registry_spec.ts
  28952. */
  28953. var SCHEMA = [
  28954. '[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop,slot' +
  28955. ',*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored',
  28956. '[HTMLElement]^[Element]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate',
  28957. 'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate',
  28958. 'media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,src,%srcObject,#volume',
  28959. ':svg:^[HTMLElement]|*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex',
  28960. ':svg:graphics^:svg:|',
  28961. ':svg:animation^:svg:|*begin,*end,*repeat',
  28962. ':svg:geometry^:svg:|',
  28963. ':svg:componentTransferFunction^:svg:|',
  28964. ':svg:gradient^:svg:|',
  28965. ':svg:textContent^:svg:graphics|',
  28966. ':svg:textPositioning^:svg:textContent|',
  28967. 'a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,rev,search,shape,target,text,type,username',
  28968. 'area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,search,shape,target,username',
  28969. 'audio^media|',
  28970. 'br^[HTMLElement]|clear',
  28971. 'base^[HTMLElement]|href,target',
  28972. 'body^[HTMLElement]|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink',
  28973. 'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value',
  28974. 'canvas^[HTMLElement]|#height,#width',
  28975. 'content^[HTMLElement]|select',
  28976. 'dl^[HTMLElement]|!compact',
  28977. 'datalist^[HTMLElement]|',
  28978. 'details^[HTMLElement]|!open',
  28979. 'dialog^[HTMLElement]|!open,returnValue',
  28980. 'dir^[HTMLElement]|!compact',
  28981. 'div^[HTMLElement]|align',
  28982. 'embed^[HTMLElement]|align,height,name,src,type,width',
  28983. 'fieldset^[HTMLElement]|!disabled,name',
  28984. 'font^[HTMLElement]|color,face,size',
  28985. 'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target',
  28986. 'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src',
  28987. 'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows',
  28988. 'hr^[HTMLElement]|align,color,!noShade,size,width',
  28989. 'head^[HTMLElement]|',
  28990. 'h1,h2,h3,h4,h5,h6^[HTMLElement]|align',
  28991. 'html^[HTMLElement]|version',
  28992. 'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width',
  28993. 'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width',
  28994. 'input^[HTMLElement]|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width',
  28995. 'li^[HTMLElement]|type,#value',
  28996. 'label^[HTMLElement]|htmlFor',
  28997. 'legend^[HTMLElement]|align',
  28998. 'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type',
  28999. 'map^[HTMLElement]|name',
  29000. 'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width',
  29001. 'menu^[HTMLElement]|!compact',
  29002. 'meta^[HTMLElement]|content,httpEquiv,name,scheme',
  29003. 'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value',
  29004. 'ins,del^[HTMLElement]|cite,dateTime',
  29005. 'ol^[HTMLElement]|!compact,!reversed,#start,type',
  29006. 'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width',
  29007. 'optgroup^[HTMLElement]|!disabled,label',
  29008. 'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value',
  29009. 'output^[HTMLElement]|defaultValue,%htmlFor,name,value',
  29010. 'p^[HTMLElement]|align',
  29011. 'param^[HTMLElement]|name,type,value,valueType',
  29012. 'picture^[HTMLElement]|',
  29013. 'pre^[HTMLElement]|#width',
  29014. 'progress^[HTMLElement]|#max,#value',
  29015. 'q,blockquote,cite^[HTMLElement]|',
  29016. 'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type',
  29017. 'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
  29018. 'shadow^[HTMLElement]|',
  29019. 'slot^[HTMLElement]|name',
  29020. 'source^[HTMLElement]|media,sizes,src,srcset,type',
  29021. 'span^[HTMLElement]|',
  29022. 'style^[HTMLElement]|!disabled,media,type',
  29023. 'caption^[HTMLElement]|align',
  29024. 'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width',
  29025. 'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width',
  29026. 'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width',
  29027. 'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign',
  29028. 'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign',
  29029. 'template^[HTMLElement]|',
  29030. 'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap',
  29031. 'title^[HTMLElement]|text',
  29032. 'track^[HTMLElement]|!default,kind,label,src,srclang',
  29033. 'ul^[HTMLElement]|!compact,type',
  29034. 'unknown^[HTMLElement]|',
  29035. 'video^media|#height,poster,#width',
  29036. ':svg:a^:svg:graphics|',
  29037. ':svg:animate^:svg:animation|',
  29038. ':svg:animateMotion^:svg:animation|',
  29039. ':svg:animateTransform^:svg:animation|',
  29040. ':svg:circle^:svg:geometry|',
  29041. ':svg:clipPath^:svg:graphics|',
  29042. ':svg:defs^:svg:graphics|',
  29043. ':svg:desc^:svg:|',
  29044. ':svg:discard^:svg:|',
  29045. ':svg:ellipse^:svg:geometry|',
  29046. ':svg:feBlend^:svg:|',
  29047. ':svg:feColorMatrix^:svg:|',
  29048. ':svg:feComponentTransfer^:svg:|',
  29049. ':svg:feComposite^:svg:|',
  29050. ':svg:feConvolveMatrix^:svg:|',
  29051. ':svg:feDiffuseLighting^:svg:|',
  29052. ':svg:feDisplacementMap^:svg:|',
  29053. ':svg:feDistantLight^:svg:|',
  29054. ':svg:feDropShadow^:svg:|',
  29055. ':svg:feFlood^:svg:|',
  29056. ':svg:feFuncA^:svg:componentTransferFunction|',
  29057. ':svg:feFuncB^:svg:componentTransferFunction|',
  29058. ':svg:feFuncG^:svg:componentTransferFunction|',
  29059. ':svg:feFuncR^:svg:componentTransferFunction|',
  29060. ':svg:feGaussianBlur^:svg:|',
  29061. ':svg:feImage^:svg:|',
  29062. ':svg:feMerge^:svg:|',
  29063. ':svg:feMergeNode^:svg:|',
  29064. ':svg:feMorphology^:svg:|',
  29065. ':svg:feOffset^:svg:|',
  29066. ':svg:fePointLight^:svg:|',
  29067. ':svg:feSpecularLighting^:svg:|',
  29068. ':svg:feSpotLight^:svg:|',
  29069. ':svg:feTile^:svg:|',
  29070. ':svg:feTurbulence^:svg:|',
  29071. ':svg:filter^:svg:|',
  29072. ':svg:foreignObject^:svg:graphics|',
  29073. ':svg:g^:svg:graphics|',
  29074. ':svg:image^:svg:graphics|',
  29075. ':svg:line^:svg:geometry|',
  29076. ':svg:linearGradient^:svg:gradient|',
  29077. ':svg:mpath^:svg:|',
  29078. ':svg:marker^:svg:|',
  29079. ':svg:mask^:svg:|',
  29080. ':svg:metadata^:svg:|',
  29081. ':svg:path^:svg:geometry|',
  29082. ':svg:pattern^:svg:|',
  29083. ':svg:polygon^:svg:geometry|',
  29084. ':svg:polyline^:svg:geometry|',
  29085. ':svg:radialGradient^:svg:gradient|',
  29086. ':svg:rect^:svg:geometry|',
  29087. ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan',
  29088. ':svg:script^:svg:|type',
  29089. ':svg:set^:svg:animation|',
  29090. ':svg:stop^:svg:|',
  29091. ':svg:style^:svg:|!disabled,media,title,type',
  29092. ':svg:switch^:svg:graphics|',
  29093. ':svg:symbol^:svg:|',
  29094. ':svg:tspan^:svg:textPositioning|',
  29095. ':svg:text^:svg:textPositioning|',
  29096. ':svg:textPath^:svg:textContent|',
  29097. ':svg:title^:svg:|',
  29098. ':svg:use^:svg:graphics|',
  29099. ':svg:view^:svg:|#zoomAndPan',
  29100. 'data^[HTMLElement]|value',
  29101. 'keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name',
  29102. 'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default',
  29103. 'summary^[HTMLElement]|',
  29104. 'time^[HTMLElement]|dateTime',
  29105. ':svg:cursor^:svg:|',
  29106. ];
  29107. var _ATTR_TO_PROP = {
  29108. 'class': 'className',
  29109. 'for': 'htmlFor',
  29110. 'formaction': 'formAction',
  29111. 'innerHtml': 'innerHTML',
  29112. 'readonly': 'readOnly',
  29113. 'tabindex': 'tabIndex',
  29114. };
  29115. var DomElementSchemaRegistry = /** @class */ (function (_super) {
  29116. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DomElementSchemaRegistry, _super);
  29117. function DomElementSchemaRegistry() {
  29118. var _this = _super.call(this) || this;
  29119. _this._schema = {};
  29120. SCHEMA.forEach(function (encodedType) {
  29121. var /** @type {?} */ type = {};
  29122. var _a = encodedType.split('|'), strType = _a[0], strProperties = _a[1];
  29123. var /** @type {?} */ properties = strProperties.split(',');
  29124. var _b = strType.split('^'), typeNames = _b[0], superName = _b[1];
  29125. typeNames.split(',').forEach(function (tag) { return _this._schema[tag.toLowerCase()] = type; });
  29126. var /** @type {?} */ superType = superName && _this._schema[superName.toLowerCase()];
  29127. if (superType) {
  29128. Object.keys(superType).forEach(function (prop) { type[prop] = superType[prop]; });
  29129. }
  29130. properties.forEach(function (property) {
  29131. if (property.length > 0) {
  29132. switch (property[0]) {
  29133. case '*':
  29134. // We don't yet support events.
  29135. // If ever allowing to bind to events, GO THROUGH A SECURITY REVIEW, allowing events
  29136. // will
  29137. // almost certainly introduce bad XSS vulnerabilities.
  29138. // type[property.substring(1)] = EVENT;
  29139. break;
  29140. case '!':
  29141. type[property.substring(1)] = BOOLEAN;
  29142. break;
  29143. case '#':
  29144. type[property.substring(1)] = NUMBER;
  29145. break;
  29146. case '%':
  29147. type[property.substring(1)] = OBJECT;
  29148. break;
  29149. default:
  29150. type[property] = STRING;
  29151. }
  29152. }
  29153. });
  29154. });
  29155. return _this;
  29156. }
  29157. /**
  29158. * @param {?} tagName
  29159. * @param {?} propName
  29160. * @param {?} schemaMetas
  29161. * @return {?}
  29162. */
  29163. DomElementSchemaRegistry.prototype.hasProperty = /**
  29164. * @param {?} tagName
  29165. * @param {?} propName
  29166. * @param {?} schemaMetas
  29167. * @return {?}
  29168. */
  29169. function (tagName, propName, schemaMetas) {
  29170. if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
  29171. return true;
  29172. }
  29173. if (tagName.indexOf('-') > -1) {
  29174. if (isNgContainer(tagName) || isNgContent(tagName)) {
  29175. return false;
  29176. }
  29177. if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
  29178. // Can't tell now as we don't know which properties a custom element will get
  29179. // once it is instantiated
  29180. return true;
  29181. }
  29182. }
  29183. var /** @type {?} */ elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown'];
  29184. return !!elementProperties[propName];
  29185. };
  29186. /**
  29187. * @param {?} tagName
  29188. * @param {?} schemaMetas
  29189. * @return {?}
  29190. */
  29191. DomElementSchemaRegistry.prototype.hasElement = /**
  29192. * @param {?} tagName
  29193. * @param {?} schemaMetas
  29194. * @return {?}
  29195. */
  29196. function (tagName, schemaMetas) {
  29197. if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
  29198. return true;
  29199. }
  29200. if (tagName.indexOf('-') > -1) {
  29201. if (isNgContainer(tagName) || isNgContent(tagName)) {
  29202. return true;
  29203. }
  29204. if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
  29205. // Allow any custom elements
  29206. return true;
  29207. }
  29208. }
  29209. return !!this._schema[tagName.toLowerCase()];
  29210. };
  29211. /**
  29212. * securityContext returns the security context for the given property on the given DOM tag.
  29213. *
  29214. * Tag and property name are statically known and cannot change at runtime, i.e. it is not
  29215. * possible to bind a value into a changing attribute or tag name.
  29216. *
  29217. * The filtering is white list based. All attributes in the schema above are assumed to have the
  29218. * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
  29219. * attack vectors are assigned their appropriate context.
  29220. */
  29221. /**
  29222. * securityContext returns the security context for the given property on the given DOM tag.
  29223. *
  29224. * Tag and property name are statically known and cannot change at runtime, i.e. it is not
  29225. * possible to bind a value into a changing attribute or tag name.
  29226. *
  29227. * The filtering is white list based. All attributes in the schema above are assumed to have the
  29228. * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
  29229. * attack vectors are assigned their appropriate context.
  29230. * @param {?} tagName
  29231. * @param {?} propName
  29232. * @param {?} isAttribute
  29233. * @return {?}
  29234. */
  29235. DomElementSchemaRegistry.prototype.securityContext = /**
  29236. * securityContext returns the security context for the given property on the given DOM tag.
  29237. *
  29238. * Tag and property name are statically known and cannot change at runtime, i.e. it is not
  29239. * possible to bind a value into a changing attribute or tag name.
  29240. *
  29241. * The filtering is white list based. All attributes in the schema above are assumed to have the
  29242. * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
  29243. * attack vectors are assigned their appropriate context.
  29244. * @param {?} tagName
  29245. * @param {?} propName
  29246. * @param {?} isAttribute
  29247. * @return {?}
  29248. */
  29249. function (tagName, propName, isAttribute) {
  29250. if (isAttribute) {
  29251. // NB: For security purposes, use the mapped property name, not the attribute name.
  29252. propName = this.getMappedPropName(propName);
  29253. }
  29254. // Make sure comparisons are case insensitive, so that case differences between attribute and
  29255. // property names do not have a security impact.
  29256. tagName = tagName.toLowerCase();
  29257. propName = propName.toLowerCase();
  29258. var /** @type {?} */ ctx = SECURITY_SCHEMA[tagName + '|' + propName];
  29259. if (ctx) {
  29260. return ctx;
  29261. }
  29262. ctx = SECURITY_SCHEMA['*|' + propName];
  29263. return ctx ? ctx : SecurityContext.NONE;
  29264. };
  29265. /**
  29266. * @param {?} propName
  29267. * @return {?}
  29268. */
  29269. DomElementSchemaRegistry.prototype.getMappedPropName = /**
  29270. * @param {?} propName
  29271. * @return {?}
  29272. */
  29273. function (propName) { return _ATTR_TO_PROP[propName] || propName; };
  29274. /**
  29275. * @return {?}
  29276. */
  29277. DomElementSchemaRegistry.prototype.getDefaultComponentElementName = /**
  29278. * @return {?}
  29279. */
  29280. function () { return 'ng-component'; };
  29281. /**
  29282. * @param {?} name
  29283. * @return {?}
  29284. */
  29285. DomElementSchemaRegistry.prototype.validateProperty = /**
  29286. * @param {?} name
  29287. * @return {?}
  29288. */
  29289. function (name) {
  29290. if (name.toLowerCase().startsWith('on')) {
  29291. var /** @type {?} */ msg = "Binding to event property '" + name + "' is disallowed for security reasons, " +
  29292. ("please use (" + name.slice(2) + ")=...") +
  29293. ("\nIf '" + name + "' is a directive input, make sure the directive is imported by the") +
  29294. " current module.";
  29295. return { error: true, msg: msg };
  29296. }
  29297. else {
  29298. return { error: false };
  29299. }
  29300. };
  29301. /**
  29302. * @param {?} name
  29303. * @return {?}
  29304. */
  29305. DomElementSchemaRegistry.prototype.validateAttribute = /**
  29306. * @param {?} name
  29307. * @return {?}
  29308. */
  29309. function (name) {
  29310. if (name.toLowerCase().startsWith('on')) {
  29311. var /** @type {?} */ msg = "Binding to event attribute '" + name + "' is disallowed for security reasons, " +
  29312. ("please use (" + name.slice(2) + ")=...");
  29313. return { error: true, msg: msg };
  29314. }
  29315. else {
  29316. return { error: false };
  29317. }
  29318. };
  29319. /**
  29320. * @return {?}
  29321. */
  29322. DomElementSchemaRegistry.prototype.allKnownElementNames = /**
  29323. * @return {?}
  29324. */
  29325. function () { return Object.keys(this._schema); };
  29326. /**
  29327. * @param {?} propName
  29328. * @return {?}
  29329. */
  29330. DomElementSchemaRegistry.prototype.normalizeAnimationStyleProperty = /**
  29331. * @param {?} propName
  29332. * @return {?}
  29333. */
  29334. function (propName) {
  29335. return dashCaseToCamelCase(propName);
  29336. };
  29337. /**
  29338. * @param {?} camelCaseProp
  29339. * @param {?} userProvidedProp
  29340. * @param {?} val
  29341. * @return {?}
  29342. */
  29343. DomElementSchemaRegistry.prototype.normalizeAnimationStyleValue = /**
  29344. * @param {?} camelCaseProp
  29345. * @param {?} userProvidedProp
  29346. * @param {?} val
  29347. * @return {?}
  29348. */
  29349. function (camelCaseProp, userProvidedProp, val) {
  29350. var /** @type {?} */ unit = '';
  29351. var /** @type {?} */ strVal = val.toString().trim();
  29352. var /** @type {?} */ errorMsg = /** @type {?} */ ((null));
  29353. if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') {
  29354. if (typeof val === 'number') {
  29355. unit = 'px';
  29356. }
  29357. else {
  29358. var /** @type {?} */ valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
  29359. if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
  29360. errorMsg = "Please provide a CSS unit value for " + userProvidedProp + ":" + val;
  29361. }
  29362. }
  29363. }
  29364. return { error: errorMsg, value: strVal + unit };
  29365. };
  29366. return DomElementSchemaRegistry;
  29367. }(ElementSchemaRegistry));
  29368. /**
  29369. * @param {?} prop
  29370. * @return {?}
  29371. */
  29372. function _isPixelDimensionStyle(prop) {
  29373. switch (prop) {
  29374. case 'width':
  29375. case 'height':
  29376. case 'minWidth':
  29377. case 'minHeight':
  29378. case 'maxWidth':
  29379. case 'maxHeight':
  29380. case 'left':
  29381. case 'top':
  29382. case 'bottom':
  29383. case 'right':
  29384. case 'fontSize':
  29385. case 'outlineWidth':
  29386. case 'outlineOffset':
  29387. case 'paddingTop':
  29388. case 'paddingLeft':
  29389. case 'paddingBottom':
  29390. case 'paddingRight':
  29391. case 'marginTop':
  29392. case 'marginLeft':
  29393. case 'marginBottom':
  29394. case 'marginRight':
  29395. case 'borderRadius':
  29396. case 'borderWidth':
  29397. case 'borderTopWidth':
  29398. case 'borderLeftWidth':
  29399. case 'borderRightWidth':
  29400. case 'borderBottomWidth':
  29401. case 'textIndent':
  29402. return true;
  29403. default:
  29404. return false;
  29405. }
  29406. }
  29407. /**
  29408. * @fileoverview added by tsickle
  29409. * @suppress {checkTypes} checked by tsc
  29410. */
  29411. /**
  29412. * @license
  29413. * Copyright Google Inc. All Rights Reserved.
  29414. *
  29415. * Use of this source code is governed by an MIT-style license that can be
  29416. * found in the LICENSE file at https://angular.io/license
  29417. */
  29418. /**
  29419. * This file is a port of shadowCSS from webcomponents.js to TypeScript.
  29420. *
  29421. * Please make sure to keep to edits in sync with the source file.
  29422. *
  29423. * Source:
  29424. * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
  29425. *
  29426. * The original file level comment is reproduced below
  29427. */
  29428. /*
  29429. This is a limited shim for ShadowDOM css styling.
  29430. https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
  29431. The intention here is to support only the styling features which can be
  29432. relatively simply implemented. The goal is to allow users to avoid the
  29433. most obvious pitfalls and do so without compromising performance significantly.
  29434. For ShadowDOM styling that's not covered here, a set of best practices
  29435. can be provided that should allow users to accomplish more complex styling.
  29436. The following is a list of specific ShadowDOM styling features and a brief
  29437. discussion of the approach used to shim.
  29438. Shimmed features:
  29439. * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host
  29440. element using the :host rule. To shim this feature, the :host styles are
  29441. reformatted and prefixed with a given scope name and promoted to a
  29442. document level stylesheet.
  29443. For example, given a scope name of .foo, a rule like this:
  29444. :host {
  29445. background: red;
  29446. }
  29447. }
  29448. becomes:
  29449. .foo {
  29450. background: red;
  29451. }
  29452. * encapsulation: Styles defined within ShadowDOM, apply only to
  29453. dom inside the ShadowDOM. Polymer uses one of two techniques to implement
  29454. this feature.
  29455. By default, rules are prefixed with the host element tag name
  29456. as a descendant selector. This ensures styling does not leak out of the 'top'
  29457. of the element's ShadowDOM. For example,
  29458. div {
  29459. font-weight: bold;
  29460. }
  29461. becomes:
  29462. x-foo div {
  29463. font-weight: bold;
  29464. }
  29465. becomes:
  29466. Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
  29467. selectors are scoped by adding an attribute selector suffix to each
  29468. simple selector that contains the host element tag name. Each element
  29469. in the element's ShadowDOM template is also given the scope attribute.
  29470. Thus, these rules match only elements that have the scope attribute.
  29471. For example, given a scope name of x-foo, a rule like this:
  29472. div {
  29473. font-weight: bold;
  29474. }
  29475. becomes:
  29476. div[x-foo] {
  29477. font-weight: bold;
  29478. }
  29479. Note that elements that are dynamically added to a scope must have the scope
  29480. selector added to them manually.
  29481. * upper/lower bound encapsulation: Styles which are defined outside a
  29482. shadowRoot should not cross the ShadowDOM boundary and should not apply
  29483. inside a shadowRoot.
  29484. This styling behavior is not emulated. Some possible ways to do this that
  29485. were rejected due to complexity and/or performance concerns include: (1) reset
  29486. every possible property for every possible selector for a given scope name;
  29487. (2) re-implement css in javascript.
  29488. As an alternative, users should make sure to use selectors
  29489. specific to the scope in which they are working.
  29490. * ::distributed: This behavior is not emulated. It's often not necessary
  29491. to style the contents of a specific insertion point and instead, descendants
  29492. of the host element can be styled selectively. Users can also create an
  29493. extra node around an insertion point and style that node's contents
  29494. via descendent selectors. For example, with a shadowRoot like this:
  29495. <style>
  29496. ::content(div) {
  29497. background: red;
  29498. }
  29499. </style>
  29500. <content></content>
  29501. could become:
  29502. <style>
  29503. / *@polyfill .content-container div * /
  29504. ::content(div) {
  29505. background: red;
  29506. }
  29507. </style>
  29508. <div class="content-container">
  29509. <content></content>
  29510. </div>
  29511. Note the use of @polyfill in the comment above a ShadowDOM specific style
  29512. declaration. This is a directive to the styling shim to use the selector
  29513. in comments in lieu of the next selector when running under polyfill.
  29514. */
  29515. var ShadowCss = /** @class */ (function () {
  29516. function ShadowCss() {
  29517. this.strictStyling = true;
  29518. }
  29519. /*
  29520. * Shim some cssText with the given selector. Returns cssText that can
  29521. * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
  29522. *
  29523. * When strictStyling is true:
  29524. * - selector is the attribute added to all elements inside the host,
  29525. * - hostSelector is the attribute added to the host itself.
  29526. */
  29527. /**
  29528. * @param {?} cssText
  29529. * @param {?} selector
  29530. * @param {?=} hostSelector
  29531. * @return {?}
  29532. */
  29533. ShadowCss.prototype.shimCssText = /**
  29534. * @param {?} cssText
  29535. * @param {?} selector
  29536. * @param {?=} hostSelector
  29537. * @return {?}
  29538. */
  29539. function (cssText, selector, hostSelector) {
  29540. if (hostSelector === void 0) { hostSelector = ''; }
  29541. var /** @type {?} */ commentsWithHash = extractCommentsWithHash(cssText);
  29542. cssText = stripComments(cssText);
  29543. cssText = this._insertDirectives(cssText);
  29544. var /** @type {?} */ scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
  29545. return [scopedCssText].concat(commentsWithHash).join('\n');
  29546. };
  29547. /**
  29548. * @param {?} cssText
  29549. * @return {?}
  29550. */
  29551. ShadowCss.prototype._insertDirectives = /**
  29552. * @param {?} cssText
  29553. * @return {?}
  29554. */
  29555. function (cssText) {
  29556. cssText = this._insertPolyfillDirectivesInCssText(cssText);
  29557. return this._insertPolyfillRulesInCssText(cssText);
  29558. };
  29559. /**
  29560. * @param {?} cssText
  29561. * @return {?}
  29562. */
  29563. ShadowCss.prototype._insertPolyfillDirectivesInCssText = /**
  29564. * @param {?} cssText
  29565. * @return {?}
  29566. */
  29567. function (cssText) {
  29568. // Difference with webcomponents.js: does not handle comments
  29569. return cssText.replace(_cssContentNextSelectorRe, function () {
  29570. var m = [];
  29571. for (var _i = 0; _i < arguments.length; _i++) {
  29572. m[_i] = arguments[_i];
  29573. }
  29574. return m[2] + '{';
  29575. });
  29576. };
  29577. /**
  29578. * @param {?} cssText
  29579. * @return {?}
  29580. */
  29581. ShadowCss.prototype._insertPolyfillRulesInCssText = /**
  29582. * @param {?} cssText
  29583. * @return {?}
  29584. */
  29585. function (cssText) {
  29586. // Difference with webcomponents.js: does not handle comments
  29587. return cssText.replace(_cssContentRuleRe, function () {
  29588. var m = [];
  29589. for (var _i = 0; _i < arguments.length; _i++) {
  29590. m[_i] = arguments[_i];
  29591. }
  29592. var /** @type {?} */ rule = m[0].replace(m[1], '').replace(m[2], '');
  29593. return m[4] + rule;
  29594. });
  29595. };
  29596. /**
  29597. * @param {?} cssText
  29598. * @param {?} scopeSelector
  29599. * @param {?} hostSelector
  29600. * @return {?}
  29601. */
  29602. ShadowCss.prototype._scopeCssText = /**
  29603. * @param {?} cssText
  29604. * @param {?} scopeSelector
  29605. * @param {?} hostSelector
  29606. * @return {?}
  29607. */
  29608. function (cssText, scopeSelector, hostSelector) {
  29609. var /** @type {?} */ unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
  29610. // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
  29611. cssText = this._insertPolyfillHostInCssText(cssText);
  29612. cssText = this._convertColonHost(cssText);
  29613. cssText = this._convertColonHostContext(cssText);
  29614. cssText = this._convertShadowDOMSelectors(cssText);
  29615. if (scopeSelector) {
  29616. cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
  29617. }
  29618. cssText = cssText + '\n' + unscopedRules;
  29619. return cssText.trim();
  29620. };
  29621. /**
  29622. * @param {?} cssText
  29623. * @return {?}
  29624. */
  29625. ShadowCss.prototype._extractUnscopedRulesFromCssText = /**
  29626. * @param {?} cssText
  29627. * @return {?}
  29628. */
  29629. function (cssText) {
  29630. // Difference with webcomponents.js: does not handle comments
  29631. var /** @type {?} */ r = '';
  29632. var /** @type {?} */ m;
  29633. _cssContentUnscopedRuleRe.lastIndex = 0;
  29634. while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {
  29635. var /** @type {?} */ rule = m[0].replace(m[2], '').replace(m[1], m[4]);
  29636. r += rule + '\n\n';
  29637. }
  29638. return r;
  29639. };
  29640. /**
  29641. * @param {?} cssText
  29642. * @return {?}
  29643. */
  29644. ShadowCss.prototype._convertColonHost = /**
  29645. * @param {?} cssText
  29646. * @return {?}
  29647. */
  29648. function (cssText) {
  29649. return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);
  29650. };
  29651. /**
  29652. * @param {?} cssText
  29653. * @return {?}
  29654. */
  29655. ShadowCss.prototype._convertColonHostContext = /**
  29656. * @param {?} cssText
  29657. * @return {?}
  29658. */
  29659. function (cssText) {
  29660. return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer);
  29661. };
  29662. /**
  29663. * @param {?} cssText
  29664. * @param {?} regExp
  29665. * @param {?} partReplacer
  29666. * @return {?}
  29667. */
  29668. ShadowCss.prototype._convertColonRule = /**
  29669. * @param {?} cssText
  29670. * @param {?} regExp
  29671. * @param {?} partReplacer
  29672. * @return {?}
  29673. */
  29674. function (cssText, regExp, partReplacer) {
  29675. // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
  29676. return cssText.replace(regExp, function () {
  29677. var m = [];
  29678. for (var _i = 0; _i < arguments.length; _i++) {
  29679. m[_i] = arguments[_i];
  29680. }
  29681. if (m[2]) {
  29682. var /** @type {?} */ parts = m[2].split(',');
  29683. var /** @type {?} */ r = [];
  29684. for (var /** @type {?} */ i = 0; i < parts.length; i++) {
  29685. var /** @type {?} */ p = parts[i].trim();
  29686. if (!p)
  29687. break;
  29688. r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
  29689. }
  29690. return r.join(',');
  29691. }
  29692. else {
  29693. return _polyfillHostNoCombinator + m[3];
  29694. }
  29695. });
  29696. };
  29697. /**
  29698. * @param {?} host
  29699. * @param {?} part
  29700. * @param {?} suffix
  29701. * @return {?}
  29702. */
  29703. ShadowCss.prototype._colonHostContextPartReplacer = /**
  29704. * @param {?} host
  29705. * @param {?} part
  29706. * @param {?} suffix
  29707. * @return {?}
  29708. */
  29709. function (host, part, suffix) {
  29710. if (part.indexOf(_polyfillHost) > -1) {
  29711. return this._colonHostPartReplacer(host, part, suffix);
  29712. }
  29713. else {
  29714. return host + part + suffix + ', ' + part + ' ' + host + suffix;
  29715. }
  29716. };
  29717. /**
  29718. * @param {?} host
  29719. * @param {?} part
  29720. * @param {?} suffix
  29721. * @return {?}
  29722. */
  29723. ShadowCss.prototype._colonHostPartReplacer = /**
  29724. * @param {?} host
  29725. * @param {?} part
  29726. * @param {?} suffix
  29727. * @return {?}
  29728. */
  29729. function (host, part, suffix) {
  29730. return host + part.replace(_polyfillHost, '') + suffix;
  29731. };
  29732. /**
  29733. * @param {?} cssText
  29734. * @return {?}
  29735. */
  29736. ShadowCss.prototype._convertShadowDOMSelectors = /**
  29737. * @param {?} cssText
  29738. * @return {?}
  29739. */
  29740. function (cssText) {
  29741. return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText);
  29742. };
  29743. /**
  29744. * @param {?} cssText
  29745. * @param {?} scopeSelector
  29746. * @param {?} hostSelector
  29747. * @return {?}
  29748. */
  29749. ShadowCss.prototype._scopeSelectors = /**
  29750. * @param {?} cssText
  29751. * @param {?} scopeSelector
  29752. * @param {?} hostSelector
  29753. * @return {?}
  29754. */
  29755. function (cssText, scopeSelector, hostSelector) {
  29756. var _this = this;
  29757. return processRules(cssText, function (rule) {
  29758. var /** @type {?} */ selector = rule.selector;
  29759. var /** @type {?} */ content = rule.content;
  29760. if (rule.selector[0] != '@') {
  29761. selector =
  29762. _this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling);
  29763. }
  29764. else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
  29765. rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) {
  29766. content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector);
  29767. }
  29768. return new CssRule(selector, content);
  29769. });
  29770. };
  29771. /**
  29772. * @param {?} selector
  29773. * @param {?} scopeSelector
  29774. * @param {?} hostSelector
  29775. * @param {?} strict
  29776. * @return {?}
  29777. */
  29778. ShadowCss.prototype._scopeSelector = /**
  29779. * @param {?} selector
  29780. * @param {?} scopeSelector
  29781. * @param {?} hostSelector
  29782. * @param {?} strict
  29783. * @return {?}
  29784. */
  29785. function (selector, scopeSelector, hostSelector, strict) {
  29786. var _this = this;
  29787. return selector.split(',')
  29788. .map(function (part) { return part.trim().split(_shadowDeepSelectors); })
  29789. .map(function (deepParts) {
  29790. var shallowPart = deepParts[0], otherParts = deepParts.slice(1);
  29791. var /** @type {?} */ applyScope = function (shallowPart) {
  29792. if (_this._selectorNeedsScoping(shallowPart, scopeSelector)) {
  29793. return strict ?
  29794. _this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
  29795. _this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
  29796. }
  29797. else {
  29798. return shallowPart;
  29799. }
  29800. };
  29801. return [applyScope(shallowPart)].concat(otherParts).join(' ');
  29802. })
  29803. .join(', ');
  29804. };
  29805. /**
  29806. * @param {?} selector
  29807. * @param {?} scopeSelector
  29808. * @return {?}
  29809. */
  29810. ShadowCss.prototype._selectorNeedsScoping = /**
  29811. * @param {?} selector
  29812. * @param {?} scopeSelector
  29813. * @return {?}
  29814. */
  29815. function (selector, scopeSelector) {
  29816. var /** @type {?} */ re = this._makeScopeMatcher(scopeSelector);
  29817. return !re.test(selector);
  29818. };
  29819. /**
  29820. * @param {?} scopeSelector
  29821. * @return {?}
  29822. */
  29823. ShadowCss.prototype._makeScopeMatcher = /**
  29824. * @param {?} scopeSelector
  29825. * @return {?}
  29826. */
  29827. function (scopeSelector) {
  29828. var /** @type {?} */ lre = /\[/g;
  29829. var /** @type {?} */ rre = /\]/g;
  29830. scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
  29831. return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
  29832. };
  29833. /**
  29834. * @param {?} selector
  29835. * @param {?} scopeSelector
  29836. * @param {?} hostSelector
  29837. * @return {?}
  29838. */
  29839. ShadowCss.prototype._applySelectorScope = /**
  29840. * @param {?} selector
  29841. * @param {?} scopeSelector
  29842. * @param {?} hostSelector
  29843. * @return {?}
  29844. */
  29845. function (selector, scopeSelector, hostSelector) {
  29846. // Difference from webcomponents.js: scopeSelector could not be an array
  29847. return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
  29848. };
  29849. /**
  29850. * @param {?} selector
  29851. * @param {?} scopeSelector
  29852. * @param {?} hostSelector
  29853. * @return {?}
  29854. */
  29855. ShadowCss.prototype._applySimpleSelectorScope = /**
  29856. * @param {?} selector
  29857. * @param {?} scopeSelector
  29858. * @param {?} hostSelector
  29859. * @return {?}
  29860. */
  29861. function (selector, scopeSelector, hostSelector) {
  29862. // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
  29863. _polyfillHostRe.lastIndex = 0;
  29864. if (_polyfillHostRe.test(selector)) {
  29865. var /** @type {?} */ replaceBy_1 = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector;
  29866. return selector
  29867. .replace(_polyfillHostNoCombinatorRe, function (hnc, selector) {
  29868. return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) {
  29869. return before + replaceBy_1 + colon + after;
  29870. });
  29871. })
  29872. .replace(_polyfillHostRe, replaceBy_1 + ' ');
  29873. }
  29874. return scopeSelector + ' ' + selector;
  29875. };
  29876. /**
  29877. * @param {?} selector
  29878. * @param {?} scopeSelector
  29879. * @param {?} hostSelector
  29880. * @return {?}
  29881. */
  29882. ShadowCss.prototype._applyStrictSelectorScope = /**
  29883. * @param {?} selector
  29884. * @param {?} scopeSelector
  29885. * @param {?} hostSelector
  29886. * @return {?}
  29887. */
  29888. function (selector, scopeSelector, hostSelector) {
  29889. var _this = this;
  29890. var /** @type {?} */ isRe = /\[is=([^\]]*)\]/g;
  29891. scopeSelector = scopeSelector.replace(isRe, function (_) {
  29892. var parts = [];
  29893. for (var _i = 1; _i < arguments.length; _i++) {
  29894. parts[_i - 1] = arguments[_i];
  29895. }
  29896. return parts[0];
  29897. });
  29898. var /** @type {?} */ attrName = '[' + scopeSelector + ']';
  29899. var /** @type {?} */ _scopeSelectorPart = function (p) {
  29900. var /** @type {?} */ scopedP = p.trim();
  29901. if (!scopedP) {
  29902. return '';
  29903. }
  29904. if (p.indexOf(_polyfillHostNoCombinator) > -1) {
  29905. scopedP = _this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
  29906. }
  29907. else {
  29908. // remove :host since it should be unnecessary
  29909. var /** @type {?} */ t = p.replace(_polyfillHostRe, '');
  29910. if (t.length > 0) {
  29911. var /** @type {?} */ matches = t.match(/([^:]*)(:*)(.*)/);
  29912. if (matches) {
  29913. scopedP = matches[1] + attrName + matches[2] + matches[3];
  29914. }
  29915. }
  29916. }
  29917. return scopedP;
  29918. };
  29919. var /** @type {?} */ safeContent = new SafeSelector(selector);
  29920. selector = safeContent.content();
  29921. var /** @type {?} */ scopedSelector = '';
  29922. var /** @type {?} */ startIndex = 0;
  29923. var /** @type {?} */ res;
  29924. var /** @type {?} */ sep = /( |>|\+|~(?!=))\s*/g;
  29925. // If a selector appears before :host it should not be shimmed as it
  29926. // matches on ancestor elements and not on elements in the host's shadow
  29927. // `:host-context(div)` is transformed to
  29928. // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
  29929. // the `div` is not part of the component in the 2nd selectors and should not be scoped.
  29930. // Historically `component-tag:host` was matching the component so we also want to preserve
  29931. // this behavior to avoid breaking legacy apps (it should not match).
  29932. // The behavior should be:
  29933. // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
  29934. // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
  29935. // `:host-context(tag)`)
  29936. var /** @type {?} */ hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
  29937. // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
  29938. var /** @type {?} */ shouldScope = !hasHost;
  29939. while ((res = sep.exec(selector)) !== null) {
  29940. var /** @type {?} */ separator = res[1];
  29941. var /** @type {?} */ part_1 = selector.slice(startIndex, res.index).trim();
  29942. shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1;
  29943. var /** @type {?} */ scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1;
  29944. scopedSelector += scopedPart + " " + separator + " ";
  29945. startIndex = sep.lastIndex;
  29946. }
  29947. var /** @type {?} */ part = selector.substring(startIndex);
  29948. shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
  29949. scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
  29950. // replace the placeholders with their original values
  29951. return safeContent.restore(scopedSelector);
  29952. };
  29953. /**
  29954. * @param {?} selector
  29955. * @return {?}
  29956. */
  29957. ShadowCss.prototype._insertPolyfillHostInCssText = /**
  29958. * @param {?} selector
  29959. * @return {?}
  29960. */
  29961. function (selector) {
  29962. return selector.replace(_colonHostContextRe, _polyfillHostContext)
  29963. .replace(_colonHostRe, _polyfillHost);
  29964. };
  29965. return ShadowCss;
  29966. }());
  29967. var SafeSelector = /** @class */ (function () {
  29968. function SafeSelector(selector) {
  29969. var _this = this;
  29970. this.placeholders = [];
  29971. this.index = 0;
  29972. // Replaces attribute selectors with placeholders.
  29973. // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
  29974. selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) {
  29975. var /** @type {?} */ replaceBy = "__ph-" + _this.index + "__";
  29976. _this.placeholders.push(keep);
  29977. _this.index++;
  29978. return replaceBy;
  29979. });
  29980. // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
  29981. // WS and "+" would otherwise be interpreted as selector separators.
  29982. this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) {
  29983. var /** @type {?} */ replaceBy = "__ph-" + _this.index + "__";
  29984. _this.placeholders.push(exp);
  29985. _this.index++;
  29986. return pseudo + replaceBy;
  29987. });
  29988. }
  29989. /**
  29990. * @param {?} content
  29991. * @return {?}
  29992. */
  29993. SafeSelector.prototype.restore = /**
  29994. * @param {?} content
  29995. * @return {?}
  29996. */
  29997. function (content) {
  29998. var _this = this;
  29999. return content.replace(/__ph-(\d+)__/g, function (ph, index) { return _this.placeholders[+index]; });
  30000. };
  30001. /**
  30002. * @return {?}
  30003. */
  30004. SafeSelector.prototype.content = /**
  30005. * @return {?}
  30006. */
  30007. function () { return this._content; };
  30008. return SafeSelector;
  30009. }());
  30010. var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
  30011. var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
  30012. var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
  30013. var _polyfillHost = '-shadowcsshost';
  30014. // note: :host-context pre-processed to -shadowcsshostcontext.
  30015. var _polyfillHostContext = '-shadowcsscontext';
  30016. var _parenSuffix = ')(?:\\((' +
  30017. '(?:\\([^)(]*\\)|[^)(]*)+?' +
  30018. ')\\))?([^,{]*)';
  30019. var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
  30020. var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
  30021. var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
  30022. var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
  30023. var _shadowDOMSelectorsRe = [
  30024. /::shadow/g,
  30025. /::content/g,
  30026. /\/shadow-deep\//g,
  30027. /\/shadow\//g,
  30028. ];
  30029. // The deep combinator is deprecated in the CSS spec
  30030. // Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.
  30031. // see https://github.com/angular/angular/pull/17677
  30032. var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g;
  30033. var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$';
  30034. var _polyfillHostRe = /-shadowcsshost/gim;
  30035. var _colonHostRe = /:host/gim;
  30036. var _colonHostContextRe = /:host-context/gim;
  30037. var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
  30038. /**
  30039. * @param {?} input
  30040. * @return {?}
  30041. */
  30042. function stripComments(input) {
  30043. return input.replace(_commentRe, '');
  30044. }
  30045. var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
  30046. /**
  30047. * @param {?} input
  30048. * @return {?}
  30049. */
  30050. function extractCommentsWithHash(input) {
  30051. return input.match(_commentWithHashRe) || [];
  30052. }
  30053. var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
  30054. var _curlyRe = /([{}])/g;
  30055. var OPEN_CURLY = '{';
  30056. var CLOSE_CURLY = '}';
  30057. var BLOCK_PLACEHOLDER = '%BLOCK%';
  30058. var CssRule = /** @class */ (function () {
  30059. function CssRule(selector, content) {
  30060. this.selector = selector;
  30061. this.content = content;
  30062. }
  30063. return CssRule;
  30064. }());
  30065. /**
  30066. * @param {?} input
  30067. * @param {?} ruleCallback
  30068. * @return {?}
  30069. */
  30070. function processRules(input, ruleCallback) {
  30071. var /** @type {?} */ inputWithEscapedBlocks = escapeBlocks(input);
  30072. var /** @type {?} */ nextBlockIndex = 0;
  30073. return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () {
  30074. var m = [];
  30075. for (var _i = 0; _i < arguments.length; _i++) {
  30076. m[_i] = arguments[_i];
  30077. }
  30078. var /** @type {?} */ selector = m[2];
  30079. var /** @type {?} */ content = '';
  30080. var /** @type {?} */ suffix = m[4];
  30081. var /** @type {?} */ contentPrefix = '';
  30082. if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
  30083. content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
  30084. suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
  30085. contentPrefix = '{';
  30086. }
  30087. var /** @type {?} */ rule = ruleCallback(new CssRule(selector, content));
  30088. return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;
  30089. });
  30090. }
  30091. var StringWithEscapedBlocks = /** @class */ (function () {
  30092. function StringWithEscapedBlocks(escapedString, blocks) {
  30093. this.escapedString = escapedString;
  30094. this.blocks = blocks;
  30095. }
  30096. return StringWithEscapedBlocks;
  30097. }());
  30098. /**
  30099. * @param {?} input
  30100. * @return {?}
  30101. */
  30102. function escapeBlocks(input) {
  30103. var /** @type {?} */ inputParts = input.split(_curlyRe);
  30104. var /** @type {?} */ resultParts = [];
  30105. var /** @type {?} */ escapedBlocks = [];
  30106. var /** @type {?} */ bracketCount = 0;
  30107. var /** @type {?} */ currentBlockParts = [];
  30108. for (var /** @type {?} */ partIndex = 0; partIndex < inputParts.length; partIndex++) {
  30109. var /** @type {?} */ part = inputParts[partIndex];
  30110. if (part == CLOSE_CURLY) {
  30111. bracketCount--;
  30112. }
  30113. if (bracketCount > 0) {
  30114. currentBlockParts.push(part);
  30115. }
  30116. else {
  30117. if (currentBlockParts.length > 0) {
  30118. escapedBlocks.push(currentBlockParts.join(''));
  30119. resultParts.push(BLOCK_PLACEHOLDER);
  30120. currentBlockParts = [];
  30121. }
  30122. resultParts.push(part);
  30123. }
  30124. if (part == OPEN_CURLY) {
  30125. bracketCount++;
  30126. }
  30127. }
  30128. if (currentBlockParts.length > 0) {
  30129. escapedBlocks.push(currentBlockParts.join(''));
  30130. resultParts.push(BLOCK_PLACEHOLDER);
  30131. }
  30132. return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
  30133. }
  30134. /**
  30135. * @fileoverview added by tsickle
  30136. * @suppress {checkTypes} checked by tsc
  30137. */
  30138. /**
  30139. * @license
  30140. * Copyright Google Inc. All Rights Reserved.
  30141. *
  30142. * Use of this source code is governed by an MIT-style license that can be
  30143. * found in the LICENSE file at https://angular.io/license
  30144. */
  30145. var COMPONENT_VARIABLE = '%COMP%';
  30146. var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
  30147. var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
  30148. var StylesCompileDependency = /** @class */ (function () {
  30149. function StylesCompileDependency(name, moduleUrl, setValue) {
  30150. this.name = name;
  30151. this.moduleUrl = moduleUrl;
  30152. this.setValue = setValue;
  30153. }
  30154. return StylesCompileDependency;
  30155. }());
  30156. var CompiledStylesheet = /** @class */ (function () {
  30157. function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) {
  30158. this.outputCtx = outputCtx;
  30159. this.stylesVar = stylesVar;
  30160. this.dependencies = dependencies;
  30161. this.isShimmed = isShimmed;
  30162. this.meta = meta;
  30163. }
  30164. return CompiledStylesheet;
  30165. }());
  30166. var StyleCompiler = /** @class */ (function () {
  30167. function StyleCompiler(_urlResolver) {
  30168. this._urlResolver = _urlResolver;
  30169. this._shadowCss = new ShadowCss();
  30170. }
  30171. /**
  30172. * @param {?} outputCtx
  30173. * @param {?} comp
  30174. * @return {?}
  30175. */
  30176. StyleCompiler.prototype.compileComponent = /**
  30177. * @param {?} outputCtx
  30178. * @param {?} comp
  30179. * @return {?}
  30180. */
  30181. function (outputCtx, comp) {
  30182. var /** @type {?} */ template = /** @type {?} */ ((comp.template));
  30183. return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({
  30184. styles: template.styles,
  30185. styleUrls: template.styleUrls,
  30186. moduleUrl: identifierModuleUrl(comp.type)
  30187. }), this.needsStyleShim(comp), true);
  30188. };
  30189. /**
  30190. * @param {?} outputCtx
  30191. * @param {?} comp
  30192. * @param {?} stylesheet
  30193. * @param {?=} shim
  30194. * @return {?}
  30195. */
  30196. StyleCompiler.prototype.compileStyles = /**
  30197. * @param {?} outputCtx
  30198. * @param {?} comp
  30199. * @param {?} stylesheet
  30200. * @param {?=} shim
  30201. * @return {?}
  30202. */
  30203. function (outputCtx, comp, stylesheet, shim) {
  30204. if (shim === void 0) { shim = this.needsStyleShim(comp); }
  30205. return this._compileStyles(outputCtx, comp, stylesheet, shim, false);
  30206. };
  30207. /**
  30208. * @param {?} comp
  30209. * @return {?}
  30210. */
  30211. StyleCompiler.prototype.needsStyleShim = /**
  30212. * @param {?} comp
  30213. * @return {?}
  30214. */
  30215. function (comp) {
  30216. return /** @type {?} */ ((comp.template)).encapsulation === ViewEncapsulation.Emulated;
  30217. };
  30218. /**
  30219. * @param {?} outputCtx
  30220. * @param {?} comp
  30221. * @param {?} stylesheet
  30222. * @param {?} shim
  30223. * @param {?} isComponentStylesheet
  30224. * @return {?}
  30225. */
  30226. StyleCompiler.prototype._compileStyles = /**
  30227. * @param {?} outputCtx
  30228. * @param {?} comp
  30229. * @param {?} stylesheet
  30230. * @param {?} shim
  30231. * @param {?} isComponentStylesheet
  30232. * @return {?}
  30233. */
  30234. function (outputCtx, comp, stylesheet, shim, isComponentStylesheet) {
  30235. var _this = this;
  30236. var /** @type {?} */ styleExpressions = stylesheet.styles.map(function (plainStyle) { return literal(_this._shimIfNeeded(plainStyle, shim)); });
  30237. var /** @type {?} */ dependencies = [];
  30238. stylesheet.styleUrls.forEach(function (styleUrl) {
  30239. var /** @type {?} */ exprIndex = styleExpressions.length;
  30240. // Note: This placeholder will be filled later.
  30241. styleExpressions.push(/** @type {?} */ ((null)));
  30242. dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); }));
  30243. });
  30244. // styles variable contains plain strings and arrays of other styles arrays (recursive),
  30245. // so we set its type to dynamic.
  30246. var /** @type {?} */ stylesVar = getStylesVarName(isComponentStylesheet ? comp : null);
  30247. var /** @type {?} */ stmt = variable(stylesVar)
  30248. .set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const])))
  30249. .toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [
  30250. StmtModifier.Final, StmtModifier.Exported
  30251. ]);
  30252. outputCtx.statements.push(stmt);
  30253. return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet);
  30254. };
  30255. /**
  30256. * @param {?} style
  30257. * @param {?} shim
  30258. * @return {?}
  30259. */
  30260. StyleCompiler.prototype._shimIfNeeded = /**
  30261. * @param {?} style
  30262. * @param {?} shim
  30263. * @return {?}
  30264. */
  30265. function (style, shim) {
  30266. return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style;
  30267. };
  30268. return StyleCompiler;
  30269. }());
  30270. /**
  30271. * @param {?} component
  30272. * @return {?}
  30273. */
  30274. function getStylesVarName(component) {
  30275. var /** @type {?} */ result = "styles";
  30276. if (component) {
  30277. result += "_" + identifierName(component.type);
  30278. }
  30279. return result;
  30280. }
  30281. /**
  30282. * @fileoverview added by tsickle
  30283. * @suppress {checkTypes} checked by tsc
  30284. */
  30285. /**
  30286. * @license
  30287. * Copyright Google Inc. All Rights Reserved.
  30288. *
  30289. * Use of this source code is governed by an MIT-style license that can be
  30290. * found in the LICENSE file at https://angular.io/license
  30291. */
  30292. var PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces';
  30293. var SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']);
  30294. // Equivalent to \s with \u00a0 (non-breaking space) excluded.
  30295. // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
  30296. var WS_CHARS = ' \f\n\r\t\v\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff';
  30297. var NO_WS_REGEXP = new RegExp("[^" + WS_CHARS + "]");
  30298. var WS_REPLACE_REGEXP = new RegExp("[" + WS_CHARS + "]{2,}", 'g');
  30299. /**
  30300. * @param {?} attrs
  30301. * @return {?}
  30302. */
  30303. function hasPreserveWhitespacesAttr(attrs) {
  30304. return attrs.some(function (attr) { return attr.name === PRESERVE_WS_ATTR_NAME; });
  30305. }
  30306. /**
  30307. * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see:
  30308. * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32
  30309. * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character
  30310. * and later on replaced by a space. We are re-implementing the same idea here.
  30311. * @param {?} value
  30312. * @return {?}
  30313. */
  30314. function replaceNgsp(value) {
  30315. // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE
  30316. return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' ');
  30317. }
  30318. /**
  30319. * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules:
  30320. * - consider spaces, tabs and new lines as whitespace characters;
  30321. * - drop text nodes consisting of whitespace characters only;
  30322. * - for all other text nodes replace consecutive whitespace characters with one space;
  30323. * - convert &ngsp; pseudo-entity to a single space;
  30324. *
  30325. * Removal and trimming of whitespaces have positive performance impact (less code to generate
  30326. * while compiling templates, faster view creation). At the same time it can be "destructive"
  30327. * in some cases (whitespaces can influence layout). Because of the potential of breaking layout
  30328. * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for
  30329. * whitespace removal. The default option for whitespace removal will be revisited in Angular 6
  30330. * and might be changed to "on" by default.
  30331. */
  30332. var WhitespaceVisitor = /** @class */ (function () {
  30333. function WhitespaceVisitor() {
  30334. }
  30335. /**
  30336. * @param {?} element
  30337. * @param {?} context
  30338. * @return {?}
  30339. */
  30340. WhitespaceVisitor.prototype.visitElement = /**
  30341. * @param {?} element
  30342. * @param {?} context
  30343. * @return {?}
  30344. */
  30345. function (element, context) {
  30346. if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
  30347. // don't descent into elements where we need to preserve whitespaces
  30348. // but still visit all attributes to eliminate one used as a market to preserve WS
  30349. return new Element(element.name, visitAll(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  30350. }
  30351. return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  30352. };
  30353. /**
  30354. * @param {?} attribute
  30355. * @param {?} context
  30356. * @return {?}
  30357. */
  30358. WhitespaceVisitor.prototype.visitAttribute = /**
  30359. * @param {?} attribute
  30360. * @param {?} context
  30361. * @return {?}
  30362. */
  30363. function (attribute, context) {
  30364. return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;
  30365. };
  30366. /**
  30367. * @param {?} text
  30368. * @param {?} context
  30369. * @return {?}
  30370. */
  30371. WhitespaceVisitor.prototype.visitText = /**
  30372. * @param {?} text
  30373. * @param {?} context
  30374. * @return {?}
  30375. */
  30376. function (text, context) {
  30377. var /** @type {?} */ isNotBlank = text.value.match(NO_WS_REGEXP);
  30378. if (isNotBlank) {
  30379. return new Text(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan);
  30380. }
  30381. return null;
  30382. };
  30383. /**
  30384. * @param {?} comment
  30385. * @param {?} context
  30386. * @return {?}
  30387. */
  30388. WhitespaceVisitor.prototype.visitComment = /**
  30389. * @param {?} comment
  30390. * @param {?} context
  30391. * @return {?}
  30392. */
  30393. function (comment, context) { return comment; };
  30394. /**
  30395. * @param {?} expansion
  30396. * @param {?} context
  30397. * @return {?}
  30398. */
  30399. WhitespaceVisitor.prototype.visitExpansion = /**
  30400. * @param {?} expansion
  30401. * @param {?} context
  30402. * @return {?}
  30403. */
  30404. function (expansion, context) { return expansion; };
  30405. /**
  30406. * @param {?} expansionCase
  30407. * @param {?} context
  30408. * @return {?}
  30409. */
  30410. WhitespaceVisitor.prototype.visitExpansionCase = /**
  30411. * @param {?} expansionCase
  30412. * @param {?} context
  30413. * @return {?}
  30414. */
  30415. function (expansionCase, context) { return expansionCase; };
  30416. return WhitespaceVisitor;
  30417. }());
  30418. /**
  30419. * @param {?} htmlAstWithErrors
  30420. * @return {?}
  30421. */
  30422. function removeWhitespaces(htmlAstWithErrors) {
  30423. return new ParseTreeResult(visitAll(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
  30424. }
  30425. /**
  30426. * @fileoverview added by tsickle
  30427. * @suppress {checkTypes} checked by tsc
  30428. */
  30429. /**
  30430. * @license
  30431. * Copyright Google Inc. All Rights Reserved.
  30432. *
  30433. * Use of this source code is governed by an MIT-style license that can be
  30434. * found in the LICENSE file at https://angular.io/license
  30435. */
  30436. // http://cldr.unicode.org/index/cldr-spec/plural-rules
  30437. var PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other'];
  30438. /**
  30439. * Expands special forms into elements.
  30440. *
  30441. * For example,
  30442. *
  30443. * ```
  30444. * { messages.length, plural,
  30445. * =0 {zero}
  30446. * =1 {one}
  30447. * other {more than one}
  30448. * }
  30449. * ```
  30450. *
  30451. * will be expanded into
  30452. *
  30453. * ```
  30454. * <ng-container [ngPlural]="messages.length">
  30455. * <ng-template ngPluralCase="=0">zero</ng-template>
  30456. * <ng-template ngPluralCase="=1">one</ng-template>
  30457. * <ng-template ngPluralCase="other">more than one</ng-template>
  30458. * </ng-container>
  30459. * ```
  30460. * @param {?} nodes
  30461. * @return {?}
  30462. */
  30463. function expandNodes(nodes) {
  30464. var /** @type {?} */ expander = new _Expander();
  30465. return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors);
  30466. }
  30467. var ExpansionResult = /** @class */ (function () {
  30468. function ExpansionResult(nodes, expanded, errors) {
  30469. this.nodes = nodes;
  30470. this.expanded = expanded;
  30471. this.errors = errors;
  30472. }
  30473. return ExpansionResult;
  30474. }());
  30475. var ExpansionError = /** @class */ (function (_super) {
  30476. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpansionError, _super);
  30477. function ExpansionError(span, errorMsg) {
  30478. return _super.call(this, span, errorMsg) || this;
  30479. }
  30480. return ExpansionError;
  30481. }(ParseError));
  30482. /**
  30483. * Expand expansion forms (plural, select) to directives
  30484. *
  30485. * \@internal
  30486. */
  30487. var _Expander = /** @class */ (function () {
  30488. function _Expander() {
  30489. this.isExpanded = false;
  30490. this.errors = [];
  30491. }
  30492. /**
  30493. * @param {?} element
  30494. * @param {?} context
  30495. * @return {?}
  30496. */
  30497. _Expander.prototype.visitElement = /**
  30498. * @param {?} element
  30499. * @param {?} context
  30500. * @return {?}
  30501. */
  30502. function (element, context) {
  30503. return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  30504. };
  30505. /**
  30506. * @param {?} attribute
  30507. * @param {?} context
  30508. * @return {?}
  30509. */
  30510. _Expander.prototype.visitAttribute = /**
  30511. * @param {?} attribute
  30512. * @param {?} context
  30513. * @return {?}
  30514. */
  30515. function (attribute, context) { return attribute; };
  30516. /**
  30517. * @param {?} text
  30518. * @param {?} context
  30519. * @return {?}
  30520. */
  30521. _Expander.prototype.visitText = /**
  30522. * @param {?} text
  30523. * @param {?} context
  30524. * @return {?}
  30525. */
  30526. function (text, context) { return text; };
  30527. /**
  30528. * @param {?} comment
  30529. * @param {?} context
  30530. * @return {?}
  30531. */
  30532. _Expander.prototype.visitComment = /**
  30533. * @param {?} comment
  30534. * @param {?} context
  30535. * @return {?}
  30536. */
  30537. function (comment, context) { return comment; };
  30538. /**
  30539. * @param {?} icu
  30540. * @param {?} context
  30541. * @return {?}
  30542. */
  30543. _Expander.prototype.visitExpansion = /**
  30544. * @param {?} icu
  30545. * @param {?} context
  30546. * @return {?}
  30547. */
  30548. function (icu, context) {
  30549. this.isExpanded = true;
  30550. return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) :
  30551. _expandDefaultForm(icu, this.errors);
  30552. };
  30553. /**
  30554. * @param {?} icuCase
  30555. * @param {?} context
  30556. * @return {?}
  30557. */
  30558. _Expander.prototype.visitExpansionCase = /**
  30559. * @param {?} icuCase
  30560. * @param {?} context
  30561. * @return {?}
  30562. */
  30563. function (icuCase, context) {
  30564. throw new Error('Should not be reached');
  30565. };
  30566. return _Expander;
  30567. }());
  30568. /**
  30569. * @param {?} ast
  30570. * @param {?} errors
  30571. * @return {?}
  30572. */
  30573. function _expandPluralForm(ast, errors) {
  30574. var /** @type {?} */ children = ast.cases.map(function (c) {
  30575. if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) {
  30576. errors.push(new ExpansionError(c.valueSourceSpan, "Plural cases should be \"=<number>\" or one of " + PLURAL_CASES.join(", ")));
  30577. }
  30578. var /** @type {?} */ expansionResult = expandNodes(c.expression);
  30579. errors.push.apply(errors, expansionResult.errors);
  30580. return new Element("ng-template", [new Attribute$1('ngPluralCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
  30581. });
  30582. var /** @type {?} */ switchAttr = new Attribute$1('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan);
  30583. return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
  30584. }
  30585. /**
  30586. * @param {?} ast
  30587. * @param {?} errors
  30588. * @return {?}
  30589. */
  30590. function _expandDefaultForm(ast, errors) {
  30591. var /** @type {?} */ children = ast.cases.map(function (c) {
  30592. var /** @type {?} */ expansionResult = expandNodes(c.expression);
  30593. errors.push.apply(errors, expansionResult.errors);
  30594. if (c.value === 'other') {
  30595. // other is the default case when no values match
  30596. return new Element("ng-template", [new Attribute$1('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
  30597. }
  30598. return new Element("ng-template", [new Attribute$1('ngSwitchCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
  30599. });
  30600. var /** @type {?} */ switchAttr = new Attribute$1('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan);
  30601. return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
  30602. }
  30603. /**
  30604. * @fileoverview added by tsickle
  30605. * @suppress {checkTypes} checked by tsc
  30606. */
  30607. /**
  30608. * @license
  30609. * Copyright Google Inc. All Rights Reserved.
  30610. *
  30611. * Use of this source code is governed by an MIT-style license that can be
  30612. * found in the LICENSE file at https://angular.io/license
  30613. */
  30614. var PROPERTY_PARTS_SEPARATOR = '.';
  30615. var ATTRIBUTE_PREFIX = 'attr';
  30616. var CLASS_PREFIX = 'class';
  30617. var STYLE_PREFIX = 'style';
  30618. var ANIMATE_PROP_PREFIX = 'animate-';
  30619. /** @enum {number} */
  30620. var BoundPropertyType = {
  30621. DEFAULT: 0,
  30622. LITERAL_ATTR: 1,
  30623. ANIMATION: 2,
  30624. };
  30625. BoundPropertyType[BoundPropertyType.DEFAULT] = "DEFAULT";
  30626. BoundPropertyType[BoundPropertyType.LITERAL_ATTR] = "LITERAL_ATTR";
  30627. BoundPropertyType[BoundPropertyType.ANIMATION] = "ANIMATION";
  30628. /**
  30629. * Represents a parsed property.
  30630. */
  30631. var BoundProperty = /** @class */ (function () {
  30632. function BoundProperty(name, expression, type, sourceSpan) {
  30633. this.name = name;
  30634. this.expression = expression;
  30635. this.type = type;
  30636. this.sourceSpan = sourceSpan;
  30637. this.isLiteral = this.type === BoundPropertyType.LITERAL_ATTR;
  30638. this.isAnimation = this.type === BoundPropertyType.ANIMATION;
  30639. }
  30640. return BoundProperty;
  30641. }());
  30642. /**
  30643. * Parses bindings in templates and in the directive host area.
  30644. */
  30645. var BindingParser = /** @class */ (function () {
  30646. function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, _targetErrors) {
  30647. var _this = this;
  30648. this._exprParser = _exprParser;
  30649. this._interpolationConfig = _interpolationConfig;
  30650. this._schemaRegistry = _schemaRegistry;
  30651. this._targetErrors = _targetErrors;
  30652. this.pipesByName = new Map();
  30653. this._usedPipes = new Map();
  30654. pipes.forEach(function (pipe) { return _this.pipesByName.set(pipe.name, pipe); });
  30655. }
  30656. /**
  30657. * @return {?}
  30658. */
  30659. BindingParser.prototype.getUsedPipes = /**
  30660. * @return {?}
  30661. */
  30662. function () { return Array.from(this._usedPipes.values()); };
  30663. /**
  30664. * @param {?} dirMeta
  30665. * @param {?} elementSelector
  30666. * @param {?} sourceSpan
  30667. * @return {?}
  30668. */
  30669. BindingParser.prototype.createDirectiveHostPropertyAsts = /**
  30670. * @param {?} dirMeta
  30671. * @param {?} elementSelector
  30672. * @param {?} sourceSpan
  30673. * @return {?}
  30674. */
  30675. function (dirMeta, elementSelector, sourceSpan) {
  30676. var _this = this;
  30677. if (dirMeta.hostProperties) {
  30678. var /** @type {?} */ boundProps_1 = [];
  30679. Object.keys(dirMeta.hostProperties).forEach(function (propName) {
  30680. var /** @type {?} */ expression = dirMeta.hostProperties[propName];
  30681. if (typeof expression === 'string') {
  30682. _this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps_1);
  30683. }
  30684. else {
  30685. _this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
  30686. }
  30687. });
  30688. return boundProps_1.map(function (prop) { return _this.createElementPropertyAst(elementSelector, prop); });
  30689. }
  30690. return null;
  30691. };
  30692. /**
  30693. * @param {?} dirMeta
  30694. * @param {?} sourceSpan
  30695. * @return {?}
  30696. */
  30697. BindingParser.prototype.createDirectiveHostEventAsts = /**
  30698. * @param {?} dirMeta
  30699. * @param {?} sourceSpan
  30700. * @return {?}
  30701. */
  30702. function (dirMeta, sourceSpan) {
  30703. var _this = this;
  30704. if (dirMeta.hostListeners) {
  30705. var /** @type {?} */ targetEventAsts_1 = [];
  30706. Object.keys(dirMeta.hostListeners).forEach(function (propName) {
  30707. var /** @type {?} */ expression = dirMeta.hostListeners[propName];
  30708. if (typeof expression === 'string') {
  30709. _this.parseEvent(propName, expression, sourceSpan, [], targetEventAsts_1);
  30710. }
  30711. else {
  30712. _this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
  30713. }
  30714. });
  30715. return targetEventAsts_1;
  30716. }
  30717. return null;
  30718. };
  30719. /**
  30720. * @param {?} value
  30721. * @param {?} sourceSpan
  30722. * @return {?}
  30723. */
  30724. BindingParser.prototype.parseInterpolation = /**
  30725. * @param {?} value
  30726. * @param {?} sourceSpan
  30727. * @return {?}
  30728. */
  30729. function (value, sourceSpan) {
  30730. var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
  30731. try {
  30732. var /** @type {?} */ ast = /** @type {?} */ ((this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig)));
  30733. if (ast)
  30734. this._reportExpressionParserErrors(ast.errors, sourceSpan);
  30735. this._checkPipes(ast, sourceSpan);
  30736. return ast;
  30737. }
  30738. catch (/** @type {?} */ e) {
  30739. this._reportError("" + e, sourceSpan);
  30740. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  30741. }
  30742. };
  30743. /**
  30744. * @param {?} prefixToken
  30745. * @param {?} value
  30746. * @param {?} sourceSpan
  30747. * @param {?} targetMatchableAttrs
  30748. * @param {?} targetProps
  30749. * @param {?} targetVars
  30750. * @return {?}
  30751. */
  30752. BindingParser.prototype.parseInlineTemplateBinding = /**
  30753. * @param {?} prefixToken
  30754. * @param {?} value
  30755. * @param {?} sourceSpan
  30756. * @param {?} targetMatchableAttrs
  30757. * @param {?} targetProps
  30758. * @param {?} targetVars
  30759. * @return {?}
  30760. */
  30761. function (prefixToken, value, sourceSpan, targetMatchableAttrs, targetProps, targetVars) {
  30762. var /** @type {?} */ bindings = this._parseTemplateBindings(prefixToken, value, sourceSpan);
  30763. for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
  30764. var /** @type {?} */ binding = bindings[i];
  30765. if (binding.keyIsVar) {
  30766. targetVars.push(new VariableAst(binding.key, binding.name, sourceSpan));
  30767. }
  30768. else if (binding.expression) {
  30769. this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps);
  30770. }
  30771. else {
  30772. targetMatchableAttrs.push([binding.key, '']);
  30773. this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps);
  30774. }
  30775. }
  30776. };
  30777. /**
  30778. * @param {?} prefixToken
  30779. * @param {?} value
  30780. * @param {?} sourceSpan
  30781. * @return {?}
  30782. */
  30783. BindingParser.prototype._parseTemplateBindings = /**
  30784. * @param {?} prefixToken
  30785. * @param {?} value
  30786. * @param {?} sourceSpan
  30787. * @return {?}
  30788. */
  30789. function (prefixToken, value, sourceSpan) {
  30790. var _this = this;
  30791. var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
  30792. try {
  30793. var /** @type {?} */ bindingsResult = this._exprParser.parseTemplateBindings(prefixToken, value, sourceInfo);
  30794. this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
  30795. bindingsResult.templateBindings.forEach(function (binding) {
  30796. if (binding.expression) {
  30797. _this._checkPipes(binding.expression, sourceSpan);
  30798. }
  30799. });
  30800. bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); });
  30801. return bindingsResult.templateBindings;
  30802. }
  30803. catch (/** @type {?} */ e) {
  30804. this._reportError("" + e, sourceSpan);
  30805. return [];
  30806. }
  30807. };
  30808. /**
  30809. * @param {?} name
  30810. * @param {?} value
  30811. * @param {?} sourceSpan
  30812. * @param {?} targetMatchableAttrs
  30813. * @param {?} targetProps
  30814. * @return {?}
  30815. */
  30816. BindingParser.prototype.parseLiteralAttr = /**
  30817. * @param {?} name
  30818. * @param {?} value
  30819. * @param {?} sourceSpan
  30820. * @param {?} targetMatchableAttrs
  30821. * @param {?} targetProps
  30822. * @return {?}
  30823. */
  30824. function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
  30825. if (_isAnimationLabel(name)) {
  30826. name = name.substring(1);
  30827. if (value) {
  30828. this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." +
  30829. " Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, ParseErrorLevel.ERROR);
  30830. }
  30831. this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps);
  30832. }
  30833. else {
  30834. targetProps.push(new BoundProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), BoundPropertyType.LITERAL_ATTR, sourceSpan));
  30835. }
  30836. };
  30837. /**
  30838. * @param {?} name
  30839. * @param {?} expression
  30840. * @param {?} isHost
  30841. * @param {?} sourceSpan
  30842. * @param {?} targetMatchableAttrs
  30843. * @param {?} targetProps
  30844. * @return {?}
  30845. */
  30846. BindingParser.prototype.parsePropertyBinding = /**
  30847. * @param {?} name
  30848. * @param {?} expression
  30849. * @param {?} isHost
  30850. * @param {?} sourceSpan
  30851. * @param {?} targetMatchableAttrs
  30852. * @param {?} targetProps
  30853. * @return {?}
  30854. */
  30855. function (name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) {
  30856. var /** @type {?} */ isAnimationProp = false;
  30857. if (name.startsWith(ANIMATE_PROP_PREFIX)) {
  30858. isAnimationProp = true;
  30859. name = name.substring(ANIMATE_PROP_PREFIX.length);
  30860. }
  30861. else if (_isAnimationLabel(name)) {
  30862. isAnimationProp = true;
  30863. name = name.substring(1);
  30864. }
  30865. if (isAnimationProp) {
  30866. this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps);
  30867. }
  30868. else {
  30869. this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps);
  30870. }
  30871. };
  30872. /**
  30873. * @param {?} name
  30874. * @param {?} value
  30875. * @param {?} sourceSpan
  30876. * @param {?} targetMatchableAttrs
  30877. * @param {?} targetProps
  30878. * @return {?}
  30879. */
  30880. BindingParser.prototype.parsePropertyInterpolation = /**
  30881. * @param {?} name
  30882. * @param {?} value
  30883. * @param {?} sourceSpan
  30884. * @param {?} targetMatchableAttrs
  30885. * @param {?} targetProps
  30886. * @return {?}
  30887. */
  30888. function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
  30889. var /** @type {?} */ expr = this.parseInterpolation(value, sourceSpan);
  30890. if (expr) {
  30891. this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps);
  30892. return true;
  30893. }
  30894. return false;
  30895. };
  30896. /**
  30897. * @param {?} name
  30898. * @param {?} ast
  30899. * @param {?} sourceSpan
  30900. * @param {?} targetMatchableAttrs
  30901. * @param {?} targetProps
  30902. * @return {?}
  30903. */
  30904. BindingParser.prototype._parsePropertyAst = /**
  30905. * @param {?} name
  30906. * @param {?} ast
  30907. * @param {?} sourceSpan
  30908. * @param {?} targetMatchableAttrs
  30909. * @param {?} targetProps
  30910. * @return {?}
  30911. */
  30912. function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) {
  30913. targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]);
  30914. targetProps.push(new BoundProperty(name, ast, BoundPropertyType.DEFAULT, sourceSpan));
  30915. };
  30916. /**
  30917. * @param {?} name
  30918. * @param {?} expression
  30919. * @param {?} sourceSpan
  30920. * @param {?} targetMatchableAttrs
  30921. * @param {?} targetProps
  30922. * @return {?}
  30923. */
  30924. BindingParser.prototype._parseAnimation = /**
  30925. * @param {?} name
  30926. * @param {?} expression
  30927. * @param {?} sourceSpan
  30928. * @param {?} targetMatchableAttrs
  30929. * @param {?} targetProps
  30930. * @return {?}
  30931. */
  30932. function (name, expression, sourceSpan, targetMatchableAttrs, targetProps) {
  30933. // This will occur when a @trigger is not paired with an expression.
  30934. // For animations it is valid to not have an expression since */void
  30935. // states will be applied by angular when the element is attached/detached
  30936. var /** @type {?} */ ast = this._parseBinding(expression || 'undefined', false, sourceSpan);
  30937. targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]);
  30938. targetProps.push(new BoundProperty(name, ast, BoundPropertyType.ANIMATION, sourceSpan));
  30939. };
  30940. /**
  30941. * @param {?} value
  30942. * @param {?} isHostBinding
  30943. * @param {?} sourceSpan
  30944. * @return {?}
  30945. */
  30946. BindingParser.prototype._parseBinding = /**
  30947. * @param {?} value
  30948. * @param {?} isHostBinding
  30949. * @param {?} sourceSpan
  30950. * @return {?}
  30951. */
  30952. function (value, isHostBinding, sourceSpan) {
  30953. var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
  30954. try {
  30955. var /** @type {?} */ ast = isHostBinding ?
  30956. this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) :
  30957. this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig);
  30958. if (ast)
  30959. this._reportExpressionParserErrors(ast.errors, sourceSpan);
  30960. this._checkPipes(ast, sourceSpan);
  30961. return ast;
  30962. }
  30963. catch (/** @type {?} */ e) {
  30964. this._reportError("" + e, sourceSpan);
  30965. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  30966. }
  30967. };
  30968. /**
  30969. * @param {?} elementSelector
  30970. * @param {?} boundProp
  30971. * @return {?}
  30972. */
  30973. BindingParser.prototype.createElementPropertyAst = /**
  30974. * @param {?} elementSelector
  30975. * @param {?} boundProp
  30976. * @return {?}
  30977. */
  30978. function (elementSelector, boundProp) {
  30979. if (boundProp.isAnimation) {
  30980. return new BoundElementPropertyAst(boundProp.name, PropertyBindingType.Animation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan);
  30981. }
  30982. var /** @type {?} */ unit = null;
  30983. var /** @type {?} */ bindingType = /** @type {?} */ ((undefined));
  30984. var /** @type {?} */ boundPropertyName = null;
  30985. var /** @type {?} */ parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
  30986. var /** @type {?} */ securityContexts = /** @type {?} */ ((undefined));
  30987. // Check check for special cases (prefix style, attr, class)
  30988. if (parts.length > 1) {
  30989. if (parts[0] == ATTRIBUTE_PREFIX) {
  30990. boundPropertyName = parts[1];
  30991. this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
  30992. securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
  30993. var /** @type {?} */ nsSeparatorIdx = boundPropertyName.indexOf(':');
  30994. if (nsSeparatorIdx > -1) {
  30995. var /** @type {?} */ ns = boundPropertyName.substring(0, nsSeparatorIdx);
  30996. var /** @type {?} */ name_1 = boundPropertyName.substring(nsSeparatorIdx + 1);
  30997. boundPropertyName = mergeNsAndName(ns, name_1);
  30998. }
  30999. bindingType = PropertyBindingType.Attribute;
  31000. }
  31001. else if (parts[0] == CLASS_PREFIX) {
  31002. boundPropertyName = parts[1];
  31003. bindingType = PropertyBindingType.Class;
  31004. securityContexts = [SecurityContext.NONE];
  31005. }
  31006. else if (parts[0] == STYLE_PREFIX) {
  31007. unit = parts.length > 2 ? parts[2] : null;
  31008. boundPropertyName = parts[1];
  31009. bindingType = PropertyBindingType.Style;
  31010. securityContexts = [SecurityContext.STYLE];
  31011. }
  31012. }
  31013. // If not a special case, use the full property name
  31014. if (boundPropertyName === null) {
  31015. boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
  31016. securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false);
  31017. bindingType = PropertyBindingType.Property;
  31018. this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
  31019. }
  31020. return new BoundElementPropertyAst(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan);
  31021. };
  31022. /**
  31023. * @param {?} name
  31024. * @param {?} expression
  31025. * @param {?} sourceSpan
  31026. * @param {?} targetMatchableAttrs
  31027. * @param {?} targetEvents
  31028. * @return {?}
  31029. */
  31030. BindingParser.prototype.parseEvent = /**
  31031. * @param {?} name
  31032. * @param {?} expression
  31033. * @param {?} sourceSpan
  31034. * @param {?} targetMatchableAttrs
  31035. * @param {?} targetEvents
  31036. * @return {?}
  31037. */
  31038. function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
  31039. if (_isAnimationLabel(name)) {
  31040. name = name.substr(1);
  31041. this._parseAnimationEvent(name, expression, sourceSpan, targetEvents);
  31042. }
  31043. else {
  31044. this._parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents);
  31045. }
  31046. };
  31047. /**
  31048. * @param {?} name
  31049. * @param {?} expression
  31050. * @param {?} sourceSpan
  31051. * @param {?} targetEvents
  31052. * @return {?}
  31053. */
  31054. BindingParser.prototype._parseAnimationEvent = /**
  31055. * @param {?} name
  31056. * @param {?} expression
  31057. * @param {?} sourceSpan
  31058. * @param {?} targetEvents
  31059. * @return {?}
  31060. */
  31061. function (name, expression, sourceSpan, targetEvents) {
  31062. var /** @type {?} */ matches = splitAtPeriod(name, [name, '']);
  31063. var /** @type {?} */ eventName = matches[0];
  31064. var /** @type {?} */ phase = matches[1].toLowerCase();
  31065. if (phase) {
  31066. switch (phase) {
  31067. case 'start':
  31068. case 'done':
  31069. var /** @type {?} */ ast = this._parseAction(expression, sourceSpan);
  31070. targetEvents.push(new BoundEventAst(eventName, null, phase, ast, sourceSpan));
  31071. break;
  31072. default:
  31073. this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan);
  31074. break;
  31075. }
  31076. }
  31077. else {
  31078. this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan);
  31079. }
  31080. };
  31081. /**
  31082. * @param {?} name
  31083. * @param {?} expression
  31084. * @param {?} sourceSpan
  31085. * @param {?} targetMatchableAttrs
  31086. * @param {?} targetEvents
  31087. * @return {?}
  31088. */
  31089. BindingParser.prototype._parseEvent = /**
  31090. * @param {?} name
  31091. * @param {?} expression
  31092. * @param {?} sourceSpan
  31093. * @param {?} targetMatchableAttrs
  31094. * @param {?} targetEvents
  31095. * @return {?}
  31096. */
  31097. function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
  31098. // long format: 'target: eventName'
  31099. var _a = splitAtColon(name, [/** @type {?} */ ((null)), name]), target = _a[0], eventName = _a[1];
  31100. var /** @type {?} */ ast = this._parseAction(expression, sourceSpan);
  31101. targetMatchableAttrs.push([/** @type {?} */ ((name)), /** @type {?} */ ((ast.source))]);
  31102. targetEvents.push(new BoundEventAst(eventName, target, null, ast, sourceSpan));
  31103. // Don't detect directives for event names for now,
  31104. // so don't add the event name to the matchableAttrs
  31105. };
  31106. /**
  31107. * @param {?} value
  31108. * @param {?} sourceSpan
  31109. * @return {?}
  31110. */
  31111. BindingParser.prototype._parseAction = /**
  31112. * @param {?} value
  31113. * @param {?} sourceSpan
  31114. * @return {?}
  31115. */
  31116. function (value, sourceSpan) {
  31117. var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
  31118. try {
  31119. var /** @type {?} */ ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig);
  31120. if (ast) {
  31121. this._reportExpressionParserErrors(ast.errors, sourceSpan);
  31122. }
  31123. if (!ast || ast.ast instanceof EmptyExpr) {
  31124. this._reportError("Empty expressions are not allowed", sourceSpan);
  31125. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  31126. }
  31127. this._checkPipes(ast, sourceSpan);
  31128. return ast;
  31129. }
  31130. catch (/** @type {?} */ e) {
  31131. this._reportError("" + e, sourceSpan);
  31132. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  31133. }
  31134. };
  31135. /**
  31136. * @param {?} message
  31137. * @param {?} sourceSpan
  31138. * @param {?=} level
  31139. * @return {?}
  31140. */
  31141. BindingParser.prototype._reportError = /**
  31142. * @param {?} message
  31143. * @param {?} sourceSpan
  31144. * @param {?=} level
  31145. * @return {?}
  31146. */
  31147. function (message, sourceSpan, level) {
  31148. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  31149. this._targetErrors.push(new ParseError(sourceSpan, message, level));
  31150. };
  31151. /**
  31152. * @param {?} errors
  31153. * @param {?} sourceSpan
  31154. * @return {?}
  31155. */
  31156. BindingParser.prototype._reportExpressionParserErrors = /**
  31157. * @param {?} errors
  31158. * @param {?} sourceSpan
  31159. * @return {?}
  31160. */
  31161. function (errors, sourceSpan) {
  31162. for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
  31163. var error = errors_1[_i];
  31164. this._reportError(error.message, sourceSpan);
  31165. }
  31166. };
  31167. /**
  31168. * @param {?} ast
  31169. * @param {?} sourceSpan
  31170. * @return {?}
  31171. */
  31172. BindingParser.prototype._checkPipes = /**
  31173. * @param {?} ast
  31174. * @param {?} sourceSpan
  31175. * @return {?}
  31176. */
  31177. function (ast, sourceSpan) {
  31178. var _this = this;
  31179. if (ast) {
  31180. var /** @type {?} */ collector = new PipeCollector();
  31181. ast.visit(collector);
  31182. collector.pipes.forEach(function (ast, pipeName) {
  31183. var /** @type {?} */ pipeMeta = _this.pipesByName.get(pipeName);
  31184. if (!pipeMeta) {
  31185. _this._reportError("The pipe '" + pipeName + "' could not be found", new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end)));
  31186. }
  31187. else {
  31188. _this._usedPipes.set(pipeName, pipeMeta);
  31189. }
  31190. });
  31191. }
  31192. };
  31193. /**
  31194. * @param {?} propName the name of the property / attribute
  31195. * @param {?} sourceSpan
  31196. * @param {?} isAttr true when binding to an attribute
  31197. * @return {?}
  31198. */
  31199. BindingParser.prototype._validatePropertyOrAttributeName = /**
  31200. * @param {?} propName the name of the property / attribute
  31201. * @param {?} sourceSpan
  31202. * @param {?} isAttr true when binding to an attribute
  31203. * @return {?}
  31204. */
  31205. function (propName, sourceSpan, isAttr) {
  31206. var /** @type {?} */ report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
  31207. this._schemaRegistry.validateProperty(propName);
  31208. if (report.error) {
  31209. this._reportError(/** @type {?} */ ((report.msg)), sourceSpan, ParseErrorLevel.ERROR);
  31210. }
  31211. };
  31212. return BindingParser;
  31213. }());
  31214. var PipeCollector = /** @class */ (function (_super) {
  31215. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PipeCollector, _super);
  31216. function PipeCollector() {
  31217. var _this = _super !== null && _super.apply(this, arguments) || this;
  31218. _this.pipes = new Map();
  31219. return _this;
  31220. }
  31221. /**
  31222. * @param {?} ast
  31223. * @param {?} context
  31224. * @return {?}
  31225. */
  31226. PipeCollector.prototype.visitPipe = /**
  31227. * @param {?} ast
  31228. * @param {?} context
  31229. * @return {?}
  31230. */
  31231. function (ast, context) {
  31232. this.pipes.set(ast.name, ast);
  31233. ast.exp.visit(this);
  31234. this.visitAll(ast.args, context);
  31235. return null;
  31236. };
  31237. return PipeCollector;
  31238. }(RecursiveAstVisitor));
  31239. /**
  31240. * @param {?} name
  31241. * @return {?}
  31242. */
  31243. function _isAnimationLabel(name) {
  31244. return name[0] == '@';
  31245. }
  31246. /**
  31247. * @param {?} registry
  31248. * @param {?} selector
  31249. * @param {?} propName
  31250. * @param {?} isAttribute
  31251. * @return {?}
  31252. */
  31253. function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
  31254. var /** @type {?} */ ctxs = [];
  31255. CssSelector.parse(selector).forEach(function (selector) {
  31256. var /** @type {?} */ elementNames = selector.element ? [selector.element] : registry.allKnownElementNames();
  31257. var /** @type {?} */ notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); })
  31258. .map(function (selector) { return selector.element; }));
  31259. var /** @type {?} */ possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); });
  31260. ctxs.push.apply(ctxs, possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); }));
  31261. });
  31262. return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
  31263. }
  31264. /**
  31265. * @fileoverview added by tsickle
  31266. * @suppress {checkTypes} checked by tsc
  31267. */
  31268. /**
  31269. * @license
  31270. * Copyright Google Inc. All Rights Reserved.
  31271. *
  31272. * Use of this source code is governed by an MIT-style license that can be
  31273. * found in the LICENSE file at https://angular.io/license
  31274. */
  31275. var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/;
  31276. // Group 1 = "bind-"
  31277. var KW_BIND_IDX = 1;
  31278. // Group 2 = "let-"
  31279. var KW_LET_IDX = 2;
  31280. // Group 3 = "ref-/#"
  31281. var KW_REF_IDX = 3;
  31282. // Group 4 = "on-"
  31283. var KW_ON_IDX = 4;
  31284. // Group 5 = "bindon-"
  31285. var KW_BINDON_IDX = 5;
  31286. // Group 6 = "@"
  31287. var KW_AT_IDX = 6;
  31288. // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@"
  31289. var IDENT_KW_IDX = 7;
  31290. // Group 8 = identifier inside [()]
  31291. var IDENT_BANANA_BOX_IDX = 8;
  31292. // Group 9 = identifier inside []
  31293. var IDENT_PROPERTY_IDX = 9;
  31294. // Group 10 = identifier inside ()
  31295. var IDENT_EVENT_IDX = 10;
  31296. // deprecated in 4.x
  31297. var TEMPLATE_ELEMENT = 'template';
  31298. // deprecated in 4.x
  31299. var TEMPLATE_ATTR = 'template';
  31300. var TEMPLATE_ATTR_PREFIX = '*';
  31301. var CLASS_ATTR = 'class';
  31302. var TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
  31303. var TEMPLATE_ELEMENT_DEPRECATION_WARNING = 'The <template> element is deprecated. Use <ng-template> instead';
  31304. var TEMPLATE_ATTR_DEPRECATION_WARNING = 'The template attribute is deprecated. Use an ng-template element instead.';
  31305. var warningCounts = {};
  31306. /**
  31307. * @param {?} warnings
  31308. * @return {?}
  31309. */
  31310. function warnOnlyOnce(warnings) {
  31311. return function (error) {
  31312. if (warnings.indexOf(error.msg) !== -1) {
  31313. warningCounts[error.msg] = (warningCounts[error.msg] || 0) + 1;
  31314. return warningCounts[error.msg] <= 1;
  31315. }
  31316. return true;
  31317. };
  31318. }
  31319. var TemplateParseError = /** @class */ (function (_super) {
  31320. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TemplateParseError, _super);
  31321. function TemplateParseError(message, span, level) {
  31322. return _super.call(this, span, message, level) || this;
  31323. }
  31324. return TemplateParseError;
  31325. }(ParseError));
  31326. var TemplateParseResult = /** @class */ (function () {
  31327. function TemplateParseResult(templateAst, usedPipes, errors) {
  31328. this.templateAst = templateAst;
  31329. this.usedPipes = usedPipes;
  31330. this.errors = errors;
  31331. }
  31332. return TemplateParseResult;
  31333. }());
  31334. var TemplateParser = /** @class */ (function () {
  31335. function TemplateParser(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) {
  31336. this._config = _config;
  31337. this._reflector = _reflector;
  31338. this._exprParser = _exprParser;
  31339. this._schemaRegistry = _schemaRegistry;
  31340. this._htmlParser = _htmlParser;
  31341. this._console = _console;
  31342. this.transforms = transforms;
  31343. }
  31344. /**
  31345. * @param {?} component
  31346. * @param {?} template
  31347. * @param {?} directives
  31348. * @param {?} pipes
  31349. * @param {?} schemas
  31350. * @param {?} templateUrl
  31351. * @param {?} preserveWhitespaces
  31352. * @return {?}
  31353. */
  31354. TemplateParser.prototype.parse = /**
  31355. * @param {?} component
  31356. * @param {?} template
  31357. * @param {?} directives
  31358. * @param {?} pipes
  31359. * @param {?} schemas
  31360. * @param {?} templateUrl
  31361. * @param {?} preserveWhitespaces
  31362. * @return {?}
  31363. */
  31364. function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
  31365. var /** @type {?} */ result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces);
  31366. var /** @type {?} */ warnings = /** @type {?} */ ((result.errors)).filter(function (error) { return error.level === ParseErrorLevel.WARNING; }).filter(warnOnlyOnce([TEMPLATE_ATTR_DEPRECATION_WARNING, TEMPLATE_ELEMENT_DEPRECATION_WARNING]));
  31367. var /** @type {?} */ errors = /** @type {?} */ ((result.errors)).filter(function (error) { return error.level === ParseErrorLevel.ERROR; });
  31368. if (warnings.length > 0) {
  31369. this._console.warn("Template parse warnings:\n" + warnings.join('\n'));
  31370. }
  31371. if (errors.length > 0) {
  31372. var /** @type {?} */ errorString = errors.join('\n');
  31373. throw syntaxError("Template parse errors:\n" + errorString, errors);
  31374. }
  31375. return { template: /** @type {?} */ ((result.templateAst)), pipes: /** @type {?} */ ((result.usedPipes)) };
  31376. };
  31377. /**
  31378. * @param {?} component
  31379. * @param {?} template
  31380. * @param {?} directives
  31381. * @param {?} pipes
  31382. * @param {?} schemas
  31383. * @param {?} templateUrl
  31384. * @param {?} preserveWhitespaces
  31385. * @return {?}
  31386. */
  31387. TemplateParser.prototype.tryParse = /**
  31388. * @param {?} component
  31389. * @param {?} template
  31390. * @param {?} directives
  31391. * @param {?} pipes
  31392. * @param {?} schemas
  31393. * @param {?} templateUrl
  31394. * @param {?} preserveWhitespaces
  31395. * @return {?}
  31396. */
  31397. function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
  31398. var /** @type {?} */ htmlParseResult = typeof template === 'string' ? /** @type {?} */ ((this._htmlParser)).parse(template, templateUrl, true, this.getInterpolationConfig(component)) :
  31399. template;
  31400. if (!preserveWhitespaces) {
  31401. htmlParseResult = removeWhitespaces(htmlParseResult);
  31402. }
  31403. return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas);
  31404. };
  31405. /**
  31406. * @param {?} htmlAstWithErrors
  31407. * @param {?} component
  31408. * @param {?} directives
  31409. * @param {?} pipes
  31410. * @param {?} schemas
  31411. * @return {?}
  31412. */
  31413. TemplateParser.prototype.tryParseHtml = /**
  31414. * @param {?} htmlAstWithErrors
  31415. * @param {?} component
  31416. * @param {?} directives
  31417. * @param {?} pipes
  31418. * @param {?} schemas
  31419. * @return {?}
  31420. */
  31421. function (htmlAstWithErrors, component, directives, pipes, schemas) {
  31422. var /** @type {?} */ result;
  31423. var /** @type {?} */ errors = htmlAstWithErrors.errors;
  31424. var /** @type {?} */ usedPipes = [];
  31425. if (htmlAstWithErrors.rootNodes.length > 0) {
  31426. var /** @type {?} */ uniqDirectives = removeSummaryDuplicates(directives);
  31427. var /** @type {?} */ uniqPipes = removeSummaryDuplicates(pipes);
  31428. var /** @type {?} */ providerViewContext = new ProviderViewContext(this._reflector, component);
  31429. var /** @type {?} */ interpolationConfig = /** @type {?} */ ((undefined));
  31430. if (component.template && component.template.interpolation) {
  31431. interpolationConfig = {
  31432. start: component.template.interpolation[0],
  31433. end: component.template.interpolation[1]
  31434. };
  31435. }
  31436. var /** @type {?} */ bindingParser = new BindingParser(this._exprParser, /** @type {?} */ ((interpolationConfig)), this._schemaRegistry, uniqPipes, errors);
  31437. var /** @type {?} */ parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors);
  31438. result = visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT);
  31439. errors.push.apply(errors, providerViewContext.errors);
  31440. usedPipes.push.apply(usedPipes, bindingParser.getUsedPipes());
  31441. }
  31442. else {
  31443. result = [];
  31444. }
  31445. this._assertNoReferenceDuplicationOnTemplate(result, errors);
  31446. if (errors.length > 0) {
  31447. return new TemplateParseResult(result, usedPipes, errors);
  31448. }
  31449. if (this.transforms) {
  31450. this.transforms.forEach(function (transform) { result = templateVisitAll(transform, result); });
  31451. }
  31452. return new TemplateParseResult(result, usedPipes, errors);
  31453. };
  31454. /**
  31455. * @param {?} htmlAstWithErrors
  31456. * @param {?=} forced
  31457. * @return {?}
  31458. */
  31459. TemplateParser.prototype.expandHtml = /**
  31460. * @param {?} htmlAstWithErrors
  31461. * @param {?=} forced
  31462. * @return {?}
  31463. */
  31464. function (htmlAstWithErrors, forced) {
  31465. if (forced === void 0) { forced = false; }
  31466. var /** @type {?} */ errors = htmlAstWithErrors.errors;
  31467. if (errors.length == 0 || forced) {
  31468. // Transform ICU messages to angular directives
  31469. var /** @type {?} */ expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes);
  31470. errors.push.apply(errors, expandedHtmlAst.errors);
  31471. htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors);
  31472. }
  31473. return htmlAstWithErrors;
  31474. };
  31475. /**
  31476. * @param {?} component
  31477. * @return {?}
  31478. */
  31479. TemplateParser.prototype.getInterpolationConfig = /**
  31480. * @param {?} component
  31481. * @return {?}
  31482. */
  31483. function (component) {
  31484. if (component.template) {
  31485. return InterpolationConfig.fromArray(component.template.interpolation);
  31486. }
  31487. return undefined;
  31488. };
  31489. /** @internal */
  31490. /**
  31491. * \@internal
  31492. * @param {?} result
  31493. * @param {?} errors
  31494. * @return {?}
  31495. */
  31496. TemplateParser.prototype._assertNoReferenceDuplicationOnTemplate = /**
  31497. * \@internal
  31498. * @param {?} result
  31499. * @param {?} errors
  31500. * @return {?}
  31501. */
  31502. function (result, errors) {
  31503. var /** @type {?} */ existingReferences = [];
  31504. result.filter(function (element) { return !!(/** @type {?} */ (element)).references; })
  31505. .forEach(function (element) {
  31506. return (/** @type {?} */ (element)).references.forEach(function (reference) {
  31507. var /** @type {?} */ name = reference.name;
  31508. if (existingReferences.indexOf(name) < 0) {
  31509. existingReferences.push(name);
  31510. }
  31511. else {
  31512. var /** @type {?} */ error = new TemplateParseError("Reference \"#" + name + "\" is defined several times", reference.sourceSpan, ParseErrorLevel.ERROR);
  31513. errors.push(error);
  31514. }
  31515. });
  31516. });
  31517. };
  31518. return TemplateParser;
  31519. }());
  31520. var TemplateParseVisitor = /** @class */ (function () {
  31521. function TemplateParseVisitor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) {
  31522. var _this = this;
  31523. this.reflector = reflector;
  31524. this.config = config;
  31525. this.providerViewContext = providerViewContext;
  31526. this._bindingParser = _bindingParser;
  31527. this._schemaRegistry = _schemaRegistry;
  31528. this._schemas = _schemas;
  31529. this._targetErrors = _targetErrors;
  31530. this.selectorMatcher = new SelectorMatcher();
  31531. this.directivesIndex = new Map();
  31532. this.ngContentCount = 0;
  31533. // Note: queries start with id 1 so we can use the number in a Bloom filter!
  31534. this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1;
  31535. directives.forEach(function (directive, index) {
  31536. var /** @type {?} */ selector = CssSelector.parse(/** @type {?} */ ((directive.selector)));
  31537. _this.selectorMatcher.addSelectables(selector, directive);
  31538. _this.directivesIndex.set(directive, index);
  31539. });
  31540. }
  31541. /**
  31542. * @param {?} expansion
  31543. * @param {?} context
  31544. * @return {?}
  31545. */
  31546. TemplateParseVisitor.prototype.visitExpansion = /**
  31547. * @param {?} expansion
  31548. * @param {?} context
  31549. * @return {?}
  31550. */
  31551. function (expansion, context) { return null; };
  31552. /**
  31553. * @param {?} expansionCase
  31554. * @param {?} context
  31555. * @return {?}
  31556. */
  31557. TemplateParseVisitor.prototype.visitExpansionCase = /**
  31558. * @param {?} expansionCase
  31559. * @param {?} context
  31560. * @return {?}
  31561. */
  31562. function (expansionCase, context) { return null; };
  31563. /**
  31564. * @param {?} text
  31565. * @param {?} parent
  31566. * @return {?}
  31567. */
  31568. TemplateParseVisitor.prototype.visitText = /**
  31569. * @param {?} text
  31570. * @param {?} parent
  31571. * @return {?}
  31572. */
  31573. function (text, parent) {
  31574. var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR)));
  31575. var /** @type {?} */ valueNoNgsp = replaceNgsp(text.value);
  31576. var /** @type {?} */ expr = this._bindingParser.parseInterpolation(valueNoNgsp, /** @type {?} */ ((text.sourceSpan)));
  31577. return expr ? new BoundTextAst(expr, ngContentIndex, /** @type {?} */ ((text.sourceSpan))) :
  31578. new TextAst(valueNoNgsp, ngContentIndex, /** @type {?} */ ((text.sourceSpan)));
  31579. };
  31580. /**
  31581. * @param {?} attribute
  31582. * @param {?} context
  31583. * @return {?}
  31584. */
  31585. TemplateParseVisitor.prototype.visitAttribute = /**
  31586. * @param {?} attribute
  31587. * @param {?} context
  31588. * @return {?}
  31589. */
  31590. function (attribute, context) {
  31591. return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
  31592. };
  31593. /**
  31594. * @param {?} comment
  31595. * @param {?} context
  31596. * @return {?}
  31597. */
  31598. TemplateParseVisitor.prototype.visitComment = /**
  31599. * @param {?} comment
  31600. * @param {?} context
  31601. * @return {?}
  31602. */
  31603. function (comment, context) { return null; };
  31604. /**
  31605. * @param {?} element
  31606. * @param {?} parent
  31607. * @return {?}
  31608. */
  31609. TemplateParseVisitor.prototype.visitElement = /**
  31610. * @param {?} element
  31611. * @param {?} parent
  31612. * @return {?}
  31613. */
  31614. function (element, parent) {
  31615. var _this = this;
  31616. var /** @type {?} */ queryStartIndex = this.contentQueryStartId;
  31617. var /** @type {?} */ nodeName = element.name;
  31618. var /** @type {?} */ preparsedElement = preparseElement(element);
  31619. if (preparsedElement.type === PreparsedElementType.SCRIPT ||
  31620. preparsedElement.type === PreparsedElementType.STYLE) {
  31621. // Skipping <script> for security reasons
  31622. // Skipping <style> as we already processed them
  31623. // in the StyleCompiler
  31624. return null;
  31625. }
  31626. if (preparsedElement.type === PreparsedElementType.STYLESHEET &&
  31627. isStyleUrlResolvable(preparsedElement.hrefAttr)) {
  31628. // Skipping stylesheets with either relative urls or package scheme as we already processed
  31629. // them in the StyleCompiler
  31630. return null;
  31631. }
  31632. var /** @type {?} */ matchableAttrs = [];
  31633. var /** @type {?} */ elementOrDirectiveProps = [];
  31634. var /** @type {?} */ elementOrDirectiveRefs = [];
  31635. var /** @type {?} */ elementVars = [];
  31636. var /** @type {?} */ events = [];
  31637. var /** @type {?} */ templateElementOrDirectiveProps = [];
  31638. var /** @type {?} */ templateMatchableAttrs = [];
  31639. var /** @type {?} */ templateElementVars = [];
  31640. var /** @type {?} */ hasInlineTemplates = false;
  31641. var /** @type {?} */ attrs = [];
  31642. var /** @type {?} */ isTemplateElement = isTemplate(element, this.config.enableLegacyTemplate, function (m, span) { return _this._reportError(m, span, ParseErrorLevel.WARNING); });
  31643. element.attrs.forEach(function (attr) {
  31644. var /** @type {?} */ hasBinding = _this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars);
  31645. var /** @type {?} */ templateBindingsSource;
  31646. var /** @type {?} */ prefixToken;
  31647. var /** @type {?} */ normalizedName = _this._normalizeAttributeName(attr.name);
  31648. if (_this.config.enableLegacyTemplate && normalizedName == TEMPLATE_ATTR) {
  31649. _this._reportError(TEMPLATE_ATTR_DEPRECATION_WARNING, attr.sourceSpan, ParseErrorLevel.WARNING);
  31650. templateBindingsSource = attr.value;
  31651. }
  31652. else if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
  31653. templateBindingsSource = attr.value;
  31654. prefixToken = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length) + ':';
  31655. }
  31656. var /** @type {?} */ hasTemplateBinding = templateBindingsSource != null;
  31657. if (hasTemplateBinding) {
  31658. if (hasInlineTemplates) {
  31659. _this._reportError("Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *", attr.sourceSpan);
  31660. }
  31661. hasInlineTemplates = true;
  31662. _this._bindingParser.parseInlineTemplateBinding(/** @type {?} */ ((prefixToken)), /** @type {?} */ ((templateBindingsSource)), attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars);
  31663. }
  31664. if (!hasBinding && !hasTemplateBinding) {
  31665. // don't include the bindings as attributes as well in the AST
  31666. attrs.push(_this.visitAttribute(attr, null));
  31667. matchableAttrs.push([attr.name, attr.value]);
  31668. }
  31669. });
  31670. var /** @type {?} */ elementCssSelector = createElementCssSelector(nodeName, matchableAttrs);
  31671. var _a = this._parseDirectives(this.selectorMatcher, elementCssSelector), directiveMetas = _a.directives, matchElement = _a.matchElement;
  31672. var /** @type {?} */ references = [];
  31673. var /** @type {?} */ boundDirectivePropNames = new Set();
  31674. var /** @type {?} */ directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, /** @type {?} */ ((element.sourceSpan)), references, boundDirectivePropNames);
  31675. var /** @type {?} */ elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, boundDirectivePropNames);
  31676. var /** @type {?} */ isViewRoot = parent.isTemplateElement || hasInlineTemplates;
  31677. var /** @type {?} */ providerContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), isViewRoot, directiveAsts, attrs, references, isTemplateElement, queryStartIndex, /** @type {?} */ ((element.sourceSpan)));
  31678. var /** @type {?} */ children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create(isTemplateElement, directiveAsts, isTemplateElement ? /** @type {?} */ ((parent.providerContext)) : providerContext));
  31679. providerContext.afterElement();
  31680. // Override the actual selector when the `ngProjectAs` attribute is provided
  31681. var /** @type {?} */ projectionSelector = preparsedElement.projectAs != null ?
  31682. CssSelector.parse(preparsedElement.projectAs)[0] :
  31683. elementCssSelector;
  31684. var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(projectionSelector)));
  31685. var /** @type {?} */ parsedElement;
  31686. if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
  31687. if (element.children && !element.children.every(_isEmptyTextNode)) {
  31688. this._reportError("<ng-content> element cannot have content.", /** @type {?} */ ((element.sourceSpan)));
  31689. }
  31690. parsedElement = new NgContentAst(this.ngContentCount++, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
  31691. }
  31692. else if (isTemplateElement) {
  31693. this._assertAllEventsPublishedByDirectives(directiveAsts, events);
  31694. this._assertNoComponentsNorElementBindingsOnTemplate(directiveAsts, elementProps, /** @type {?} */ ((element.sourceSpan)));
  31695. parsedElement = new EmbeddedTemplateAst(attrs, events, references, elementVars, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
  31696. }
  31697. else {
  31698. this._assertElementExists(matchElement, element);
  31699. this._assertOnlyOneComponent(directiveAsts, /** @type {?} */ ((element.sourceSpan)));
  31700. var /** @type {?} */ ngContentIndex_1 = hasInlineTemplates ? null : parent.findNgContentIndex(projectionSelector);
  31701. parsedElement = new ElementAst(nodeName, attrs, elementProps, events, references, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : ngContentIndex_1, element.sourceSpan, element.endSourceSpan || null);
  31702. }
  31703. if (hasInlineTemplates) {
  31704. var /** @type {?} */ templateQueryStartIndex = this.contentQueryStartId;
  31705. var /** @type {?} */ templateSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs);
  31706. var templateDirectiveMetas = this._parseDirectives(this.selectorMatcher, templateSelector).directives;
  31707. var /** @type {?} */ templateBoundDirectivePropNames = new Set();
  31708. var /** @type {?} */ templateDirectiveAsts = this._createDirectiveAsts(true, element.name, templateDirectiveMetas, templateElementOrDirectiveProps, [], /** @type {?} */ ((element.sourceSpan)), [], templateBoundDirectivePropNames);
  31709. var /** @type {?} */ templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateBoundDirectivePropNames);
  31710. this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectiveAsts, templateElementProps, /** @type {?} */ ((element.sourceSpan)));
  31711. var /** @type {?} */ templateProviderContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), parent.isTemplateElement, templateDirectiveAsts, [], [], true, templateQueryStartIndex, /** @type {?} */ ((element.sourceSpan)));
  31712. templateProviderContext.afterElement();
  31713. parsedElement = new EmbeddedTemplateAst([], [], [], templateElementVars, templateProviderContext.transformedDirectiveAsts, templateProviderContext.transformProviders, templateProviderContext.transformedHasViewContainer, templateProviderContext.queryMatches, [parsedElement], ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
  31714. }
  31715. return parsedElement;
  31716. };
  31717. /**
  31718. * @param {?} isTemplateElement
  31719. * @param {?} attr
  31720. * @param {?} targetMatchableAttrs
  31721. * @param {?} targetProps
  31722. * @param {?} targetEvents
  31723. * @param {?} targetRefs
  31724. * @param {?} targetVars
  31725. * @return {?}
  31726. */
  31727. TemplateParseVisitor.prototype._parseAttr = /**
  31728. * @param {?} isTemplateElement
  31729. * @param {?} attr
  31730. * @param {?} targetMatchableAttrs
  31731. * @param {?} targetProps
  31732. * @param {?} targetEvents
  31733. * @param {?} targetRefs
  31734. * @param {?} targetVars
  31735. * @return {?}
  31736. */
  31737. function (isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) {
  31738. var /** @type {?} */ name = this._normalizeAttributeName(attr.name);
  31739. var /** @type {?} */ value = attr.value;
  31740. var /** @type {?} */ srcSpan = attr.sourceSpan;
  31741. var /** @type {?} */ bindParts = name.match(BIND_NAME_REGEXP);
  31742. var /** @type {?} */ hasBinding = false;
  31743. if (bindParts !== null) {
  31744. hasBinding = true;
  31745. if (bindParts[KW_BIND_IDX] != null) {
  31746. this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  31747. }
  31748. else if (bindParts[KW_LET_IDX]) {
  31749. if (isTemplateElement) {
  31750. var /** @type {?} */ identifier = bindParts[IDENT_KW_IDX];
  31751. this._parseVariable(identifier, value, srcSpan, targetVars);
  31752. }
  31753. else {
  31754. this._reportError("\"let-\" is only supported on ng-template elements.", srcSpan);
  31755. }
  31756. }
  31757. else if (bindParts[KW_REF_IDX]) {
  31758. var /** @type {?} */ identifier = bindParts[IDENT_KW_IDX];
  31759. this._parseReference(identifier, value, srcSpan, targetRefs);
  31760. }
  31761. else if (bindParts[KW_ON_IDX]) {
  31762. this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
  31763. }
  31764. else if (bindParts[KW_BINDON_IDX]) {
  31765. this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  31766. this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
  31767. }
  31768. else if (bindParts[KW_AT_IDX]) {
  31769. this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
  31770. }
  31771. else if (bindParts[IDENT_BANANA_BOX_IDX]) {
  31772. this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  31773. this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
  31774. }
  31775. else if (bindParts[IDENT_PROPERTY_IDX]) {
  31776. this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  31777. }
  31778. else if (bindParts[IDENT_EVENT_IDX]) {
  31779. this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
  31780. }
  31781. }
  31782. else {
  31783. hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps);
  31784. }
  31785. if (!hasBinding) {
  31786. this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
  31787. }
  31788. return hasBinding;
  31789. };
  31790. /**
  31791. * @param {?} attrName
  31792. * @return {?}
  31793. */
  31794. TemplateParseVisitor.prototype._normalizeAttributeName = /**
  31795. * @param {?} attrName
  31796. * @return {?}
  31797. */
  31798. function (attrName) {
  31799. return /^data-/i.test(attrName) ? attrName.substring(5) : attrName;
  31800. };
  31801. /**
  31802. * @param {?} identifier
  31803. * @param {?} value
  31804. * @param {?} sourceSpan
  31805. * @param {?} targetVars
  31806. * @return {?}
  31807. */
  31808. TemplateParseVisitor.prototype._parseVariable = /**
  31809. * @param {?} identifier
  31810. * @param {?} value
  31811. * @param {?} sourceSpan
  31812. * @param {?} targetVars
  31813. * @return {?}
  31814. */
  31815. function (identifier, value, sourceSpan, targetVars) {
  31816. if (identifier.indexOf('-') > -1) {
  31817. this._reportError("\"-\" is not allowed in variable names", sourceSpan);
  31818. }
  31819. targetVars.push(new VariableAst(identifier, value, sourceSpan));
  31820. };
  31821. /**
  31822. * @param {?} identifier
  31823. * @param {?} value
  31824. * @param {?} sourceSpan
  31825. * @param {?} targetRefs
  31826. * @return {?}
  31827. */
  31828. TemplateParseVisitor.prototype._parseReference = /**
  31829. * @param {?} identifier
  31830. * @param {?} value
  31831. * @param {?} sourceSpan
  31832. * @param {?} targetRefs
  31833. * @return {?}
  31834. */
  31835. function (identifier, value, sourceSpan, targetRefs) {
  31836. if (identifier.indexOf('-') > -1) {
  31837. this._reportError("\"-\" is not allowed in reference names", sourceSpan);
  31838. }
  31839. targetRefs.push(new ElementOrDirectiveRef(identifier, value, sourceSpan));
  31840. };
  31841. /**
  31842. * @param {?} name
  31843. * @param {?} expression
  31844. * @param {?} sourceSpan
  31845. * @param {?} targetMatchableAttrs
  31846. * @param {?} targetEvents
  31847. * @return {?}
  31848. */
  31849. TemplateParseVisitor.prototype._parseAssignmentEvent = /**
  31850. * @param {?} name
  31851. * @param {?} expression
  31852. * @param {?} sourceSpan
  31853. * @param {?} targetMatchableAttrs
  31854. * @param {?} targetEvents
  31855. * @return {?}
  31856. */
  31857. function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
  31858. this._bindingParser.parseEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, targetEvents);
  31859. };
  31860. /**
  31861. * @param {?} selectorMatcher
  31862. * @param {?} elementCssSelector
  31863. * @return {?}
  31864. */
  31865. TemplateParseVisitor.prototype._parseDirectives = /**
  31866. * @param {?} selectorMatcher
  31867. * @param {?} elementCssSelector
  31868. * @return {?}
  31869. */
  31870. function (selectorMatcher, elementCssSelector) {
  31871. var _this = this;
  31872. // Need to sort the directives so that we get consistent results throughout,
  31873. // as selectorMatcher uses Maps inside.
  31874. // Also deduplicate directives as they might match more than one time!
  31875. var /** @type {?} */ directives = new Array(this.directivesIndex.size);
  31876. // Whether any directive selector matches on the element name
  31877. var /** @type {?} */ matchElement = false;
  31878. selectorMatcher.match(elementCssSelector, function (selector, directive) {
  31879. directives[/** @type {?} */ ((_this.directivesIndex.get(directive)))] = directive;
  31880. matchElement = matchElement || selector.hasElementSelector();
  31881. });
  31882. return {
  31883. directives: directives.filter(function (dir) { return !!dir; }),
  31884. matchElement: matchElement,
  31885. };
  31886. };
  31887. /**
  31888. * @param {?} isTemplateElement
  31889. * @param {?} elementName
  31890. * @param {?} directives
  31891. * @param {?} props
  31892. * @param {?} elementOrDirectiveRefs
  31893. * @param {?} elementSourceSpan
  31894. * @param {?} targetReferences
  31895. * @param {?} targetBoundDirectivePropNames
  31896. * @return {?}
  31897. */
  31898. TemplateParseVisitor.prototype._createDirectiveAsts = /**
  31899. * @param {?} isTemplateElement
  31900. * @param {?} elementName
  31901. * @param {?} directives
  31902. * @param {?} props
  31903. * @param {?} elementOrDirectiveRefs
  31904. * @param {?} elementSourceSpan
  31905. * @param {?} targetReferences
  31906. * @param {?} targetBoundDirectivePropNames
  31907. * @return {?}
  31908. */
  31909. function (isTemplateElement, elementName, directives, props, elementOrDirectiveRefs, elementSourceSpan, targetReferences, targetBoundDirectivePropNames) {
  31910. var _this = this;
  31911. var /** @type {?} */ matchedReferences = new Set();
  31912. var /** @type {?} */ component = /** @type {?} */ ((null));
  31913. var /** @type {?} */ directiveAsts = directives.map(function (directive) {
  31914. var /** @type {?} */ sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, "Directive " + identifierName(directive.type));
  31915. if (directive.isComponent) {
  31916. component = directive;
  31917. }
  31918. var /** @type {?} */ directiveProperties = [];
  31919. var /** @type {?} */ hostProperties = /** @type {?} */ ((_this._bindingParser.createDirectiveHostPropertyAsts(directive, elementName, sourceSpan)));
  31920. // Note: We need to check the host properties here as well,
  31921. // as we don't know the element name in the DirectiveWrapperCompiler yet.
  31922. hostProperties = _this._checkPropertiesInSchema(elementName, hostProperties);
  31923. var /** @type {?} */ hostEvents = /** @type {?} */ ((_this._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan)));
  31924. _this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties, targetBoundDirectivePropNames);
  31925. elementOrDirectiveRefs.forEach(function (elOrDirRef) {
  31926. if ((elOrDirRef.value.length === 0 && directive.isComponent) ||
  31927. (elOrDirRef.isReferenceToDirective(directive))) {
  31928. targetReferences.push(new ReferenceAst(elOrDirRef.name, createTokenForReference(directive.type.reference), elOrDirRef.sourceSpan));
  31929. matchedReferences.add(elOrDirRef.name);
  31930. }
  31931. });
  31932. var /** @type {?} */ contentQueryStartId = _this.contentQueryStartId;
  31933. _this.contentQueryStartId += directive.queries.length;
  31934. return new DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, contentQueryStartId, sourceSpan);
  31935. });
  31936. elementOrDirectiveRefs.forEach(function (elOrDirRef) {
  31937. if (elOrDirRef.value.length > 0) {
  31938. if (!matchedReferences.has(elOrDirRef.name)) {
  31939. _this._reportError("There is no directive with \"exportAs\" set to \"" + elOrDirRef.value + "\"", elOrDirRef.sourceSpan);
  31940. }
  31941. }
  31942. else if (!component) {
  31943. var /** @type {?} */ refToken = /** @type {?} */ ((null));
  31944. if (isTemplateElement) {
  31945. refToken = createTokenForExternalReference(_this.reflector, Identifiers.TemplateRef);
  31946. }
  31947. targetReferences.push(new ReferenceAst(elOrDirRef.name, refToken, elOrDirRef.sourceSpan));
  31948. }
  31949. });
  31950. return directiveAsts;
  31951. };
  31952. /**
  31953. * @param {?} directiveProperties
  31954. * @param {?} boundProps
  31955. * @param {?} targetBoundDirectiveProps
  31956. * @param {?} targetBoundDirectivePropNames
  31957. * @return {?}
  31958. */
  31959. TemplateParseVisitor.prototype._createDirectivePropertyAsts = /**
  31960. * @param {?} directiveProperties
  31961. * @param {?} boundProps
  31962. * @param {?} targetBoundDirectiveProps
  31963. * @param {?} targetBoundDirectivePropNames
  31964. * @return {?}
  31965. */
  31966. function (directiveProperties, boundProps, targetBoundDirectiveProps, targetBoundDirectivePropNames) {
  31967. if (directiveProperties) {
  31968. var /** @type {?} */ boundPropsByName_1 = new Map();
  31969. boundProps.forEach(function (boundProp) {
  31970. var /** @type {?} */ prevValue = boundPropsByName_1.get(boundProp.name);
  31971. if (!prevValue || prevValue.isLiteral) {
  31972. // give [a]="b" a higher precedence than a="b" on the same element
  31973. // give [a]="b" a higher precedence than a="b" on the same element
  31974. boundPropsByName_1.set(boundProp.name, boundProp);
  31975. }
  31976. });
  31977. Object.keys(directiveProperties).forEach(function (dirProp) {
  31978. var /** @type {?} */ elProp = directiveProperties[dirProp];
  31979. var /** @type {?} */ boundProp = boundPropsByName_1.get(elProp);
  31980. // Bindings are optional, so this binding only needs to be set up if an expression is given.
  31981. if (boundProp) {
  31982. targetBoundDirectivePropNames.add(boundProp.name);
  31983. if (!isEmptyExpression(boundProp.expression)) {
  31984. targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan));
  31985. }
  31986. }
  31987. });
  31988. }
  31989. };
  31990. /**
  31991. * @param {?} elementName
  31992. * @param {?} props
  31993. * @param {?} boundDirectivePropNames
  31994. * @return {?}
  31995. */
  31996. TemplateParseVisitor.prototype._createElementPropertyAsts = /**
  31997. * @param {?} elementName
  31998. * @param {?} props
  31999. * @param {?} boundDirectivePropNames
  32000. * @return {?}
  32001. */
  32002. function (elementName, props, boundDirectivePropNames) {
  32003. var _this = this;
  32004. var /** @type {?} */ boundElementProps = [];
  32005. props.forEach(function (prop) {
  32006. if (!prop.isLiteral && !boundDirectivePropNames.has(prop.name)) {
  32007. boundElementProps.push(_this._bindingParser.createElementPropertyAst(elementName, prop));
  32008. }
  32009. });
  32010. return this._checkPropertiesInSchema(elementName, boundElementProps);
  32011. };
  32012. /**
  32013. * @param {?} directives
  32014. * @return {?}
  32015. */
  32016. TemplateParseVisitor.prototype._findComponentDirectives = /**
  32017. * @param {?} directives
  32018. * @return {?}
  32019. */
  32020. function (directives) {
  32021. return directives.filter(function (directive) { return directive.directive.isComponent; });
  32022. };
  32023. /**
  32024. * @param {?} directives
  32025. * @return {?}
  32026. */
  32027. TemplateParseVisitor.prototype._findComponentDirectiveNames = /**
  32028. * @param {?} directives
  32029. * @return {?}
  32030. */
  32031. function (directives) {
  32032. return this._findComponentDirectives(directives)
  32033. .map(function (directive) { return ((identifierName(directive.directive.type))); });
  32034. };
  32035. /**
  32036. * @param {?} directives
  32037. * @param {?} sourceSpan
  32038. * @return {?}
  32039. */
  32040. TemplateParseVisitor.prototype._assertOnlyOneComponent = /**
  32041. * @param {?} directives
  32042. * @param {?} sourceSpan
  32043. * @return {?}
  32044. */
  32045. function (directives, sourceSpan) {
  32046. var /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives);
  32047. if (componentTypeNames.length > 1) {
  32048. this._reportError("More than one component matched on this element.\n" +
  32049. "Make sure that only one component's selector can match a given element.\n" +
  32050. ("Conflicting components: " + componentTypeNames.join(',')), sourceSpan);
  32051. }
  32052. };
  32053. /**
  32054. * Make sure that non-angular tags conform to the schemas.
  32055. *
  32056. * Note: An element is considered an angular tag when at least one directive selector matches the
  32057. * tag name.
  32058. *
  32059. * @param {?} matchElement Whether any directive has matched on the tag name
  32060. * @param {?} element the html element
  32061. * @return {?}
  32062. */
  32063. TemplateParseVisitor.prototype._assertElementExists = /**
  32064. * Make sure that non-angular tags conform to the schemas.
  32065. *
  32066. * Note: An element is considered an angular tag when at least one directive selector matches the
  32067. * tag name.
  32068. *
  32069. * @param {?} matchElement Whether any directive has matched on the tag name
  32070. * @param {?} element the html element
  32071. * @return {?}
  32072. */
  32073. function (matchElement, element) {
  32074. var /** @type {?} */ elName = element.name.replace(/^:xhtml:/, '');
  32075. if (!matchElement && !this._schemaRegistry.hasElement(elName, this._schemas)) {
  32076. var /** @type {?} */ errorMsg = "'" + elName + "' is not a known element:\n";
  32077. errorMsg +=
  32078. "1. If '" + elName + "' is an Angular component, then verify that it is part of this module.\n";
  32079. if (elName.indexOf('-') > -1) {
  32080. errorMsg +=
  32081. "2. If '" + elName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.";
  32082. }
  32083. else {
  32084. errorMsg +=
  32085. "2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
  32086. }
  32087. this._reportError(errorMsg, /** @type {?} */ ((element.sourceSpan)));
  32088. }
  32089. };
  32090. /**
  32091. * @param {?} directives
  32092. * @param {?} elementProps
  32093. * @param {?} sourceSpan
  32094. * @return {?}
  32095. */
  32096. TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = /**
  32097. * @param {?} directives
  32098. * @param {?} elementProps
  32099. * @param {?} sourceSpan
  32100. * @return {?}
  32101. */
  32102. function (directives, elementProps, sourceSpan) {
  32103. var _this = this;
  32104. var /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives);
  32105. if (componentTypeNames.length > 0) {
  32106. this._reportError("Components on an embedded template: " + componentTypeNames.join(','), sourceSpan);
  32107. }
  32108. elementProps.forEach(function (prop) {
  32109. _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the \"@NgModule.declarations\".", sourceSpan);
  32110. });
  32111. };
  32112. /**
  32113. * @param {?} directives
  32114. * @param {?} events
  32115. * @return {?}
  32116. */
  32117. TemplateParseVisitor.prototype._assertAllEventsPublishedByDirectives = /**
  32118. * @param {?} directives
  32119. * @param {?} events
  32120. * @return {?}
  32121. */
  32122. function (directives, events) {
  32123. var _this = this;
  32124. var /** @type {?} */ allDirectiveEvents = new Set();
  32125. directives.forEach(function (directive) {
  32126. Object.keys(directive.directive.outputs).forEach(function (k) {
  32127. var /** @type {?} */ eventName = directive.directive.outputs[k];
  32128. allDirectiveEvents.add(eventName);
  32129. });
  32130. });
  32131. events.forEach(function (event) {
  32132. if (event.target != null || !allDirectiveEvents.has(event.name)) {
  32133. _this._reportError("Event binding " + event.fullName + " not emitted by any directive on an embedded template. Make sure that the event name is spelled correctly and all directives are listed in the \"@NgModule.declarations\".", event.sourceSpan);
  32134. }
  32135. });
  32136. };
  32137. /**
  32138. * @param {?} elementName
  32139. * @param {?} boundProps
  32140. * @return {?}
  32141. */
  32142. TemplateParseVisitor.prototype._checkPropertiesInSchema = /**
  32143. * @param {?} elementName
  32144. * @param {?} boundProps
  32145. * @return {?}
  32146. */
  32147. function (elementName, boundProps) {
  32148. var _this = this;
  32149. // Note: We can't filter out empty expressions before this method,
  32150. // as we still want to validate them!
  32151. return boundProps.filter(function (boundProp) {
  32152. if (boundProp.type === PropertyBindingType.Property &&
  32153. !_this._schemaRegistry.hasProperty(elementName, boundProp.name, _this._schemas)) {
  32154. var /** @type {?} */ errorMsg = "Can't bind to '" + boundProp.name + "' since it isn't a known property of '" + elementName + "'.";
  32155. if (elementName.startsWith('ng-')) {
  32156. errorMsg +=
  32157. "\n1. If '" + boundProp.name + "' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component." +
  32158. "\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
  32159. }
  32160. else if (elementName.indexOf('-') > -1) {
  32161. errorMsg +=
  32162. "\n1. If '" + elementName + "' is an Angular component and it has '" + boundProp.name + "' input, then verify that it is part of this module." +
  32163. ("\n2. If '" + elementName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.") +
  32164. "\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
  32165. }
  32166. _this._reportError(errorMsg, boundProp.sourceSpan);
  32167. }
  32168. return !isEmptyExpression(boundProp.value);
  32169. });
  32170. };
  32171. /**
  32172. * @param {?} message
  32173. * @param {?} sourceSpan
  32174. * @param {?=} level
  32175. * @return {?}
  32176. */
  32177. TemplateParseVisitor.prototype._reportError = /**
  32178. * @param {?} message
  32179. * @param {?} sourceSpan
  32180. * @param {?=} level
  32181. * @return {?}
  32182. */
  32183. function (message, sourceSpan, level) {
  32184. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  32185. this._targetErrors.push(new ParseError(sourceSpan, message, level));
  32186. };
  32187. return TemplateParseVisitor;
  32188. }());
  32189. var NonBindableVisitor = /** @class */ (function () {
  32190. function NonBindableVisitor() {
  32191. }
  32192. /**
  32193. * @param {?} ast
  32194. * @param {?} parent
  32195. * @return {?}
  32196. */
  32197. NonBindableVisitor.prototype.visitElement = /**
  32198. * @param {?} ast
  32199. * @param {?} parent
  32200. * @return {?}
  32201. */
  32202. function (ast, parent) {
  32203. var /** @type {?} */ preparsedElement = preparseElement(ast);
  32204. if (preparsedElement.type === PreparsedElementType.SCRIPT ||
  32205. preparsedElement.type === PreparsedElementType.STYLE ||
  32206. preparsedElement.type === PreparsedElementType.STYLESHEET) {
  32207. // Skipping <script> for security reasons
  32208. // Skipping <style> and stylesheets as we already processed them
  32209. // in the StyleCompiler
  32210. return null;
  32211. }
  32212. var /** @type {?} */ attrNameAndValues = ast.attrs.map(function (attr) { return [attr.name, attr.value]; });
  32213. var /** @type {?} */ selector = createElementCssSelector(ast.name, attrNameAndValues);
  32214. var /** @type {?} */ ngContentIndex = parent.findNgContentIndex(selector);
  32215. var /** @type {?} */ children = visitAll(this, ast.children, EMPTY_ELEMENT_CONTEXT);
  32216. return new ElementAst(ast.name, visitAll(this, ast.attrs), [], [], [], [], [], false, [], children, ngContentIndex, ast.sourceSpan, ast.endSourceSpan);
  32217. };
  32218. /**
  32219. * @param {?} comment
  32220. * @param {?} context
  32221. * @return {?}
  32222. */
  32223. NonBindableVisitor.prototype.visitComment = /**
  32224. * @param {?} comment
  32225. * @param {?} context
  32226. * @return {?}
  32227. */
  32228. function (comment, context) { return null; };
  32229. /**
  32230. * @param {?} attribute
  32231. * @param {?} context
  32232. * @return {?}
  32233. */
  32234. NonBindableVisitor.prototype.visitAttribute = /**
  32235. * @param {?} attribute
  32236. * @param {?} context
  32237. * @return {?}
  32238. */
  32239. function (attribute, context) {
  32240. return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
  32241. };
  32242. /**
  32243. * @param {?} text
  32244. * @param {?} parent
  32245. * @return {?}
  32246. */
  32247. NonBindableVisitor.prototype.visitText = /**
  32248. * @param {?} text
  32249. * @param {?} parent
  32250. * @return {?}
  32251. */
  32252. function (text, parent) {
  32253. var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR)));
  32254. return new TextAst(text.value, ngContentIndex, /** @type {?} */ ((text.sourceSpan)));
  32255. };
  32256. /**
  32257. * @param {?} expansion
  32258. * @param {?} context
  32259. * @return {?}
  32260. */
  32261. NonBindableVisitor.prototype.visitExpansion = /**
  32262. * @param {?} expansion
  32263. * @param {?} context
  32264. * @return {?}
  32265. */
  32266. function (expansion, context) { return expansion; };
  32267. /**
  32268. * @param {?} expansionCase
  32269. * @param {?} context
  32270. * @return {?}
  32271. */
  32272. NonBindableVisitor.prototype.visitExpansionCase = /**
  32273. * @param {?} expansionCase
  32274. * @param {?} context
  32275. * @return {?}
  32276. */
  32277. function (expansionCase, context) { return expansionCase; };
  32278. return NonBindableVisitor;
  32279. }());
  32280. /**
  32281. * A reference to an element or directive in a template. E.g., the reference in this template:
  32282. *
  32283. * <div #myMenu="coolMenu">
  32284. *
  32285. * would be {name: 'myMenu', value: 'coolMenu', sourceSpan: ...}
  32286. */
  32287. var ElementOrDirectiveRef = /** @class */ (function () {
  32288. function ElementOrDirectiveRef(name, value, sourceSpan) {
  32289. this.name = name;
  32290. this.value = value;
  32291. this.sourceSpan = sourceSpan;
  32292. }
  32293. /** Gets whether this is a reference to the given directive. */
  32294. /**
  32295. * Gets whether this is a reference to the given directive.
  32296. * @param {?} directive
  32297. * @return {?}
  32298. */
  32299. ElementOrDirectiveRef.prototype.isReferenceToDirective = /**
  32300. * Gets whether this is a reference to the given directive.
  32301. * @param {?} directive
  32302. * @return {?}
  32303. */
  32304. function (directive) {
  32305. return splitExportAs(directive.exportAs).indexOf(this.value) !== -1;
  32306. };
  32307. return ElementOrDirectiveRef;
  32308. }());
  32309. /**
  32310. * Splits a raw, potentially comma-delimted `exportAs` value into an array of names.
  32311. * @param {?} exportAs
  32312. * @return {?}
  32313. */
  32314. function splitExportAs(exportAs) {
  32315. return exportAs ? exportAs.split(',').map(function (e) { return e.trim(); }) : [];
  32316. }
  32317. /**
  32318. * @param {?} classAttrValue
  32319. * @return {?}
  32320. */
  32321. function splitClasses(classAttrValue) {
  32322. return classAttrValue.trim().split(/\s+/g);
  32323. }
  32324. var ElementContext = /** @class */ (function () {
  32325. function ElementContext(isTemplateElement, _ngContentIndexMatcher, _wildcardNgContentIndex, providerContext) {
  32326. this.isTemplateElement = isTemplateElement;
  32327. this._ngContentIndexMatcher = _ngContentIndexMatcher;
  32328. this._wildcardNgContentIndex = _wildcardNgContentIndex;
  32329. this.providerContext = providerContext;
  32330. }
  32331. /**
  32332. * @param {?} isTemplateElement
  32333. * @param {?} directives
  32334. * @param {?} providerContext
  32335. * @return {?}
  32336. */
  32337. ElementContext.create = /**
  32338. * @param {?} isTemplateElement
  32339. * @param {?} directives
  32340. * @param {?} providerContext
  32341. * @return {?}
  32342. */
  32343. function (isTemplateElement, directives, providerContext) {
  32344. var /** @type {?} */ matcher = new SelectorMatcher();
  32345. var /** @type {?} */ wildcardNgContentIndex = /** @type {?} */ ((null));
  32346. var /** @type {?} */ component = directives.find(function (directive) { return directive.directive.isComponent; });
  32347. if (component) {
  32348. var /** @type {?} */ ngContentSelectors = /** @type {?} */ ((component.directive.template)).ngContentSelectors;
  32349. for (var /** @type {?} */ i = 0; i < ngContentSelectors.length; i++) {
  32350. var /** @type {?} */ selector = ngContentSelectors[i];
  32351. if (selector === '*') {
  32352. wildcardNgContentIndex = i;
  32353. }
  32354. else {
  32355. matcher.addSelectables(CssSelector.parse(ngContentSelectors[i]), i);
  32356. }
  32357. }
  32358. }
  32359. return new ElementContext(isTemplateElement, matcher, wildcardNgContentIndex, providerContext);
  32360. };
  32361. /**
  32362. * @param {?} selector
  32363. * @return {?}
  32364. */
  32365. ElementContext.prototype.findNgContentIndex = /**
  32366. * @param {?} selector
  32367. * @return {?}
  32368. */
  32369. function (selector) {
  32370. var /** @type {?} */ ngContentIndices = [];
  32371. this._ngContentIndexMatcher.match(selector, function (selector, ngContentIndex) { ngContentIndices.push(ngContentIndex); });
  32372. ngContentIndices.sort();
  32373. if (this._wildcardNgContentIndex != null) {
  32374. ngContentIndices.push(this._wildcardNgContentIndex);
  32375. }
  32376. return ngContentIndices.length > 0 ? ngContentIndices[0] : null;
  32377. };
  32378. return ElementContext;
  32379. }());
  32380. /**
  32381. * @param {?} elementName
  32382. * @param {?} attributes
  32383. * @return {?}
  32384. */
  32385. function createElementCssSelector(elementName, attributes) {
  32386. var /** @type {?} */ cssSelector = new CssSelector();
  32387. var /** @type {?} */ elNameNoNs = splitNsName(elementName)[1];
  32388. cssSelector.setElement(elNameNoNs);
  32389. for (var /** @type {?} */ i = 0; i < attributes.length; i++) {
  32390. var /** @type {?} */ attrName = attributes[i][0];
  32391. var /** @type {?} */ attrNameNoNs = splitNsName(attrName)[1];
  32392. var /** @type {?} */ attrValue = attributes[i][1];
  32393. cssSelector.addAttribute(attrNameNoNs, attrValue);
  32394. if (attrName.toLowerCase() == CLASS_ATTR) {
  32395. var /** @type {?} */ classes = splitClasses(attrValue);
  32396. classes.forEach(function (className) { return cssSelector.addClassName(className); });
  32397. }
  32398. }
  32399. return cssSelector;
  32400. }
  32401. var EMPTY_ELEMENT_CONTEXT = new ElementContext(true, new SelectorMatcher(), null, null);
  32402. var NON_BINDABLE_VISITOR = new NonBindableVisitor();
  32403. /**
  32404. * @param {?} node
  32405. * @return {?}
  32406. */
  32407. function _isEmptyTextNode(node) {
  32408. return node instanceof Text && node.value.trim().length == 0;
  32409. }
  32410. /**
  32411. * @template T
  32412. * @param {?} items
  32413. * @return {?}
  32414. */
  32415. function removeSummaryDuplicates(items) {
  32416. var /** @type {?} */ map = new Map();
  32417. items.forEach(function (item) {
  32418. if (!map.get(item.type.reference)) {
  32419. map.set(item.type.reference, item);
  32420. }
  32421. });
  32422. return Array.from(map.values());
  32423. }
  32424. /**
  32425. * @param {?} ast
  32426. * @return {?}
  32427. */
  32428. function isEmptyExpression(ast) {
  32429. if (ast instanceof ASTWithSource) {
  32430. ast = ast.ast;
  32431. }
  32432. return ast instanceof EmptyExpr;
  32433. }
  32434. /**
  32435. * @param {?} el
  32436. * @param {?} enableLegacyTemplate
  32437. * @param {?} reportDeprecation
  32438. * @return {?}
  32439. */
  32440. function isTemplate(el, enableLegacyTemplate, reportDeprecation) {
  32441. if (isNgTemplate(el.name))
  32442. return true;
  32443. var /** @type {?} */ tagNoNs = splitNsName(el.name)[1];
  32444. // `<template>` is HTML and case insensitive
  32445. if (tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) {
  32446. if (enableLegacyTemplate && tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) {
  32447. reportDeprecation(TEMPLATE_ELEMENT_DEPRECATION_WARNING, /** @type {?} */ ((el.sourceSpan)));
  32448. return true;
  32449. }
  32450. }
  32451. return false;
  32452. }
  32453. /**
  32454. * @fileoverview added by tsickle
  32455. * @suppress {checkTypes} checked by tsc
  32456. */
  32457. /**
  32458. * @license
  32459. * Copyright Google Inc. All Rights Reserved.
  32460. *
  32461. * Use of this source code is governed by an MIT-style license that can be
  32462. * found in the LICENSE file at https://angular.io/license
  32463. */
  32464. var EventHandlerVars = /** @class */ (function () {
  32465. function EventHandlerVars() {
  32466. }
  32467. EventHandlerVars.event = variable('$event');
  32468. return EventHandlerVars;
  32469. }());
  32470. /**
  32471. * @record
  32472. */
  32473. var ConvertActionBindingResult = /** @class */ (function () {
  32474. function ConvertActionBindingResult(stmts, allowDefault) {
  32475. this.stmts = stmts;
  32476. this.allowDefault = allowDefault;
  32477. }
  32478. return ConvertActionBindingResult;
  32479. }());
  32480. /**
  32481. * Converts the given expression AST into an executable output AST, assuming the expression is
  32482. * used in an action binding (e.g. an event handler).
  32483. * @param {?} localResolver
  32484. * @param {?} implicitReceiver
  32485. * @param {?} action
  32486. * @param {?} bindingId
  32487. * @return {?}
  32488. */
  32489. function convertActionBinding(localResolver, implicitReceiver, action, bindingId) {
  32490. if (!localResolver) {
  32491. localResolver = new DefaultLocalResolver();
  32492. }
  32493. var /** @type {?} */ actionWithoutBuiltins = convertPropertyBindingBuiltins({
  32494. createLiteralArrayConverter: function (argCount) {
  32495. // Note: no caching for literal arrays in actions.
  32496. return function (args) { return literalArr(args); };
  32497. },
  32498. createLiteralMapConverter: function (keys) {
  32499. // Note: no caching for literal maps in actions.
  32500. return function (values) {
  32501. var /** @type {?} */ entries = keys.map(function (k, i) {
  32502. return ({
  32503. key: k.key,
  32504. value: values[i],
  32505. quoted: k.quoted,
  32506. });
  32507. });
  32508. return literalMap(entries);
  32509. };
  32510. },
  32511. createPipeConverter: function (name) {
  32512. throw new Error("Illegal State: Actions are not allowed to contain pipes. Pipe: " + name);
  32513. }
  32514. }, action);
  32515. var /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId);
  32516. var /** @type {?} */ actionStmts = [];
  32517. flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts);
  32518. prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts);
  32519. var /** @type {?} */ lastIndex = actionStmts.length - 1;
  32520. var /** @type {?} */ preventDefaultVar = /** @type {?} */ ((null));
  32521. if (lastIndex >= 0) {
  32522. var /** @type {?} */ lastStatement = actionStmts[lastIndex];
  32523. var /** @type {?} */ returnExpr = convertStmtIntoExpression(lastStatement);
  32524. if (returnExpr) {
  32525. // Note: We need to cast the result of the method call to dynamic,
  32526. // as it might be a void method!
  32527. preventDefaultVar = createPreventDefaultVar(bindingId);
  32528. actionStmts[lastIndex] =
  32529. preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false)))
  32530. .toDeclStmt(null, [StmtModifier.Final]);
  32531. }
  32532. }
  32533. return new ConvertActionBindingResult(actionStmts, preventDefaultVar);
  32534. }
  32535. /**
  32536. * @record
  32537. */
  32538. /**
  32539. * @record
  32540. */
  32541. /**
  32542. * @param {?} converterFactory
  32543. * @param {?} ast
  32544. * @return {?}
  32545. */
  32546. function convertPropertyBindingBuiltins(converterFactory, ast) {
  32547. return convertBuiltins(converterFactory, ast);
  32548. }
  32549. var ConvertPropertyBindingResult = /** @class */ (function () {
  32550. function ConvertPropertyBindingResult(stmts, currValExpr) {
  32551. this.stmts = stmts;
  32552. this.currValExpr = currValExpr;
  32553. }
  32554. return ConvertPropertyBindingResult;
  32555. }());
  32556. /** @enum {number} */
  32557. var BindingForm = {
  32558. // The general form of binding expression, supports all expressions.
  32559. General: 0,
  32560. // Try to generate a simple binding (no temporaries or statements)
  32561. // otherise generate a general binding
  32562. TrySimple: 1,
  32563. };
  32564. BindingForm[BindingForm.General] = "General";
  32565. BindingForm[BindingForm.TrySimple] = "TrySimple";
  32566. /**
  32567. * Converts the given expression AST into an executable output AST, assuming the expression
  32568. * is used in property binding. The expression has to be preprocessed via
  32569. * `convertPropertyBindingBuiltins`.
  32570. * @param {?} localResolver
  32571. * @param {?} implicitReceiver
  32572. * @param {?} expressionWithoutBuiltins
  32573. * @param {?} bindingId
  32574. * @param {?} form
  32575. * @return {?}
  32576. */
  32577. function convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId, form) {
  32578. if (!localResolver) {
  32579. localResolver = new DefaultLocalResolver();
  32580. }
  32581. var /** @type {?} */ currValExpr = createCurrValueExpr(bindingId);
  32582. var /** @type {?} */ stmts = [];
  32583. var /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId);
  32584. var /** @type {?} */ outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression);
  32585. if (visitor.temporaryCount) {
  32586. for (var /** @type {?} */ i = 0; i < visitor.temporaryCount; i++) {
  32587. stmts.push(temporaryDeclaration(bindingId, i));
  32588. }
  32589. }
  32590. else if (form == BindingForm.TrySimple) {
  32591. return new ConvertPropertyBindingResult([], outputExpr);
  32592. }
  32593. stmts.push(currValExpr.set(outputExpr).toDeclStmt(DYNAMIC_TYPE, [StmtModifier.Final]));
  32594. return new ConvertPropertyBindingResult(stmts, currValExpr);
  32595. }
  32596. /**
  32597. * @param {?} converterFactory
  32598. * @param {?} ast
  32599. * @return {?}
  32600. */
  32601. function convertBuiltins(converterFactory, ast) {
  32602. var /** @type {?} */ visitor = new _BuiltinAstConverter(converterFactory);
  32603. return ast.visit(visitor);
  32604. }
  32605. /**
  32606. * @param {?} bindingId
  32607. * @param {?} temporaryNumber
  32608. * @return {?}
  32609. */
  32610. function temporaryName(bindingId, temporaryNumber) {
  32611. return "tmp_" + bindingId + "_" + temporaryNumber;
  32612. }
  32613. /**
  32614. * @param {?} bindingId
  32615. * @param {?} temporaryNumber
  32616. * @return {?}
  32617. */
  32618. function temporaryDeclaration(bindingId, temporaryNumber) {
  32619. return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber), NULL_EXPR);
  32620. }
  32621. /**
  32622. * @param {?} temporaryCount
  32623. * @param {?} bindingId
  32624. * @param {?} statements
  32625. * @return {?}
  32626. */
  32627. function prependTemporaryDecls(temporaryCount, bindingId, statements) {
  32628. for (var /** @type {?} */ i = temporaryCount - 1; i >= 0; i--) {
  32629. statements.unshift(temporaryDeclaration(bindingId, i));
  32630. }
  32631. }
  32632. /** @enum {number} */
  32633. var _Mode = {
  32634. Statement: 0,
  32635. Expression: 1,
  32636. };
  32637. _Mode[_Mode.Statement] = "Statement";
  32638. _Mode[_Mode.Expression] = "Expression";
  32639. /**
  32640. * @param {?} mode
  32641. * @param {?} ast
  32642. * @return {?}
  32643. */
  32644. function ensureStatementMode(mode, ast) {
  32645. if (mode !== _Mode.Statement) {
  32646. throw new Error("Expected a statement, but saw " + ast);
  32647. }
  32648. }
  32649. /**
  32650. * @param {?} mode
  32651. * @param {?} ast
  32652. * @return {?}
  32653. */
  32654. function ensureExpressionMode(mode, ast) {
  32655. if (mode !== _Mode.Expression) {
  32656. throw new Error("Expected an expression, but saw " + ast);
  32657. }
  32658. }
  32659. /**
  32660. * @param {?} mode
  32661. * @param {?} expr
  32662. * @return {?}
  32663. */
  32664. function convertToStatementIfNeeded(mode, expr) {
  32665. if (mode === _Mode.Statement) {
  32666. return expr.toStmt();
  32667. }
  32668. else {
  32669. return expr;
  32670. }
  32671. }
  32672. var _BuiltinAstConverter = /** @class */ (function (_super) {
  32673. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_BuiltinAstConverter, _super);
  32674. function _BuiltinAstConverter(_converterFactory) {
  32675. var _this = _super.call(this) || this;
  32676. _this._converterFactory = _converterFactory;
  32677. return _this;
  32678. }
  32679. /**
  32680. * @param {?} ast
  32681. * @param {?} context
  32682. * @return {?}
  32683. */
  32684. _BuiltinAstConverter.prototype.visitPipe = /**
  32685. * @param {?} ast
  32686. * @param {?} context
  32687. * @return {?}
  32688. */
  32689. function (ast, context) {
  32690. var _this = this;
  32691. var /** @type {?} */ args = [ast.exp].concat(ast.args).map(function (ast) { return ast.visit(_this, context); });
  32692. return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createPipeConverter(ast.name, args.length));
  32693. };
  32694. /**
  32695. * @param {?} ast
  32696. * @param {?} context
  32697. * @return {?}
  32698. */
  32699. _BuiltinAstConverter.prototype.visitLiteralArray = /**
  32700. * @param {?} ast
  32701. * @param {?} context
  32702. * @return {?}
  32703. */
  32704. function (ast, context) {
  32705. var _this = this;
  32706. var /** @type {?} */ args = ast.expressions.map(function (ast) { return ast.visit(_this, context); });
  32707. return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length));
  32708. };
  32709. /**
  32710. * @param {?} ast
  32711. * @param {?} context
  32712. * @return {?}
  32713. */
  32714. _BuiltinAstConverter.prototype.visitLiteralMap = /**
  32715. * @param {?} ast
  32716. * @param {?} context
  32717. * @return {?}
  32718. */
  32719. function (ast, context) {
  32720. var _this = this;
  32721. var /** @type {?} */ args = ast.values.map(function (ast) { return ast.visit(_this, context); });
  32722. return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralMapConverter(ast.keys));
  32723. };
  32724. return _BuiltinAstConverter;
  32725. }(AstTransformer));
  32726. var _AstToIrVisitor = /** @class */ (function () {
  32727. function _AstToIrVisitor(_localResolver, _implicitReceiver, bindingId) {
  32728. this._localResolver = _localResolver;
  32729. this._implicitReceiver = _implicitReceiver;
  32730. this.bindingId = bindingId;
  32731. this._nodeMap = new Map();
  32732. this._resultMap = new Map();
  32733. this._currentTemporary = 0;
  32734. this.temporaryCount = 0;
  32735. }
  32736. /**
  32737. * @param {?} ast
  32738. * @param {?} mode
  32739. * @return {?}
  32740. */
  32741. _AstToIrVisitor.prototype.visitBinary = /**
  32742. * @param {?} ast
  32743. * @param {?} mode
  32744. * @return {?}
  32745. */
  32746. function (ast, mode) {
  32747. var /** @type {?} */ op;
  32748. switch (ast.operation) {
  32749. case '+':
  32750. op = BinaryOperator.Plus;
  32751. break;
  32752. case '-':
  32753. op = BinaryOperator.Minus;
  32754. break;
  32755. case '*':
  32756. op = BinaryOperator.Multiply;
  32757. break;
  32758. case '/':
  32759. op = BinaryOperator.Divide;
  32760. break;
  32761. case '%':
  32762. op = BinaryOperator.Modulo;
  32763. break;
  32764. case '&&':
  32765. op = BinaryOperator.And;
  32766. break;
  32767. case '||':
  32768. op = BinaryOperator.Or;
  32769. break;
  32770. case '==':
  32771. op = BinaryOperator.Equals;
  32772. break;
  32773. case '!=':
  32774. op = BinaryOperator.NotEquals;
  32775. break;
  32776. case '===':
  32777. op = BinaryOperator.Identical;
  32778. break;
  32779. case '!==':
  32780. op = BinaryOperator.NotIdentical;
  32781. break;
  32782. case '<':
  32783. op = BinaryOperator.Lower;
  32784. break;
  32785. case '>':
  32786. op = BinaryOperator.Bigger;
  32787. break;
  32788. case '<=':
  32789. op = BinaryOperator.LowerEquals;
  32790. break;
  32791. case '>=':
  32792. op = BinaryOperator.BiggerEquals;
  32793. break;
  32794. default:
  32795. throw new Error("Unsupported operation " + ast.operation);
  32796. }
  32797. return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression)));
  32798. };
  32799. /**
  32800. * @param {?} ast
  32801. * @param {?} mode
  32802. * @return {?}
  32803. */
  32804. _AstToIrVisitor.prototype.visitChain = /**
  32805. * @param {?} ast
  32806. * @param {?} mode
  32807. * @return {?}
  32808. */
  32809. function (ast, mode) {
  32810. ensureStatementMode(mode, ast);
  32811. return this.visitAll(ast.expressions, mode);
  32812. };
  32813. /**
  32814. * @param {?} ast
  32815. * @param {?} mode
  32816. * @return {?}
  32817. */
  32818. _AstToIrVisitor.prototype.visitConditional = /**
  32819. * @param {?} ast
  32820. * @param {?} mode
  32821. * @return {?}
  32822. */
  32823. function (ast, mode) {
  32824. var /** @type {?} */ value = this._visit(ast.condition, _Mode.Expression);
  32825. return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression)));
  32826. };
  32827. /**
  32828. * @param {?} ast
  32829. * @param {?} mode
  32830. * @return {?}
  32831. */
  32832. _AstToIrVisitor.prototype.visitPipe = /**
  32833. * @param {?} ast
  32834. * @param {?} mode
  32835. * @return {?}
  32836. */
  32837. function (ast, mode) {
  32838. throw new Error("Illegal state: Pipes should have been converted into functions. Pipe: " + ast.name);
  32839. };
  32840. /**
  32841. * @param {?} ast
  32842. * @param {?} mode
  32843. * @return {?}
  32844. */
  32845. _AstToIrVisitor.prototype.visitFunctionCall = /**
  32846. * @param {?} ast
  32847. * @param {?} mode
  32848. * @return {?}
  32849. */
  32850. function (ast, mode) {
  32851. var /** @type {?} */ convertedArgs = this.visitAll(ast.args, _Mode.Expression);
  32852. var /** @type {?} */ fnResult;
  32853. if (ast instanceof BuiltinFunctionCall) {
  32854. fnResult = ast.converter(convertedArgs);
  32855. }
  32856. else {
  32857. fnResult = this._visit(/** @type {?} */ ((ast.target)), _Mode.Expression).callFn(convertedArgs);
  32858. }
  32859. return convertToStatementIfNeeded(mode, fnResult);
  32860. };
  32861. /**
  32862. * @param {?} ast
  32863. * @param {?} mode
  32864. * @return {?}
  32865. */
  32866. _AstToIrVisitor.prototype.visitImplicitReceiver = /**
  32867. * @param {?} ast
  32868. * @param {?} mode
  32869. * @return {?}
  32870. */
  32871. function (ast, mode) {
  32872. ensureExpressionMode(mode, ast);
  32873. return this._implicitReceiver;
  32874. };
  32875. /**
  32876. * @param {?} ast
  32877. * @param {?} mode
  32878. * @return {?}
  32879. */
  32880. _AstToIrVisitor.prototype.visitInterpolation = /**
  32881. * @param {?} ast
  32882. * @param {?} mode
  32883. * @return {?}
  32884. */
  32885. function (ast, mode) {
  32886. ensureExpressionMode(mode, ast);
  32887. var /** @type {?} */ args = [literal(ast.expressions.length)];
  32888. for (var /** @type {?} */ i = 0; i < ast.strings.length - 1; i++) {
  32889. args.push(literal(ast.strings[i]));
  32890. args.push(this._visit(ast.expressions[i], _Mode.Expression));
  32891. }
  32892. args.push(literal(ast.strings[ast.strings.length - 1]));
  32893. return ast.expressions.length <= 9 ?
  32894. importExpr(Identifiers.inlineInterpolate).callFn(args) :
  32895. importExpr(Identifiers.interpolate).callFn([args[0], literalArr(args.slice(1))]);
  32896. };
  32897. /**
  32898. * @param {?} ast
  32899. * @param {?} mode
  32900. * @return {?}
  32901. */
  32902. _AstToIrVisitor.prototype.visitKeyedRead = /**
  32903. * @param {?} ast
  32904. * @param {?} mode
  32905. * @return {?}
  32906. */
  32907. function (ast, mode) {
  32908. var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
  32909. if (leftMostSafe) {
  32910. return this.convertSafeAccess(ast, leftMostSafe, mode);
  32911. }
  32912. else {
  32913. return convertToStatementIfNeeded(mode, this._visit(ast.obj, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression)));
  32914. }
  32915. };
  32916. /**
  32917. * @param {?} ast
  32918. * @param {?} mode
  32919. * @return {?}
  32920. */
  32921. _AstToIrVisitor.prototype.visitKeyedWrite = /**
  32922. * @param {?} ast
  32923. * @param {?} mode
  32924. * @return {?}
  32925. */
  32926. function (ast, mode) {
  32927. var /** @type {?} */ obj = this._visit(ast.obj, _Mode.Expression);
  32928. var /** @type {?} */ key = this._visit(ast.key, _Mode.Expression);
  32929. var /** @type {?} */ value = this._visit(ast.value, _Mode.Expression);
  32930. return convertToStatementIfNeeded(mode, obj.key(key).set(value));
  32931. };
  32932. /**
  32933. * @param {?} ast
  32934. * @param {?} mode
  32935. * @return {?}
  32936. */
  32937. _AstToIrVisitor.prototype.visitLiteralArray = /**
  32938. * @param {?} ast
  32939. * @param {?} mode
  32940. * @return {?}
  32941. */
  32942. function (ast, mode) {
  32943. throw new Error("Illegal State: literal arrays should have been converted into functions");
  32944. };
  32945. /**
  32946. * @param {?} ast
  32947. * @param {?} mode
  32948. * @return {?}
  32949. */
  32950. _AstToIrVisitor.prototype.visitLiteralMap = /**
  32951. * @param {?} ast
  32952. * @param {?} mode
  32953. * @return {?}
  32954. */
  32955. function (ast, mode) {
  32956. throw new Error("Illegal State: literal maps should have been converted into functions");
  32957. };
  32958. /**
  32959. * @param {?} ast
  32960. * @param {?} mode
  32961. * @return {?}
  32962. */
  32963. _AstToIrVisitor.prototype.visitLiteralPrimitive = /**
  32964. * @param {?} ast
  32965. * @param {?} mode
  32966. * @return {?}
  32967. */
  32968. function (ast, mode) {
  32969. // For literal values of null, undefined, true, or false allow type inteference
  32970. // to infer the type.
  32971. var /** @type {?} */ type = ast.value === null || ast.value === undefined || ast.value === true || ast.value === true ?
  32972. INFERRED_TYPE :
  32973. undefined;
  32974. return convertToStatementIfNeeded(mode, literal(ast.value, type));
  32975. };
  32976. /**
  32977. * @param {?} name
  32978. * @return {?}
  32979. */
  32980. _AstToIrVisitor.prototype._getLocal = /**
  32981. * @param {?} name
  32982. * @return {?}
  32983. */
  32984. function (name) { return this._localResolver.getLocal(name); };
  32985. /**
  32986. * @param {?} ast
  32987. * @param {?} mode
  32988. * @return {?}
  32989. */
  32990. _AstToIrVisitor.prototype.visitMethodCall = /**
  32991. * @param {?} ast
  32992. * @param {?} mode
  32993. * @return {?}
  32994. */
  32995. function (ast, mode) {
  32996. if (ast.receiver instanceof ImplicitReceiver && ast.name == '$any') {
  32997. var /** @type {?} */ args = /** @type {?} */ (this.visitAll(ast.args, _Mode.Expression));
  32998. if (args.length != 1) {
  32999. throw new Error("Invalid call to $any, expected 1 argument but received " + (args.length || 'none'));
  33000. }
  33001. return (/** @type {?} */ (args[0])).cast(DYNAMIC_TYPE);
  33002. }
  33003. var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
  33004. if (leftMostSafe) {
  33005. return this.convertSafeAccess(ast, leftMostSafe, mode);
  33006. }
  33007. else {
  33008. var /** @type {?} */ args = this.visitAll(ast.args, _Mode.Expression);
  33009. var /** @type {?} */ result = null;
  33010. var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
  33011. if (receiver === this._implicitReceiver) {
  33012. var /** @type {?} */ varExpr = this._getLocal(ast.name);
  33013. if (varExpr) {
  33014. result = varExpr.callFn(args);
  33015. }
  33016. }
  33017. if (result == null) {
  33018. result = receiver.callMethod(ast.name, args);
  33019. }
  33020. return convertToStatementIfNeeded(mode, result);
  33021. }
  33022. };
  33023. /**
  33024. * @param {?} ast
  33025. * @param {?} mode
  33026. * @return {?}
  33027. */
  33028. _AstToIrVisitor.prototype.visitPrefixNot = /**
  33029. * @param {?} ast
  33030. * @param {?} mode
  33031. * @return {?}
  33032. */
  33033. function (ast, mode) {
  33034. return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression)));
  33035. };
  33036. /**
  33037. * @param {?} ast
  33038. * @param {?} mode
  33039. * @return {?}
  33040. */
  33041. _AstToIrVisitor.prototype.visitNonNullAssert = /**
  33042. * @param {?} ast
  33043. * @param {?} mode
  33044. * @return {?}
  33045. */
  33046. function (ast, mode) {
  33047. return convertToStatementIfNeeded(mode, assertNotNull(this._visit(ast.expression, _Mode.Expression)));
  33048. };
  33049. /**
  33050. * @param {?} ast
  33051. * @param {?} mode
  33052. * @return {?}
  33053. */
  33054. _AstToIrVisitor.prototype.visitPropertyRead = /**
  33055. * @param {?} ast
  33056. * @param {?} mode
  33057. * @return {?}
  33058. */
  33059. function (ast, mode) {
  33060. var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
  33061. if (leftMostSafe) {
  33062. return this.convertSafeAccess(ast, leftMostSafe, mode);
  33063. }
  33064. else {
  33065. var /** @type {?} */ result = null;
  33066. var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
  33067. if (receiver === this._implicitReceiver) {
  33068. result = this._getLocal(ast.name);
  33069. }
  33070. if (result == null) {
  33071. result = receiver.prop(ast.name);
  33072. }
  33073. return convertToStatementIfNeeded(mode, result);
  33074. }
  33075. };
  33076. /**
  33077. * @param {?} ast
  33078. * @param {?} mode
  33079. * @return {?}
  33080. */
  33081. _AstToIrVisitor.prototype.visitPropertyWrite = /**
  33082. * @param {?} ast
  33083. * @param {?} mode
  33084. * @return {?}
  33085. */
  33086. function (ast, mode) {
  33087. var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
  33088. if (receiver === this._implicitReceiver) {
  33089. var /** @type {?} */ varExpr = this._getLocal(ast.name);
  33090. if (varExpr) {
  33091. throw new Error('Cannot assign to a reference or variable!');
  33092. }
  33093. }
  33094. return convertToStatementIfNeeded(mode, receiver.prop(ast.name).set(this._visit(ast.value, _Mode.Expression)));
  33095. };
  33096. /**
  33097. * @param {?} ast
  33098. * @param {?} mode
  33099. * @return {?}
  33100. */
  33101. _AstToIrVisitor.prototype.visitSafePropertyRead = /**
  33102. * @param {?} ast
  33103. * @param {?} mode
  33104. * @return {?}
  33105. */
  33106. function (ast, mode) {
  33107. return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
  33108. };
  33109. /**
  33110. * @param {?} ast
  33111. * @param {?} mode
  33112. * @return {?}
  33113. */
  33114. _AstToIrVisitor.prototype.visitSafeMethodCall = /**
  33115. * @param {?} ast
  33116. * @param {?} mode
  33117. * @return {?}
  33118. */
  33119. function (ast, mode) {
  33120. return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
  33121. };
  33122. /**
  33123. * @param {?} asts
  33124. * @param {?} mode
  33125. * @return {?}
  33126. */
  33127. _AstToIrVisitor.prototype.visitAll = /**
  33128. * @param {?} asts
  33129. * @param {?} mode
  33130. * @return {?}
  33131. */
  33132. function (asts, mode) {
  33133. var _this = this;
  33134. return asts.map(function (ast) { return _this._visit(ast, mode); });
  33135. };
  33136. /**
  33137. * @param {?} ast
  33138. * @param {?} mode
  33139. * @return {?}
  33140. */
  33141. _AstToIrVisitor.prototype.visitQuote = /**
  33142. * @param {?} ast
  33143. * @param {?} mode
  33144. * @return {?}
  33145. */
  33146. function (ast, mode) {
  33147. throw new Error("Quotes are not supported for evaluation!\n Statement: " + ast.uninterpretedExpression + " located at " + ast.location);
  33148. };
  33149. /**
  33150. * @param {?} ast
  33151. * @param {?} mode
  33152. * @return {?}
  33153. */
  33154. _AstToIrVisitor.prototype._visit = /**
  33155. * @param {?} ast
  33156. * @param {?} mode
  33157. * @return {?}
  33158. */
  33159. function (ast, mode) {
  33160. var /** @type {?} */ result = this._resultMap.get(ast);
  33161. if (result)
  33162. return result;
  33163. return (this._nodeMap.get(ast) || ast).visit(this, mode);
  33164. };
  33165. /**
  33166. * @param {?} ast
  33167. * @param {?} leftMostSafe
  33168. * @param {?} mode
  33169. * @return {?}
  33170. */
  33171. _AstToIrVisitor.prototype.convertSafeAccess = /**
  33172. * @param {?} ast
  33173. * @param {?} leftMostSafe
  33174. * @param {?} mode
  33175. * @return {?}
  33176. */
  33177. function (ast, leftMostSafe, mode) {
  33178. // If the expression contains a safe access node on the left it needs to be converted to
  33179. // an expression that guards the access to the member by checking the receiver for blank. As
  33180. // execution proceeds from left to right, the left most part of the expression must be guarded
  33181. // first but, because member access is left associative, the right side of the expression is at
  33182. // the top of the AST. The desired result requires lifting a copy of the the left part of the
  33183. // expression up to test it for blank before generating the unguarded version.
  33184. // Consider, for example the following expression: a?.b.c?.d.e
  33185. // This results in the ast:
  33186. // .
  33187. // / \
  33188. // ?. e
  33189. // / \
  33190. // . d
  33191. // / \
  33192. // ?. c
  33193. // / \
  33194. // a b
  33195. // The following tree should be generated:
  33196. //
  33197. // /---- ? ----\
  33198. // / | \
  33199. // a /--- ? ---\ null
  33200. // / | \
  33201. // . . null
  33202. // / \ / \
  33203. // . c . e
  33204. // / \ / \
  33205. // a b , d
  33206. // / \
  33207. // . c
  33208. // / \
  33209. // a b
  33210. //
  33211. // Notice that the first guard condition is the left hand of the left most safe access node
  33212. // which comes in as leftMostSafe to this routine.
  33213. var /** @type {?} */ guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression);
  33214. var /** @type {?} */ temporary = /** @type {?} */ ((undefined));
  33215. if (this.needsTemporary(leftMostSafe.receiver)) {
  33216. // If the expression has method calls or pipes then we need to save the result into a
  33217. // temporary variable to avoid calling stateful or impure code more than once.
  33218. temporary = this.allocateTemporary();
  33219. // Preserve the result in the temporary variable
  33220. guardedExpression = temporary.set(guardedExpression);
  33221. // Ensure all further references to the guarded expression refer to the temporary instead.
  33222. this._resultMap.set(leftMostSafe.receiver, temporary);
  33223. }
  33224. var /** @type {?} */ condition = guardedExpression.isBlank();
  33225. // Convert the ast to an unguarded access to the receiver's member. The map will substitute
  33226. // leftMostNode with its unguarded version in the call to `this.visit()`.
  33227. if (leftMostSafe instanceof SafeMethodCall) {
  33228. this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args));
  33229. }
  33230. else {
  33231. this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name));
  33232. }
  33233. // Recursively convert the node now without the guarded member access.
  33234. var /** @type {?} */ access = this._visit(ast, _Mode.Expression);
  33235. // Remove the mapping. This is not strictly required as the converter only traverses each node
  33236. // once but is safer if the conversion is changed to traverse the nodes more than once.
  33237. this._nodeMap.delete(leftMostSafe);
  33238. // If we allocated a temporary, release it.
  33239. if (temporary) {
  33240. this.releaseTemporary(temporary);
  33241. }
  33242. // Produce the conditional
  33243. return convertToStatementIfNeeded(mode, condition.conditional(literal(null), access));
  33244. };
  33245. /**
  33246. * @param {?} ast
  33247. * @return {?}
  33248. */
  33249. _AstToIrVisitor.prototype.leftMostSafeNode = /**
  33250. * @param {?} ast
  33251. * @return {?}
  33252. */
  33253. function (ast) {
  33254. var _this = this;
  33255. var /** @type {?} */ visit = function (visitor, ast) {
  33256. return (_this._nodeMap.get(ast) || ast).visit(visitor);
  33257. };
  33258. return ast.visit({
  33259. visitBinary: /**
  33260. * @param {?} ast
  33261. * @return {?}
  33262. */
  33263. function (ast) { return null; },
  33264. visitChain: /**
  33265. * @param {?} ast
  33266. * @return {?}
  33267. */
  33268. function (ast) { return null; },
  33269. visitConditional: /**
  33270. * @param {?} ast
  33271. * @return {?}
  33272. */
  33273. function (ast) { return null; },
  33274. visitFunctionCall: /**
  33275. * @param {?} ast
  33276. * @return {?}
  33277. */
  33278. function (ast) { return null; },
  33279. visitImplicitReceiver: /**
  33280. * @param {?} ast
  33281. * @return {?}
  33282. */
  33283. function (ast) { return null; },
  33284. visitInterpolation: /**
  33285. * @param {?} ast
  33286. * @return {?}
  33287. */
  33288. function (ast) { return null; },
  33289. visitKeyedRead: /**
  33290. * @param {?} ast
  33291. * @return {?}
  33292. */
  33293. function (ast) { return visit(this, ast.obj); },
  33294. visitKeyedWrite: /**
  33295. * @param {?} ast
  33296. * @return {?}
  33297. */
  33298. function (ast) { return null; },
  33299. visitLiteralArray: /**
  33300. * @param {?} ast
  33301. * @return {?}
  33302. */
  33303. function (ast) { return null; },
  33304. visitLiteralMap: /**
  33305. * @param {?} ast
  33306. * @return {?}
  33307. */
  33308. function (ast) { return null; },
  33309. visitLiteralPrimitive: /**
  33310. * @param {?} ast
  33311. * @return {?}
  33312. */
  33313. function (ast) { return null; },
  33314. visitMethodCall: /**
  33315. * @param {?} ast
  33316. * @return {?}
  33317. */
  33318. function (ast) { return visit(this, ast.receiver); },
  33319. visitPipe: /**
  33320. * @param {?} ast
  33321. * @return {?}
  33322. */
  33323. function (ast) { return null; },
  33324. visitPrefixNot: /**
  33325. * @param {?} ast
  33326. * @return {?}
  33327. */
  33328. function (ast) { return null; },
  33329. visitNonNullAssert: /**
  33330. * @param {?} ast
  33331. * @return {?}
  33332. */
  33333. function (ast) { return null; },
  33334. visitPropertyRead: /**
  33335. * @param {?} ast
  33336. * @return {?}
  33337. */
  33338. function (ast) { return visit(this, ast.receiver); },
  33339. visitPropertyWrite: /**
  33340. * @param {?} ast
  33341. * @return {?}
  33342. */
  33343. function (ast) { return null; },
  33344. visitQuote: /**
  33345. * @param {?} ast
  33346. * @return {?}
  33347. */
  33348. function (ast) { return null; },
  33349. visitSafeMethodCall: /**
  33350. * @param {?} ast
  33351. * @return {?}
  33352. */
  33353. function (ast) { return visit(this, ast.receiver) || ast; },
  33354. visitSafePropertyRead: /**
  33355. * @param {?} ast
  33356. * @return {?}
  33357. */
  33358. function (ast) {
  33359. return visit(this, ast.receiver) || ast;
  33360. }
  33361. });
  33362. };
  33363. /**
  33364. * @param {?} ast
  33365. * @return {?}
  33366. */
  33367. _AstToIrVisitor.prototype.needsTemporary = /**
  33368. * @param {?} ast
  33369. * @return {?}
  33370. */
  33371. function (ast) {
  33372. var _this = this;
  33373. var /** @type {?} */ visit = function (visitor, ast) {
  33374. return ast && (_this._nodeMap.get(ast) || ast).visit(visitor);
  33375. };
  33376. var /** @type {?} */ visitSome = function (visitor, ast) {
  33377. return ast.some(function (ast) { return visit(visitor, ast); });
  33378. };
  33379. return ast.visit({
  33380. visitBinary: /**
  33381. * @param {?} ast
  33382. * @return {?}
  33383. */
  33384. function (ast) { return visit(this, ast.left) || visit(this, ast.right); },
  33385. visitChain: /**
  33386. * @param {?} ast
  33387. * @return {?}
  33388. */
  33389. function (ast) { return false; },
  33390. visitConditional: /**
  33391. * @param {?} ast
  33392. * @return {?}
  33393. */
  33394. function (ast) {
  33395. return visit(this, ast.condition) || visit(this, ast.trueExp) ||
  33396. visit(this, ast.falseExp);
  33397. },
  33398. visitFunctionCall: /**
  33399. * @param {?} ast
  33400. * @return {?}
  33401. */
  33402. function (ast) { return true; },
  33403. visitImplicitReceiver: /**
  33404. * @param {?} ast
  33405. * @return {?}
  33406. */
  33407. function (ast) { return false; },
  33408. visitInterpolation: /**
  33409. * @param {?} ast
  33410. * @return {?}
  33411. */
  33412. function (ast) { return visitSome(this, ast.expressions); },
  33413. visitKeyedRead: /**
  33414. * @param {?} ast
  33415. * @return {?}
  33416. */
  33417. function (ast) { return false; },
  33418. visitKeyedWrite: /**
  33419. * @param {?} ast
  33420. * @return {?}
  33421. */
  33422. function (ast) { return false; },
  33423. visitLiteralArray: /**
  33424. * @param {?} ast
  33425. * @return {?}
  33426. */
  33427. function (ast) { return true; },
  33428. visitLiteralMap: /**
  33429. * @param {?} ast
  33430. * @return {?}
  33431. */
  33432. function (ast) { return true; },
  33433. visitLiteralPrimitive: /**
  33434. * @param {?} ast
  33435. * @return {?}
  33436. */
  33437. function (ast) { return false; },
  33438. visitMethodCall: /**
  33439. * @param {?} ast
  33440. * @return {?}
  33441. */
  33442. function (ast) { return true; },
  33443. visitPipe: /**
  33444. * @param {?} ast
  33445. * @return {?}
  33446. */
  33447. function (ast) { return true; },
  33448. visitPrefixNot: /**
  33449. * @param {?} ast
  33450. * @return {?}
  33451. */
  33452. function (ast) { return visit(this, ast.expression); },
  33453. visitNonNullAssert: /**
  33454. * @param {?} ast
  33455. * @return {?}
  33456. */
  33457. function (ast) { return visit(this, ast.expression); },
  33458. visitPropertyRead: /**
  33459. * @param {?} ast
  33460. * @return {?}
  33461. */
  33462. function (ast) { return false; },
  33463. visitPropertyWrite: /**
  33464. * @param {?} ast
  33465. * @return {?}
  33466. */
  33467. function (ast) { return false; },
  33468. visitQuote: /**
  33469. * @param {?} ast
  33470. * @return {?}
  33471. */
  33472. function (ast) { return false; },
  33473. visitSafeMethodCall: /**
  33474. * @param {?} ast
  33475. * @return {?}
  33476. */
  33477. function (ast) { return true; },
  33478. visitSafePropertyRead: /**
  33479. * @param {?} ast
  33480. * @return {?}
  33481. */
  33482. function (ast) { return false; }
  33483. });
  33484. };
  33485. /**
  33486. * @return {?}
  33487. */
  33488. _AstToIrVisitor.prototype.allocateTemporary = /**
  33489. * @return {?}
  33490. */
  33491. function () {
  33492. var /** @type {?} */ tempNumber = this._currentTemporary++;
  33493. this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount);
  33494. return new ReadVarExpr(temporaryName(this.bindingId, tempNumber));
  33495. };
  33496. /**
  33497. * @param {?} temporary
  33498. * @return {?}
  33499. */
  33500. _AstToIrVisitor.prototype.releaseTemporary = /**
  33501. * @param {?} temporary
  33502. * @return {?}
  33503. */
  33504. function (temporary) {
  33505. this._currentTemporary--;
  33506. if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) {
  33507. throw new Error("Temporary " + temporary.name + " released out of order");
  33508. }
  33509. };
  33510. return _AstToIrVisitor;
  33511. }());
  33512. /**
  33513. * @param {?} arg
  33514. * @param {?} output
  33515. * @return {?}
  33516. */
  33517. function flattenStatements(arg, output) {
  33518. if (Array.isArray(arg)) {
  33519. (/** @type {?} */ (arg)).forEach(function (entry) { return flattenStatements(entry, output); });
  33520. }
  33521. else {
  33522. output.push(arg);
  33523. }
  33524. }
  33525. var DefaultLocalResolver = /** @class */ (function () {
  33526. function DefaultLocalResolver() {
  33527. }
  33528. /**
  33529. * @param {?} name
  33530. * @return {?}
  33531. */
  33532. DefaultLocalResolver.prototype.getLocal = /**
  33533. * @param {?} name
  33534. * @return {?}
  33535. */
  33536. function (name) {
  33537. if (name === EventHandlerVars.event.name) {
  33538. return EventHandlerVars.event;
  33539. }
  33540. return null;
  33541. };
  33542. return DefaultLocalResolver;
  33543. }());
  33544. /**
  33545. * @param {?} bindingId
  33546. * @return {?}
  33547. */
  33548. function createCurrValueExpr(bindingId) {
  33549. return variable("currVal_" + bindingId); // fix syntax highlighting: `
  33550. }
  33551. /**
  33552. * @param {?} bindingId
  33553. * @return {?}
  33554. */
  33555. function createPreventDefaultVar(bindingId) {
  33556. return variable("pd_" + bindingId);
  33557. }
  33558. /**
  33559. * @param {?} stmt
  33560. * @return {?}
  33561. */
  33562. function convertStmtIntoExpression(stmt) {
  33563. if (stmt instanceof ExpressionStatement) {
  33564. return stmt.expr;
  33565. }
  33566. else if (stmt instanceof ReturnStatement) {
  33567. return stmt.value;
  33568. }
  33569. return null;
  33570. }
  33571. var BuiltinFunctionCall = /** @class */ (function (_super) {
  33572. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BuiltinFunctionCall, _super);
  33573. function BuiltinFunctionCall(span, args, converter) {
  33574. var _this = _super.call(this, span, null, args) || this;
  33575. _this.args = args;
  33576. _this.converter = converter;
  33577. return _this;
  33578. }
  33579. return BuiltinFunctionCall;
  33580. }(FunctionCall));
  33581. /**
  33582. * @fileoverview added by tsickle
  33583. * @suppress {checkTypes} checked by tsc
  33584. */
  33585. /**
  33586. * @license
  33587. * Copyright Google Inc. All Rights Reserved.
  33588. *
  33589. * Use of this source code is governed by an MIT-style license that can be
  33590. * found in the LICENSE file at https://angular.io/license
  33591. */
  33592. /**
  33593. * Generates code that is used to type check templates.
  33594. */
  33595. var TypeCheckCompiler = /** @class */ (function () {
  33596. function TypeCheckCompiler(options, reflector) {
  33597. this.options = options;
  33598. this.reflector = reflector;
  33599. }
  33600. /**
  33601. * Important notes:
  33602. * - This must not produce new `import` statements, but only refer to types outside
  33603. * of the file via the variables provided via externalReferenceVars.
  33604. * This allows Typescript to reuse the old program's structure as no imports have changed.
  33605. * - This must not produce any exports, as this would pollute the .d.ts file
  33606. * and also violate the point above.
  33607. */
  33608. /**
  33609. * Important notes:
  33610. * - This must not produce new `import` statements, but only refer to types outside
  33611. * of the file via the variables provided via externalReferenceVars.
  33612. * This allows Typescript to reuse the old program's structure as no imports have changed.
  33613. * - This must not produce any exports, as this would pollute the .d.ts file
  33614. * and also violate the point above.
  33615. * @param {?} componentId
  33616. * @param {?} component
  33617. * @param {?} template
  33618. * @param {?} usedPipes
  33619. * @param {?} externalReferenceVars
  33620. * @param {?} ctx
  33621. * @return {?}
  33622. */
  33623. TypeCheckCompiler.prototype.compileComponent = /**
  33624. * Important notes:
  33625. * - This must not produce new `import` statements, but only refer to types outside
  33626. * of the file via the variables provided via externalReferenceVars.
  33627. * This allows Typescript to reuse the old program's structure as no imports have changed.
  33628. * - This must not produce any exports, as this would pollute the .d.ts file
  33629. * and also violate the point above.
  33630. * @param {?} componentId
  33631. * @param {?} component
  33632. * @param {?} template
  33633. * @param {?} usedPipes
  33634. * @param {?} externalReferenceVars
  33635. * @param {?} ctx
  33636. * @return {?}
  33637. */
  33638. function (componentId, component, template, usedPipes, externalReferenceVars, ctx) {
  33639. var _this = this;
  33640. var /** @type {?} */ pipes = new Map();
  33641. usedPipes.forEach(function (p) { return pipes.set(p.name, p.type.reference); });
  33642. var /** @type {?} */ embeddedViewCount = 0;
  33643. var /** @type {?} */ viewBuilderFactory = function (parent, guards) {
  33644. var /** @type {?} */ embeddedViewIndex = embeddedViewCount++;
  33645. return new ViewBuilder(_this.options, _this.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory);
  33646. };
  33647. var /** @type {?} */ visitor = viewBuilderFactory(null, []);
  33648. visitor.visitAll([], template);
  33649. return visitor.build(componentId);
  33650. };
  33651. return TypeCheckCompiler;
  33652. }());
  33653. var DYNAMIC_VAR_NAME = '_any';
  33654. var TypeCheckLocalResolver = /** @class */ (function () {
  33655. function TypeCheckLocalResolver() {
  33656. }
  33657. /**
  33658. * @param {?} name
  33659. * @return {?}
  33660. */
  33661. TypeCheckLocalResolver.prototype.getLocal = /**
  33662. * @param {?} name
  33663. * @return {?}
  33664. */
  33665. function (name) {
  33666. if (name === EventHandlerVars.event.name) {
  33667. // References to the event should not be type-checked.
  33668. // TODO(chuckj): determine a better type for the event.
  33669. return variable(DYNAMIC_VAR_NAME);
  33670. }
  33671. return null;
  33672. };
  33673. return TypeCheckLocalResolver;
  33674. }());
  33675. var defaultResolver = new TypeCheckLocalResolver();
  33676. var ViewBuilder = /** @class */ (function () {
  33677. function ViewBuilder(options, reflector, externalReferenceVars, parent, component, isHostComponent, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory) {
  33678. this.options = options;
  33679. this.reflector = reflector;
  33680. this.externalReferenceVars = externalReferenceVars;
  33681. this.parent = parent;
  33682. this.component = component;
  33683. this.isHostComponent = isHostComponent;
  33684. this.embeddedViewIndex = embeddedViewIndex;
  33685. this.pipes = pipes;
  33686. this.guards = guards;
  33687. this.ctx = ctx;
  33688. this.viewBuilderFactory = viewBuilderFactory;
  33689. this.refOutputVars = new Map();
  33690. this.variables = [];
  33691. this.children = [];
  33692. this.updates = [];
  33693. this.actions = [];
  33694. }
  33695. /**
  33696. * @param {?} type
  33697. * @return {?}
  33698. */
  33699. ViewBuilder.prototype.getOutputVar = /**
  33700. * @param {?} type
  33701. * @return {?}
  33702. */
  33703. function (type) {
  33704. var /** @type {?} */ varName;
  33705. if (type === this.component && this.isHostComponent) {
  33706. varName = DYNAMIC_VAR_NAME;
  33707. }
  33708. else if (type instanceof StaticSymbol) {
  33709. varName = this.externalReferenceVars.get(type);
  33710. }
  33711. else {
  33712. varName = DYNAMIC_VAR_NAME;
  33713. }
  33714. if (!varName) {
  33715. throw new Error("Illegal State: referring to a type without a variable " + JSON.stringify(type));
  33716. }
  33717. return varName;
  33718. };
  33719. /**
  33720. * @param {?} ast
  33721. * @return {?}
  33722. */
  33723. ViewBuilder.prototype.getTypeGuardExpressions = /**
  33724. * @param {?} ast
  33725. * @return {?}
  33726. */
  33727. function (ast) {
  33728. var /** @type {?} */ result = this.guards.slice();
  33729. for (var _i = 0, _a = ast.directives; _i < _a.length; _i++) {
  33730. var directive = _a[_i];
  33731. for (var _b = 0, _c = directive.inputs; _b < _c.length; _b++) {
  33732. var input = _c[_b];
  33733. var /** @type {?} */ guard = directive.directive.guards[input.directiveName];
  33734. if (guard) {
  33735. var /** @type {?} */ useIf = guard === 'UseIf';
  33736. result.push({
  33737. guard: guard,
  33738. useIf: useIf,
  33739. expression: /** @type {?} */ ({ context: this.component, value: input.value })
  33740. });
  33741. }
  33742. }
  33743. }
  33744. return result;
  33745. };
  33746. /**
  33747. * @param {?} variables
  33748. * @param {?} astNodes
  33749. * @return {?}
  33750. */
  33751. ViewBuilder.prototype.visitAll = /**
  33752. * @param {?} variables
  33753. * @param {?} astNodes
  33754. * @return {?}
  33755. */
  33756. function (variables, astNodes) {
  33757. this.variables = variables;
  33758. templateVisitAll(this, astNodes);
  33759. };
  33760. /**
  33761. * @param {?} componentId
  33762. * @param {?=} targetStatements
  33763. * @return {?}
  33764. */
  33765. ViewBuilder.prototype.build = /**
  33766. * @param {?} componentId
  33767. * @param {?=} targetStatements
  33768. * @return {?}
  33769. */
  33770. function (componentId, targetStatements) {
  33771. var _this = this;
  33772. if (targetStatements === void 0) { targetStatements = []; }
  33773. this.children.forEach(function (child) { return child.build(componentId, targetStatements); });
  33774. var /** @type {?} */ viewStmts = [variable(DYNAMIC_VAR_NAME).set(NULL_EXPR).toDeclStmt(DYNAMIC_TYPE)];
  33775. var /** @type {?} */ bindingCount = 0;
  33776. this.updates.forEach(function (expression) {
  33777. var _a = _this.preprocessUpdateExpression(expression), sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
  33778. var /** @type {?} */ bindingId = "" + bindingCount++;
  33779. var /** @type {?} */ nameResolver = context === _this.component ? _this : defaultResolver;
  33780. var _b = convertPropertyBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId, BindingForm.General), stmts = _b.stmts, currValExpr = _b.currValExpr;
  33781. stmts.push(new ExpressionStatement(currValExpr));
  33782. viewStmts.push.apply(viewStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
  33783. });
  33784. this.actions.forEach(function (_a) {
  33785. var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
  33786. var /** @type {?} */ bindingId = "" + bindingCount++;
  33787. var /** @type {?} */ nameResolver = context === _this.component ? _this : defaultResolver;
  33788. var stmts = convertActionBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId).stmts;
  33789. viewStmts.push.apply(viewStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
  33790. });
  33791. if (this.guards.length) {
  33792. var /** @type {?} */ guardExpression = undefined;
  33793. for (var _i = 0, _a = this.guards; _i < _a.length; _i++) {
  33794. var guard = _a[_i];
  33795. var _b = this.preprocessUpdateExpression(guard.expression), context = _b.context, value = _b.value;
  33796. var /** @type {?} */ bindingId = "" + bindingCount++;
  33797. var /** @type {?} */ nameResolver = context === this.component ? this : defaultResolver;
  33798. // We only support support simple expressions and ignore others as they
  33799. // are unlikely to affect type narrowing.
  33800. var _c = convertPropertyBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId, BindingForm.TrySimple), stmts = _c.stmts, currValExpr = _c.currValExpr;
  33801. if (stmts.length == 0) {
  33802. var /** @type {?} */ guardClause = guard.useIf ? currValExpr : this.ctx.importExpr(guard.guard).callFn([currValExpr]);
  33803. guardExpression = guardExpression ? guardExpression.and(guardClause) : guardClause;
  33804. }
  33805. }
  33806. if (guardExpression) {
  33807. viewStmts = [new IfStmt(guardExpression, viewStmts)];
  33808. }
  33809. }
  33810. var /** @type {?} */ viewName = "_View_" + componentId + "_" + this.embeddedViewIndex;
  33811. var /** @type {?} */ viewFactory = new DeclareFunctionStmt(viewName, [], viewStmts);
  33812. targetStatements.push(viewFactory);
  33813. return targetStatements;
  33814. };
  33815. /**
  33816. * @param {?} ast
  33817. * @param {?} context
  33818. * @return {?}
  33819. */
  33820. ViewBuilder.prototype.visitBoundText = /**
  33821. * @param {?} ast
  33822. * @param {?} context
  33823. * @return {?}
  33824. */
  33825. function (ast, context) {
  33826. var _this = this;
  33827. var /** @type {?} */ astWithSource = /** @type {?} */ (ast.value);
  33828. var /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast);
  33829. inter.expressions.forEach(function (expr) {
  33830. return _this.updates.push({ context: _this.component, value: expr, sourceSpan: ast.sourceSpan });
  33831. });
  33832. };
  33833. /**
  33834. * @param {?} ast
  33835. * @param {?} context
  33836. * @return {?}
  33837. */
  33838. ViewBuilder.prototype.visitEmbeddedTemplate = /**
  33839. * @param {?} ast
  33840. * @param {?} context
  33841. * @return {?}
  33842. */
  33843. function (ast, context) {
  33844. this.visitElementOrTemplate(ast);
  33845. // Note: The old view compiler used to use an `any` type
  33846. // for the context in any embedded view.
  33847. // We keep this behaivor behind a flag for now.
  33848. if (this.options.fullTemplateTypeCheck) {
  33849. // Find any applicable type guards. For example, NgIf has a type guard on ngIf
  33850. // (see NgIf.ngIfTypeGuard) that can be used to indicate that a template is only
  33851. // stamped out if ngIf is truthy so any bindings in the template can assume that,
  33852. // if a nullable type is used for ngIf, that expression is not null or undefined.
  33853. var /** @type {?} */ guards = this.getTypeGuardExpressions(ast);
  33854. var /** @type {?} */ childVisitor = this.viewBuilderFactory(this, guards);
  33855. this.children.push(childVisitor);
  33856. childVisitor.visitAll(ast.variables, ast.children);
  33857. }
  33858. };
  33859. /**
  33860. * @param {?} ast
  33861. * @param {?} context
  33862. * @return {?}
  33863. */
  33864. ViewBuilder.prototype.visitElement = /**
  33865. * @param {?} ast
  33866. * @param {?} context
  33867. * @return {?}
  33868. */
  33869. function (ast, context) {
  33870. var _this = this;
  33871. this.visitElementOrTemplate(ast);
  33872. var /** @type {?} */ inputDefs = [];
  33873. var /** @type {?} */ updateRendererExpressions = [];
  33874. var /** @type {?} */ outputDefs = [];
  33875. ast.inputs.forEach(function (inputAst) {
  33876. _this.updates.push({ context: _this.component, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
  33877. });
  33878. templateVisitAll(this, ast.children);
  33879. };
  33880. /**
  33881. * @param {?} ast
  33882. * @return {?}
  33883. */
  33884. ViewBuilder.prototype.visitElementOrTemplate = /**
  33885. * @param {?} ast
  33886. * @return {?}
  33887. */
  33888. function (ast) {
  33889. var _this = this;
  33890. ast.directives.forEach(function (dirAst) { _this.visitDirective(dirAst); });
  33891. ast.references.forEach(function (ref) {
  33892. var /** @type {?} */ outputVarType = /** @type {?} */ ((null));
  33893. // Note: The old view compiler used to use an `any` type
  33894. // for directives exposed via `exportAs`.
  33895. // We keep this behaivor behind a flag for now.
  33896. if (ref.value && ref.value.identifier && _this.options.fullTemplateTypeCheck) {
  33897. outputVarType = ref.value.identifier.reference;
  33898. }
  33899. else {
  33900. outputVarType = BuiltinTypeName.Dynamic;
  33901. }
  33902. _this.refOutputVars.set(ref.name, outputVarType);
  33903. });
  33904. ast.outputs.forEach(function (outputAst) {
  33905. _this.actions.push({ context: _this.component, value: outputAst.handler, sourceSpan: outputAst.sourceSpan });
  33906. });
  33907. };
  33908. /**
  33909. * @param {?} dirAst
  33910. * @return {?}
  33911. */
  33912. ViewBuilder.prototype.visitDirective = /**
  33913. * @param {?} dirAst
  33914. * @return {?}
  33915. */
  33916. function (dirAst) {
  33917. var _this = this;
  33918. var /** @type {?} */ dirType = dirAst.directive.type.reference;
  33919. dirAst.inputs.forEach(function (input) {
  33920. return _this.updates.push({ context: _this.component, value: input.value, sourceSpan: input.sourceSpan });
  33921. });
  33922. // Note: The old view compiler used to use an `any` type
  33923. // for expressions in host properties / events.
  33924. // We keep this behaivor behind a flag for now.
  33925. if (this.options.fullTemplateTypeCheck) {
  33926. dirAst.hostProperties.forEach(function (inputAst) {
  33927. return _this.updates.push({ context: dirType, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
  33928. });
  33929. dirAst.hostEvents.forEach(function (hostEventAst) {
  33930. return _this.actions.push({
  33931. context: dirType,
  33932. value: hostEventAst.handler,
  33933. sourceSpan: hostEventAst.sourceSpan
  33934. });
  33935. });
  33936. }
  33937. };
  33938. /**
  33939. * @param {?} name
  33940. * @return {?}
  33941. */
  33942. ViewBuilder.prototype.getLocal = /**
  33943. * @param {?} name
  33944. * @return {?}
  33945. */
  33946. function (name) {
  33947. if (name == EventHandlerVars.event.name) {
  33948. return variable(this.getOutputVar(BuiltinTypeName.Dynamic));
  33949. }
  33950. for (var /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent) {
  33951. var /** @type {?} */ outputVarType = void 0;
  33952. // check references
  33953. outputVarType = currBuilder.refOutputVars.get(name);
  33954. if (outputVarType == null) {
  33955. // check variables
  33956. var /** @type {?} */ varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
  33957. if (varAst) {
  33958. outputVarType = BuiltinTypeName.Dynamic;
  33959. }
  33960. }
  33961. if (outputVarType != null) {
  33962. return variable(this.getOutputVar(outputVarType));
  33963. }
  33964. }
  33965. return null;
  33966. };
  33967. /**
  33968. * @param {?} name
  33969. * @return {?}
  33970. */
  33971. ViewBuilder.prototype.pipeOutputVar = /**
  33972. * @param {?} name
  33973. * @return {?}
  33974. */
  33975. function (name) {
  33976. var /** @type {?} */ pipe = this.pipes.get(name);
  33977. if (!pipe) {
  33978. throw new Error("Illegal State: Could not find pipe " + name + " in template of " + this.component);
  33979. }
  33980. return this.getOutputVar(pipe);
  33981. };
  33982. /**
  33983. * @param {?} expression
  33984. * @return {?}
  33985. */
  33986. ViewBuilder.prototype.preprocessUpdateExpression = /**
  33987. * @param {?} expression
  33988. * @return {?}
  33989. */
  33990. function (expression) {
  33991. var _this = this;
  33992. return {
  33993. sourceSpan: expression.sourceSpan,
  33994. context: expression.context,
  33995. value: convertPropertyBindingBuiltins({
  33996. createLiteralArrayConverter: function (argCount) {
  33997. return function (args) {
  33998. var /** @type {?} */ arr = literalArr(args);
  33999. // Note: The old view compiler used to use an `any` type
  34000. // for arrays.
  34001. return _this.options.fullTemplateTypeCheck ? arr : arr.cast(DYNAMIC_TYPE);
  34002. };
  34003. },
  34004. createLiteralMapConverter: function (keys) {
  34005. return function (values) {
  34006. var /** @type {?} */ entries = keys.map(function (k, i) {
  34007. return ({
  34008. key: k.key,
  34009. value: values[i],
  34010. quoted: k.quoted,
  34011. });
  34012. });
  34013. var /** @type {?} */ map = literalMap(entries);
  34014. // Note: The old view compiler used to use an `any` type
  34015. // for maps.
  34016. return _this.options.fullTemplateTypeCheck ? map : map.cast(DYNAMIC_TYPE);
  34017. };
  34018. },
  34019. createPipeConverter: function (name, argCount) {
  34020. return function (args) {
  34021. // Note: The old view compiler used to use an `any` type
  34022. // for pipes.
  34023. var /** @type {?} */ pipeExpr = _this.options.fullTemplateTypeCheck ?
  34024. variable(_this.pipeOutputVar(name)) :
  34025. variable(_this.getOutputVar(BuiltinTypeName.Dynamic));
  34026. return pipeExpr.callMethod('transform', args);
  34027. };
  34028. },
  34029. }, expression.value)
  34030. };
  34031. };
  34032. /**
  34033. * @param {?} ast
  34034. * @param {?} context
  34035. * @return {?}
  34036. */
  34037. ViewBuilder.prototype.visitNgContent = /**
  34038. * @param {?} ast
  34039. * @param {?} context
  34040. * @return {?}
  34041. */
  34042. function (ast, context) { };
  34043. /**
  34044. * @param {?} ast
  34045. * @param {?} context
  34046. * @return {?}
  34047. */
  34048. ViewBuilder.prototype.visitText = /**
  34049. * @param {?} ast
  34050. * @param {?} context
  34051. * @return {?}
  34052. */
  34053. function (ast, context) { };
  34054. /**
  34055. * @param {?} ast
  34056. * @param {?} context
  34057. * @return {?}
  34058. */
  34059. ViewBuilder.prototype.visitDirectiveProperty = /**
  34060. * @param {?} ast
  34061. * @param {?} context
  34062. * @return {?}
  34063. */
  34064. function (ast, context) { };
  34065. /**
  34066. * @param {?} ast
  34067. * @param {?} context
  34068. * @return {?}
  34069. */
  34070. ViewBuilder.prototype.visitReference = /**
  34071. * @param {?} ast
  34072. * @param {?} context
  34073. * @return {?}
  34074. */
  34075. function (ast, context) { };
  34076. /**
  34077. * @param {?} ast
  34078. * @param {?} context
  34079. * @return {?}
  34080. */
  34081. ViewBuilder.prototype.visitVariable = /**
  34082. * @param {?} ast
  34083. * @param {?} context
  34084. * @return {?}
  34085. */
  34086. function (ast, context) { };
  34087. /**
  34088. * @param {?} ast
  34089. * @param {?} context
  34090. * @return {?}
  34091. */
  34092. ViewBuilder.prototype.visitEvent = /**
  34093. * @param {?} ast
  34094. * @param {?} context
  34095. * @return {?}
  34096. */
  34097. function (ast, context) { };
  34098. /**
  34099. * @param {?} ast
  34100. * @param {?} context
  34101. * @return {?}
  34102. */
  34103. ViewBuilder.prototype.visitElementProperty = /**
  34104. * @param {?} ast
  34105. * @param {?} context
  34106. * @return {?}
  34107. */
  34108. function (ast, context) { };
  34109. /**
  34110. * @param {?} ast
  34111. * @param {?} context
  34112. * @return {?}
  34113. */
  34114. ViewBuilder.prototype.visitAttr = /**
  34115. * @param {?} ast
  34116. * @param {?} context
  34117. * @return {?}
  34118. */
  34119. function (ast, context) { };
  34120. return ViewBuilder;
  34121. }());
  34122. /**
  34123. * @fileoverview added by tsickle
  34124. * @suppress {checkTypes} checked by tsc
  34125. */
  34126. /**
  34127. * @license
  34128. * Copyright Google Inc. All Rights Reserved.
  34129. *
  34130. * Use of this source code is governed by an MIT-style license that can be
  34131. * found in the LICENSE file at https://angular.io/license
  34132. */
  34133. var CLASS_ATTR$1 = 'class';
  34134. var STYLE_ATTR = 'style';
  34135. var IMPLICIT_TEMPLATE_VAR = '\$implicit';
  34136. var ViewCompileResult = /** @class */ (function () {
  34137. function ViewCompileResult(viewClassVar, rendererTypeVar) {
  34138. this.viewClassVar = viewClassVar;
  34139. this.rendererTypeVar = rendererTypeVar;
  34140. }
  34141. return ViewCompileResult;
  34142. }());
  34143. var ViewCompiler = /** @class */ (function () {
  34144. function ViewCompiler(_reflector) {
  34145. this._reflector = _reflector;
  34146. }
  34147. /**
  34148. * @param {?} outputCtx
  34149. * @param {?} component
  34150. * @param {?} template
  34151. * @param {?} styles
  34152. * @param {?} usedPipes
  34153. * @return {?}
  34154. */
  34155. ViewCompiler.prototype.compileComponent = /**
  34156. * @param {?} outputCtx
  34157. * @param {?} component
  34158. * @param {?} template
  34159. * @param {?} styles
  34160. * @param {?} usedPipes
  34161. * @return {?}
  34162. */
  34163. function (outputCtx, component, template, styles, usedPipes) {
  34164. var _this = this;
  34165. var /** @type {?} */ embeddedViewCount = 0;
  34166. var /** @type {?} */ staticQueryIds = findStaticQueryIds(template);
  34167. var /** @type {?} */ renderComponentVarName = /** @type {?} */ ((undefined));
  34168. if (!component.isHost) {
  34169. var /** @type {?} */ template_1 = /** @type {?} */ ((component.template));
  34170. var /** @type {?} */ customRenderData = [];
  34171. if (template_1.animations && template_1.animations.length) {
  34172. customRenderData.push(new LiteralMapEntry('animation', convertValueToOutputAst(outputCtx, template_1.animations), true));
  34173. }
  34174. var /** @type {?} */ renderComponentVar = variable(rendererTypeName(component.type.reference));
  34175. renderComponentVarName = /** @type {?} */ ((renderComponentVar.name));
  34176. outputCtx.statements.push(renderComponentVar
  34177. .set(importExpr(Identifiers.createRendererType2).callFn([new LiteralMapExpr([
  34178. new LiteralMapEntry('encapsulation', literal(template_1.encapsulation), false),
  34179. new LiteralMapEntry('styles', styles, false),
  34180. new LiteralMapEntry('data', new LiteralMapExpr(customRenderData), false)
  34181. ])]))
  34182. .toDeclStmt(importType(Identifiers.RendererType2), [StmtModifier.Final, StmtModifier.Exported]));
  34183. }
  34184. var /** @type {?} */ viewBuilderFactory = function (parent) {
  34185. var /** @type {?} */ embeddedViewIndex = embeddedViewCount++;
  34186. return new ViewBuilder$1(_this._reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory);
  34187. };
  34188. var /** @type {?} */ visitor = viewBuilderFactory(null);
  34189. visitor.visitAll([], template);
  34190. (_a = outputCtx.statements).push.apply(_a, visitor.build());
  34191. return new ViewCompileResult(visitor.viewName, renderComponentVarName);
  34192. var _a;
  34193. };
  34194. return ViewCompiler;
  34195. }());
  34196. var LOG_VAR$1 = variable('_l');
  34197. var VIEW_VAR = variable('_v');
  34198. var CHECK_VAR = variable('_ck');
  34199. var COMP_VAR = variable('_co');
  34200. var EVENT_NAME_VAR = variable('en');
  34201. var ALLOW_DEFAULT_VAR = variable("ad");
  34202. var ViewBuilder$1 = /** @class */ (function () {
  34203. function ViewBuilder(reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory) {
  34204. this.reflector = reflector;
  34205. this.outputCtx = outputCtx;
  34206. this.parent = parent;
  34207. this.component = component;
  34208. this.embeddedViewIndex = embeddedViewIndex;
  34209. this.usedPipes = usedPipes;
  34210. this.staticQueryIds = staticQueryIds;
  34211. this.viewBuilderFactory = viewBuilderFactory;
  34212. this.nodes = [];
  34213. this.purePipeNodeIndices = Object.create(null);
  34214. this.refNodeIndices = Object.create(null);
  34215. this.variables = [];
  34216. this.children = [];
  34217. // TODO(tbosch): The old view compiler used to use an `any` type
  34218. // for the context in any embedded view. We keep this behaivor for now
  34219. // to be able to introduce the new view compiler without too many errors.
  34220. this.compType = this.embeddedViewIndex > 0 ?
  34221. DYNAMIC_TYPE : /** @type {?} */
  34222. ((expressionType(outputCtx.importExpr(this.component.type.reference))));
  34223. this.viewName = viewClassName(this.component.type.reference, this.embeddedViewIndex);
  34224. }
  34225. /**
  34226. * @param {?} variables
  34227. * @param {?} astNodes
  34228. * @return {?}
  34229. */
  34230. ViewBuilder.prototype.visitAll = /**
  34231. * @param {?} variables
  34232. * @param {?} astNodes
  34233. * @return {?}
  34234. */
  34235. function (variables, astNodes) {
  34236. var _this = this;
  34237. this.variables = variables;
  34238. // create the pipes for the pure pipes immediately, so that we know their indices.
  34239. if (!this.parent) {
  34240. this.usedPipes.forEach(function (pipe) {
  34241. if (pipe.pure) {
  34242. _this.purePipeNodeIndices[pipe.name] = _this._createPipe(null, pipe);
  34243. }
  34244. });
  34245. }
  34246. if (!this.parent) {
  34247. var /** @type {?} */ queryIds_1 = staticViewQueryIds(this.staticQueryIds);
  34248. this.component.viewQueries.forEach(function (query, queryIndex) {
  34249. // Note: queries start with id 1 so we can use the number in a Bloom filter!
  34250. var /** @type {?} */ queryId = queryIndex + 1;
  34251. var /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1;
  34252. var /** @type {?} */ flags = 134217728 /* TypeViewQuery */ | calcStaticDynamicQueryFlags(queryIds_1, queryId, query.first);
  34253. _this.nodes.push(function () {
  34254. return ({
  34255. sourceSpan: null,
  34256. nodeFlags: flags,
  34257. nodeDef: importExpr(Identifiers.queryDef).callFn([
  34258. literal(flags), literal(queryId),
  34259. new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
  34260. ])
  34261. });
  34262. });
  34263. });
  34264. }
  34265. templateVisitAll(this, astNodes);
  34266. if (this.parent && (astNodes.length === 0 || needsAdditionalRootNode(astNodes))) {
  34267. // if the view is an embedded view, then we need to add an additional root node in some cases
  34268. this.nodes.push(function () {
  34269. return ({
  34270. sourceSpan: null,
  34271. nodeFlags: 1 /* TypeElement */,
  34272. nodeDef: importExpr(Identifiers.anchorDef).callFn([
  34273. literal(0 /* None */), NULL_EXPR, NULL_EXPR, literal(0)
  34274. ])
  34275. });
  34276. });
  34277. }
  34278. };
  34279. /**
  34280. * @param {?=} targetStatements
  34281. * @return {?}
  34282. */
  34283. ViewBuilder.prototype.build = /**
  34284. * @param {?=} targetStatements
  34285. * @return {?}
  34286. */
  34287. function (targetStatements) {
  34288. if (targetStatements === void 0) { targetStatements = []; }
  34289. this.children.forEach(function (child) { return child.build(targetStatements); });
  34290. var _a = this._createNodeExpressions(), updateRendererStmts = _a.updateRendererStmts, updateDirectivesStmts = _a.updateDirectivesStmts, nodeDefExprs = _a.nodeDefExprs;
  34291. var /** @type {?} */ updateRendererFn = this._createUpdateFn(updateRendererStmts);
  34292. var /** @type {?} */ updateDirectivesFn = this._createUpdateFn(updateDirectivesStmts);
  34293. var /** @type {?} */ viewFlags = 0;
  34294. if (!this.parent && this.component.changeDetection === ChangeDetectionStrategy.OnPush) {
  34295. viewFlags |= 2 /* OnPush */;
  34296. }
  34297. var /** @type {?} */ viewFactory = new DeclareFunctionStmt(this.viewName, [new FnParam(/** @type {?} */ ((LOG_VAR$1.name)))], [new ReturnStatement(importExpr(Identifiers.viewDef).callFn([
  34298. literal(viewFlags),
  34299. literalArr(nodeDefExprs),
  34300. updateDirectivesFn,
  34301. updateRendererFn,
  34302. ]))], importType(Identifiers.ViewDefinition), this.embeddedViewIndex === 0 ? [StmtModifier.Exported] : []);
  34303. targetStatements.push(viewFactory);
  34304. return targetStatements;
  34305. };
  34306. /**
  34307. * @param {?} updateStmts
  34308. * @return {?}
  34309. */
  34310. ViewBuilder.prototype._createUpdateFn = /**
  34311. * @param {?} updateStmts
  34312. * @return {?}
  34313. */
  34314. function (updateStmts) {
  34315. var /** @type {?} */ updateFn;
  34316. if (updateStmts.length > 0) {
  34317. var /** @type {?} */ preStmts = [];
  34318. if (!this.component.isHost && findReadVarNames(updateStmts).has(/** @type {?} */ ((COMP_VAR.name)))) {
  34319. preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
  34320. }
  34321. updateFn = fn([
  34322. new FnParam(/** @type {?} */ ((CHECK_VAR.name)), INFERRED_TYPE),
  34323. new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE)
  34324. ], preStmts.concat(updateStmts), INFERRED_TYPE);
  34325. }
  34326. else {
  34327. updateFn = NULL_EXPR;
  34328. }
  34329. return updateFn;
  34330. };
  34331. /**
  34332. * @param {?} ast
  34333. * @param {?} context
  34334. * @return {?}
  34335. */
  34336. ViewBuilder.prototype.visitNgContent = /**
  34337. * @param {?} ast
  34338. * @param {?} context
  34339. * @return {?}
  34340. */
  34341. function (ast, context) {
  34342. // ngContentDef(ngContentIndex: number, index: number): NodeDef;
  34343. this.nodes.push(function () {
  34344. return ({
  34345. sourceSpan: ast.sourceSpan,
  34346. nodeFlags: 8 /* TypeNgContent */,
  34347. nodeDef: importExpr(Identifiers.ngContentDef).callFn([
  34348. literal(ast.ngContentIndex), literal(ast.index)
  34349. ])
  34350. });
  34351. });
  34352. };
  34353. /**
  34354. * @param {?} ast
  34355. * @param {?} context
  34356. * @return {?}
  34357. */
  34358. ViewBuilder.prototype.visitText = /**
  34359. * @param {?} ast
  34360. * @param {?} context
  34361. * @return {?}
  34362. */
  34363. function (ast, context) {
  34364. // Static text nodes have no check function
  34365. var /** @type {?} */ checkIndex = -1;
  34366. this.nodes.push(function () {
  34367. return ({
  34368. sourceSpan: ast.sourceSpan,
  34369. nodeFlags: 2 /* TypeText */,
  34370. nodeDef: importExpr(Identifiers.textDef).callFn([
  34371. literal(checkIndex),
  34372. literal(ast.ngContentIndex),
  34373. literalArr([literal(ast.value)]),
  34374. ])
  34375. });
  34376. });
  34377. };
  34378. /**
  34379. * @param {?} ast
  34380. * @param {?} context
  34381. * @return {?}
  34382. */
  34383. ViewBuilder.prototype.visitBoundText = /**
  34384. * @param {?} ast
  34385. * @param {?} context
  34386. * @return {?}
  34387. */
  34388. function (ast, context) {
  34389. var _this = this;
  34390. var /** @type {?} */ nodeIndex = this.nodes.length;
  34391. // reserve the space in the nodeDefs array
  34392. this.nodes.push(/** @type {?} */ ((null)));
  34393. var /** @type {?} */ astWithSource = /** @type {?} */ (ast.value);
  34394. var /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast);
  34395. var /** @type {?} */ updateRendererExpressions = inter.expressions.map(function (expr, bindingIndex) {
  34396. return _this._preprocessUpdateExpression({ nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: ast.sourceSpan, context: COMP_VAR, value: expr });
  34397. });
  34398. // Check index is the same as the node index during compilation
  34399. // They might only differ at runtime
  34400. var /** @type {?} */ checkIndex = nodeIndex;
  34401. this.nodes[nodeIndex] = function () {
  34402. return ({
  34403. sourceSpan: ast.sourceSpan,
  34404. nodeFlags: 2 /* TypeText */,
  34405. nodeDef: importExpr(Identifiers.textDef).callFn([
  34406. literal(checkIndex),
  34407. literal(ast.ngContentIndex),
  34408. literalArr(inter.strings.map(function (s) { return literal(s); })),
  34409. ]),
  34410. updateRenderer: updateRendererExpressions
  34411. });
  34412. };
  34413. };
  34414. /**
  34415. * @param {?} ast
  34416. * @param {?} context
  34417. * @return {?}
  34418. */
  34419. ViewBuilder.prototype.visitEmbeddedTemplate = /**
  34420. * @param {?} ast
  34421. * @param {?} context
  34422. * @return {?}
  34423. */
  34424. function (ast, context) {
  34425. var _this = this;
  34426. var /** @type {?} */ nodeIndex = this.nodes.length;
  34427. // reserve the space in the nodeDefs array
  34428. this.nodes.push(/** @type {?} */ ((null)));
  34429. var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, queryMatchesExpr = _a.queryMatchesExpr, hostEvents = _a.hostEvents;
  34430. var /** @type {?} */ childVisitor = this.viewBuilderFactory(this);
  34431. this.children.push(childVisitor);
  34432. childVisitor.visitAll(ast.variables, ast.children);
  34433. var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
  34434. // anchorDef(
  34435. // flags: NodeFlags, matchedQueries: [string, QueryValueType][], ngContentIndex: number,
  34436. // childCount: number, handleEventFn?: ElementHandleEventFn, templateFactory?:
  34437. // ViewDefinitionFactory): NodeDef;
  34438. this.nodes[nodeIndex] = function () {
  34439. return ({
  34440. sourceSpan: ast.sourceSpan,
  34441. nodeFlags: 1 /* TypeElement */ | flags,
  34442. nodeDef: importExpr(Identifiers.anchorDef).callFn([
  34443. literal(flags),
  34444. queryMatchesExpr,
  34445. literal(ast.ngContentIndex),
  34446. literal(childCount),
  34447. _this._createElementHandleEventFn(nodeIndex, hostEvents),
  34448. variable(childVisitor.viewName),
  34449. ])
  34450. });
  34451. };
  34452. };
  34453. /**
  34454. * @param {?} ast
  34455. * @param {?} context
  34456. * @return {?}
  34457. */
  34458. ViewBuilder.prototype.visitElement = /**
  34459. * @param {?} ast
  34460. * @param {?} context
  34461. * @return {?}
  34462. */
  34463. function (ast, context) {
  34464. var _this = this;
  34465. var /** @type {?} */ nodeIndex = this.nodes.length;
  34466. // reserve the space in the nodeDefs array so we can add children
  34467. this.nodes.push(/** @type {?} */ ((null)));
  34468. // Using a null element name creates an anchor.
  34469. var /** @type {?} */ elName = isNgContainer(ast.name) ? null : ast.name;
  34470. var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, usedEvents = _a.usedEvents, queryMatchesExpr = _a.queryMatchesExpr, dirHostBindings = _a.hostBindings, hostEvents = _a.hostEvents;
  34471. var /** @type {?} */ inputDefs = [];
  34472. var /** @type {?} */ updateRendererExpressions = [];
  34473. var /** @type {?} */ outputDefs = [];
  34474. if (elName) {
  34475. var /** @type {?} */ hostBindings = ast.inputs
  34476. .map(function (inputAst) {
  34477. return ({
  34478. context: /** @type {?} */ (COMP_VAR),
  34479. inputAst: inputAst,
  34480. dirAst: /** @type {?} */ (null),
  34481. });
  34482. })
  34483. .concat(dirHostBindings);
  34484. if (hostBindings.length) {
  34485. updateRendererExpressions =
  34486. hostBindings.map(function (hostBinding, bindingIndex) {
  34487. return _this._preprocessUpdateExpression({
  34488. context: hostBinding.context,
  34489. nodeIndex: nodeIndex,
  34490. bindingIndex: bindingIndex,
  34491. sourceSpan: hostBinding.inputAst.sourceSpan,
  34492. value: hostBinding.inputAst.value
  34493. });
  34494. });
  34495. inputDefs = hostBindings.map(function (hostBinding) { return elementBindingDef(hostBinding.inputAst, hostBinding.dirAst); });
  34496. }
  34497. outputDefs = usedEvents.map(function (_a) {
  34498. var target = _a[0], eventName = _a[1];
  34499. return literalArr([literal(target), literal(eventName)]);
  34500. });
  34501. }
  34502. templateVisitAll(this, ast.children);
  34503. var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
  34504. var /** @type {?} */ compAst = ast.directives.find(function (dirAst) { return dirAst.directive.isComponent; });
  34505. var /** @type {?} */ compRendererType = /** @type {?} */ (NULL_EXPR);
  34506. var /** @type {?} */ compView = /** @type {?} */ (NULL_EXPR);
  34507. if (compAst) {
  34508. compView = this.outputCtx.importExpr(compAst.directive.componentViewType);
  34509. compRendererType = this.outputCtx.importExpr(compAst.directive.rendererType);
  34510. }
  34511. // Check index is the same as the node index during compilation
  34512. // They might only differ at runtime
  34513. var /** @type {?} */ checkIndex = nodeIndex;
  34514. this.nodes[nodeIndex] = function () {
  34515. return ({
  34516. sourceSpan: ast.sourceSpan,
  34517. nodeFlags: 1 /* TypeElement */ | flags,
  34518. nodeDef: importExpr(Identifiers.elementDef).callFn([
  34519. literal(checkIndex),
  34520. literal(flags),
  34521. queryMatchesExpr,
  34522. literal(ast.ngContentIndex),
  34523. literal(childCount),
  34524. literal(elName),
  34525. elName ? fixedAttrsDef(ast) : NULL_EXPR,
  34526. inputDefs.length ? literalArr(inputDefs) : NULL_EXPR,
  34527. outputDefs.length ? literalArr(outputDefs) : NULL_EXPR,
  34528. _this._createElementHandleEventFn(nodeIndex, hostEvents),
  34529. compView,
  34530. compRendererType,
  34531. ]),
  34532. updateRenderer: updateRendererExpressions
  34533. });
  34534. };
  34535. };
  34536. /**
  34537. * @param {?} nodeIndex
  34538. * @param {?} ast
  34539. * @return {?}
  34540. */
  34541. ViewBuilder.prototype._visitElementOrTemplate = /**
  34542. * @param {?} nodeIndex
  34543. * @param {?} ast
  34544. * @return {?}
  34545. */
  34546. function (nodeIndex, ast) {
  34547. var _this = this;
  34548. var /** @type {?} */ flags = 0;
  34549. if (ast.hasViewContainer) {
  34550. flags |= 16777216 /* EmbeddedViews */;
  34551. }
  34552. var /** @type {?} */ usedEvents = new Map();
  34553. ast.outputs.forEach(function (event) {
  34554. var _a = elementEventNameAndTarget(event, null), name = _a.name, target = _a.target;
  34555. usedEvents.set(elementEventFullName(target, name), [target, name]);
  34556. });
  34557. ast.directives.forEach(function (dirAst) {
  34558. dirAst.hostEvents.forEach(function (event) {
  34559. var _a = elementEventNameAndTarget(event, dirAst), name = _a.name, target = _a.target;
  34560. usedEvents.set(elementEventFullName(target, name), [target, name]);
  34561. });
  34562. });
  34563. var /** @type {?} */ hostBindings = [];
  34564. var /** @type {?} */ hostEvents = [];
  34565. this._visitComponentFactoryResolverProvider(ast.directives);
  34566. ast.providers.forEach(function (providerAst, providerIndex) {
  34567. var /** @type {?} */ dirAst = /** @type {?} */ ((undefined));
  34568. var /** @type {?} */ dirIndex = /** @type {?} */ ((undefined));
  34569. ast.directives.forEach(function (localDirAst, i) {
  34570. if (localDirAst.directive.type.reference === tokenReference(providerAst.token)) {
  34571. dirAst = localDirAst;
  34572. dirIndex = i;
  34573. }
  34574. });
  34575. if (dirAst) {
  34576. var _a = _this._visitDirective(providerAst, dirAst, dirIndex, nodeIndex, ast.references, ast.queryMatches, usedEvents, /** @type {?} */ ((_this.staticQueryIds.get(/** @type {?} */ (ast))))), dirHostBindings = _a.hostBindings, dirHostEvents = _a.hostEvents;
  34577. hostBindings.push.apply(hostBindings, dirHostBindings);
  34578. hostEvents.push.apply(hostEvents, dirHostEvents);
  34579. }
  34580. else {
  34581. _this._visitProvider(providerAst, ast.queryMatches);
  34582. }
  34583. });
  34584. var /** @type {?} */ queryMatchExprs = [];
  34585. ast.queryMatches.forEach(function (match) {
  34586. var /** @type {?} */ valueType = /** @type {?} */ ((undefined));
  34587. if (tokenReference(match.value) ===
  34588. _this.reflector.resolveExternalReference(Identifiers.ElementRef)) {
  34589. valueType = 0 /* ElementRef */;
  34590. }
  34591. else if (tokenReference(match.value) ===
  34592. _this.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
  34593. valueType = 3 /* ViewContainerRef */;
  34594. }
  34595. else if (tokenReference(match.value) ===
  34596. _this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
  34597. valueType = 2 /* TemplateRef */;
  34598. }
  34599. if (valueType != null) {
  34600. queryMatchExprs.push(literalArr([literal(match.queryId), literal(valueType)]));
  34601. }
  34602. });
  34603. ast.references.forEach(function (ref) {
  34604. var /** @type {?} */ valueType = /** @type {?} */ ((undefined));
  34605. if (!ref.value) {
  34606. valueType = 1 /* RenderElement */;
  34607. }
  34608. else if (tokenReference(ref.value) ===
  34609. _this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
  34610. valueType = 2 /* TemplateRef */;
  34611. }
  34612. if (valueType != null) {
  34613. _this.refNodeIndices[ref.name] = nodeIndex;
  34614. queryMatchExprs.push(literalArr([literal(ref.name), literal(valueType)]));
  34615. }
  34616. });
  34617. ast.outputs.forEach(function (outputAst) {
  34618. hostEvents.push({ context: COMP_VAR, eventAst: outputAst, dirAst: /** @type {?} */ ((null)) });
  34619. });
  34620. return {
  34621. flags: flags,
  34622. usedEvents: Array.from(usedEvents.values()),
  34623. queryMatchesExpr: queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
  34624. hostBindings: hostBindings,
  34625. hostEvents: hostEvents
  34626. };
  34627. };
  34628. /**
  34629. * @param {?} providerAst
  34630. * @param {?} dirAst
  34631. * @param {?} directiveIndex
  34632. * @param {?} elementNodeIndex
  34633. * @param {?} refs
  34634. * @param {?} queryMatches
  34635. * @param {?} usedEvents
  34636. * @param {?} queryIds
  34637. * @return {?}
  34638. */
  34639. ViewBuilder.prototype._visitDirective = /**
  34640. * @param {?} providerAst
  34641. * @param {?} dirAst
  34642. * @param {?} directiveIndex
  34643. * @param {?} elementNodeIndex
  34644. * @param {?} refs
  34645. * @param {?} queryMatches
  34646. * @param {?} usedEvents
  34647. * @param {?} queryIds
  34648. * @return {?}
  34649. */
  34650. function (providerAst, dirAst, directiveIndex, elementNodeIndex, refs, queryMatches, usedEvents, queryIds) {
  34651. var _this = this;
  34652. var /** @type {?} */ nodeIndex = this.nodes.length;
  34653. // reserve the space in the nodeDefs array so we can add children
  34654. this.nodes.push(/** @type {?} */ ((null)));
  34655. dirAst.directive.queries.forEach(function (query, queryIndex) {
  34656. var /** @type {?} */ queryId = dirAst.contentQueryStartId + queryIndex;
  34657. var /** @type {?} */ flags = 67108864 /* TypeContentQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query.first);
  34658. var /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1;
  34659. _this.nodes.push(function () {
  34660. return ({
  34661. sourceSpan: dirAst.sourceSpan,
  34662. nodeFlags: flags,
  34663. nodeDef: importExpr(Identifiers.queryDef).callFn([
  34664. literal(flags), literal(queryId),
  34665. new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
  34666. ]),
  34667. });
  34668. });
  34669. });
  34670. // Note: the operation below might also create new nodeDefs,
  34671. // but we don't want them to be a child of a directive,
  34672. // as they might be a provider/pipe on their own.
  34673. // I.e. we only allow queries as children of directives nodes.
  34674. var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
  34675. var _a = this._visitProviderOrDirective(providerAst, queryMatches), flags = _a.flags, queryMatchExprs = _a.queryMatchExprs, providerExpr = _a.providerExpr, depsExpr = _a.depsExpr;
  34676. refs.forEach(function (ref) {
  34677. if (ref.value && tokenReference(ref.value) === tokenReference(providerAst.token)) {
  34678. _this.refNodeIndices[ref.name] = nodeIndex;
  34679. queryMatchExprs.push(literalArr([literal(ref.name), literal(4 /* Provider */)]));
  34680. }
  34681. });
  34682. if (dirAst.directive.isComponent) {
  34683. flags |= 32768 /* Component */;
  34684. }
  34685. var /** @type {?} */ inputDefs = dirAst.inputs.map(function (inputAst, inputIndex) {
  34686. var /** @type {?} */ mapValue = literalArr([literal(inputIndex), literal(inputAst.directiveName)]);
  34687. // Note: it's important to not quote the key so that we can capture renames by minifiers!
  34688. return new LiteralMapEntry(inputAst.directiveName, mapValue, false);
  34689. });
  34690. var /** @type {?} */ outputDefs = [];
  34691. var /** @type {?} */ dirMeta = dirAst.directive;
  34692. Object.keys(dirMeta.outputs).forEach(function (propName) {
  34693. var /** @type {?} */ eventName = dirMeta.outputs[propName];
  34694. if (usedEvents.has(eventName)) {
  34695. // Note: it's important to not quote the key so that we can capture renames by minifiers!
  34696. outputDefs.push(new LiteralMapEntry(propName, literal(eventName), false));
  34697. }
  34698. });
  34699. var /** @type {?} */ updateDirectiveExpressions = [];
  34700. if (dirAst.inputs.length || (flags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0) {
  34701. updateDirectiveExpressions =
  34702. dirAst.inputs.map(function (input, bindingIndex) {
  34703. return _this._preprocessUpdateExpression({
  34704. nodeIndex: nodeIndex,
  34705. bindingIndex: bindingIndex,
  34706. sourceSpan: input.sourceSpan,
  34707. context: COMP_VAR,
  34708. value: input.value
  34709. });
  34710. });
  34711. }
  34712. var /** @type {?} */ dirContextExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
  34713. var /** @type {?} */ hostBindings = dirAst.hostProperties.map(function (inputAst) {
  34714. return ({
  34715. context: dirContextExpr,
  34716. dirAst: dirAst,
  34717. inputAst: inputAst,
  34718. });
  34719. });
  34720. var /** @type {?} */ hostEvents = dirAst.hostEvents.map(function (hostEventAst) {
  34721. return ({
  34722. context: dirContextExpr,
  34723. eventAst: hostEventAst, dirAst: dirAst,
  34724. });
  34725. });
  34726. // Check index is the same as the node index during compilation
  34727. // They might only differ at runtime
  34728. var /** @type {?} */ checkIndex = nodeIndex;
  34729. this.nodes[nodeIndex] = function () {
  34730. return ({
  34731. sourceSpan: dirAst.sourceSpan,
  34732. nodeFlags: 16384 /* TypeDirective */ | flags,
  34733. nodeDef: importExpr(Identifiers.directiveDef).callFn([
  34734. literal(checkIndex),
  34735. literal(flags),
  34736. queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
  34737. literal(childCount),
  34738. providerExpr,
  34739. depsExpr,
  34740. inputDefs.length ? new LiteralMapExpr(inputDefs) : NULL_EXPR,
  34741. outputDefs.length ? new LiteralMapExpr(outputDefs) : NULL_EXPR,
  34742. ]),
  34743. updateDirectives: updateDirectiveExpressions,
  34744. directive: dirAst.directive.type,
  34745. });
  34746. };
  34747. return { hostBindings: hostBindings, hostEvents: hostEvents };
  34748. };
  34749. /**
  34750. * @param {?} providerAst
  34751. * @param {?} queryMatches
  34752. * @return {?}
  34753. */
  34754. ViewBuilder.prototype._visitProvider = /**
  34755. * @param {?} providerAst
  34756. * @param {?} queryMatches
  34757. * @return {?}
  34758. */
  34759. function (providerAst, queryMatches) {
  34760. this._addProviderNode(this._visitProviderOrDirective(providerAst, queryMatches));
  34761. };
  34762. /**
  34763. * @param {?} directives
  34764. * @return {?}
  34765. */
  34766. ViewBuilder.prototype._visitComponentFactoryResolverProvider = /**
  34767. * @param {?} directives
  34768. * @return {?}
  34769. */
  34770. function (directives) {
  34771. var /** @type {?} */ componentDirMeta = directives.find(function (dirAst) { return dirAst.directive.isComponent; });
  34772. if (componentDirMeta && componentDirMeta.directive.entryComponents.length) {
  34773. var _a = componentFactoryResolverProviderDef(this.reflector, this.outputCtx, 8192 /* PrivateProvider */, componentDirMeta.directive.entryComponents), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
  34774. this._addProviderNode({
  34775. providerExpr: providerExpr,
  34776. depsExpr: depsExpr,
  34777. flags: flags,
  34778. tokenExpr: tokenExpr,
  34779. queryMatchExprs: [],
  34780. sourceSpan: componentDirMeta.sourceSpan
  34781. });
  34782. }
  34783. };
  34784. /**
  34785. * @param {?} data
  34786. * @return {?}
  34787. */
  34788. ViewBuilder.prototype._addProviderNode = /**
  34789. * @param {?} data
  34790. * @return {?}
  34791. */
  34792. function (data) {
  34793. var /** @type {?} */ nodeIndex = this.nodes.length;
  34794. // providerDef(
  34795. // flags: NodeFlags, matchedQueries: [string, QueryValueType][], token:any,
  34796. // value: any, deps: ([DepFlags, any] | any)[]): NodeDef;
  34797. this.nodes.push(function () {
  34798. return ({
  34799. sourceSpan: data.sourceSpan,
  34800. nodeFlags: data.flags,
  34801. nodeDef: importExpr(Identifiers.providerDef).callFn([
  34802. literal(data.flags),
  34803. data.queryMatchExprs.length ? literalArr(data.queryMatchExprs) : NULL_EXPR,
  34804. data.tokenExpr, data.providerExpr, data.depsExpr
  34805. ])
  34806. });
  34807. });
  34808. };
  34809. /**
  34810. * @param {?} providerAst
  34811. * @param {?} queryMatches
  34812. * @return {?}
  34813. */
  34814. ViewBuilder.prototype._visitProviderOrDirective = /**
  34815. * @param {?} providerAst
  34816. * @param {?} queryMatches
  34817. * @return {?}
  34818. */
  34819. function (providerAst, queryMatches) {
  34820. var /** @type {?} */ flags = 0;
  34821. var /** @type {?} */ queryMatchExprs = [];
  34822. queryMatches.forEach(function (match) {
  34823. if (tokenReference(match.value) === tokenReference(providerAst.token)) {
  34824. queryMatchExprs.push(literalArr([literal(match.queryId), literal(4 /* Provider */)]));
  34825. }
  34826. });
  34827. var _a = providerDef(this.outputCtx, providerAst), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, providerFlags = _a.flags, tokenExpr = _a.tokenExpr;
  34828. return {
  34829. flags: flags | providerFlags,
  34830. queryMatchExprs: queryMatchExprs,
  34831. providerExpr: providerExpr,
  34832. depsExpr: depsExpr,
  34833. tokenExpr: tokenExpr,
  34834. sourceSpan: providerAst.sourceSpan
  34835. };
  34836. };
  34837. /**
  34838. * @param {?} name
  34839. * @return {?}
  34840. */
  34841. ViewBuilder.prototype.getLocal = /**
  34842. * @param {?} name
  34843. * @return {?}
  34844. */
  34845. function (name) {
  34846. if (name == EventHandlerVars.event.name) {
  34847. return EventHandlerVars.event;
  34848. }
  34849. var /** @type {?} */ currViewExpr = VIEW_VAR;
  34850. for (var /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent,
  34851. currViewExpr = currViewExpr.prop('parent').cast(DYNAMIC_TYPE)) {
  34852. // check references
  34853. var /** @type {?} */ refNodeIndex = currBuilder.refNodeIndices[name];
  34854. if (refNodeIndex != null) {
  34855. return importExpr(Identifiers.nodeValue).callFn([currViewExpr, literal(refNodeIndex)]);
  34856. }
  34857. // check variables
  34858. var /** @type {?} */ varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
  34859. if (varAst) {
  34860. var /** @type {?} */ varValue = varAst.value || IMPLICIT_TEMPLATE_VAR;
  34861. return currViewExpr.prop('context').prop(varValue);
  34862. }
  34863. }
  34864. return null;
  34865. };
  34866. /**
  34867. * @param {?} sourceSpan
  34868. * @param {?} argCount
  34869. * @return {?}
  34870. */
  34871. ViewBuilder.prototype._createLiteralArrayConverter = /**
  34872. * @param {?} sourceSpan
  34873. * @param {?} argCount
  34874. * @return {?}
  34875. */
  34876. function (sourceSpan, argCount) {
  34877. if (argCount === 0) {
  34878. var /** @type {?} */ valueExpr_1 = importExpr(Identifiers.EMPTY_ARRAY);
  34879. return function () { return valueExpr_1; };
  34880. }
  34881. var /** @type {?} */ checkIndex = this.nodes.length;
  34882. this.nodes.push(function () {
  34883. return ({
  34884. sourceSpan: sourceSpan,
  34885. nodeFlags: 32 /* TypePureArray */,
  34886. nodeDef: importExpr(Identifiers.pureArrayDef).callFn([
  34887. literal(checkIndex),
  34888. literal(argCount),
  34889. ])
  34890. });
  34891. });
  34892. return function (args) { return callCheckStmt(checkIndex, args); };
  34893. };
  34894. /**
  34895. * @param {?} sourceSpan
  34896. * @param {?} keys
  34897. * @return {?}
  34898. */
  34899. ViewBuilder.prototype._createLiteralMapConverter = /**
  34900. * @param {?} sourceSpan
  34901. * @param {?} keys
  34902. * @return {?}
  34903. */
  34904. function (sourceSpan, keys) {
  34905. if (keys.length === 0) {
  34906. var /** @type {?} */ valueExpr_2 = importExpr(Identifiers.EMPTY_MAP);
  34907. return function () { return valueExpr_2; };
  34908. }
  34909. var /** @type {?} */ map = literalMap(keys.map(function (e, i) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, e, { value: literal(i) })); }));
  34910. var /** @type {?} */ checkIndex = this.nodes.length;
  34911. this.nodes.push(function () {
  34912. return ({
  34913. sourceSpan: sourceSpan,
  34914. nodeFlags: 64 /* TypePureObject */,
  34915. nodeDef: importExpr(Identifiers.pureObjectDef).callFn([
  34916. literal(checkIndex),
  34917. map,
  34918. ])
  34919. });
  34920. });
  34921. return function (args) { return callCheckStmt(checkIndex, args); };
  34922. };
  34923. /**
  34924. * @param {?} expression
  34925. * @param {?} name
  34926. * @param {?} argCount
  34927. * @return {?}
  34928. */
  34929. ViewBuilder.prototype._createPipeConverter = /**
  34930. * @param {?} expression
  34931. * @param {?} name
  34932. * @param {?} argCount
  34933. * @return {?}
  34934. */
  34935. function (expression, name, argCount) {
  34936. var /** @type {?} */ pipe = /** @type {?} */ ((this.usedPipes.find(function (pipeSummary) { return pipeSummary.name === name; })));
  34937. if (pipe.pure) {
  34938. var /** @type {?} */ checkIndex_1 = this.nodes.length;
  34939. this.nodes.push(function () {
  34940. return ({
  34941. sourceSpan: expression.sourceSpan,
  34942. nodeFlags: 128 /* TypePurePipe */,
  34943. nodeDef: importExpr(Identifiers.purePipeDef).callFn([
  34944. literal(checkIndex_1),
  34945. literal(argCount),
  34946. ])
  34947. });
  34948. });
  34949. // find underlying pipe in the component view
  34950. var /** @type {?} */ compViewExpr = VIEW_VAR;
  34951. var /** @type {?} */ compBuilder = this;
  34952. while (compBuilder.parent) {
  34953. compBuilder = compBuilder.parent;
  34954. compViewExpr = compViewExpr.prop('parent').cast(DYNAMIC_TYPE);
  34955. }
  34956. var /** @type {?} */ pipeNodeIndex = compBuilder.purePipeNodeIndices[name];
  34957. var /** @type {?} */ pipeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([compViewExpr, literal(pipeNodeIndex)]);
  34958. return function (args) {
  34959. return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, callCheckStmt(checkIndex_1, [pipeValueExpr_1].concat(args)));
  34960. };
  34961. }
  34962. else {
  34963. var /** @type {?} */ nodeIndex = this._createPipe(expression.sourceSpan, pipe);
  34964. var /** @type {?} */ nodeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
  34965. return function (args) {
  34966. return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, nodeValueExpr_1.callMethod('transform', args));
  34967. };
  34968. }
  34969. };
  34970. /**
  34971. * @param {?} sourceSpan
  34972. * @param {?} pipe
  34973. * @return {?}
  34974. */
  34975. ViewBuilder.prototype._createPipe = /**
  34976. * @param {?} sourceSpan
  34977. * @param {?} pipe
  34978. * @return {?}
  34979. */
  34980. function (sourceSpan, pipe) {
  34981. var _this = this;
  34982. var /** @type {?} */ nodeIndex = this.nodes.length;
  34983. var /** @type {?} */ flags = 0;
  34984. pipe.type.lifecycleHooks.forEach(function (lifecycleHook) {
  34985. // for pipes, we only support ngOnDestroy
  34986. if (lifecycleHook === LifecycleHooks.OnDestroy) {
  34987. flags |= lifecycleHookToNodeFlag(lifecycleHook);
  34988. }
  34989. });
  34990. var /** @type {?} */ depExprs = pipe.type.diDeps.map(function (diDep) { return depDef(_this.outputCtx, diDep); });
  34991. // function pipeDef(
  34992. // flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef
  34993. this.nodes.push(function () {
  34994. return ({
  34995. sourceSpan: sourceSpan,
  34996. nodeFlags: 16 /* TypePipe */,
  34997. nodeDef: importExpr(Identifiers.pipeDef).callFn([
  34998. literal(flags), _this.outputCtx.importExpr(pipe.type.reference), literalArr(depExprs)
  34999. ])
  35000. });
  35001. });
  35002. return nodeIndex;
  35003. };
  35004. /**
  35005. * For the AST in `UpdateExpression.value`:
  35006. * - create nodes for pipes, literal arrays and, literal maps,
  35007. * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
  35008. *
  35009. * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
  35010. * @param {?} expression
  35011. * @return {?}
  35012. */
  35013. ViewBuilder.prototype._preprocessUpdateExpression = /**
  35014. * For the AST in `UpdateExpression.value`:
  35015. * - create nodes for pipes, literal arrays and, literal maps,
  35016. * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
  35017. *
  35018. * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
  35019. * @param {?} expression
  35020. * @return {?}
  35021. */
  35022. function (expression) {
  35023. var _this = this;
  35024. return {
  35025. nodeIndex: expression.nodeIndex,
  35026. bindingIndex: expression.bindingIndex,
  35027. sourceSpan: expression.sourceSpan,
  35028. context: expression.context,
  35029. value: convertPropertyBindingBuiltins({
  35030. createLiteralArrayConverter: function (argCount) {
  35031. return _this._createLiteralArrayConverter(expression.sourceSpan, argCount);
  35032. },
  35033. createLiteralMapConverter: function (keys) {
  35034. return _this._createLiteralMapConverter(expression.sourceSpan, keys);
  35035. },
  35036. createPipeConverter: function (name, argCount) {
  35037. return _this._createPipeConverter(expression, name, argCount);
  35038. }
  35039. }, expression.value)
  35040. };
  35041. };
  35042. /**
  35043. * @return {?}
  35044. */
  35045. ViewBuilder.prototype._createNodeExpressions = /**
  35046. * @return {?}
  35047. */
  35048. function () {
  35049. var /** @type {?} */ self = this;
  35050. var /** @type {?} */ updateBindingCount = 0;
  35051. var /** @type {?} */ updateRendererStmts = [];
  35052. var /** @type {?} */ updateDirectivesStmts = [];
  35053. var /** @type {?} */ nodeDefExprs = this.nodes.map(function (factory, nodeIndex) {
  35054. var _a = factory(), nodeDef = _a.nodeDef, nodeFlags = _a.nodeFlags, updateDirectives = _a.updateDirectives, updateRenderer = _a.updateRenderer, sourceSpan = _a.sourceSpan;
  35055. if (updateRenderer) {
  35056. updateRendererStmts.push.apply(updateRendererStmts, createUpdateStatements(nodeIndex, sourceSpan, updateRenderer, false));
  35057. }
  35058. if (updateDirectives) {
  35059. updateDirectivesStmts.push.apply(updateDirectivesStmts, createUpdateStatements(nodeIndex, sourceSpan, updateDirectives, (nodeFlags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0));
  35060. }
  35061. // We use a comma expression to call the log function before
  35062. // the nodeDef function, but still use the result of the nodeDef function
  35063. // as the value.
  35064. // Note: We only add the logger to elements / text nodes,
  35065. // so we don't generate too much code.
  35066. var /** @type {?} */ logWithNodeDef = nodeFlags & 3 /* CatRenderNode */ ?
  35067. new CommaExpr([LOG_VAR$1.callFn([]).callFn([]), nodeDef]) :
  35068. nodeDef;
  35069. return applySourceSpanToExpressionIfNeeded(logWithNodeDef, sourceSpan);
  35070. });
  35071. return { updateRendererStmts: updateRendererStmts, updateDirectivesStmts: updateDirectivesStmts, nodeDefExprs: nodeDefExprs };
  35072. /**
  35073. * @param {?} nodeIndex
  35074. * @param {?} sourceSpan
  35075. * @param {?} expressions
  35076. * @param {?} allowEmptyExprs
  35077. * @return {?}
  35078. */
  35079. function createUpdateStatements(nodeIndex, sourceSpan, expressions, allowEmptyExprs) {
  35080. var /** @type {?} */ updateStmts = [];
  35081. var /** @type {?} */ exprs = expressions.map(function (_a) {
  35082. var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
  35083. var /** @type {?} */ bindingId = "" + updateBindingCount++;
  35084. var /** @type {?} */ nameResolver = context === COMP_VAR ? self : null;
  35085. var _b = convertPropertyBinding(nameResolver, context, value, bindingId, BindingForm.General), stmts = _b.stmts, currValExpr = _b.currValExpr;
  35086. updateStmts.push.apply(updateStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
  35087. return applySourceSpanToExpressionIfNeeded(currValExpr, sourceSpan);
  35088. });
  35089. if (expressions.length || allowEmptyExprs) {
  35090. updateStmts.push(applySourceSpanToStatementIfNeeded(callCheckStmt(nodeIndex, exprs).toStmt(), sourceSpan));
  35091. }
  35092. return updateStmts;
  35093. }
  35094. };
  35095. /**
  35096. * @param {?} nodeIndex
  35097. * @param {?} handlers
  35098. * @return {?}
  35099. */
  35100. ViewBuilder.prototype._createElementHandleEventFn = /**
  35101. * @param {?} nodeIndex
  35102. * @param {?} handlers
  35103. * @return {?}
  35104. */
  35105. function (nodeIndex, handlers) {
  35106. var _this = this;
  35107. var /** @type {?} */ handleEventStmts = [];
  35108. var /** @type {?} */ handleEventBindingCount = 0;
  35109. handlers.forEach(function (_a) {
  35110. var context = _a.context, eventAst = _a.eventAst, dirAst = _a.dirAst;
  35111. var /** @type {?} */ bindingId = "" + handleEventBindingCount++;
  35112. var /** @type {?} */ nameResolver = context === COMP_VAR ? _this : null;
  35113. var _b = convertActionBinding(nameResolver, context, eventAst.handler, bindingId), stmts = _b.stmts, allowDefault = _b.allowDefault;
  35114. var /** @type {?} */ trueStmts = stmts;
  35115. if (allowDefault) {
  35116. trueStmts.push(ALLOW_DEFAULT_VAR.set(allowDefault.and(ALLOW_DEFAULT_VAR)).toStmt());
  35117. }
  35118. var _c = elementEventNameAndTarget(eventAst, dirAst), eventTarget = _c.target, eventName = _c.name;
  35119. var /** @type {?} */ fullEventName = elementEventFullName(eventTarget, eventName);
  35120. handleEventStmts.push(applySourceSpanToStatementIfNeeded(new IfStmt(literal(fullEventName).identical(EVENT_NAME_VAR), trueStmts), eventAst.sourceSpan));
  35121. });
  35122. var /** @type {?} */ handleEventFn;
  35123. if (handleEventStmts.length > 0) {
  35124. var /** @type {?} */ preStmts = [ALLOW_DEFAULT_VAR.set(literal(true)).toDeclStmt(BOOL_TYPE)];
  35125. if (!this.component.isHost && findReadVarNames(handleEventStmts).has(/** @type {?} */ ((COMP_VAR.name)))) {
  35126. preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
  35127. }
  35128. handleEventFn = fn([
  35129. new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE),
  35130. new FnParam(/** @type {?} */ ((EVENT_NAME_VAR.name)), INFERRED_TYPE),
  35131. new FnParam(/** @type {?} */ ((EventHandlerVars.event.name)), INFERRED_TYPE)
  35132. ], preStmts.concat(handleEventStmts, [new ReturnStatement(ALLOW_DEFAULT_VAR)]), INFERRED_TYPE);
  35133. }
  35134. else {
  35135. handleEventFn = NULL_EXPR;
  35136. }
  35137. return handleEventFn;
  35138. };
  35139. /**
  35140. * @param {?} ast
  35141. * @param {?} context
  35142. * @return {?}
  35143. */
  35144. ViewBuilder.prototype.visitDirective = /**
  35145. * @param {?} ast
  35146. * @param {?} context
  35147. * @return {?}
  35148. */
  35149. function (ast, context) { };
  35150. /**
  35151. * @param {?} ast
  35152. * @param {?} context
  35153. * @return {?}
  35154. */
  35155. ViewBuilder.prototype.visitDirectiveProperty = /**
  35156. * @param {?} ast
  35157. * @param {?} context
  35158. * @return {?}
  35159. */
  35160. function (ast, context) { };
  35161. /**
  35162. * @param {?} ast
  35163. * @param {?} context
  35164. * @return {?}
  35165. */
  35166. ViewBuilder.prototype.visitReference = /**
  35167. * @param {?} ast
  35168. * @param {?} context
  35169. * @return {?}
  35170. */
  35171. function (ast, context) { };
  35172. /**
  35173. * @param {?} ast
  35174. * @param {?} context
  35175. * @return {?}
  35176. */
  35177. ViewBuilder.prototype.visitVariable = /**
  35178. * @param {?} ast
  35179. * @param {?} context
  35180. * @return {?}
  35181. */
  35182. function (ast, context) { };
  35183. /**
  35184. * @param {?} ast
  35185. * @param {?} context
  35186. * @return {?}
  35187. */
  35188. ViewBuilder.prototype.visitEvent = /**
  35189. * @param {?} ast
  35190. * @param {?} context
  35191. * @return {?}
  35192. */
  35193. function (ast, context) { };
  35194. /**
  35195. * @param {?} ast
  35196. * @param {?} context
  35197. * @return {?}
  35198. */
  35199. ViewBuilder.prototype.visitElementProperty = /**
  35200. * @param {?} ast
  35201. * @param {?} context
  35202. * @return {?}
  35203. */
  35204. function (ast, context) { };
  35205. /**
  35206. * @param {?} ast
  35207. * @param {?} context
  35208. * @return {?}
  35209. */
  35210. ViewBuilder.prototype.visitAttr = /**
  35211. * @param {?} ast
  35212. * @param {?} context
  35213. * @return {?}
  35214. */
  35215. function (ast, context) { };
  35216. return ViewBuilder;
  35217. }());
  35218. /**
  35219. * @param {?} astNodes
  35220. * @return {?}
  35221. */
  35222. function needsAdditionalRootNode(astNodes) {
  35223. var /** @type {?} */ lastAstNode = astNodes[astNodes.length - 1];
  35224. if (lastAstNode instanceof EmbeddedTemplateAst) {
  35225. return lastAstNode.hasViewContainer;
  35226. }
  35227. if (lastAstNode instanceof ElementAst) {
  35228. if (isNgContainer(lastAstNode.name) && lastAstNode.children.length) {
  35229. return needsAdditionalRootNode(lastAstNode.children);
  35230. }
  35231. return lastAstNode.hasViewContainer;
  35232. }
  35233. return lastAstNode instanceof NgContentAst;
  35234. }
  35235. /**
  35236. * @param {?} inputAst
  35237. * @param {?} dirAst
  35238. * @return {?}
  35239. */
  35240. function elementBindingDef(inputAst, dirAst) {
  35241. switch (inputAst.type) {
  35242. case PropertyBindingType.Attribute:
  35243. return literalArr([
  35244. literal(1 /* TypeElementAttribute */), literal(inputAst.name),
  35245. literal(inputAst.securityContext)
  35246. ]);
  35247. case PropertyBindingType.Property:
  35248. return literalArr([
  35249. literal(8 /* TypeProperty */), literal(inputAst.name),
  35250. literal(inputAst.securityContext)
  35251. ]);
  35252. case PropertyBindingType.Animation:
  35253. var /** @type {?} */ bindingType = 8 /* TypeProperty */ |
  35254. (dirAst && dirAst.directive.isComponent ? 32 /* SyntheticHostProperty */ :
  35255. 16 /* SyntheticProperty */);
  35256. return literalArr([
  35257. literal(bindingType), literal('@' + inputAst.name), literal(inputAst.securityContext)
  35258. ]);
  35259. case PropertyBindingType.Class:
  35260. return literalArr([literal(2 /* TypeElementClass */), literal(inputAst.name), NULL_EXPR]);
  35261. case PropertyBindingType.Style:
  35262. return literalArr([
  35263. literal(4 /* TypeElementStyle */), literal(inputAst.name), literal(inputAst.unit)
  35264. ]);
  35265. }
  35266. }
  35267. /**
  35268. * @param {?} elementAst
  35269. * @return {?}
  35270. */
  35271. function fixedAttrsDef(elementAst) {
  35272. var /** @type {?} */ mapResult = Object.create(null);
  35273. elementAst.attrs.forEach(function (attrAst) { mapResult[attrAst.name] = attrAst.value; });
  35274. elementAst.directives.forEach(function (dirAst) {
  35275. Object.keys(dirAst.directive.hostAttributes).forEach(function (name) {
  35276. var /** @type {?} */ value = dirAst.directive.hostAttributes[name];
  35277. var /** @type {?} */ prevValue = mapResult[name];
  35278. mapResult[name] = prevValue != null ? mergeAttributeValue(name, prevValue, value) : value;
  35279. });
  35280. });
  35281. // Note: We need to sort to get a defined output order
  35282. // for tests and for caching generated artifacts...
  35283. return literalArr(Object.keys(mapResult).sort().map(function (attrName) { return literalArr([literal(attrName), literal(mapResult[attrName])]); }));
  35284. }
  35285. /**
  35286. * @param {?} attrName
  35287. * @param {?} attrValue1
  35288. * @param {?} attrValue2
  35289. * @return {?}
  35290. */
  35291. function mergeAttributeValue(attrName, attrValue1, attrValue2) {
  35292. if (attrName == CLASS_ATTR$1 || attrName == STYLE_ATTR) {
  35293. return attrValue1 + " " + attrValue2;
  35294. }
  35295. else {
  35296. return attrValue2;
  35297. }
  35298. }
  35299. /**
  35300. * @param {?} nodeIndex
  35301. * @param {?} exprs
  35302. * @return {?}
  35303. */
  35304. function callCheckStmt(nodeIndex, exprs) {
  35305. if (exprs.length > 10) {
  35306. return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(1 /* Dynamic */), literalArr(exprs)]);
  35307. }
  35308. else {
  35309. return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(0 /* Inline */)].concat(exprs));
  35310. }
  35311. }
  35312. /**
  35313. * @param {?} nodeIndex
  35314. * @param {?} bindingIdx
  35315. * @param {?} expr
  35316. * @return {?}
  35317. */
  35318. function callUnwrapValue(nodeIndex, bindingIdx, expr) {
  35319. return importExpr(Identifiers.unwrapValue).callFn([
  35320. VIEW_VAR, literal(nodeIndex), literal(bindingIdx), expr
  35321. ]);
  35322. }
  35323. /**
  35324. * @param {?} nodes
  35325. * @param {?=} result
  35326. * @return {?}
  35327. */
  35328. function findStaticQueryIds(nodes, result) {
  35329. if (result === void 0) { result = new Map(); }
  35330. nodes.forEach(function (node) {
  35331. var /** @type {?} */ staticQueryIds = new Set();
  35332. var /** @type {?} */ dynamicQueryIds = new Set();
  35333. var /** @type {?} */ queryMatches = /** @type {?} */ ((undefined));
  35334. if (node instanceof ElementAst) {
  35335. findStaticQueryIds(node.children, result);
  35336. node.children.forEach(function (child) {
  35337. var /** @type {?} */ childData = /** @type {?} */ ((result.get(child)));
  35338. childData.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
  35339. childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  35340. });
  35341. queryMatches = node.queryMatches;
  35342. }
  35343. else if (node instanceof EmbeddedTemplateAst) {
  35344. findStaticQueryIds(node.children, result);
  35345. node.children.forEach(function (child) {
  35346. var /** @type {?} */ childData = /** @type {?} */ ((result.get(child)));
  35347. childData.staticQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  35348. childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  35349. });
  35350. queryMatches = node.queryMatches;
  35351. }
  35352. if (queryMatches) {
  35353. queryMatches.forEach(function (match) { return staticQueryIds.add(match.queryId); });
  35354. }
  35355. dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
  35356. result.set(node, { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds });
  35357. });
  35358. return result;
  35359. }
  35360. /**
  35361. * @param {?} nodeStaticQueryIds
  35362. * @return {?}
  35363. */
  35364. function staticViewQueryIds(nodeStaticQueryIds) {
  35365. var /** @type {?} */ staticQueryIds = new Set();
  35366. var /** @type {?} */ dynamicQueryIds = new Set();
  35367. Array.from(nodeStaticQueryIds.values()).forEach(function (entry) {
  35368. entry.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
  35369. entry.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  35370. });
  35371. dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
  35372. return { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds };
  35373. }
  35374. /**
  35375. * @param {?} eventAst
  35376. * @param {?} dirAst
  35377. * @return {?}
  35378. */
  35379. function elementEventNameAndTarget(eventAst, dirAst) {
  35380. if (eventAst.isAnimation) {
  35381. return {
  35382. name: "@" + eventAst.name + "." + eventAst.phase,
  35383. target: dirAst && dirAst.directive.isComponent ? 'component' : null
  35384. };
  35385. }
  35386. else {
  35387. return eventAst;
  35388. }
  35389. }
  35390. /**
  35391. * @param {?} queryIds
  35392. * @param {?} queryId
  35393. * @param {?} isFirst
  35394. * @return {?}
  35395. */
  35396. function calcStaticDynamicQueryFlags(queryIds, queryId, isFirst) {
  35397. var /** @type {?} */ flags = 0;
  35398. // Note: We only make queries static that query for a single item.
  35399. // This is because of backwards compatibility with the old view compiler...
  35400. if (isFirst && (queryIds.staticQueryIds.has(queryId) || !queryIds.dynamicQueryIds.has(queryId))) {
  35401. flags |= 268435456 /* StaticQuery */;
  35402. }
  35403. else {
  35404. flags |= 536870912 /* DynamicQuery */;
  35405. }
  35406. return flags;
  35407. }
  35408. /**
  35409. * @param {?} target
  35410. * @param {?} name
  35411. * @return {?}
  35412. */
  35413. function elementEventFullName(target, name) {
  35414. return target ? target + ":" + name : name;
  35415. }
  35416. /**
  35417. * @fileoverview added by tsickle
  35418. * @suppress {checkTypes} checked by tsc
  35419. */
  35420. /**
  35421. * @license
  35422. * Copyright Google Inc. All Rights Reserved.
  35423. *
  35424. * Use of this source code is governed by an MIT-style license that can be
  35425. * found in the LICENSE file at https://angular.io/license
  35426. */
  35427. /**
  35428. * A container for message extracted from the templates.
  35429. */
  35430. var MessageBundle = /** @class */ (function () {
  35431. function MessageBundle(_htmlParser, _implicitTags, _implicitAttrs, _locale) {
  35432. if (_locale === void 0) { _locale = null; }
  35433. this._htmlParser = _htmlParser;
  35434. this._implicitTags = _implicitTags;
  35435. this._implicitAttrs = _implicitAttrs;
  35436. this._locale = _locale;
  35437. this._messages = [];
  35438. }
  35439. /**
  35440. * @param {?} html
  35441. * @param {?} url
  35442. * @param {?} interpolationConfig
  35443. * @return {?}
  35444. */
  35445. MessageBundle.prototype.updateFromTemplate = /**
  35446. * @param {?} html
  35447. * @param {?} url
  35448. * @param {?} interpolationConfig
  35449. * @return {?}
  35450. */
  35451. function (html, url, interpolationConfig) {
  35452. var /** @type {?} */ htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
  35453. if (htmlParserResult.errors.length) {
  35454. return htmlParserResult.errors;
  35455. }
  35456. var /** @type {?} */ i18nParserResult = extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs);
  35457. if (i18nParserResult.errors.length) {
  35458. return i18nParserResult.errors;
  35459. }
  35460. (_a = this._messages).push.apply(_a, i18nParserResult.messages);
  35461. return [];
  35462. var _a;
  35463. };
  35464. // Return the message in the internal format
  35465. // The public (serialized) format might be different, see the `write` method.
  35466. /**
  35467. * @return {?}
  35468. */
  35469. MessageBundle.prototype.getMessages = /**
  35470. * @return {?}
  35471. */
  35472. function () { return this._messages; };
  35473. /**
  35474. * @param {?} serializer
  35475. * @param {?=} filterSources
  35476. * @return {?}
  35477. */
  35478. MessageBundle.prototype.write = /**
  35479. * @param {?} serializer
  35480. * @param {?=} filterSources
  35481. * @return {?}
  35482. */
  35483. function (serializer, filterSources) {
  35484. var /** @type {?} */ messages = {};
  35485. var /** @type {?} */ mapperVisitor = new MapPlaceholderNames();
  35486. // Deduplicate messages based on their ID
  35487. this._messages.forEach(function (message) {
  35488. var /** @type {?} */ id = serializer.digest(message);
  35489. if (!messages.hasOwnProperty(id)) {
  35490. messages[id] = message;
  35491. }
  35492. else {
  35493. (_a = messages[id].sources).push.apply(_a, message.sources);
  35494. }
  35495. var _a;
  35496. });
  35497. // Transform placeholder names using the serializer mapping
  35498. var /** @type {?} */ msgList = Object.keys(messages).map(function (id) {
  35499. var /** @type {?} */ mapper = serializer.createNameMapper(messages[id]);
  35500. var /** @type {?} */ src = messages[id];
  35501. var /** @type {?} */ nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes;
  35502. var /** @type {?} */ transformedMessage = new Message(nodes, {}, {}, src.meaning, src.description, id);
  35503. transformedMessage.sources = src.sources;
  35504. if (filterSources) {
  35505. transformedMessage.sources.forEach(function (source) { return source.filePath = filterSources(source.filePath); });
  35506. }
  35507. return transformedMessage;
  35508. });
  35509. return serializer.write(msgList, this._locale);
  35510. };
  35511. return MessageBundle;
  35512. }());
  35513. var MapPlaceholderNames = /** @class */ (function (_super) {
  35514. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MapPlaceholderNames, _super);
  35515. function MapPlaceholderNames() {
  35516. return _super !== null && _super.apply(this, arguments) || this;
  35517. }
  35518. /**
  35519. * @param {?} nodes
  35520. * @param {?} mapper
  35521. * @return {?}
  35522. */
  35523. MapPlaceholderNames.prototype.convert = /**
  35524. * @param {?} nodes
  35525. * @param {?} mapper
  35526. * @return {?}
  35527. */
  35528. function (nodes, mapper) {
  35529. var _this = this;
  35530. return mapper ? nodes.map(function (n) { return n.visit(_this, mapper); }) : nodes;
  35531. };
  35532. /**
  35533. * @param {?} ph
  35534. * @param {?} mapper
  35535. * @return {?}
  35536. */
  35537. MapPlaceholderNames.prototype.visitTagPlaceholder = /**
  35538. * @param {?} ph
  35539. * @param {?} mapper
  35540. * @return {?}
  35541. */
  35542. function (ph, mapper) {
  35543. var _this = this;
  35544. var /** @type {?} */ startName = /** @type {?} */ ((mapper.toPublicName(ph.startName)));
  35545. var /** @type {?} */ closeName = ph.closeName ? /** @type {?} */ ((mapper.toPublicName(ph.closeName))) : ph.closeName;
  35546. var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, mapper); });
  35547. return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan);
  35548. };
  35549. /**
  35550. * @param {?} ph
  35551. * @param {?} mapper
  35552. * @return {?}
  35553. */
  35554. MapPlaceholderNames.prototype.visitPlaceholder = /**
  35555. * @param {?} ph
  35556. * @param {?} mapper
  35557. * @return {?}
  35558. */
  35559. function (ph, mapper) {
  35560. return new Placeholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan);
  35561. };
  35562. /**
  35563. * @param {?} ph
  35564. * @param {?} mapper
  35565. * @return {?}
  35566. */
  35567. MapPlaceholderNames.prototype.visitIcuPlaceholder = /**
  35568. * @param {?} ph
  35569. * @param {?} mapper
  35570. * @return {?}
  35571. */
  35572. function (ph, mapper) {
  35573. return new IcuPlaceholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan);
  35574. };
  35575. return MapPlaceholderNames;
  35576. }(CloneVisitor));
  35577. /**
  35578. * @fileoverview added by tsickle
  35579. * @suppress {checkTypes} checked by tsc
  35580. */
  35581. /**
  35582. * @license
  35583. * Copyright Google Inc. All Rights Reserved.
  35584. *
  35585. * Use of this source code is governed by an MIT-style license that can be
  35586. * found in the LICENSE file at https://angular.io/license
  35587. */
  35588. var GeneratedFile = /** @class */ (function () {
  35589. function GeneratedFile(srcFileUrl, genFileUrl, sourceOrStmts) {
  35590. this.srcFileUrl = srcFileUrl;
  35591. this.genFileUrl = genFileUrl;
  35592. if (typeof sourceOrStmts === 'string') {
  35593. this.source = sourceOrStmts;
  35594. this.stmts = null;
  35595. }
  35596. else {
  35597. this.source = null;
  35598. this.stmts = sourceOrStmts;
  35599. }
  35600. }
  35601. /**
  35602. * @param {?} other
  35603. * @return {?}
  35604. */
  35605. GeneratedFile.prototype.isEquivalent = /**
  35606. * @param {?} other
  35607. * @return {?}
  35608. */
  35609. function (other) {
  35610. if (this.genFileUrl !== other.genFileUrl) {
  35611. return false;
  35612. }
  35613. if (this.source) {
  35614. return this.source === other.source;
  35615. }
  35616. if (other.stmts == null) {
  35617. return false;
  35618. }
  35619. // Note: the constructor guarantees that if this.source is not filled,
  35620. // then this.stmts is.
  35621. return areAllEquivalent(/** @type {?} */ ((this.stmts)), /** @type {?} */ ((other.stmts)));
  35622. };
  35623. return GeneratedFile;
  35624. }());
  35625. /**
  35626. * @param {?} file
  35627. * @param {?=} preamble
  35628. * @return {?}
  35629. */
  35630. function toTypeScript(file, preamble) {
  35631. if (preamble === void 0) { preamble = ''; }
  35632. if (!file.stmts) {
  35633. throw new Error("Illegal state: No stmts present on GeneratedFile " + file.genFileUrl);
  35634. }
  35635. return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble);
  35636. }
  35637. /**
  35638. * @fileoverview added by tsickle
  35639. * @suppress {checkTypes} checked by tsc
  35640. */
  35641. /**
  35642. * @license
  35643. * Copyright Google Inc. All Rights Reserved.
  35644. *
  35645. * Use of this source code is governed by an MIT-style license that can be
  35646. * found in the LICENSE file at https://angular.io/license
  35647. */
  35648. /**
  35649. * @record
  35650. */
  35651. /**
  35652. * @param {?} moduleMeta
  35653. * @param {?} reflector
  35654. * @return {?}
  35655. */
  35656. function listLazyRoutes(moduleMeta, reflector) {
  35657. var /** @type {?} */ allLazyRoutes = [];
  35658. for (var _i = 0, _a = moduleMeta.transitiveModule.providers; _i < _a.length; _i++) {
  35659. var _b = _a[_i], provider = _b.provider, module = _b.module;
  35660. if (tokenReference(provider.token) === reflector.ROUTES) {
  35661. var /** @type {?} */ loadChildren = _collectLoadChildren(provider.useValue);
  35662. for (var _c = 0, loadChildren_1 = loadChildren; _c < loadChildren_1.length; _c++) {
  35663. var route = loadChildren_1[_c];
  35664. allLazyRoutes.push(parseLazyRoute(route, reflector, module.reference));
  35665. }
  35666. }
  35667. }
  35668. return allLazyRoutes;
  35669. }
  35670. /**
  35671. * @param {?} routes
  35672. * @param {?=} target
  35673. * @return {?}
  35674. */
  35675. function _collectLoadChildren(routes, target) {
  35676. if (target === void 0) { target = []; }
  35677. if (typeof routes === 'string') {
  35678. target.push(routes);
  35679. }
  35680. else if (Array.isArray(routes)) {
  35681. for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
  35682. var route = routes_1[_i];
  35683. _collectLoadChildren(route, target);
  35684. }
  35685. }
  35686. else if (routes.loadChildren) {
  35687. _collectLoadChildren(routes.loadChildren, target);
  35688. }
  35689. else if (routes.children) {
  35690. _collectLoadChildren(routes.children, target);
  35691. }
  35692. return target;
  35693. }
  35694. /**
  35695. * @param {?} route
  35696. * @param {?} reflector
  35697. * @param {?=} module
  35698. * @return {?}
  35699. */
  35700. function parseLazyRoute(route, reflector, module) {
  35701. var _a = route.split('#'), routePath = _a[0], routeName = _a[1];
  35702. var /** @type {?} */ referencedModule = reflector.resolveExternalReference({
  35703. moduleName: routePath,
  35704. name: routeName,
  35705. }, module ? module.filePath : undefined);
  35706. return { route: route, module: module || referencedModule, referencedModule: referencedModule };
  35707. }
  35708. /**
  35709. * @fileoverview added by tsickle
  35710. * @suppress {checkTypes} checked by tsc
  35711. */
  35712. /**
  35713. * @license
  35714. * Copyright Google Inc. All Rights Reserved.
  35715. *
  35716. * Use of this source code is governed by an MIT-style license that can be
  35717. * found in the LICENSE file at https://angular.io/license
  35718. */
  35719. var ResolvedStaticSymbol = /** @class */ (function () {
  35720. function ResolvedStaticSymbol(symbol, metadata) {
  35721. this.symbol = symbol;
  35722. this.metadata = metadata;
  35723. }
  35724. return ResolvedStaticSymbol;
  35725. }());
  35726. /**
  35727. * The host of the SymbolResolverHost disconnects the implementation from TypeScript / other
  35728. * language
  35729. * services and from underlying file systems.
  35730. * @record
  35731. */
  35732. var SUPPORTED_SCHEMA_VERSION = 4;
  35733. /**
  35734. * This class is responsible for loading metadata per symbol,
  35735. * and normalizing references between symbols.
  35736. *
  35737. * Internally, it only uses symbols without members,
  35738. * and deduces the values for symbols with members based
  35739. * on these symbols.
  35740. */
  35741. var StaticSymbolResolver = /** @class */ (function () {
  35742. function StaticSymbolResolver(host, staticSymbolCache, summaryResolver, errorRecorder) {
  35743. this.host = host;
  35744. this.staticSymbolCache = staticSymbolCache;
  35745. this.summaryResolver = summaryResolver;
  35746. this.errorRecorder = errorRecorder;
  35747. this.metadataCache = new Map();
  35748. this.resolvedSymbols = new Map();
  35749. this.resolvedFilePaths = new Set();
  35750. this.importAs = new Map();
  35751. this.symbolResourcePaths = new Map();
  35752. this.symbolFromFile = new Map();
  35753. this.knownFileNameToModuleNames = new Map();
  35754. }
  35755. /**
  35756. * @param {?} staticSymbol
  35757. * @return {?}
  35758. */
  35759. StaticSymbolResolver.prototype.resolveSymbol = /**
  35760. * @param {?} staticSymbol
  35761. * @return {?}
  35762. */
  35763. function (staticSymbol) {
  35764. if (staticSymbol.members.length > 0) {
  35765. return /** @type {?} */ ((this._resolveSymbolMembers(staticSymbol)));
  35766. }
  35767. // Note: always ask for a summary first,
  35768. // as we might have read shallow metadata via a .d.ts file
  35769. // for the symbol.
  35770. var /** @type {?} */ resultFromSummary = /** @type {?} */ ((this._resolveSymbolFromSummary(staticSymbol)));
  35771. if (resultFromSummary) {
  35772. return resultFromSummary;
  35773. }
  35774. var /** @type {?} */ resultFromCache = this.resolvedSymbols.get(staticSymbol);
  35775. if (resultFromCache) {
  35776. return resultFromCache;
  35777. }
  35778. // Note: Some users use libraries that were not compiled with ngc, i.e. they don't
  35779. // have summaries, only .d.ts files. So we always need to check both, the summary
  35780. // and metadata.
  35781. this._createSymbolsOf(staticSymbol.filePath);
  35782. return /** @type {?} */ ((this.resolvedSymbols.get(staticSymbol)));
  35783. };
  35784. /**
  35785. * getImportAs produces a symbol that can be used to import the given symbol.
  35786. * The import might be different than the symbol if the symbol is exported from
  35787. * a library with a summary; in which case we want to import the symbol from the
  35788. * ngfactory re-export instead of directly to avoid introducing a direct dependency
  35789. * on an otherwise indirect dependency.
  35790. *
  35791. * @param staticSymbol the symbol for which to generate a import symbol
  35792. */
  35793. /**
  35794. * getImportAs produces a symbol that can be used to import the given symbol.
  35795. * The import might be different than the symbol if the symbol is exported from
  35796. * a library with a summary; in which case we want to import the symbol from the
  35797. * ngfactory re-export instead of directly to avoid introducing a direct dependency
  35798. * on an otherwise indirect dependency.
  35799. *
  35800. * @param {?} staticSymbol the symbol for which to generate a import symbol
  35801. * @param {?=} useSummaries
  35802. * @return {?}
  35803. */
  35804. StaticSymbolResolver.prototype.getImportAs = /**
  35805. * getImportAs produces a symbol that can be used to import the given symbol.
  35806. * The import might be different than the symbol if the symbol is exported from
  35807. * a library with a summary; in which case we want to import the symbol from the
  35808. * ngfactory re-export instead of directly to avoid introducing a direct dependency
  35809. * on an otherwise indirect dependency.
  35810. *
  35811. * @param {?} staticSymbol the symbol for which to generate a import symbol
  35812. * @param {?=} useSummaries
  35813. * @return {?}
  35814. */
  35815. function (staticSymbol, useSummaries) {
  35816. if (useSummaries === void 0) { useSummaries = true; }
  35817. if (staticSymbol.members.length) {
  35818. var /** @type {?} */ baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name);
  35819. var /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol, useSummaries);
  35820. return baseImportAs ?
  35821. this.getStaticSymbol(baseImportAs.filePath, baseImportAs.name, staticSymbol.members) :
  35822. null;
  35823. }
  35824. var /** @type {?} */ summarizedFileName = stripSummaryForJitFileSuffix(staticSymbol.filePath);
  35825. if (summarizedFileName !== staticSymbol.filePath) {
  35826. var /** @type {?} */ summarizedName = stripSummaryForJitNameSuffix(staticSymbol.name);
  35827. var /** @type {?} */ baseSymbol = this.getStaticSymbol(summarizedFileName, summarizedName, staticSymbol.members);
  35828. var /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol, useSummaries);
  35829. return baseImportAs ?
  35830. this.getStaticSymbol(summaryForJitFileName(baseImportAs.filePath), summaryForJitName(baseImportAs.name), baseSymbol.members) :
  35831. null;
  35832. }
  35833. var /** @type {?} */ result = (useSummaries && this.summaryResolver.getImportAs(staticSymbol)) || null;
  35834. if (!result) {
  35835. result = /** @type {?} */ ((this.importAs.get(staticSymbol)));
  35836. }
  35837. return result;
  35838. };
  35839. /**
  35840. * getResourcePath produces the path to the original location of the symbol and should
  35841. * be used to determine the relative location of resource references recorded in
  35842. * symbol metadata.
  35843. */
  35844. /**
  35845. * getResourcePath produces the path to the original location of the symbol and should
  35846. * be used to determine the relative location of resource references recorded in
  35847. * symbol metadata.
  35848. * @param {?} staticSymbol
  35849. * @return {?}
  35850. */
  35851. StaticSymbolResolver.prototype.getResourcePath = /**
  35852. * getResourcePath produces the path to the original location of the symbol and should
  35853. * be used to determine the relative location of resource references recorded in
  35854. * symbol metadata.
  35855. * @param {?} staticSymbol
  35856. * @return {?}
  35857. */
  35858. function (staticSymbol) {
  35859. return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;
  35860. };
  35861. /**
  35862. * getTypeArity returns the number of generic type parameters the given symbol
  35863. * has. If the symbol is not a type the result is null.
  35864. */
  35865. /**
  35866. * getTypeArity returns the number of generic type parameters the given symbol
  35867. * has. If the symbol is not a type the result is null.
  35868. * @param {?} staticSymbol
  35869. * @return {?}
  35870. */
  35871. StaticSymbolResolver.prototype.getTypeArity = /**
  35872. * getTypeArity returns the number of generic type parameters the given symbol
  35873. * has. If the symbol is not a type the result is null.
  35874. * @param {?} staticSymbol
  35875. * @return {?}
  35876. */
  35877. function (staticSymbol) {
  35878. // If the file is a factory/ngsummary file, don't resolve the symbol as doing so would
  35879. // cause the metadata for an factory/ngsummary file to be loaded which doesn't exist.
  35880. // All references to generated classes must include the correct arity whenever
  35881. // generating code.
  35882. if (isGeneratedFile(staticSymbol.filePath)) {
  35883. return null;
  35884. }
  35885. var /** @type {?} */ resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(staticSymbol));
  35886. while (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) {
  35887. resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(resolvedSymbol.metadata));
  35888. }
  35889. return (resolvedSymbol && resolvedSymbol.metadata && resolvedSymbol.metadata.arity) || null;
  35890. };
  35891. /**
  35892. * @param {?} filePath
  35893. * @return {?}
  35894. */
  35895. StaticSymbolResolver.prototype.getKnownModuleName = /**
  35896. * @param {?} filePath
  35897. * @return {?}
  35898. */
  35899. function (filePath) {
  35900. return this.knownFileNameToModuleNames.get(filePath) || null;
  35901. };
  35902. /**
  35903. * @param {?} sourceSymbol
  35904. * @param {?} targetSymbol
  35905. * @return {?}
  35906. */
  35907. StaticSymbolResolver.prototype.recordImportAs = /**
  35908. * @param {?} sourceSymbol
  35909. * @param {?} targetSymbol
  35910. * @return {?}
  35911. */
  35912. function (sourceSymbol, targetSymbol) {
  35913. sourceSymbol.assertNoMembers();
  35914. targetSymbol.assertNoMembers();
  35915. this.importAs.set(sourceSymbol, targetSymbol);
  35916. };
  35917. /**
  35918. * @param {?} fileName
  35919. * @param {?} moduleName
  35920. * @return {?}
  35921. */
  35922. StaticSymbolResolver.prototype.recordModuleNameForFileName = /**
  35923. * @param {?} fileName
  35924. * @param {?} moduleName
  35925. * @return {?}
  35926. */
  35927. function (fileName, moduleName) {
  35928. this.knownFileNameToModuleNames.set(fileName, moduleName);
  35929. };
  35930. /**
  35931. * Invalidate all information derived from the given file.
  35932. *
  35933. * @param fileName the file to invalidate
  35934. */
  35935. /**
  35936. * Invalidate all information derived from the given file.
  35937. *
  35938. * @param {?} fileName the file to invalidate
  35939. * @return {?}
  35940. */
  35941. StaticSymbolResolver.prototype.invalidateFile = /**
  35942. * Invalidate all information derived from the given file.
  35943. *
  35944. * @param {?} fileName the file to invalidate
  35945. * @return {?}
  35946. */
  35947. function (fileName) {
  35948. this.metadataCache.delete(fileName);
  35949. this.resolvedFilePaths.delete(fileName);
  35950. var /** @type {?} */ symbols = this.symbolFromFile.get(fileName);
  35951. if (symbols) {
  35952. this.symbolFromFile.delete(fileName);
  35953. for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
  35954. var symbol = symbols_1[_i];
  35955. this.resolvedSymbols.delete(symbol);
  35956. this.importAs.delete(symbol);
  35957. this.symbolResourcePaths.delete(symbol);
  35958. }
  35959. }
  35960. };
  35961. /* @internal */
  35962. /**
  35963. * @template T
  35964. * @param {?} cb
  35965. * @return {?}
  35966. */
  35967. StaticSymbolResolver.prototype.ignoreErrorsFor = /**
  35968. * @template T
  35969. * @param {?} cb
  35970. * @return {?}
  35971. */
  35972. function (cb) {
  35973. var /** @type {?} */ recorder = this.errorRecorder;
  35974. this.errorRecorder = function () { };
  35975. try {
  35976. return cb();
  35977. }
  35978. finally {
  35979. this.errorRecorder = recorder;
  35980. }
  35981. };
  35982. /**
  35983. * @param {?} staticSymbol
  35984. * @return {?}
  35985. */
  35986. StaticSymbolResolver.prototype._resolveSymbolMembers = /**
  35987. * @param {?} staticSymbol
  35988. * @return {?}
  35989. */
  35990. function (staticSymbol) {
  35991. var /** @type {?} */ members = staticSymbol.members;
  35992. var /** @type {?} */ baseResolvedSymbol = this.resolveSymbol(this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name));
  35993. if (!baseResolvedSymbol) {
  35994. return null;
  35995. }
  35996. var /** @type {?} */ baseMetadata = unwrapResolvedMetadata(baseResolvedSymbol.metadata);
  35997. if (baseMetadata instanceof StaticSymbol) {
  35998. return new ResolvedStaticSymbol(staticSymbol, this.getStaticSymbol(baseMetadata.filePath, baseMetadata.name, members));
  35999. }
  36000. else if (baseMetadata && baseMetadata.__symbolic === 'class') {
  36001. if (baseMetadata.statics && members.length === 1) {
  36002. return new ResolvedStaticSymbol(staticSymbol, baseMetadata.statics[members[0]]);
  36003. }
  36004. }
  36005. else {
  36006. var /** @type {?} */ value = baseMetadata;
  36007. for (var /** @type {?} */ i = 0; i < members.length && value; i++) {
  36008. value = value[members[i]];
  36009. }
  36010. return new ResolvedStaticSymbol(staticSymbol, value);
  36011. }
  36012. return null;
  36013. };
  36014. /**
  36015. * @param {?} staticSymbol
  36016. * @return {?}
  36017. */
  36018. StaticSymbolResolver.prototype._resolveSymbolFromSummary = /**
  36019. * @param {?} staticSymbol
  36020. * @return {?}
  36021. */
  36022. function (staticSymbol) {
  36023. var /** @type {?} */ summary = this.summaryResolver.resolveSummary(staticSymbol);
  36024. return summary ? new ResolvedStaticSymbol(staticSymbol, summary.metadata) : null;
  36025. };
  36026. /**
  36027. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  36028. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  36029. *
  36030. * @param declarationFile the absolute path of the file where the symbol is declared
  36031. * @param name the name of the type.
  36032. * @param members a symbol for a static member of the named type
  36033. */
  36034. /**
  36035. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  36036. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  36037. *
  36038. * @param {?} declarationFile the absolute path of the file where the symbol is declared
  36039. * @param {?} name the name of the type.
  36040. * @param {?=} members a symbol for a static member of the named type
  36041. * @return {?}
  36042. */
  36043. StaticSymbolResolver.prototype.getStaticSymbol = /**
  36044. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  36045. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  36046. *
  36047. * @param {?} declarationFile the absolute path of the file where the symbol is declared
  36048. * @param {?} name the name of the type.
  36049. * @param {?=} members a symbol for a static member of the named type
  36050. * @return {?}
  36051. */
  36052. function (declarationFile, name, members) {
  36053. return this.staticSymbolCache.get(declarationFile, name, members);
  36054. };
  36055. /**
  36056. * hasDecorators checks a file's metadata for the presense of decorators without evalutating the
  36057. * metadata.
  36058. *
  36059. * @param filePath the absolute path to examine for decorators.
  36060. * @returns true if any class in the file has a decorator.
  36061. */
  36062. /**
  36063. * hasDecorators checks a file's metadata for the presense of decorators without evalutating the
  36064. * metadata.
  36065. *
  36066. * @param {?} filePath the absolute path to examine for decorators.
  36067. * @return {?} true if any class in the file has a decorator.
  36068. */
  36069. StaticSymbolResolver.prototype.hasDecorators = /**
  36070. * hasDecorators checks a file's metadata for the presense of decorators without evalutating the
  36071. * metadata.
  36072. *
  36073. * @param {?} filePath the absolute path to examine for decorators.
  36074. * @return {?} true if any class in the file has a decorator.
  36075. */
  36076. function (filePath) {
  36077. var /** @type {?} */ metadata = this.getModuleMetadata(filePath);
  36078. if (metadata['metadata']) {
  36079. return Object.keys(metadata['metadata']).some(function (metadataKey) {
  36080. var /** @type {?} */ entry = metadata['metadata'][metadataKey];
  36081. return entry && entry.__symbolic === 'class' && entry.decorators;
  36082. });
  36083. }
  36084. return false;
  36085. };
  36086. /**
  36087. * @param {?} filePath
  36088. * @return {?}
  36089. */
  36090. StaticSymbolResolver.prototype.getSymbolsOf = /**
  36091. * @param {?} filePath
  36092. * @return {?}
  36093. */
  36094. function (filePath) {
  36095. var /** @type {?} */ summarySymbols = this.summaryResolver.getSymbolsOf(filePath);
  36096. if (summarySymbols) {
  36097. return summarySymbols;
  36098. }
  36099. // Note: Some users use libraries that were not compiled with ngc, i.e. they don't
  36100. // have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true.
  36101. this._createSymbolsOf(filePath);
  36102. var /** @type {?} */ metadataSymbols = [];
  36103. this.resolvedSymbols.forEach(function (resolvedSymbol) {
  36104. if (resolvedSymbol.symbol.filePath === filePath) {
  36105. metadataSymbols.push(resolvedSymbol.symbol);
  36106. }
  36107. });
  36108. return metadataSymbols;
  36109. };
  36110. /**
  36111. * @param {?} filePath
  36112. * @return {?}
  36113. */
  36114. StaticSymbolResolver.prototype._createSymbolsOf = /**
  36115. * @param {?} filePath
  36116. * @return {?}
  36117. */
  36118. function (filePath) {
  36119. var _this = this;
  36120. if (this.resolvedFilePaths.has(filePath)) {
  36121. return;
  36122. }
  36123. this.resolvedFilePaths.add(filePath);
  36124. var /** @type {?} */ resolvedSymbols = [];
  36125. var /** @type {?} */ metadata = this.getModuleMetadata(filePath);
  36126. if (metadata['importAs']) {
  36127. // Index bundle indices should use the importAs module name defined
  36128. // in the bundle.
  36129. this.knownFileNameToModuleNames.set(filePath, metadata['importAs']);
  36130. }
  36131. // handle the symbols in one of the re-export location
  36132. if (metadata['exports']) {
  36133. var _loop_1 = function (moduleExport) {
  36134. // handle the symbols in the list of explicitly re-exported symbols.
  36135. if (moduleExport.export) {
  36136. moduleExport.export.forEach(function (exportSymbol) {
  36137. var /** @type {?} */ symbolName;
  36138. if (typeof exportSymbol === 'string') {
  36139. symbolName = exportSymbol;
  36140. }
  36141. else {
  36142. symbolName = exportSymbol.as;
  36143. }
  36144. symbolName = unescapeIdentifier(symbolName);
  36145. var /** @type {?} */ symName = symbolName;
  36146. if (typeof exportSymbol !== 'string') {
  36147. symName = unescapeIdentifier(exportSymbol.name);
  36148. }
  36149. var /** @type {?} */ resolvedModule = _this.resolveModule(moduleExport.from, filePath);
  36150. if (resolvedModule) {
  36151. var /** @type {?} */ targetSymbol = _this.getStaticSymbol(resolvedModule, symName);
  36152. var /** @type {?} */ sourceSymbol = _this.getStaticSymbol(filePath, symbolName);
  36153. resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
  36154. }
  36155. });
  36156. }
  36157. else {
  36158. // handle the symbols via export * directives.
  36159. var /** @type {?} */ resolvedModule = this_1.resolveModule(moduleExport.from, filePath);
  36160. if (resolvedModule) {
  36161. var /** @type {?} */ nestedExports = this_1.getSymbolsOf(resolvedModule);
  36162. nestedExports.forEach(function (targetSymbol) {
  36163. var /** @type {?} */ sourceSymbol = _this.getStaticSymbol(filePath, targetSymbol.name);
  36164. resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
  36165. });
  36166. }
  36167. }
  36168. };
  36169. var this_1 = this;
  36170. for (var _i = 0, _a = metadata['exports']; _i < _a.length; _i++) {
  36171. var moduleExport = _a[_i];
  36172. _loop_1(moduleExport);
  36173. }
  36174. }
  36175. // handle the actual metadata. Has to be after the exports
  36176. // as there migth be collisions in the names, and we want the symbols
  36177. // of the current module to win ofter reexports.
  36178. if (metadata['metadata']) {
  36179. // handle direct declarations of the symbol
  36180. var /** @type {?} */ topLevelSymbolNames_1 = new Set(Object.keys(metadata['metadata']).map(unescapeIdentifier));
  36181. var /** @type {?} */ origins_1 = metadata['origins'] || {};
  36182. Object.keys(metadata['metadata']).forEach(function (metadataKey) {
  36183. var /** @type {?} */ symbolMeta = metadata['metadata'][metadataKey];
  36184. var /** @type {?} */ name = unescapeIdentifier(metadataKey);
  36185. var /** @type {?} */ symbol = _this.getStaticSymbol(filePath, name);
  36186. var /** @type {?} */ origin = origins_1.hasOwnProperty(metadataKey) && origins_1[metadataKey];
  36187. if (origin) {
  36188. // If the symbol is from a bundled index, use the declaration location of the
  36189. // symbol so relative references (such as './my.html') will be calculated
  36190. // correctly.
  36191. var /** @type {?} */ originFilePath = _this.resolveModule(origin, filePath);
  36192. if (!originFilePath) {
  36193. _this.reportError(new Error("Couldn't resolve original symbol for " + origin + " from " + filePath));
  36194. }
  36195. else {
  36196. _this.symbolResourcePaths.set(symbol, originFilePath);
  36197. }
  36198. }
  36199. resolvedSymbols.push(_this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames_1, symbolMeta));
  36200. });
  36201. }
  36202. resolvedSymbols.forEach(function (resolvedSymbol) { return _this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol); });
  36203. this.symbolFromFile.set(filePath, resolvedSymbols.map(function (resolvedSymbol) { return resolvedSymbol.symbol; }));
  36204. };
  36205. /**
  36206. * @param {?} sourceSymbol
  36207. * @param {?} topLevelPath
  36208. * @param {?} topLevelSymbolNames
  36209. * @param {?} metadata
  36210. * @return {?}
  36211. */
  36212. StaticSymbolResolver.prototype.createResolvedSymbol = /**
  36213. * @param {?} sourceSymbol
  36214. * @param {?} topLevelPath
  36215. * @param {?} topLevelSymbolNames
  36216. * @param {?} metadata
  36217. * @return {?}
  36218. */
  36219. function (sourceSymbol, topLevelPath, topLevelSymbolNames, metadata) {
  36220. var _this = this;
  36221. // For classes that don't have Angular summaries / metadata,
  36222. // we only keep their arity, but nothing else
  36223. // (e.g. their constructor parameters).
  36224. // We do this to prevent introducing deep imports
  36225. // as we didn't generate .ngfactory.ts files with proper reexports.
  36226. if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && metadata &&
  36227. metadata['__symbolic'] === 'class') {
  36228. var /** @type {?} */ transformedMeta_1 = { __symbolic: 'class', arity: metadata.arity };
  36229. return new ResolvedStaticSymbol(sourceSymbol, transformedMeta_1);
  36230. }
  36231. var /** @type {?} */ _originalFileMemo;
  36232. var /** @type {?} */ getOriginalName = function () {
  36233. if (!_originalFileMemo) {
  36234. // Guess what hte original file name is from the reference. If it has a `.d.ts` extension
  36235. // replace it with `.ts`. If it already has `.ts` just leave it in place. If it doesn't have
  36236. // .ts or .d.ts, append `.ts'. Also, if it is in `node_modules`, trim the `node_module`
  36237. // location as it is not important to finding the file.
  36238. _originalFileMemo =
  36239. _this.host.getOutputName(topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts')
  36240. .replace(/^.*node_modules[/\\]/, ''));
  36241. }
  36242. return _originalFileMemo;
  36243. };
  36244. var /** @type {?} */ self = this;
  36245. var ReferenceTransformer = /** @class */ (function (_super) {
  36246. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReferenceTransformer, _super);
  36247. function ReferenceTransformer() {
  36248. return _super !== null && _super.apply(this, arguments) || this;
  36249. }
  36250. /**
  36251. * @param {?} map
  36252. * @param {?} functionParams
  36253. * @return {?}
  36254. */
  36255. ReferenceTransformer.prototype.visitStringMap = /**
  36256. * @param {?} map
  36257. * @param {?} functionParams
  36258. * @return {?}
  36259. */
  36260. function (map, functionParams) {
  36261. var /** @type {?} */ symbolic = map['__symbolic'];
  36262. if (symbolic === 'function') {
  36263. var /** @type {?} */ oldLen = functionParams.length;
  36264. functionParams.push.apply(functionParams, (map['parameters'] || []));
  36265. var /** @type {?} */ result = _super.prototype.visitStringMap.call(this, map, functionParams);
  36266. functionParams.length = oldLen;
  36267. return result;
  36268. }
  36269. else if (symbolic === 'reference') {
  36270. var /** @type {?} */ module = map['module'];
  36271. var /** @type {?} */ name_1 = map['name'] ? unescapeIdentifier(map['name']) : map['name'];
  36272. if (!name_1) {
  36273. return null;
  36274. }
  36275. var /** @type {?} */ filePath = void 0;
  36276. if (module) {
  36277. filePath = /** @type {?} */ ((self.resolveModule(module, sourceSymbol.filePath)));
  36278. if (!filePath) {
  36279. return {
  36280. __symbolic: 'error',
  36281. message: "Could not resolve " + module + " relative to " + sourceSymbol.filePath + ".",
  36282. line: map["line"],
  36283. character: map["character"],
  36284. fileName: getOriginalName()
  36285. };
  36286. }
  36287. return {
  36288. __symbolic: 'resolved',
  36289. symbol: self.getStaticSymbol(filePath, name_1),
  36290. line: map["line"],
  36291. character: map["character"],
  36292. fileName: getOriginalName()
  36293. };
  36294. }
  36295. else if (functionParams.indexOf(name_1) >= 0) {
  36296. // reference to a function parameter
  36297. return { __symbolic: 'reference', name: name_1 };
  36298. }
  36299. else {
  36300. if (topLevelSymbolNames.has(name_1)) {
  36301. return self.getStaticSymbol(topLevelPath, name_1);
  36302. }
  36303. // ambient value
  36304. null;
  36305. }
  36306. }
  36307. else if (symbolic === 'error') {
  36308. return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, map, { fileName: getOriginalName() });
  36309. }
  36310. else {
  36311. return _super.prototype.visitStringMap.call(this, map, functionParams);
  36312. }
  36313. };
  36314. return ReferenceTransformer;
  36315. }(ValueTransformer));
  36316. var /** @type {?} */ transformedMeta = visitValue(metadata, new ReferenceTransformer(), []);
  36317. var /** @type {?} */ unwrappedTransformedMeta = unwrapResolvedMetadata(transformedMeta);
  36318. if (unwrappedTransformedMeta instanceof StaticSymbol) {
  36319. return this.createExport(sourceSymbol, unwrappedTransformedMeta);
  36320. }
  36321. return new ResolvedStaticSymbol(sourceSymbol, transformedMeta);
  36322. };
  36323. /**
  36324. * @param {?} sourceSymbol
  36325. * @param {?} targetSymbol
  36326. * @return {?}
  36327. */
  36328. StaticSymbolResolver.prototype.createExport = /**
  36329. * @param {?} sourceSymbol
  36330. * @param {?} targetSymbol
  36331. * @return {?}
  36332. */
  36333. function (sourceSymbol, targetSymbol) {
  36334. sourceSymbol.assertNoMembers();
  36335. targetSymbol.assertNoMembers();
  36336. if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) &&
  36337. this.summaryResolver.isLibraryFile(targetSymbol.filePath)) {
  36338. // This case is for an ng library importing symbols from a plain ts library
  36339. // transitively.
  36340. // Note: We rely on the fact that we discover symbols in the direction
  36341. // from source files to library files
  36342. this.importAs.set(targetSymbol, this.getImportAs(sourceSymbol) || sourceSymbol);
  36343. }
  36344. return new ResolvedStaticSymbol(sourceSymbol, targetSymbol);
  36345. };
  36346. /**
  36347. * @param {?} error
  36348. * @param {?=} context
  36349. * @param {?=} path
  36350. * @return {?}
  36351. */
  36352. StaticSymbolResolver.prototype.reportError = /**
  36353. * @param {?} error
  36354. * @param {?=} context
  36355. * @param {?=} path
  36356. * @return {?}
  36357. */
  36358. function (error, context, path) {
  36359. if (this.errorRecorder) {
  36360. this.errorRecorder(error, (context && context.filePath) || path);
  36361. }
  36362. else {
  36363. throw error;
  36364. }
  36365. };
  36366. /**
  36367. * @param {?} module an absolute path to a module file.
  36368. * @return {?}
  36369. */
  36370. StaticSymbolResolver.prototype.getModuleMetadata = /**
  36371. * @param {?} module an absolute path to a module file.
  36372. * @return {?}
  36373. */
  36374. function (module) {
  36375. var /** @type {?} */ moduleMetadata = this.metadataCache.get(module);
  36376. if (!moduleMetadata) {
  36377. var /** @type {?} */ moduleMetadatas = this.host.getMetadataFor(module);
  36378. if (moduleMetadatas) {
  36379. var /** @type {?} */ maxVersion_1 = -1;
  36380. moduleMetadatas.forEach(function (md) {
  36381. if (md && md['version'] > maxVersion_1) {
  36382. maxVersion_1 = md['version'];
  36383. moduleMetadata = md;
  36384. }
  36385. });
  36386. }
  36387. if (!moduleMetadata) {
  36388. moduleMetadata =
  36389. { __symbolic: 'module', version: SUPPORTED_SCHEMA_VERSION, module: module, metadata: {} };
  36390. }
  36391. if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) {
  36392. var /** @type {?} */ errorMessage = moduleMetadata['version'] == 2 ?
  36393. "Unsupported metadata version " + moduleMetadata['version'] + " for module " + module + ". This module should be compiled with a newer version of ngc" :
  36394. "Metadata version mismatch for module " + module + ", found version " + moduleMetadata['version'] + ", expected " + SUPPORTED_SCHEMA_VERSION;
  36395. this.reportError(new Error(errorMessage));
  36396. }
  36397. this.metadataCache.set(module, moduleMetadata);
  36398. }
  36399. return moduleMetadata;
  36400. };
  36401. /**
  36402. * @param {?} module
  36403. * @param {?} symbolName
  36404. * @param {?=} containingFile
  36405. * @return {?}
  36406. */
  36407. StaticSymbolResolver.prototype.getSymbolByModule = /**
  36408. * @param {?} module
  36409. * @param {?} symbolName
  36410. * @param {?=} containingFile
  36411. * @return {?}
  36412. */
  36413. function (module, symbolName, containingFile) {
  36414. var /** @type {?} */ filePath = this.resolveModule(module, containingFile);
  36415. if (!filePath) {
  36416. this.reportError(new Error("Could not resolve module " + module + (containingFile ? ' relative to ' +
  36417. containingFile : '')));
  36418. return this.getStaticSymbol("ERROR:" + module, symbolName);
  36419. }
  36420. return this.getStaticSymbol(filePath, symbolName);
  36421. };
  36422. /**
  36423. * @param {?} module
  36424. * @param {?=} containingFile
  36425. * @return {?}
  36426. */
  36427. StaticSymbolResolver.prototype.resolveModule = /**
  36428. * @param {?} module
  36429. * @param {?=} containingFile
  36430. * @return {?}
  36431. */
  36432. function (module, containingFile) {
  36433. try {
  36434. return this.host.moduleNameToFileName(module, containingFile);
  36435. }
  36436. catch (/** @type {?} */ e) {
  36437. console.error("Could not resolve module '" + module + "' relative to file " + containingFile);
  36438. this.reportError(e, undefined, containingFile);
  36439. }
  36440. return null;
  36441. };
  36442. return StaticSymbolResolver;
  36443. }());
  36444. /**
  36445. * @param {?} identifier
  36446. * @return {?}
  36447. */
  36448. function unescapeIdentifier(identifier) {
  36449. return identifier.startsWith('___') ? identifier.substr(1) : identifier;
  36450. }
  36451. /**
  36452. * @param {?} metadata
  36453. * @return {?}
  36454. */
  36455. function unwrapResolvedMetadata(metadata) {
  36456. if (metadata && metadata.__symbolic === 'resolved') {
  36457. return metadata.symbol;
  36458. }
  36459. return metadata;
  36460. }
  36461. /**
  36462. * @fileoverview added by tsickle
  36463. * @suppress {checkTypes} checked by tsc
  36464. */
  36465. /**
  36466. * @param {?} srcFileName
  36467. * @param {?} forJitCtx
  36468. * @param {?} summaryResolver
  36469. * @param {?} symbolResolver
  36470. * @param {?} symbols
  36471. * @param {?} types
  36472. * @return {?}
  36473. */
  36474. function serializeSummaries(srcFileName, forJitCtx, summaryResolver, symbolResolver, symbols, types) {
  36475. var /** @type {?} */ toJsonSerializer = new ToJsonSerializer(symbolResolver, summaryResolver, srcFileName);
  36476. // for symbols, we use everything except for the class metadata itself
  36477. // (we keep the statics though), as the class metadata is contained in the
  36478. // CompileTypeSummary.
  36479. symbols.forEach(function (resolvedSymbol) {
  36480. return toJsonSerializer.addSummary({ symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata });
  36481. });
  36482. // Add type summaries.
  36483. types.forEach(function (_a) {
  36484. var summary = _a.summary, metadata = _a.metadata;
  36485. toJsonSerializer.addSummary({ symbol: summary.type.reference, metadata: undefined, type: summary });
  36486. });
  36487. var _a = toJsonSerializer.serialize(), json = _a.json, exportAs = _a.exportAs;
  36488. if (forJitCtx) {
  36489. var /** @type {?} */ forJitSerializer_1 = new ForJitSerializer(forJitCtx, symbolResolver, summaryResolver);
  36490. types.forEach(function (_a) {
  36491. var summary = _a.summary, metadata = _a.metadata;
  36492. forJitSerializer_1.addSourceType(summary, metadata);
  36493. });
  36494. toJsonSerializer.unprocessedSymbolSummariesBySymbol.forEach(function (summary) {
  36495. if (summaryResolver.isLibraryFile(summary.symbol.filePath) && summary.type) {
  36496. forJitSerializer_1.addLibType(summary.type);
  36497. }
  36498. });
  36499. forJitSerializer_1.serialize(exportAs);
  36500. }
  36501. return { json: json, exportAs: exportAs };
  36502. }
  36503. /**
  36504. * @param {?} symbolCache
  36505. * @param {?} summaryResolver
  36506. * @param {?} libraryFileName
  36507. * @param {?} json
  36508. * @return {?}
  36509. */
  36510. function deserializeSummaries(symbolCache, summaryResolver, libraryFileName, json) {
  36511. var /** @type {?} */ deserializer = new FromJsonDeserializer(symbolCache, summaryResolver);
  36512. return deserializer.deserialize(libraryFileName, json);
  36513. }
  36514. /**
  36515. * @param {?} outputCtx
  36516. * @param {?} reference
  36517. * @return {?}
  36518. */
  36519. function createForJitStub(outputCtx, reference) {
  36520. return createSummaryForJitFunction(outputCtx, reference, NULL_EXPR);
  36521. }
  36522. /**
  36523. * @param {?} outputCtx
  36524. * @param {?} reference
  36525. * @param {?} value
  36526. * @return {?}
  36527. */
  36528. function createSummaryForJitFunction(outputCtx, reference, value) {
  36529. var /** @type {?} */ fnName = summaryForJitName(reference.name);
  36530. outputCtx.statements.push(fn([], [new ReturnStatement(value)], new ArrayType(DYNAMIC_TYPE)).toDeclStmt(fnName, [
  36531. StmtModifier.Final, StmtModifier.Exported
  36532. ]));
  36533. }
  36534. var ToJsonSerializer = /** @class */ (function (_super) {
  36535. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ToJsonSerializer, _super);
  36536. function ToJsonSerializer(symbolResolver, summaryResolver, srcFileName) {
  36537. var _this = _super.call(this) || this;
  36538. _this.symbolResolver = symbolResolver;
  36539. _this.summaryResolver = summaryResolver;
  36540. _this.srcFileName = srcFileName;
  36541. _this.symbols = [];
  36542. _this.indexBySymbol = new Map();
  36543. _this.reexportedBy = new Map();
  36544. _this.processedSummaryBySymbol = new Map();
  36545. _this.processedSummaries = [];
  36546. _this.unprocessedSymbolSummariesBySymbol = new Map();
  36547. _this.moduleName = symbolResolver.getKnownModuleName(srcFileName);
  36548. return _this;
  36549. }
  36550. /**
  36551. * @param {?} summary
  36552. * @return {?}
  36553. */
  36554. ToJsonSerializer.prototype.addSummary = /**
  36555. * @param {?} summary
  36556. * @return {?}
  36557. */
  36558. function (summary) {
  36559. var _this = this;
  36560. var /** @type {?} */ unprocessedSummary = this.unprocessedSymbolSummariesBySymbol.get(summary.symbol);
  36561. var /** @type {?} */ processedSummary = this.processedSummaryBySymbol.get(summary.symbol);
  36562. if (!unprocessedSummary) {
  36563. unprocessedSummary = { symbol: summary.symbol, metadata: undefined };
  36564. this.unprocessedSymbolSummariesBySymbol.set(summary.symbol, unprocessedSummary);
  36565. processedSummary = { symbol: this.processValue(summary.symbol, 0 /* None */) };
  36566. this.processedSummaries.push(processedSummary);
  36567. this.processedSummaryBySymbol.set(summary.symbol, processedSummary);
  36568. }
  36569. if (!unprocessedSummary.metadata && summary.metadata) {
  36570. var /** @type {?} */ metadata_1 = summary.metadata || {};
  36571. if (metadata_1.__symbolic === 'class') {
  36572. // For classes, we keep everything except their class decorators.
  36573. // We need to keep e.g. the ctor args, method names, method decorators
  36574. // so that the class can be extended in another compilation unit.
  36575. // We don't keep the class decorators as
  36576. // 1) they refer to data
  36577. // that should not cause a rebuild of downstream compilation units
  36578. // (e.g. inline templates of @Component, or @NgModule.declarations)
  36579. // 2) their data is already captured in TypeSummaries, e.g. DirectiveSummary.
  36580. var /** @type {?} */ clone_1 = {};
  36581. Object.keys(metadata_1).forEach(function (propName) {
  36582. if (propName !== 'decorators') {
  36583. clone_1[propName] = metadata_1[propName];
  36584. }
  36585. });
  36586. metadata_1 = clone_1;
  36587. }
  36588. else if (isCall(metadata_1)) {
  36589. if (!isFunctionCall(metadata_1) && !isMethodCallOnVariable(metadata_1)) {
  36590. // Don't store complex calls as we won't be able to simplify them anyways later on.
  36591. // Don't store complex calls as we won't be able to simplify them anyways later on.
  36592. metadata_1 = {
  36593. __symbolic: 'error',
  36594. message: 'Complex function calls are not supported.',
  36595. };
  36596. }
  36597. }
  36598. // Note: We need to keep storing ctor calls for e.g.
  36599. // `export const x = new InjectionToken(...)`
  36600. unprocessedSummary.metadata = metadata_1;
  36601. processedSummary.metadata = this.processValue(metadata_1, 1 /* ResolveValue */);
  36602. if (metadata_1 instanceof StaticSymbol &&
  36603. this.summaryResolver.isLibraryFile(metadata_1.filePath)) {
  36604. var /** @type {?} */ declarationSymbol = this.symbols[/** @type {?} */ ((this.indexBySymbol.get(metadata_1)))];
  36605. if (!isLoweredSymbol(declarationSymbol.name)) {
  36606. // Note: symbols that were introduced during codegen in the user file can have a reexport
  36607. // if a user used `export *`. However, we can't rely on this as tsickle will change
  36608. // `export *` into named exports, using only the information from the typechecker.
  36609. // As we introduce the new symbols after typecheck, Tsickle does not know about them,
  36610. // and omits them when expanding `export *`.
  36611. // So we have to keep reexporting these symbols manually via .ngfactory files.
  36612. this.reexportedBy.set(declarationSymbol, summary.symbol);
  36613. }
  36614. }
  36615. }
  36616. if (!unprocessedSummary.type && summary.type) {
  36617. unprocessedSummary.type = summary.type;
  36618. // Note: We don't add the summaries of all referenced symbols as for the ResolvedSymbols,
  36619. // as the type summaries already contain the transitive data that they require
  36620. // (in a minimal way).
  36621. processedSummary.type = this.processValue(summary.type, 0 /* None */);
  36622. // except for reexported directives / pipes, so we need to store
  36623. // their summaries explicitly.
  36624. if (summary.type.summaryKind === CompileSummaryKind.NgModule) {
  36625. var /** @type {?} */ ngModuleSummary = /** @type {?} */ (summary.type);
  36626. ngModuleSummary.exportedDirectives.concat(ngModuleSummary.exportedPipes).forEach(function (id) {
  36627. var /** @type {?} */ symbol = id.reference;
  36628. if (_this.summaryResolver.isLibraryFile(symbol.filePath) &&
  36629. !_this.unprocessedSymbolSummariesBySymbol.has(symbol)) {
  36630. var /** @type {?} */ summary_1 = _this.summaryResolver.resolveSummary(symbol);
  36631. if (summary_1) {
  36632. _this.addSummary(summary_1);
  36633. }
  36634. }
  36635. });
  36636. }
  36637. }
  36638. };
  36639. /**
  36640. * @return {?}
  36641. */
  36642. ToJsonSerializer.prototype.serialize = /**
  36643. * @return {?}
  36644. */
  36645. function () {
  36646. var _this = this;
  36647. var /** @type {?} */ exportAs = [];
  36648. var /** @type {?} */ json = JSON.stringify({
  36649. moduleName: this.moduleName,
  36650. summaries: this.processedSummaries,
  36651. symbols: this.symbols.map(function (symbol, index) {
  36652. symbol.assertNoMembers();
  36653. var /** @type {?} */ importAs = /** @type {?} */ ((undefined));
  36654. if (_this.summaryResolver.isLibraryFile(symbol.filePath)) {
  36655. var /** @type {?} */ reexportSymbol = _this.reexportedBy.get(symbol);
  36656. if (reexportSymbol) {
  36657. importAs = /** @type {?} */ ((_this.indexBySymbol.get(reexportSymbol)));
  36658. }
  36659. else {
  36660. var /** @type {?} */ summary = _this.unprocessedSymbolSummariesBySymbol.get(symbol);
  36661. if (!summary || !summary.metadata || summary.metadata.__symbolic !== 'interface') {
  36662. importAs = symbol.name + "_" + index;
  36663. exportAs.push({ symbol: symbol, exportAs: importAs });
  36664. }
  36665. }
  36666. }
  36667. return {
  36668. __symbol: index,
  36669. name: symbol.name,
  36670. filePath: _this.summaryResolver.toSummaryFileName(symbol.filePath, _this.srcFileName),
  36671. importAs: importAs
  36672. };
  36673. })
  36674. });
  36675. return { json: json, exportAs: exportAs };
  36676. };
  36677. /**
  36678. * @param {?} value
  36679. * @param {?} flags
  36680. * @return {?}
  36681. */
  36682. ToJsonSerializer.prototype.processValue = /**
  36683. * @param {?} value
  36684. * @param {?} flags
  36685. * @return {?}
  36686. */
  36687. function (value, flags) {
  36688. return visitValue(value, this, flags);
  36689. };
  36690. /**
  36691. * @param {?} value
  36692. * @param {?} context
  36693. * @return {?}
  36694. */
  36695. ToJsonSerializer.prototype.visitOther = /**
  36696. * @param {?} value
  36697. * @param {?} context
  36698. * @return {?}
  36699. */
  36700. function (value, context) {
  36701. if (value instanceof StaticSymbol) {
  36702. var /** @type {?} */ baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name);
  36703. var /** @type {?} */ index = this.visitStaticSymbol(baseSymbol, context);
  36704. return { __symbol: index, members: value.members };
  36705. }
  36706. };
  36707. /**
  36708. * Returns null if the options.resolveValue is true, and the summary for the symbol
  36709. * resolved to a type or could not be resolved.
  36710. * @param {?} baseSymbol
  36711. * @param {?} flags
  36712. * @return {?}
  36713. */
  36714. ToJsonSerializer.prototype.visitStaticSymbol = /**
  36715. * Returns null if the options.resolveValue is true, and the summary for the symbol
  36716. * resolved to a type or could not be resolved.
  36717. * @param {?} baseSymbol
  36718. * @param {?} flags
  36719. * @return {?}
  36720. */
  36721. function (baseSymbol, flags) {
  36722. var /** @type {?} */ index = this.indexBySymbol.get(baseSymbol);
  36723. var /** @type {?} */ summary = null;
  36724. if (flags & 1 /* ResolveValue */ &&
  36725. this.summaryResolver.isLibraryFile(baseSymbol.filePath)) {
  36726. if (this.unprocessedSymbolSummariesBySymbol.has(baseSymbol)) {
  36727. // the summary for this symbol was already added
  36728. // -> nothing to do.
  36729. return /** @type {?} */ ((index));
  36730. }
  36731. summary = this.loadSummary(baseSymbol);
  36732. if (summary && summary.metadata instanceof StaticSymbol) {
  36733. // The summary is a reexport
  36734. index = this.visitStaticSymbol(summary.metadata, flags);
  36735. // reset the summary as it is just a reexport, so we don't want to store it.
  36736. summary = null;
  36737. }
  36738. }
  36739. else if (index != null) {
  36740. // Note: == on purpose to compare with undefined!
  36741. // No summary and the symbol is already added -> nothing to do.
  36742. return index;
  36743. }
  36744. // Note: == on purpose to compare with undefined!
  36745. if (index == null) {
  36746. index = this.symbols.length;
  36747. this.symbols.push(baseSymbol);
  36748. }
  36749. this.indexBySymbol.set(baseSymbol, index);
  36750. if (summary) {
  36751. this.addSummary(summary);
  36752. }
  36753. return index;
  36754. };
  36755. /**
  36756. * @param {?} symbol
  36757. * @return {?}
  36758. */
  36759. ToJsonSerializer.prototype.loadSummary = /**
  36760. * @param {?} symbol
  36761. * @return {?}
  36762. */
  36763. function (symbol) {
  36764. var /** @type {?} */ summary = this.summaryResolver.resolveSummary(symbol);
  36765. if (!summary) {
  36766. // some symbols might originate from a plain typescript library
  36767. // that just exported .d.ts and .metadata.json files, i.e. where no summary
  36768. // files were created.
  36769. var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
  36770. if (resolvedSymbol) {
  36771. summary = { symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata };
  36772. }
  36773. }
  36774. return summary;
  36775. };
  36776. return ToJsonSerializer;
  36777. }(ValueTransformer));
  36778. var ForJitSerializer = /** @class */ (function () {
  36779. function ForJitSerializer(outputCtx, symbolResolver, summaryResolver) {
  36780. this.outputCtx = outputCtx;
  36781. this.symbolResolver = symbolResolver;
  36782. this.summaryResolver = summaryResolver;
  36783. this.data = [];
  36784. }
  36785. /**
  36786. * @param {?} summary
  36787. * @param {?} metadata
  36788. * @return {?}
  36789. */
  36790. ForJitSerializer.prototype.addSourceType = /**
  36791. * @param {?} summary
  36792. * @param {?} metadata
  36793. * @return {?}
  36794. */
  36795. function (summary, metadata) {
  36796. this.data.push({ summary: summary, metadata: metadata, isLibrary: false });
  36797. };
  36798. /**
  36799. * @param {?} summary
  36800. * @return {?}
  36801. */
  36802. ForJitSerializer.prototype.addLibType = /**
  36803. * @param {?} summary
  36804. * @return {?}
  36805. */
  36806. function (summary) {
  36807. this.data.push({ summary: summary, metadata: null, isLibrary: true });
  36808. };
  36809. /**
  36810. * @param {?} exportAsArr
  36811. * @return {?}
  36812. */
  36813. ForJitSerializer.prototype.serialize = /**
  36814. * @param {?} exportAsArr
  36815. * @return {?}
  36816. */
  36817. function (exportAsArr) {
  36818. var _this = this;
  36819. var /** @type {?} */ exportAsBySymbol = new Map();
  36820. for (var _i = 0, exportAsArr_1 = exportAsArr; _i < exportAsArr_1.length; _i++) {
  36821. var _a = exportAsArr_1[_i], symbol = _a.symbol, exportAs = _a.exportAs;
  36822. exportAsBySymbol.set(symbol, exportAs);
  36823. }
  36824. var /** @type {?} */ ngModuleSymbols = new Set();
  36825. for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
  36826. var _d = _c[_b], summary = _d.summary, metadata = _d.metadata, isLibrary = _d.isLibrary;
  36827. if (summary.summaryKind === CompileSummaryKind.NgModule) {
  36828. // collect the symbols that refer to NgModule classes.
  36829. // Note: we can't just rely on `summary.type.summaryKind` to determine this as
  36830. // we don't add the summaries of all referenced symbols when we serialize type summaries.
  36831. // See serializeSummaries for details.
  36832. ngModuleSymbols.add(summary.type.reference);
  36833. var /** @type {?} */ modSummary = /** @type {?} */ (summary);
  36834. for (var _e = 0, _f = modSummary.modules; _e < _f.length; _e++) {
  36835. var mod = _f[_e];
  36836. ngModuleSymbols.add(mod.reference);
  36837. }
  36838. }
  36839. if (!isLibrary) {
  36840. var /** @type {?} */ fnName = summaryForJitName(summary.type.reference.name);
  36841. createSummaryForJitFunction(this.outputCtx, summary.type.reference, this.serializeSummaryWithDeps(summary, /** @type {?} */ ((metadata))));
  36842. }
  36843. }
  36844. ngModuleSymbols.forEach(function (ngModuleSymbol) {
  36845. if (_this.summaryResolver.isLibraryFile(ngModuleSymbol.filePath)) {
  36846. var /** @type {?} */ exportAs = exportAsBySymbol.get(ngModuleSymbol) || ngModuleSymbol.name;
  36847. var /** @type {?} */ jitExportAsName = summaryForJitName(exportAs);
  36848. _this.outputCtx.statements.push(variable(jitExportAsName)
  36849. .set(_this.serializeSummaryRef(ngModuleSymbol))
  36850. .toDeclStmt(null, [StmtModifier.Exported]));
  36851. }
  36852. });
  36853. };
  36854. /**
  36855. * @param {?} summary
  36856. * @param {?} metadata
  36857. * @return {?}
  36858. */
  36859. ForJitSerializer.prototype.serializeSummaryWithDeps = /**
  36860. * @param {?} summary
  36861. * @param {?} metadata
  36862. * @return {?}
  36863. */
  36864. function (summary, metadata) {
  36865. var _this = this;
  36866. var /** @type {?} */ expressions = [this.serializeSummary(summary)];
  36867. var /** @type {?} */ providers = [];
  36868. if (metadata instanceof CompileNgModuleMetadata) {
  36869. expressions.push.apply(expressions,
  36870. // For directives / pipes, we only add the declared ones,
  36871. // and rely on transitively importing NgModules to get the transitive
  36872. // summaries.
  36873. metadata.declaredDirectives.concat(metadata.declaredPipes)
  36874. .map(function (type) { return type.reference; })
  36875. .concat(metadata.transitiveModule.modules.map(function (type) { return type.reference; })
  36876. .filter(function (ref) { return ref !== metadata.type.reference; }))
  36877. .map(function (ref) { return _this.serializeSummaryRef(ref); }));
  36878. // Note: We don't use `NgModuleSummary.providers`, as that one is transitive,
  36879. // and we already have transitive modules.
  36880. providers = metadata.providers;
  36881. }
  36882. else if (summary.summaryKind === CompileSummaryKind.Directive) {
  36883. var /** @type {?} */ dirSummary = /** @type {?} */ (summary);
  36884. providers = dirSummary.providers.concat(dirSummary.viewProviders);
  36885. }
  36886. // Note: We can't just refer to the `ngsummary.ts` files for `useClass` providers (as we do for
  36887. // declaredDirectives / declaredPipes), as we allow
  36888. // providers without ctor arguments to skip the `@Injectable` decorator,
  36889. // i.e. we didn't generate .ngsummary.ts files for these.
  36890. expressions.push.apply(expressions, providers.filter(function (provider) { return !!provider.useClass; }).map(function (provider) {
  36891. return _this.serializeSummary(/** @type {?} */ ({
  36892. summaryKind: CompileSummaryKind.Injectable, type: provider.useClass
  36893. }));
  36894. }));
  36895. return literalArr(expressions);
  36896. };
  36897. /**
  36898. * @param {?} typeSymbol
  36899. * @return {?}
  36900. */
  36901. ForJitSerializer.prototype.serializeSummaryRef = /**
  36902. * @param {?} typeSymbol
  36903. * @return {?}
  36904. */
  36905. function (typeSymbol) {
  36906. var /** @type {?} */ jitImportedSymbol = this.symbolResolver.getStaticSymbol(summaryForJitFileName(typeSymbol.filePath), summaryForJitName(typeSymbol.name));
  36907. return this.outputCtx.importExpr(jitImportedSymbol);
  36908. };
  36909. /**
  36910. * @param {?} data
  36911. * @return {?}
  36912. */
  36913. ForJitSerializer.prototype.serializeSummary = /**
  36914. * @param {?} data
  36915. * @return {?}
  36916. */
  36917. function (data) {
  36918. var /** @type {?} */ outputCtx = this.outputCtx;
  36919. var Transformer = /** @class */ (function () {
  36920. function Transformer() {
  36921. }
  36922. /**
  36923. * @param {?} arr
  36924. * @param {?} context
  36925. * @return {?}
  36926. */
  36927. Transformer.prototype.visitArray = /**
  36928. * @param {?} arr
  36929. * @param {?} context
  36930. * @return {?}
  36931. */
  36932. function (arr, context) {
  36933. var _this = this;
  36934. return literalArr(arr.map(function (entry) { return visitValue(entry, _this, context); }));
  36935. };
  36936. /**
  36937. * @param {?} map
  36938. * @param {?} context
  36939. * @return {?}
  36940. */
  36941. Transformer.prototype.visitStringMap = /**
  36942. * @param {?} map
  36943. * @param {?} context
  36944. * @return {?}
  36945. */
  36946. function (map, context) {
  36947. var _this = this;
  36948. return new LiteralMapExpr(Object.keys(map).map(function (key) { return new LiteralMapEntry(key, visitValue(map[key], _this, context), false); }));
  36949. };
  36950. /**
  36951. * @param {?} value
  36952. * @param {?} context
  36953. * @return {?}
  36954. */
  36955. Transformer.prototype.visitPrimitive = /**
  36956. * @param {?} value
  36957. * @param {?} context
  36958. * @return {?}
  36959. */
  36960. function (value, context) { return literal(value); };
  36961. /**
  36962. * @param {?} value
  36963. * @param {?} context
  36964. * @return {?}
  36965. */
  36966. Transformer.prototype.visitOther = /**
  36967. * @param {?} value
  36968. * @param {?} context
  36969. * @return {?}
  36970. */
  36971. function (value, context) {
  36972. if (value instanceof StaticSymbol) {
  36973. return outputCtx.importExpr(value);
  36974. }
  36975. else {
  36976. throw new Error("Illegal State: Encountered value " + value);
  36977. }
  36978. };
  36979. return Transformer;
  36980. }());
  36981. return visitValue(data, new Transformer(), null);
  36982. };
  36983. return ForJitSerializer;
  36984. }());
  36985. var FromJsonDeserializer = /** @class */ (function (_super) {
  36986. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FromJsonDeserializer, _super);
  36987. function FromJsonDeserializer(symbolCache, summaryResolver) {
  36988. var _this = _super.call(this) || this;
  36989. _this.symbolCache = symbolCache;
  36990. _this.summaryResolver = summaryResolver;
  36991. return _this;
  36992. }
  36993. /**
  36994. * @param {?} libraryFileName
  36995. * @param {?} json
  36996. * @return {?}
  36997. */
  36998. FromJsonDeserializer.prototype.deserialize = /**
  36999. * @param {?} libraryFileName
  37000. * @param {?} json
  37001. * @return {?}
  37002. */
  37003. function (libraryFileName, json) {
  37004. var _this = this;
  37005. var /** @type {?} */ data = JSON.parse(json);
  37006. var /** @type {?} */ allImportAs = [];
  37007. this.symbols = data.symbols.map(function (serializedSymbol) {
  37008. return _this.symbolCache.get(_this.summaryResolver.fromSummaryFileName(serializedSymbol.filePath, libraryFileName), serializedSymbol.name);
  37009. });
  37010. data.symbols.forEach(function (serializedSymbol, index) {
  37011. var /** @type {?} */ symbol = _this.symbols[index];
  37012. var /** @type {?} */ importAs = serializedSymbol.importAs;
  37013. if (typeof importAs === 'number') {
  37014. allImportAs.push({ symbol: symbol, importAs: _this.symbols[importAs] });
  37015. }
  37016. else if (typeof importAs === 'string') {
  37017. allImportAs.push({ symbol: symbol, importAs: _this.symbolCache.get(ngfactoryFilePath(libraryFileName), importAs) });
  37018. }
  37019. });
  37020. var /** @type {?} */ summaries = /** @type {?} */ (visitValue(data.summaries, this, null));
  37021. return { moduleName: data.moduleName, summaries: summaries, importAs: allImportAs };
  37022. };
  37023. /**
  37024. * @param {?} map
  37025. * @param {?} context
  37026. * @return {?}
  37027. */
  37028. FromJsonDeserializer.prototype.visitStringMap = /**
  37029. * @param {?} map
  37030. * @param {?} context
  37031. * @return {?}
  37032. */
  37033. function (map, context) {
  37034. if ('__symbol' in map) {
  37035. var /** @type {?} */ baseSymbol = this.symbols[map['__symbol']];
  37036. var /** @type {?} */ members = map['members'];
  37037. return members.length ? this.symbolCache.get(baseSymbol.filePath, baseSymbol.name, members) :
  37038. baseSymbol;
  37039. }
  37040. else {
  37041. return _super.prototype.visitStringMap.call(this, map, context);
  37042. }
  37043. };
  37044. return FromJsonDeserializer;
  37045. }(ValueTransformer));
  37046. /**
  37047. * @param {?} metadata
  37048. * @return {?}
  37049. */
  37050. function isCall(metadata) {
  37051. return metadata && metadata.__symbolic === 'call';
  37052. }
  37053. /**
  37054. * @param {?} metadata
  37055. * @return {?}
  37056. */
  37057. function isFunctionCall(metadata) {
  37058. return isCall(metadata) && unwrapResolvedMetadata(metadata.expression) instanceof StaticSymbol;
  37059. }
  37060. /**
  37061. * @param {?} metadata
  37062. * @return {?}
  37063. */
  37064. function isMethodCallOnVariable(metadata) {
  37065. return isCall(metadata) && metadata.expression && metadata.expression.__symbolic === 'select' &&
  37066. unwrapResolvedMetadata(metadata.expression.expression) instanceof StaticSymbol;
  37067. }
  37068. /**
  37069. * @fileoverview added by tsickle
  37070. * @suppress {checkTypes} checked by tsc
  37071. */
  37072. /**
  37073. * @license
  37074. * Copyright Google Inc. All Rights Reserved.
  37075. *
  37076. * Use of this source code is governed by an MIT-style license that can be
  37077. * found in the LICENSE file at https://angular.io/license
  37078. */
  37079. /** @enum {number} */
  37080. var StubEmitFlags = {
  37081. Basic: 1,
  37082. TypeCheck: 2,
  37083. All: 3,
  37084. };
  37085. StubEmitFlags[StubEmitFlags.Basic] = "Basic";
  37086. StubEmitFlags[StubEmitFlags.TypeCheck] = "TypeCheck";
  37087. StubEmitFlags[StubEmitFlags.All] = "All";
  37088. var AotCompiler = /** @class */ (function () {
  37089. function AotCompiler(_config, _options, _host, _reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _outputEmitter, _summaryResolver, _symbolResolver) {
  37090. this._config = _config;
  37091. this._options = _options;
  37092. this._host = _host;
  37093. this._reflector = _reflector;
  37094. this._metadataResolver = _metadataResolver;
  37095. this._templateParser = _templateParser;
  37096. this._styleCompiler = _styleCompiler;
  37097. this._viewCompiler = _viewCompiler;
  37098. this._typeCheckCompiler = _typeCheckCompiler;
  37099. this._ngModuleCompiler = _ngModuleCompiler;
  37100. this._outputEmitter = _outputEmitter;
  37101. this._summaryResolver = _summaryResolver;
  37102. this._symbolResolver = _symbolResolver;
  37103. this._templateAstCache = new Map();
  37104. this._analyzedFiles = new Map();
  37105. }
  37106. /**
  37107. * @return {?}
  37108. */
  37109. AotCompiler.prototype.clearCache = /**
  37110. * @return {?}
  37111. */
  37112. function () { this._metadataResolver.clearCache(); };
  37113. /**
  37114. * @param {?} rootFiles
  37115. * @return {?}
  37116. */
  37117. AotCompiler.prototype.analyzeModulesSync = /**
  37118. * @param {?} rootFiles
  37119. * @return {?}
  37120. */
  37121. function (rootFiles) {
  37122. var _this = this;
  37123. var /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
  37124. analyzeResult.ngModules.forEach(function (ngModule) {
  37125. return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true);
  37126. });
  37127. return analyzeResult;
  37128. };
  37129. /**
  37130. * @param {?} rootFiles
  37131. * @return {?}
  37132. */
  37133. AotCompiler.prototype.analyzeModulesAsync = /**
  37134. * @param {?} rootFiles
  37135. * @return {?}
  37136. */
  37137. function (rootFiles) {
  37138. var _this = this;
  37139. var /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
  37140. return Promise
  37141. .all(analyzeResult.ngModules.map(function (ngModule) {
  37142. return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false);
  37143. }))
  37144. .then(function () { return analyzeResult; });
  37145. };
  37146. /**
  37147. * @param {?} fileName
  37148. * @return {?}
  37149. */
  37150. AotCompiler.prototype._analyzeFile = /**
  37151. * @param {?} fileName
  37152. * @return {?}
  37153. */
  37154. function (fileName) {
  37155. var /** @type {?} */ analyzedFile = this._analyzedFiles.get(fileName);
  37156. if (!analyzedFile) {
  37157. analyzedFile =
  37158. analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName);
  37159. this._analyzedFiles.set(fileName, analyzedFile);
  37160. }
  37161. return analyzedFile;
  37162. };
  37163. /**
  37164. * @param {?} fileName
  37165. * @return {?}
  37166. */
  37167. AotCompiler.prototype.findGeneratedFileNames = /**
  37168. * @param {?} fileName
  37169. * @return {?}
  37170. */
  37171. function (fileName) {
  37172. var _this = this;
  37173. var /** @type {?} */ genFileNames = [];
  37174. var /** @type {?} */ file = this._analyzeFile(fileName);
  37175. // Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule
  37176. // or a reference to a non source file.
  37177. // Note: This is overestimating the required .ngfactory files as the real calculation is harder.
  37178. // Only do this for StubEmitFlags.Basic, as adding a type check block
  37179. // does not change this file (as we generate type check blocks based on NgModules).
  37180. if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length ||
  37181. file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) {
  37182. genFileNames.push(ngfactoryFilePath(file.fileName, true));
  37183. if (this._options.enableSummariesForJit) {
  37184. genFileNames.push(summaryForJitFileName(file.fileName, true));
  37185. }
  37186. }
  37187. var /** @type {?} */ fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(file.fileName, true)[1]);
  37188. file.directives.forEach(function (dirSymbol) {
  37189. var /** @type {?} */ compMeta = /** @type {?} */ ((_this._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol))).metadata;
  37190. if (!compMeta.isComponent) {
  37191. return;
  37192. } /** @type {?} */
  37193. ((
  37194. // Note: compMeta is a component and therefore template is non null.
  37195. compMeta.template)).styleUrls.forEach(function (styleUrl) {
  37196. var /** @type {?} */ normalizedUrl = _this._host.resourceNameToFileName(styleUrl, file.fileName);
  37197. if (!normalizedUrl) {
  37198. throw syntaxError("Couldn't resolve resource " + styleUrl + " relative to " + file.fileName);
  37199. }
  37200. var /** @type {?} */ needsShim = (/** @type {?} */ ((compMeta.template)).encapsulation || _this._config.defaultEncapsulation) === ViewEncapsulation.Emulated;
  37201. genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix));
  37202. if (_this._options.allowEmptyCodegenFiles) {
  37203. genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix));
  37204. }
  37205. });
  37206. });
  37207. return genFileNames;
  37208. };
  37209. /**
  37210. * @param {?} genFileName
  37211. * @param {?=} originalFileName
  37212. * @return {?}
  37213. */
  37214. AotCompiler.prototype.emitBasicStub = /**
  37215. * @param {?} genFileName
  37216. * @param {?=} originalFileName
  37217. * @return {?}
  37218. */
  37219. function (genFileName, originalFileName) {
  37220. var /** @type {?} */ outputCtx = this._createOutputContext(genFileName);
  37221. if (genFileName.endsWith('.ngfactory.ts')) {
  37222. if (!originalFileName) {
  37223. throw new Error("Assertion error: require the original file for .ngfactory.ts stubs. File: " + genFileName);
  37224. }
  37225. var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
  37226. this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.Basic);
  37227. }
  37228. else if (genFileName.endsWith('.ngsummary.ts')) {
  37229. if (this._options.enableSummariesForJit) {
  37230. if (!originalFileName) {
  37231. throw new Error("Assertion error: require the original file for .ngsummary.ts stubs. File: " + genFileName);
  37232. }
  37233. var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
  37234. _createEmptyStub(outputCtx);
  37235. originalFile.ngModules.forEach(function (ngModule) {
  37236. // create exports that user code can reference
  37237. createForJitStub(outputCtx, ngModule.type.reference);
  37238. });
  37239. }
  37240. }
  37241. else if (genFileName.endsWith('.ngstyle.ts')) {
  37242. _createEmptyStub(outputCtx);
  37243. }
  37244. // Note: for the stubs, we don't need a property srcFileUrl,
  37245. // as lateron in emitAllImpls we will create the proper GeneratedFiles with the
  37246. // correct srcFileUrl.
  37247. // This is good as e.g. for .ngstyle.ts files we can't derive
  37248. // the url of components based on the genFileUrl.
  37249. return this._codegenSourceModule('unknown', outputCtx);
  37250. };
  37251. /**
  37252. * @param {?} genFileName
  37253. * @param {?} originalFileName
  37254. * @return {?}
  37255. */
  37256. AotCompiler.prototype.emitTypeCheckStub = /**
  37257. * @param {?} genFileName
  37258. * @param {?} originalFileName
  37259. * @return {?}
  37260. */
  37261. function (genFileName, originalFileName) {
  37262. var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
  37263. var /** @type {?} */ outputCtx = this._createOutputContext(genFileName);
  37264. if (genFileName.endsWith('.ngfactory.ts')) {
  37265. this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.TypeCheck);
  37266. }
  37267. return outputCtx.statements.length > 0 ?
  37268. this._codegenSourceModule(originalFile.fileName, outputCtx) :
  37269. null;
  37270. };
  37271. /**
  37272. * @param {?} fileNames
  37273. * @return {?}
  37274. */
  37275. AotCompiler.prototype.loadFilesAsync = /**
  37276. * @param {?} fileNames
  37277. * @return {?}
  37278. */
  37279. function (fileNames) {
  37280. var _this = this;
  37281. var /** @type {?} */ files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
  37282. var /** @type {?} */ loadingPromises = [];
  37283. files.forEach(function (file) {
  37284. return file.ngModules.forEach(function (ngModule) {
  37285. return loadingPromises.push(_this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false));
  37286. });
  37287. });
  37288. return Promise.all(loadingPromises).then(function (_) { return mergeAndValidateNgFiles(files); });
  37289. };
  37290. /**
  37291. * @param {?} fileNames
  37292. * @return {?}
  37293. */
  37294. AotCompiler.prototype.loadFilesSync = /**
  37295. * @param {?} fileNames
  37296. * @return {?}
  37297. */
  37298. function (fileNames) {
  37299. var _this = this;
  37300. var /** @type {?} */ files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
  37301. files.forEach(function (file) {
  37302. return file.ngModules.forEach(function (ngModule) {
  37303. return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true);
  37304. });
  37305. });
  37306. return mergeAndValidateNgFiles(files);
  37307. };
  37308. /**
  37309. * @param {?} outputCtx
  37310. * @param {?} file
  37311. * @param {?} emitFlags
  37312. * @return {?}
  37313. */
  37314. AotCompiler.prototype._createNgFactoryStub = /**
  37315. * @param {?} outputCtx
  37316. * @param {?} file
  37317. * @param {?} emitFlags
  37318. * @return {?}
  37319. */
  37320. function (outputCtx, file, emitFlags) {
  37321. var _this = this;
  37322. var /** @type {?} */ componentId = 0;
  37323. file.ngModules.forEach(function (ngModuleMeta, ngModuleIndex) {
  37324. // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
  37325. // so we don't change the .ngfactory file too much when adding the typecheck block.
  37326. // create exports that user code can reference
  37327. // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
  37328. // so we don't change the .ngfactory file too much when adding the typecheck block.
  37329. // create exports that user code can reference
  37330. _this._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference);
  37331. // add references to the symbols from the metadata.
  37332. // These can be used by the type check block for components,
  37333. // and they also cause TypeScript to include these files into the program too,
  37334. // which will make them part of the analyzedFiles.
  37335. var /** @type {?} */ externalReferences = ngModuleMeta.transitiveModule.directives.map(function (d) { return d.reference; }).concat(ngModuleMeta.transitiveModule.pipes.map(function (d) { return d.reference; }), ngModuleMeta.importedModules.map(function (m) { return m.type.reference; }), ngModuleMeta.exportedModules.map(function (m) { return m.type.reference; }), _this._externalIdentifierReferences([Identifiers.TemplateRef, Identifiers.ElementRef]));
  37336. var /** @type {?} */ externalReferenceVars = new Map();
  37337. externalReferences.forEach(function (ref, typeIndex) {
  37338. externalReferenceVars.set(ref, "_decl" + ngModuleIndex + "_" + typeIndex);
  37339. });
  37340. externalReferenceVars.forEach(function (varName, reference) {
  37341. outputCtx.statements.push(variable(varName)
  37342. .set(NULL_EXPR.cast(DYNAMIC_TYPE))
  37343. .toDeclStmt(expressionType(outputCtx.importExpr(reference, /* typeParams */ null, /* useSummaries */ /* useSummaries */ false))));
  37344. });
  37345. if (emitFlags & StubEmitFlags.TypeCheck) {
  37346. // add the typecheck block for all components of the NgModule
  37347. ngModuleMeta.declaredDirectives.forEach(function (dirId) {
  37348. var /** @type {?} */ compMeta = _this._metadataResolver.getDirectiveMetadata(dirId.reference);
  37349. if (!compMeta.isComponent) {
  37350. return;
  37351. }
  37352. componentId++;
  37353. _this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_Host_" + componentId, ngModuleMeta, _this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars);
  37354. _this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_" + componentId, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars);
  37355. });
  37356. }
  37357. });
  37358. if (outputCtx.statements.length === 0) {
  37359. _createEmptyStub(outputCtx);
  37360. }
  37361. };
  37362. /**
  37363. * @param {?} references
  37364. * @return {?}
  37365. */
  37366. AotCompiler.prototype._externalIdentifierReferences = /**
  37367. * @param {?} references
  37368. * @return {?}
  37369. */
  37370. function (references) {
  37371. var /** @type {?} */ result = [];
  37372. for (var _i = 0, references_1 = references; _i < references_1.length; _i++) {
  37373. var reference = references_1[_i];
  37374. var /** @type {?} */ token = createTokenForExternalReference(this._reflector, reference);
  37375. if (token.identifier) {
  37376. result.push(token.identifier.reference);
  37377. }
  37378. }
  37379. return result;
  37380. };
  37381. /**
  37382. * @param {?} ctx
  37383. * @param {?} componentId
  37384. * @param {?} moduleMeta
  37385. * @param {?} compMeta
  37386. * @param {?} directives
  37387. * @param {?} externalReferenceVars
  37388. * @return {?}
  37389. */
  37390. AotCompiler.prototype._createTypeCheckBlock = /**
  37391. * @param {?} ctx
  37392. * @param {?} componentId
  37393. * @param {?} moduleMeta
  37394. * @param {?} compMeta
  37395. * @param {?} directives
  37396. * @param {?} externalReferenceVars
  37397. * @return {?}
  37398. */
  37399. function (ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) {
  37400. var _a = this._parseTemplate(compMeta, moduleMeta, directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
  37401. (_b = ctx.statements).push.apply(_b, this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars, ctx));
  37402. var _b;
  37403. };
  37404. /**
  37405. * @param {?} analyzeResult
  37406. * @param {?} locale
  37407. * @return {?}
  37408. */
  37409. AotCompiler.prototype.emitMessageBundle = /**
  37410. * @param {?} analyzeResult
  37411. * @param {?} locale
  37412. * @return {?}
  37413. */
  37414. function (analyzeResult, locale) {
  37415. var _this = this;
  37416. var /** @type {?} */ errors = [];
  37417. var /** @type {?} */ htmlParser = new HtmlParser();
  37418. // TODO(vicb): implicit tags & attributes
  37419. var /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale);
  37420. analyzeResult.files.forEach(function (file) {
  37421. var /** @type {?} */ compMetas = [];
  37422. file.directives.forEach(function (directiveType) {
  37423. var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(directiveType);
  37424. if (dirMeta && dirMeta.isComponent) {
  37425. compMetas.push(dirMeta);
  37426. }
  37427. });
  37428. compMetas.forEach(function (compMeta) {
  37429. var /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template));
  37430. var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation);
  37431. errors.push.apply(errors, /** @type {?} */ ((messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig))));
  37432. });
  37433. });
  37434. if (errors.length) {
  37435. throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
  37436. }
  37437. return messageBundle;
  37438. };
  37439. /**
  37440. * @param {?} analyzeResult
  37441. * @return {?}
  37442. */
  37443. AotCompiler.prototype.emitAllImpls = /**
  37444. * @param {?} analyzeResult
  37445. * @return {?}
  37446. */
  37447. function (analyzeResult) {
  37448. var _this = this;
  37449. var ngModuleByPipeOrDirective = analyzeResult.ngModuleByPipeOrDirective, files = analyzeResult.files;
  37450. var /** @type {?} */ sourceModules = files.map(function (file) {
  37451. return _this._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables);
  37452. });
  37453. return flatten(sourceModules);
  37454. };
  37455. /**
  37456. * @param {?} srcFileUrl
  37457. * @param {?} ngModuleByPipeOrDirective
  37458. * @param {?} directives
  37459. * @param {?} pipes
  37460. * @param {?} ngModules
  37461. * @param {?} injectables
  37462. * @return {?}
  37463. */
  37464. AotCompiler.prototype._compileImplFile = /**
  37465. * @param {?} srcFileUrl
  37466. * @param {?} ngModuleByPipeOrDirective
  37467. * @param {?} directives
  37468. * @param {?} pipes
  37469. * @param {?} ngModules
  37470. * @param {?} injectables
  37471. * @return {?}
  37472. */
  37473. function (srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) {
  37474. var _this = this;
  37475. var /** @type {?} */ fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(srcFileUrl, true)[1]);
  37476. var /** @type {?} */ generatedFiles = [];
  37477. var /** @type {?} */ outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true));
  37478. generatedFiles.push.apply(generatedFiles, this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx));
  37479. // compile all ng modules
  37480. ngModules.forEach(function (ngModuleMeta) { return _this._compileModule(outputCtx, ngModuleMeta); });
  37481. // compile components
  37482. directives.forEach(function (dirType) {
  37483. var /** @type {?} */ compMeta = _this._metadataResolver.getDirectiveMetadata(/** @type {?} */ (dirType));
  37484. if (!compMeta.isComponent) {
  37485. return;
  37486. }
  37487. var /** @type {?} */ ngModule = ngModuleByPipeOrDirective.get(dirType);
  37488. if (!ngModule) {
  37489. throw new Error("Internal Error: cannot determine the module for component " + identifierName(compMeta.type) + "!");
  37490. }
  37491. // compile styles
  37492. var /** @type {?} */ componentStylesheet = _this._styleCompiler.compileComponent(outputCtx, compMeta); /** @type {?} */
  37493. ((
  37494. // Note: compMeta is a component and therefore template is non null.
  37495. compMeta.template)).externalStylesheets.forEach(function (stylesheetMeta) {
  37496. // Note: fill non shim and shim style files as they might
  37497. // be shared by component with and without ViewEncapsulation.
  37498. var /** @type {?} */ shim = _this._styleCompiler.needsStyleShim(compMeta);
  37499. generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix));
  37500. if (_this._options.allowEmptyCodegenFiles) {
  37501. generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix));
  37502. }
  37503. });
  37504. // compile components
  37505. var /** @type {?} */ compViewVars = _this._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix);
  37506. _this._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix);
  37507. });
  37508. if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) {
  37509. var /** @type {?} */ srcModule = this._codegenSourceModule(srcFileUrl, outputCtx);
  37510. generatedFiles.unshift(srcModule);
  37511. }
  37512. return generatedFiles;
  37513. };
  37514. /**
  37515. * @param {?} srcFileName
  37516. * @param {?} directives
  37517. * @param {?} pipes
  37518. * @param {?} ngModules
  37519. * @param {?} injectables
  37520. * @param {?} ngFactoryCtx
  37521. * @return {?}
  37522. */
  37523. AotCompiler.prototype._createSummary = /**
  37524. * @param {?} srcFileName
  37525. * @param {?} directives
  37526. * @param {?} pipes
  37527. * @param {?} ngModules
  37528. * @param {?} injectables
  37529. * @param {?} ngFactoryCtx
  37530. * @return {?}
  37531. */
  37532. function (srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) {
  37533. var _this = this;
  37534. var /** @type {?} */ symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName)
  37535. .map(function (symbol) { return _this._symbolResolver.resolveSymbol(symbol); });
  37536. var /** @type {?} */ typeData = ngModules.map(function (meta) {
  37537. return ({
  37538. summary: /** @type {?} */ ((_this._metadataResolver.getNgModuleSummary(meta.type.reference))),
  37539. metadata: /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(meta.type.reference)))
  37540. });
  37541. }).concat(directives.map(function (ref) {
  37542. return ({
  37543. summary: /** @type {?} */ ((_this._metadataResolver.getDirectiveSummary(ref))),
  37544. metadata: /** @type {?} */ ((_this._metadataResolver.getDirectiveMetadata(ref)))
  37545. });
  37546. }), pipes.map(function (ref) {
  37547. return ({
  37548. summary: /** @type {?} */ ((_this._metadataResolver.getPipeSummary(ref))),
  37549. metadata: /** @type {?} */ ((_this._metadataResolver.getPipeMetadata(ref)))
  37550. });
  37551. }), injectables.map(function (ref) {
  37552. return ({
  37553. summary: /** @type {?} */ ((_this._metadataResolver.getInjectableSummary(ref))),
  37554. metadata: /** @type {?} */ ((_this._metadataResolver.getInjectableSummary(ref))).type
  37555. });
  37556. }));
  37557. var /** @type {?} */ forJitOutputCtx = this._options.enableSummariesForJit ?
  37558. this._createOutputContext(summaryForJitFileName(srcFileName, true)) :
  37559. null;
  37560. var _a = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData), json = _a.json, exportAs = _a.exportAs;
  37561. exportAs.forEach(function (entry) {
  37562. ngFactoryCtx.statements.push(variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [
  37563. StmtModifier.Exported
  37564. ]));
  37565. });
  37566. var /** @type {?} */ summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json);
  37567. var /** @type {?} */ result = [summaryJson];
  37568. if (forJitOutputCtx) {
  37569. result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx));
  37570. }
  37571. return result;
  37572. };
  37573. /**
  37574. * @param {?} outputCtx
  37575. * @param {?} ngModule
  37576. * @return {?}
  37577. */
  37578. AotCompiler.prototype._compileModule = /**
  37579. * @param {?} outputCtx
  37580. * @param {?} ngModule
  37581. * @return {?}
  37582. */
  37583. function (outputCtx, ngModule) {
  37584. var /** @type {?} */ providers = [];
  37585. if (this._options.locale) {
  37586. var /** @type {?} */ normalizedLocale = this._options.locale.replace(/_/g, '-');
  37587. providers.push({
  37588. token: createTokenForExternalReference(this._reflector, Identifiers.LOCALE_ID),
  37589. useValue: normalizedLocale,
  37590. });
  37591. }
  37592. if (this._options.i18nFormat) {
  37593. providers.push({
  37594. token: createTokenForExternalReference(this._reflector, Identifiers.TRANSLATIONS_FORMAT),
  37595. useValue: this._options.i18nFormat
  37596. });
  37597. }
  37598. this._ngModuleCompiler.compile(outputCtx, ngModule, providers);
  37599. };
  37600. /**
  37601. * @param {?} outputCtx
  37602. * @param {?} compMeta
  37603. * @param {?} ngModule
  37604. * @param {?} fileSuffix
  37605. * @return {?}
  37606. */
  37607. AotCompiler.prototype._compileComponentFactory = /**
  37608. * @param {?} outputCtx
  37609. * @param {?} compMeta
  37610. * @param {?} ngModule
  37611. * @param {?} fileSuffix
  37612. * @return {?}
  37613. */
  37614. function (outputCtx, compMeta, ngModule, fileSuffix) {
  37615. var /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta);
  37616. var /** @type {?} */ hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix)
  37617. .viewClassVar;
  37618. var /** @type {?} */ compFactoryVar = componentFactoryName(compMeta.type.reference);
  37619. var /** @type {?} */ inputsExprs = [];
  37620. for (var /** @type {?} */ propName in compMeta.inputs) {
  37621. var /** @type {?} */ templateName = compMeta.inputs[propName];
  37622. // Don't quote so that the key gets minified...
  37623. inputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
  37624. }
  37625. var /** @type {?} */ outputsExprs = [];
  37626. for (var /** @type {?} */ propName in compMeta.outputs) {
  37627. var /** @type {?} */ templateName = compMeta.outputs[propName];
  37628. // Don't quote so that the key gets minified...
  37629. outputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
  37630. }
  37631. outputCtx.statements.push(variable(compFactoryVar)
  37632. .set(importExpr(Identifiers.createComponentFactory).callFn([
  37633. literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference),
  37634. variable(hostViewFactoryVar), new LiteralMapExpr(inputsExprs),
  37635. new LiteralMapExpr(outputsExprs),
  37636. literalArr(/** @type {?} */ ((compMeta.template)).ngContentSelectors.map(function (selector) { return literal(selector); }))
  37637. ]))
  37638. .toDeclStmt(importType(Identifiers.ComponentFactory, [/** @type {?} */ ((expressionType(outputCtx.importExpr(compMeta.type.reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]));
  37639. };
  37640. /**
  37641. * @param {?} outputCtx
  37642. * @param {?} compMeta
  37643. * @param {?} ngModule
  37644. * @param {?} directiveIdentifiers
  37645. * @param {?} componentStyles
  37646. * @param {?} fileSuffix
  37647. * @return {?}
  37648. */
  37649. AotCompiler.prototype._compileComponent = /**
  37650. * @param {?} outputCtx
  37651. * @param {?} compMeta
  37652. * @param {?} ngModule
  37653. * @param {?} directiveIdentifiers
  37654. * @param {?} componentStyles
  37655. * @param {?} fileSuffix
  37656. * @return {?}
  37657. */
  37658. function (outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) {
  37659. var _a = this._parseTemplate(compMeta, ngModule, directiveIdentifiers), parsedTemplate = _a.template, usedPipes = _a.pipes;
  37660. var /** @type {?} */ stylesExpr = componentStyles ? variable(componentStyles.stylesVar) : literalArr([]);
  37661. var /** @type {?} */ viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes);
  37662. if (componentStyles) {
  37663. _resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix);
  37664. }
  37665. return viewResult;
  37666. };
  37667. /**
  37668. * @param {?} compMeta
  37669. * @param {?} ngModule
  37670. * @param {?} directiveIdentifiers
  37671. * @return {?}
  37672. */
  37673. AotCompiler.prototype._parseTemplate = /**
  37674. * @param {?} compMeta
  37675. * @param {?} ngModule
  37676. * @param {?} directiveIdentifiers
  37677. * @return {?}
  37678. */
  37679. function (compMeta, ngModule, directiveIdentifiers) {
  37680. var _this = this;
  37681. if (this._templateAstCache.has(compMeta.type.reference)) {
  37682. return /** @type {?} */ ((this._templateAstCache.get(compMeta.type.reference)));
  37683. }
  37684. var /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((/** @type {?} */ ((compMeta)).template)).preserveWhitespaces;
  37685. var /** @type {?} */ directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
  37686. var /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  37687. var /** @type {?} */ result = this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces);
  37688. this._templateAstCache.set(compMeta.type.reference, result);
  37689. return result;
  37690. };
  37691. /**
  37692. * @param {?} genFilePath
  37693. * @return {?}
  37694. */
  37695. AotCompiler.prototype._createOutputContext = /**
  37696. * @param {?} genFilePath
  37697. * @return {?}
  37698. */
  37699. function (genFilePath) {
  37700. var _this = this;
  37701. var /** @type {?} */ importExpr$$1 = function (symbol, typeParams, useSummaries) {
  37702. if (typeParams === void 0) { typeParams = null; }
  37703. if (useSummaries === void 0) { useSummaries = true; }
  37704. if (!(symbol instanceof StaticSymbol)) {
  37705. throw new Error("Internal error: unknown identifier " + JSON.stringify(symbol));
  37706. }
  37707. var /** @type {?} */ arity = _this._symbolResolver.getTypeArity(symbol) || 0;
  37708. var _a = _this._symbolResolver.getImportAs(symbol, useSummaries) || symbol, filePath = _a.filePath, name = _a.name, members = _a.members;
  37709. var /** @type {?} */ importModule = _this._fileNameToModuleName(filePath, genFilePath);
  37710. // It should be good enough to compare filePath to genFilePath and if they are equal
  37711. // there is a self reference. However, ngfactory files generate to .ts but their
  37712. // symbols have .d.ts so a simple compare is insufficient. They should be canonical
  37713. // and is tracked by #17705.
  37714. var /** @type {?} */ selfReference = _this._fileNameToModuleName(genFilePath, genFilePath);
  37715. var /** @type {?} */ moduleName = importModule === selfReference ? null : importModule;
  37716. // If we are in a type expression that refers to a generic type then supply
  37717. // the required type parameters. If there were not enough type parameters
  37718. // supplied, supply any as the type. Outside a type expression the reference
  37719. // should not supply type parameters and be treated as a simple value reference
  37720. // to the constructor function itself.
  37721. var /** @type {?} */ suppliedTypeParams = typeParams || [];
  37722. var /** @type {?} */ missingTypeParamsCount = arity - suppliedTypeParams.length;
  37723. var /** @type {?} */ allTypeParams = suppliedTypeParams.concat(new Array(missingTypeParamsCount).fill(DYNAMIC_TYPE));
  37724. return members.reduce(function (expr, memberName) { return expr.prop(memberName); }, /** @type {?} */ (importExpr(new ExternalReference(moduleName, name, null), allTypeParams)));
  37725. };
  37726. return { statements: [], genFilePath: genFilePath, importExpr: importExpr$$1 };
  37727. };
  37728. /**
  37729. * @param {?} importedFilePath
  37730. * @param {?} containingFilePath
  37731. * @return {?}
  37732. */
  37733. AotCompiler.prototype._fileNameToModuleName = /**
  37734. * @param {?} importedFilePath
  37735. * @param {?} containingFilePath
  37736. * @return {?}
  37737. */
  37738. function (importedFilePath, containingFilePath) {
  37739. return this._summaryResolver.getKnownModuleName(importedFilePath) ||
  37740. this._symbolResolver.getKnownModuleName(importedFilePath) ||
  37741. this._host.fileNameToModuleName(importedFilePath, containingFilePath);
  37742. };
  37743. /**
  37744. * @param {?} srcFileUrl
  37745. * @param {?} compMeta
  37746. * @param {?} stylesheetMetadata
  37747. * @param {?} isShimmed
  37748. * @param {?} fileSuffix
  37749. * @return {?}
  37750. */
  37751. AotCompiler.prototype._codegenStyles = /**
  37752. * @param {?} srcFileUrl
  37753. * @param {?} compMeta
  37754. * @param {?} stylesheetMetadata
  37755. * @param {?} isShimmed
  37756. * @param {?} fileSuffix
  37757. * @return {?}
  37758. */
  37759. function (srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) {
  37760. var /** @type {?} */ outputCtx = this._createOutputContext(_stylesModuleUrl(/** @type {?} */ ((stylesheetMetadata.moduleUrl)), isShimmed, fileSuffix));
  37761. var /** @type {?} */ compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed);
  37762. _resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix);
  37763. return this._codegenSourceModule(srcFileUrl, outputCtx);
  37764. };
  37765. /**
  37766. * @param {?} srcFileUrl
  37767. * @param {?} ctx
  37768. * @return {?}
  37769. */
  37770. AotCompiler.prototype._codegenSourceModule = /**
  37771. * @param {?} srcFileUrl
  37772. * @param {?} ctx
  37773. * @return {?}
  37774. */
  37775. function (srcFileUrl, ctx) {
  37776. return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements);
  37777. };
  37778. /**
  37779. * @param {?=} entryRoute
  37780. * @param {?=} analyzedModules
  37781. * @return {?}
  37782. */
  37783. AotCompiler.prototype.listLazyRoutes = /**
  37784. * @param {?=} entryRoute
  37785. * @param {?=} analyzedModules
  37786. * @return {?}
  37787. */
  37788. function (entryRoute, analyzedModules) {
  37789. var /** @type {?} */ self = this;
  37790. if (entryRoute) {
  37791. var /** @type {?} */ symbol = parseLazyRoute(entryRoute, this._reflector).referencedModule;
  37792. return visitLazyRoute(symbol);
  37793. }
  37794. else if (analyzedModules) {
  37795. var /** @type {?} */ allLazyRoutes = [];
  37796. for (var _i = 0, _a = analyzedModules.ngModules; _i < _a.length; _i++) {
  37797. var ngModule = _a[_i];
  37798. var /** @type {?} */ lazyRoutes = listLazyRoutes(ngModule, this._reflector);
  37799. for (var _b = 0, lazyRoutes_1 = lazyRoutes; _b < lazyRoutes_1.length; _b++) {
  37800. var lazyRoute = lazyRoutes_1[_b];
  37801. allLazyRoutes.push(lazyRoute);
  37802. }
  37803. }
  37804. return allLazyRoutes;
  37805. }
  37806. else {
  37807. throw new Error("Either route or analyzedModules has to be specified!");
  37808. }
  37809. /**
  37810. * @param {?} symbol
  37811. * @param {?=} seenRoutes
  37812. * @param {?=} allLazyRoutes
  37813. * @return {?}
  37814. */
  37815. function visitLazyRoute(symbol, seenRoutes, allLazyRoutes) {
  37816. if (seenRoutes === void 0) { seenRoutes = new Set(); }
  37817. if (allLazyRoutes === void 0) { allLazyRoutes = []; }
  37818. // Support pointing to default exports, but stop recursing there,
  37819. // as the StaticReflector does not yet support default exports.
  37820. if (seenRoutes.has(symbol) || !symbol.name) {
  37821. return allLazyRoutes;
  37822. }
  37823. seenRoutes.add(symbol);
  37824. var /** @type {?} */ lazyRoutes = listLazyRoutes(/** @type {?} */ ((self._metadataResolver.getNgModuleMetadata(symbol, true))), self._reflector);
  37825. for (var _i = 0, lazyRoutes_2 = lazyRoutes; _i < lazyRoutes_2.length; _i++) {
  37826. var lazyRoute = lazyRoutes_2[_i];
  37827. allLazyRoutes.push(lazyRoute);
  37828. visitLazyRoute(lazyRoute.referencedModule, seenRoutes, allLazyRoutes);
  37829. }
  37830. return allLazyRoutes;
  37831. }
  37832. };
  37833. return AotCompiler;
  37834. }());
  37835. /**
  37836. * @param {?} outputCtx
  37837. * @return {?}
  37838. */
  37839. function _createEmptyStub(outputCtx) {
  37840. // Note: We need to produce at least one import statement so that
  37841. // TypeScript knows that the file is an es6 module. Otherwise our generated
  37842. // exports / imports won't be emitted properly by TypeScript.
  37843. outputCtx.statements.push(importExpr(Identifiers.ComponentFactory).toStmt());
  37844. }
  37845. /**
  37846. * @param {?} symbolResolver
  37847. * @param {?} compileResult
  37848. * @param {?} needsShim
  37849. * @param {?} fileSuffix
  37850. * @return {?}
  37851. */
  37852. function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) {
  37853. compileResult.dependencies.forEach(function (dep) {
  37854. dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name));
  37855. });
  37856. }
  37857. /**
  37858. * @param {?} stylesheetUrl
  37859. * @param {?} shim
  37860. * @param {?} suffix
  37861. * @return {?}
  37862. */
  37863. function _stylesModuleUrl(stylesheetUrl, shim, suffix) {
  37864. return "" + stylesheetUrl + (shim ? '.shim' : '') + ".ngstyle" + suffix;
  37865. }
  37866. /**
  37867. * @record
  37868. */
  37869. /**
  37870. * @record
  37871. */
  37872. /**
  37873. * @record
  37874. */
  37875. /**
  37876. * @param {?} fileNames
  37877. * @param {?} host
  37878. * @param {?} staticSymbolResolver
  37879. * @param {?} metadataResolver
  37880. * @return {?}
  37881. */
  37882. function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
  37883. var /** @type {?} */ files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver);
  37884. return mergeAnalyzedFiles(files);
  37885. }
  37886. /**
  37887. * @param {?} fileNames
  37888. * @param {?} host
  37889. * @param {?} staticSymbolResolver
  37890. * @param {?} metadataResolver
  37891. * @return {?}
  37892. */
  37893. function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
  37894. return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver));
  37895. }
  37896. /**
  37897. * @param {?} analyzedModules
  37898. * @return {?}
  37899. */
  37900. function validateAnalyzedModules(analyzedModules) {
  37901. if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) {
  37902. var /** @type {?} */ messages = analyzedModules.symbolsMissingModule.map(function (s) {
  37903. return "Cannot determine the module for class " + s.name + " in " + s.filePath + "! Add " + s.name + " to the NgModule to fix it.";
  37904. });
  37905. throw syntaxError(messages.join('\n'));
  37906. }
  37907. return analyzedModules;
  37908. }
  37909. /**
  37910. * @param {?} fileNames
  37911. * @param {?} host
  37912. * @param {?} staticSymbolResolver
  37913. * @param {?} metadataResolver
  37914. * @return {?}
  37915. */
  37916. function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) {
  37917. var /** @type {?} */ seenFiles = new Set();
  37918. var /** @type {?} */ files = [];
  37919. var /** @type {?} */ visitFile = function (fileName) {
  37920. if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) {
  37921. return false;
  37922. }
  37923. seenFiles.add(fileName);
  37924. var /** @type {?} */ analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName);
  37925. files.push(analyzedFile);
  37926. analyzedFile.ngModules.forEach(function (ngModule) {
  37927. ngModule.transitiveModule.modules.forEach(function (modMeta) { return visitFile(modMeta.reference.filePath); });
  37928. });
  37929. };
  37930. fileNames.forEach(function (fileName) { return visitFile(fileName); });
  37931. return files;
  37932. }
  37933. /**
  37934. * @param {?} host
  37935. * @param {?} staticSymbolResolver
  37936. * @param {?} metadataResolver
  37937. * @param {?} fileName
  37938. * @return {?}
  37939. */
  37940. function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) {
  37941. var /** @type {?} */ directives = [];
  37942. var /** @type {?} */ pipes = [];
  37943. var /** @type {?} */ injectables = [];
  37944. var /** @type {?} */ ngModules = [];
  37945. var /** @type {?} */ hasDecorators = staticSymbolResolver.hasDecorators(fileName);
  37946. var /** @type {?} */ exportsNonSourceFiles = false;
  37947. // Don't analyze .d.ts files that have no decorators as a shortcut
  37948. // to speed up the analysis. This prevents us from
  37949. // resolving the references in these files.
  37950. // Note: exportsNonSourceFiles is only needed when compiling with summaries,
  37951. // which is not the case when .d.ts files are treated as input files.
  37952. if (!fileName.endsWith('.d.ts') || hasDecorators) {
  37953. staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) {
  37954. var /** @type {?} */ resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
  37955. var /** @type {?} */ symbolMeta = resolvedSymbol.metadata;
  37956. if (!symbolMeta || symbolMeta.__symbolic === 'error') {
  37957. return;
  37958. }
  37959. var /** @type {?} */ isNgSymbol = false;
  37960. if (symbolMeta.__symbolic === 'class') {
  37961. if (metadataResolver.isDirective(symbol)) {
  37962. isNgSymbol = true;
  37963. directives.push(symbol);
  37964. }
  37965. else if (metadataResolver.isPipe(symbol)) {
  37966. isNgSymbol = true;
  37967. pipes.push(symbol);
  37968. }
  37969. else if (metadataResolver.isNgModule(symbol)) {
  37970. var /** @type {?} */ ngModule = metadataResolver.getNgModuleMetadata(symbol, false);
  37971. if (ngModule) {
  37972. isNgSymbol = true;
  37973. ngModules.push(ngModule);
  37974. }
  37975. }
  37976. else if (metadataResolver.isInjectable(symbol)) {
  37977. isNgSymbol = true;
  37978. injectables.push(symbol);
  37979. }
  37980. }
  37981. if (!isNgSymbol) {
  37982. exportsNonSourceFiles =
  37983. exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta);
  37984. }
  37985. });
  37986. }
  37987. return {
  37988. fileName: fileName, directives: directives, pipes: pipes, ngModules: ngModules, injectables: injectables, exportsNonSourceFiles: exportsNonSourceFiles,
  37989. };
  37990. }
  37991. /**
  37992. * @param {?} host
  37993. * @param {?} metadata
  37994. * @return {?}
  37995. */
  37996. function isValueExportingNonSourceFile(host, metadata) {
  37997. var /** @type {?} */ exportsNonSourceFiles = false;
  37998. var Visitor = /** @class */ (function () {
  37999. function Visitor() {
  38000. }
  38001. /**
  38002. * @param {?} arr
  38003. * @param {?} context
  38004. * @return {?}
  38005. */
  38006. Visitor.prototype.visitArray = /**
  38007. * @param {?} arr
  38008. * @param {?} context
  38009. * @return {?}
  38010. */
  38011. function (arr, context) {
  38012. var _this = this;
  38013. arr.forEach(function (v) { return visitValue(v, _this, context); });
  38014. };
  38015. /**
  38016. * @param {?} map
  38017. * @param {?} context
  38018. * @return {?}
  38019. */
  38020. Visitor.prototype.visitStringMap = /**
  38021. * @param {?} map
  38022. * @param {?} context
  38023. * @return {?}
  38024. */
  38025. function (map, context) {
  38026. var _this = this;
  38027. Object.keys(map).forEach(function (key) { return visitValue(map[key], _this, context); });
  38028. };
  38029. /**
  38030. * @param {?} value
  38031. * @param {?} context
  38032. * @return {?}
  38033. */
  38034. Visitor.prototype.visitPrimitive = /**
  38035. * @param {?} value
  38036. * @param {?} context
  38037. * @return {?}
  38038. */
  38039. function (value, context) { };
  38040. /**
  38041. * @param {?} value
  38042. * @param {?} context
  38043. * @return {?}
  38044. */
  38045. Visitor.prototype.visitOther = /**
  38046. * @param {?} value
  38047. * @param {?} context
  38048. * @return {?}
  38049. */
  38050. function (value, context) {
  38051. if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) {
  38052. exportsNonSourceFiles = true;
  38053. }
  38054. };
  38055. return Visitor;
  38056. }());
  38057. visitValue(metadata, new Visitor(), null);
  38058. return exportsNonSourceFiles;
  38059. }
  38060. /**
  38061. * @param {?} analyzedFiles
  38062. * @return {?}
  38063. */
  38064. function mergeAnalyzedFiles(analyzedFiles) {
  38065. var /** @type {?} */ allNgModules = [];
  38066. var /** @type {?} */ ngModuleByPipeOrDirective = new Map();
  38067. var /** @type {?} */ allPipesAndDirectives = new Set();
  38068. analyzedFiles.forEach(function (af) {
  38069. af.ngModules.forEach(function (ngModule) {
  38070. allNgModules.push(ngModule);
  38071. ngModule.declaredDirectives.forEach(function (d) { return ngModuleByPipeOrDirective.set(d.reference, ngModule); });
  38072. ngModule.declaredPipes.forEach(function (p) { return ngModuleByPipeOrDirective.set(p.reference, ngModule); });
  38073. });
  38074. af.directives.forEach(function (d) { return allPipesAndDirectives.add(d); });
  38075. af.pipes.forEach(function (p) { return allPipesAndDirectives.add(p); });
  38076. });
  38077. var /** @type {?} */ symbolsMissingModule = [];
  38078. allPipesAndDirectives.forEach(function (ref) {
  38079. if (!ngModuleByPipeOrDirective.has(ref)) {
  38080. symbolsMissingModule.push(ref);
  38081. }
  38082. });
  38083. return {
  38084. ngModules: allNgModules,
  38085. ngModuleByPipeOrDirective: ngModuleByPipeOrDirective,
  38086. symbolsMissingModule: symbolsMissingModule,
  38087. files: analyzedFiles
  38088. };
  38089. }
  38090. /**
  38091. * @param {?} files
  38092. * @return {?}
  38093. */
  38094. function mergeAndValidateNgFiles(files) {
  38095. return validateAnalyzedModules(mergeAnalyzedFiles(files));
  38096. }
  38097. /**
  38098. * @fileoverview added by tsickle
  38099. * @suppress {checkTypes} checked by tsc
  38100. */
  38101. /**
  38102. * @license
  38103. * Copyright Google Inc. All Rights Reserved.
  38104. *
  38105. * Use of this source code is governed by an MIT-style license that can be
  38106. * found in the LICENSE file at https://angular.io/license
  38107. */
  38108. /**
  38109. * @record
  38110. */
  38111. /**
  38112. * @record
  38113. */
  38114. var FORMATTED_MESSAGE = 'ngFormattedMessage';
  38115. /**
  38116. * @param {?} level
  38117. * @return {?}
  38118. */
  38119. function indentStr(level) {
  38120. if (level <= 0)
  38121. return '';
  38122. if (level < 6)
  38123. return ['', ' ', ' ', ' ', ' ', ' '][level];
  38124. var /** @type {?} */ half = indentStr(Math.floor(level / 2));
  38125. return half + half + (level % 2 === 1 ? ' ' : '');
  38126. }
  38127. /**
  38128. * @param {?} chain
  38129. * @param {?=} indent
  38130. * @return {?}
  38131. */
  38132. function formatChain(chain, indent) {
  38133. if (indent === void 0) { indent = 0; }
  38134. if (!chain)
  38135. return '';
  38136. var /** @type {?} */ position = chain.position ?
  38137. chain.position.fileName + "(" + (chain.position.line + 1) + "," + (chain.position.column + 1) + ")" :
  38138. '';
  38139. var /** @type {?} */ prefix = position && indent === 0 ? position + ": " : '';
  38140. var /** @type {?} */ postfix = position && indent !== 0 ? " at " + position : '';
  38141. var /** @type {?} */ message = "" + prefix + chain.message + postfix;
  38142. return "" + indentStr(indent) + message + ((chain.next && ('\n' + formatChain(chain.next, indent + 2))) || '');
  38143. }
  38144. /**
  38145. * @param {?} chain
  38146. * @return {?}
  38147. */
  38148. function formattedError(chain) {
  38149. var /** @type {?} */ message = formatChain(chain) + '.';
  38150. var /** @type {?} */ error = /** @type {?} */ (syntaxError(message));
  38151. (/** @type {?} */ (error))[FORMATTED_MESSAGE] = true;
  38152. error.chain = chain;
  38153. error.position = chain.position;
  38154. return error;
  38155. }
  38156. /**
  38157. * @param {?} error
  38158. * @return {?}
  38159. */
  38160. function isFormattedError(error) {
  38161. return !!(/** @type {?} */ (error))[FORMATTED_MESSAGE];
  38162. }
  38163. /**
  38164. * @fileoverview added by tsickle
  38165. * @suppress {checkTypes} checked by tsc
  38166. */
  38167. /**
  38168. * @license
  38169. * Copyright Google Inc. All Rights Reserved.
  38170. *
  38171. * Use of this source code is governed by an MIT-style license that can be
  38172. * found in the LICENSE file at https://angular.io/license
  38173. */
  38174. var ANGULAR_CORE = '@angular/core';
  38175. var ANGULAR_ROUTER = '@angular/router';
  38176. var HIDDEN_KEY = /^\$.*\$$/;
  38177. var IGNORE = {
  38178. __symbolic: 'ignore'
  38179. };
  38180. var USE_VALUE = 'useValue';
  38181. var PROVIDE = 'provide';
  38182. var REFERENCE_SET = new Set([USE_VALUE, 'useFactory', 'data']);
  38183. var TYPEGUARD_POSTFIX = 'TypeGuard';
  38184. var USE_IF = 'UseIf';
  38185. /**
  38186. * @param {?} value
  38187. * @return {?}
  38188. */
  38189. function shouldIgnore(value) {
  38190. return value && value.__symbolic == 'ignore';
  38191. }
  38192. /**
  38193. * A static reflector implements enough of the Reflector API that is necessary to compile
  38194. * templates statically.
  38195. */
  38196. var StaticReflector = /** @class */ (function () {
  38197. function StaticReflector(summaryResolver, symbolResolver, knownMetadataClasses, knownMetadataFunctions, errorRecorder) {
  38198. if (knownMetadataClasses === void 0) { knownMetadataClasses = []; }
  38199. if (knownMetadataFunctions === void 0) { knownMetadataFunctions = []; }
  38200. var _this = this;
  38201. this.summaryResolver = summaryResolver;
  38202. this.symbolResolver = symbolResolver;
  38203. this.errorRecorder = errorRecorder;
  38204. this.annotationCache = new Map();
  38205. this.propertyCache = new Map();
  38206. this.parameterCache = new Map();
  38207. this.methodCache = new Map();
  38208. this.staticCache = new Map();
  38209. this.conversionMap = new Map();
  38210. this.resolvedExternalReferences = new Map();
  38211. this.annotationForParentClassWithSummaryKind = new Map();
  38212. this.initializeConversionMap();
  38213. knownMetadataClasses.forEach(function (kc) {
  38214. return _this._registerDecoratorOrConstructor(_this.getStaticSymbol(kc.filePath, kc.name), kc.ctor);
  38215. });
  38216. knownMetadataFunctions.forEach(function (kf) { return _this._registerFunction(_this.getStaticSymbol(kf.filePath, kf.name), kf.fn); });
  38217. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Directive, [createDirective, createComponent]);
  38218. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]);
  38219. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]);
  38220. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Injectable, [createInjectable, createPipe, createDirective, createComponent, createNgModule]);
  38221. }
  38222. /**
  38223. * @param {?} typeOrFunc
  38224. * @return {?}
  38225. */
  38226. StaticReflector.prototype.componentModuleUrl = /**
  38227. * @param {?} typeOrFunc
  38228. * @return {?}
  38229. */
  38230. function (typeOrFunc) {
  38231. var /** @type {?} */ staticSymbol = this.findSymbolDeclaration(typeOrFunc);
  38232. return this.symbolResolver.getResourcePath(staticSymbol);
  38233. };
  38234. /**
  38235. * @param {?} ref
  38236. * @param {?=} containingFile
  38237. * @return {?}
  38238. */
  38239. StaticReflector.prototype.resolveExternalReference = /**
  38240. * @param {?} ref
  38241. * @param {?=} containingFile
  38242. * @return {?}
  38243. */
  38244. function (ref, containingFile) {
  38245. var /** @type {?} */ key = undefined;
  38246. if (!containingFile) {
  38247. key = ref.moduleName + ":" + ref.name;
  38248. var /** @type {?} */ declarationSymbol_1 = this.resolvedExternalReferences.get(key);
  38249. if (declarationSymbol_1)
  38250. return declarationSymbol_1;
  38251. }
  38252. var /** @type {?} */ refSymbol = this.symbolResolver.getSymbolByModule(/** @type {?} */ ((ref.moduleName)), /** @type {?} */ ((ref.name)), containingFile);
  38253. var /** @type {?} */ declarationSymbol = this.findSymbolDeclaration(refSymbol);
  38254. if (!containingFile) {
  38255. this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, /** @type {?} */ ((ref.moduleName)));
  38256. this.symbolResolver.recordImportAs(declarationSymbol, refSymbol);
  38257. }
  38258. if (key) {
  38259. this.resolvedExternalReferences.set(key, declarationSymbol);
  38260. }
  38261. return declarationSymbol;
  38262. };
  38263. /**
  38264. * @param {?} moduleUrl
  38265. * @param {?} name
  38266. * @param {?=} containingFile
  38267. * @return {?}
  38268. */
  38269. StaticReflector.prototype.findDeclaration = /**
  38270. * @param {?} moduleUrl
  38271. * @param {?} name
  38272. * @param {?=} containingFile
  38273. * @return {?}
  38274. */
  38275. function (moduleUrl, name, containingFile) {
  38276. return this.findSymbolDeclaration(this.symbolResolver.getSymbolByModule(moduleUrl, name, containingFile));
  38277. };
  38278. /**
  38279. * @param {?} moduleUrl
  38280. * @param {?} name
  38281. * @return {?}
  38282. */
  38283. StaticReflector.prototype.tryFindDeclaration = /**
  38284. * @param {?} moduleUrl
  38285. * @param {?} name
  38286. * @return {?}
  38287. */
  38288. function (moduleUrl, name) {
  38289. var _this = this;
  38290. return this.symbolResolver.ignoreErrorsFor(function () { return _this.findDeclaration(moduleUrl, name); });
  38291. };
  38292. /**
  38293. * @param {?} symbol
  38294. * @return {?}
  38295. */
  38296. StaticReflector.prototype.findSymbolDeclaration = /**
  38297. * @param {?} symbol
  38298. * @return {?}
  38299. */
  38300. function (symbol) {
  38301. var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
  38302. if (resolvedSymbol) {
  38303. var /** @type {?} */ resolvedMetadata = resolvedSymbol.metadata;
  38304. if (resolvedMetadata && resolvedMetadata.__symbolic === 'resolved') {
  38305. resolvedMetadata = resolvedMetadata.symbol;
  38306. }
  38307. if (resolvedMetadata instanceof StaticSymbol) {
  38308. return this.findSymbolDeclaration(resolvedSymbol.metadata);
  38309. }
  38310. }
  38311. return symbol;
  38312. };
  38313. /**
  38314. * @param {?} type
  38315. * @return {?}
  38316. */
  38317. StaticReflector.prototype.annotations = /**
  38318. * @param {?} type
  38319. * @return {?}
  38320. */
  38321. function (type) {
  38322. var /** @type {?} */ annotations = this.annotationCache.get(type);
  38323. if (!annotations) {
  38324. annotations = [];
  38325. var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
  38326. var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
  38327. if (parentType) {
  38328. var /** @type {?} */ parentAnnotations = this.annotations(parentType);
  38329. annotations.push.apply(annotations, parentAnnotations);
  38330. }
  38331. var /** @type {?} */ ownAnnotations_1 = [];
  38332. if (classMetadata['decorators']) {
  38333. ownAnnotations_1 = this.simplify(type, classMetadata['decorators']);
  38334. annotations.push.apply(annotations, ownAnnotations_1);
  38335. }
  38336. if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) &&
  38337. this.summaryResolver.isLibraryFile(parentType.filePath)) {
  38338. var /** @type {?} */ summary = this.summaryResolver.resolveSummary(parentType);
  38339. if (summary && summary.type) {
  38340. var /** @type {?} */ requiredAnnotationTypes = /** @type {?} */ ((this.annotationForParentClassWithSummaryKind.get(/** @type {?} */ ((summary.type.summaryKind)))));
  38341. var /** @type {?} */ typeHasRequiredAnnotation = requiredAnnotationTypes.some(function (requiredType) { return ownAnnotations_1.some(function (ann) { return requiredType.isTypeOf(ann); }); });
  38342. if (!typeHasRequiredAnnotation) {
  38343. this.reportError(formatMetadataError(metadataError("Class " + type.name + " in " + type.filePath + " extends from a " + CompileSummaryKind[(/** @type {?} */ ((summary.type.summaryKind)))] + " in another compilation unit without duplicating the decorator", undefined, "Please add a " + requiredAnnotationTypes.map(function (type) { return type.ngMetadataName; }).join(' or ') + " decorator to the class"), type), type);
  38344. }
  38345. }
  38346. }
  38347. this.annotationCache.set(type, annotations.filter(function (ann) { return !!ann; }));
  38348. }
  38349. return annotations;
  38350. };
  38351. /**
  38352. * @param {?} type
  38353. * @return {?}
  38354. */
  38355. StaticReflector.prototype.propMetadata = /**
  38356. * @param {?} type
  38357. * @return {?}
  38358. */
  38359. function (type) {
  38360. var _this = this;
  38361. var /** @type {?} */ propMetadata = this.propertyCache.get(type);
  38362. if (!propMetadata) {
  38363. var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
  38364. propMetadata = {};
  38365. var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
  38366. if (parentType) {
  38367. var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentType);
  38368. Object.keys(parentPropMetadata_1).forEach(function (parentProp) {
  38369. /** @type {?} */ ((propMetadata))[parentProp] = parentPropMetadata_1[parentProp];
  38370. });
  38371. }
  38372. var /** @type {?} */ members_1 = classMetadata['members'] || {};
  38373. Object.keys(members_1).forEach(function (propName) {
  38374. var /** @type {?} */ propData = members_1[propName];
  38375. var /** @type {?} */ prop = (/** @type {?} */ (propData))
  38376. .find(function (a) { return a['__symbolic'] == 'property' || a['__symbolic'] == 'method'; });
  38377. var /** @type {?} */ decorators = [];
  38378. if (/** @type {?} */ ((propMetadata))[propName]) {
  38379. decorators.push.apply(decorators, /** @type {?} */ ((propMetadata))[propName]);
  38380. } /** @type {?} */
  38381. ((propMetadata))[propName] = decorators;
  38382. if (prop && prop['decorators']) {
  38383. decorators.push.apply(decorators, _this.simplify(type, prop['decorators']));
  38384. }
  38385. });
  38386. this.propertyCache.set(type, propMetadata);
  38387. }
  38388. return propMetadata;
  38389. };
  38390. /**
  38391. * @param {?} type
  38392. * @return {?}
  38393. */
  38394. StaticReflector.prototype.parameters = /**
  38395. * @param {?} type
  38396. * @return {?}
  38397. */
  38398. function (type) {
  38399. var _this = this;
  38400. if (!(type instanceof StaticSymbol)) {
  38401. this.reportError(new Error("parameters received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
  38402. return [];
  38403. }
  38404. try {
  38405. var /** @type {?} */ parameters_1 = this.parameterCache.get(type);
  38406. if (!parameters_1) {
  38407. var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
  38408. var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
  38409. var /** @type {?} */ members = classMetadata ? classMetadata['members'] : null;
  38410. var /** @type {?} */ ctorData = members ? members['__ctor__'] : null;
  38411. if (ctorData) {
  38412. var /** @type {?} */ ctor = (/** @type {?} */ (ctorData)).find(function (a) { return a['__symbolic'] == 'constructor'; });
  38413. var /** @type {?} */ rawParameterTypes = /** @type {?} */ (ctor['parameters']) || [];
  38414. var /** @type {?} */ parameterDecorators_1 = /** @type {?} */ (this.simplify(type, ctor['parameterDecorators'] || []));
  38415. parameters_1 = [];
  38416. rawParameterTypes.forEach(function (rawParamType, index) {
  38417. var /** @type {?} */ nestedResult = [];
  38418. var /** @type {?} */ paramType = _this.trySimplify(type, rawParamType);
  38419. if (paramType)
  38420. nestedResult.push(paramType);
  38421. var /** @type {?} */ decorators = parameterDecorators_1 ? parameterDecorators_1[index] : null;
  38422. if (decorators) {
  38423. nestedResult.push.apply(nestedResult, decorators);
  38424. } /** @type {?} */
  38425. ((parameters_1)).push(nestedResult);
  38426. });
  38427. }
  38428. else if (parentType) {
  38429. parameters_1 = this.parameters(parentType);
  38430. }
  38431. if (!parameters_1) {
  38432. parameters_1 = [];
  38433. }
  38434. this.parameterCache.set(type, parameters_1);
  38435. }
  38436. return parameters_1;
  38437. }
  38438. catch (/** @type {?} */ e) {
  38439. console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
  38440. throw e;
  38441. }
  38442. };
  38443. /**
  38444. * @param {?} type
  38445. * @return {?}
  38446. */
  38447. StaticReflector.prototype._methodNames = /**
  38448. * @param {?} type
  38449. * @return {?}
  38450. */
  38451. function (type) {
  38452. var /** @type {?} */ methodNames = this.methodCache.get(type);
  38453. if (!methodNames) {
  38454. var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
  38455. methodNames = {};
  38456. var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
  38457. if (parentType) {
  38458. var /** @type {?} */ parentMethodNames_1 = this._methodNames(parentType);
  38459. Object.keys(parentMethodNames_1).forEach(function (parentProp) {
  38460. /** @type {?} */ ((methodNames))[parentProp] = parentMethodNames_1[parentProp];
  38461. });
  38462. }
  38463. var /** @type {?} */ members_2 = classMetadata['members'] || {};
  38464. Object.keys(members_2).forEach(function (propName) {
  38465. var /** @type {?} */ propData = members_2[propName];
  38466. var /** @type {?} */ isMethod = (/** @type {?} */ (propData)).some(function (a) { return a['__symbolic'] == 'method'; }); /** @type {?} */
  38467. ((methodNames))[propName] = /** @type {?} */ ((methodNames))[propName] || isMethod;
  38468. });
  38469. this.methodCache.set(type, methodNames);
  38470. }
  38471. return methodNames;
  38472. };
  38473. /**
  38474. * @param {?} type
  38475. * @return {?}
  38476. */
  38477. StaticReflector.prototype._staticMembers = /**
  38478. * @param {?} type
  38479. * @return {?}
  38480. */
  38481. function (type) {
  38482. var /** @type {?} */ staticMembers = this.staticCache.get(type);
  38483. if (!staticMembers) {
  38484. var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
  38485. var /** @type {?} */ staticMemberData = classMetadata['statics'] || {};
  38486. staticMembers = Object.keys(staticMemberData);
  38487. this.staticCache.set(type, staticMembers);
  38488. }
  38489. return staticMembers;
  38490. };
  38491. /**
  38492. * @param {?} type
  38493. * @param {?} classMetadata
  38494. * @return {?}
  38495. */
  38496. StaticReflector.prototype.findParentType = /**
  38497. * @param {?} type
  38498. * @param {?} classMetadata
  38499. * @return {?}
  38500. */
  38501. function (type, classMetadata) {
  38502. var /** @type {?} */ parentType = this.trySimplify(type, classMetadata['extends']);
  38503. if (parentType instanceof StaticSymbol) {
  38504. return parentType;
  38505. }
  38506. };
  38507. /**
  38508. * @param {?} type
  38509. * @param {?} lcProperty
  38510. * @return {?}
  38511. */
  38512. StaticReflector.prototype.hasLifecycleHook = /**
  38513. * @param {?} type
  38514. * @param {?} lcProperty
  38515. * @return {?}
  38516. */
  38517. function (type, lcProperty) {
  38518. if (!(type instanceof StaticSymbol)) {
  38519. this.reportError(new Error("hasLifecycleHook received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
  38520. }
  38521. try {
  38522. return !!this._methodNames(type)[lcProperty];
  38523. }
  38524. catch (/** @type {?} */ e) {
  38525. console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
  38526. throw e;
  38527. }
  38528. };
  38529. /**
  38530. * @param {?} type
  38531. * @return {?}
  38532. */
  38533. StaticReflector.prototype.guards = /**
  38534. * @param {?} type
  38535. * @return {?}
  38536. */
  38537. function (type) {
  38538. if (!(type instanceof StaticSymbol)) {
  38539. this.reportError(new Error("guards received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
  38540. return {};
  38541. }
  38542. var /** @type {?} */ staticMembers = this._staticMembers(type);
  38543. var /** @type {?} */ result = {};
  38544. for (var _i = 0, staticMembers_1 = staticMembers; _i < staticMembers_1.length; _i++) {
  38545. var name_1 = staticMembers_1[_i];
  38546. if (name_1.endsWith(TYPEGUARD_POSTFIX)) {
  38547. var /** @type {?} */ property = name_1.substr(0, name_1.length - TYPEGUARD_POSTFIX.length);
  38548. var /** @type {?} */ value = void 0;
  38549. if (property.endsWith(USE_IF)) {
  38550. property = name_1.substr(0, property.length - USE_IF.length);
  38551. value = USE_IF;
  38552. }
  38553. else {
  38554. value = this.getStaticSymbol(type.filePath, type.name, [name_1]);
  38555. }
  38556. result[property] = value;
  38557. }
  38558. }
  38559. return result;
  38560. };
  38561. /**
  38562. * @param {?} type
  38563. * @param {?} ctor
  38564. * @return {?}
  38565. */
  38566. StaticReflector.prototype._registerDecoratorOrConstructor = /**
  38567. * @param {?} type
  38568. * @param {?} ctor
  38569. * @return {?}
  38570. */
  38571. function (type, ctor) {
  38572. this.conversionMap.set(type, function (context, args) { return new (ctor.bind.apply(ctor, [void 0].concat(args)))(); });
  38573. };
  38574. /**
  38575. * @param {?} type
  38576. * @param {?} fn
  38577. * @return {?}
  38578. */
  38579. StaticReflector.prototype._registerFunction = /**
  38580. * @param {?} type
  38581. * @param {?} fn
  38582. * @return {?}
  38583. */
  38584. function (type, fn) {
  38585. this.conversionMap.set(type, function (context, args) { return fn.apply(undefined, args); });
  38586. };
  38587. /**
  38588. * @return {?}
  38589. */
  38590. StaticReflector.prototype.initializeConversionMap = /**
  38591. * @return {?}
  38592. */
  38593. function () {
  38594. this.injectionToken = this.findDeclaration(ANGULAR_CORE, 'InjectionToken');
  38595. this.opaqueToken = this.findDeclaration(ANGULAR_CORE, 'OpaqueToken');
  38596. this.ROUTES = this.tryFindDeclaration(ANGULAR_ROUTER, 'ROUTES');
  38597. this.ANALYZE_FOR_ENTRY_COMPONENTS =
  38598. this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS');
  38599. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
  38600. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable);
  38601. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
  38602. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
  38603. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject);
  38604. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
  38605. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute);
  38606. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild);
  38607. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren);
  38608. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild);
  38609. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren);
  38610. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput);
  38611. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput);
  38612. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe);
  38613. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding);
  38614. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener);
  38615. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective);
  38616. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent);
  38617. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule);
  38618. // Note: Some metadata classes can be used directly with Provider.deps.
  38619. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
  38620. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
  38621. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
  38622. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
  38623. };
  38624. /**
  38625. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  38626. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  38627. *
  38628. * @param declarationFile the absolute path of the file where the symbol is declared
  38629. * @param name the name of the type.
  38630. */
  38631. /**
  38632. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  38633. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  38634. *
  38635. * @param {?} declarationFile the absolute path of the file where the symbol is declared
  38636. * @param {?} name the name of the type.
  38637. * @param {?=} members
  38638. * @return {?}
  38639. */
  38640. StaticReflector.prototype.getStaticSymbol = /**
  38641. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  38642. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  38643. *
  38644. * @param {?} declarationFile the absolute path of the file where the symbol is declared
  38645. * @param {?} name the name of the type.
  38646. * @param {?=} members
  38647. * @return {?}
  38648. */
  38649. function (declarationFile, name, members) {
  38650. return this.symbolResolver.getStaticSymbol(declarationFile, name, members);
  38651. };
  38652. /**
  38653. * Simplify but discard any errors
  38654. * @param {?} context
  38655. * @param {?} value
  38656. * @return {?}
  38657. */
  38658. StaticReflector.prototype.trySimplify = /**
  38659. * Simplify but discard any errors
  38660. * @param {?} context
  38661. * @param {?} value
  38662. * @return {?}
  38663. */
  38664. function (context, value) {
  38665. var /** @type {?} */ originalRecorder = this.errorRecorder;
  38666. this.errorRecorder = function (error, fileName) { };
  38667. var /** @type {?} */ result = this.simplify(context, value);
  38668. this.errorRecorder = originalRecorder;
  38669. return result;
  38670. };
  38671. /**
  38672. * \@internal
  38673. * @param {?} context
  38674. * @param {?} value
  38675. * @return {?}
  38676. */
  38677. StaticReflector.prototype.simplify = /**
  38678. * \@internal
  38679. * @param {?} context
  38680. * @param {?} value
  38681. * @return {?}
  38682. */
  38683. function (context, value) {
  38684. var /** @type {?} */ self = this;
  38685. var /** @type {?} */ scope = BindingScope.empty;
  38686. var /** @type {?} */ calling = new Map();
  38687. var /** @type {?} */ rootContext = context;
  38688. /**
  38689. * @param {?} context
  38690. * @param {?} value
  38691. * @param {?} depth
  38692. * @param {?} references
  38693. * @return {?}
  38694. */
  38695. function simplifyInContext(context, value, depth, references) {
  38696. /**
  38697. * @param {?} staticSymbol
  38698. * @return {?}
  38699. */
  38700. function resolveReferenceValue(staticSymbol) {
  38701. var /** @type {?} */ resolvedSymbol = self.symbolResolver.resolveSymbol(staticSymbol);
  38702. return resolvedSymbol ? resolvedSymbol.metadata : null;
  38703. }
  38704. /**
  38705. * @param {?} value
  38706. * @return {?}
  38707. */
  38708. function simplifyEagerly(value) {
  38709. return simplifyInContext(context, value, depth, 0);
  38710. }
  38711. /**
  38712. * @param {?} value
  38713. * @return {?}
  38714. */
  38715. function simplifyLazily(value) {
  38716. return simplifyInContext(context, value, depth, references + 1);
  38717. }
  38718. /**
  38719. * @param {?} nestedContext
  38720. * @param {?} value
  38721. * @return {?}
  38722. */
  38723. function simplifyNested(nestedContext, value) {
  38724. if (nestedContext === context) {
  38725. // If the context hasn't changed let the exception propagate unmodified.
  38726. return simplifyInContext(nestedContext, value, depth + 1, references);
  38727. }
  38728. try {
  38729. return simplifyInContext(nestedContext, value, depth + 1, references);
  38730. }
  38731. catch (/** @type {?} */ e) {
  38732. if (isMetadataError(e)) {
  38733. // Propagate the message text up but add a message to the chain that explains how we got
  38734. // here.
  38735. // e.chain implies e.symbol
  38736. var /** @type {?} */ summaryMsg = e.chain ? 'references \'' + /** @type {?} */ ((e.symbol)).name + '\'' : errorSummary(e);
  38737. var /** @type {?} */ summary = "'" + nestedContext.name + "' " + summaryMsg;
  38738. var /** @type {?} */ chain = { message: summary, position: e.position, next: e.chain };
  38739. // TODO(chuckj): retrieve the position information indirectly from the collectors node
  38740. // map if the metadata is from a .ts file.
  38741. self.error({
  38742. message: e.message,
  38743. advise: e.advise,
  38744. context: e.context, chain: chain,
  38745. symbol: nestedContext
  38746. }, context);
  38747. }
  38748. else {
  38749. // It is probably an internal error.
  38750. throw e;
  38751. }
  38752. }
  38753. }
  38754. /**
  38755. * @param {?} functionSymbol
  38756. * @param {?} targetFunction
  38757. * @param {?} args
  38758. * @param {?} targetExpression
  38759. * @return {?}
  38760. */
  38761. function simplifyCall(functionSymbol, targetFunction, args, targetExpression) {
  38762. if (targetFunction && targetFunction['__symbolic'] == 'function') {
  38763. if (calling.get(functionSymbol)) {
  38764. self.error({
  38765. message: 'Recursion is not supported',
  38766. summary: "called '" + functionSymbol.name + "' recursively",
  38767. value: targetFunction
  38768. }, functionSymbol);
  38769. }
  38770. try {
  38771. var /** @type {?} */ value_1 = targetFunction['value'];
  38772. if (value_1 && (depth != 0 || value_1.__symbolic != 'error')) {
  38773. var /** @type {?} */ parameters = targetFunction['parameters'];
  38774. var /** @type {?} */ defaults = targetFunction.defaults;
  38775. args = args.map(function (arg) { return simplifyNested(context, arg); })
  38776. .map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
  38777. if (defaults && defaults.length > args.length) {
  38778. args.push.apply(args, defaults.slice(args.length).map(function (value) { return simplify(value); }));
  38779. }
  38780. calling.set(functionSymbol, true);
  38781. var /** @type {?} */ functionScope = BindingScope.build();
  38782. for (var /** @type {?} */ i = 0; i < parameters.length; i++) {
  38783. functionScope.define(parameters[i], args[i]);
  38784. }
  38785. var /** @type {?} */ oldScope = scope;
  38786. var /** @type {?} */ result_1;
  38787. try {
  38788. scope = functionScope.done();
  38789. result_1 = simplifyNested(functionSymbol, value_1);
  38790. }
  38791. finally {
  38792. scope = oldScope;
  38793. }
  38794. return result_1;
  38795. }
  38796. }
  38797. finally {
  38798. calling.delete(functionSymbol);
  38799. }
  38800. }
  38801. if (depth === 0) {
  38802. // If depth is 0 we are evaluating the top level expression that is describing element
  38803. // decorator. In this case, it is a decorator we don't understand, such as a custom
  38804. // non-angular decorator, and we should just ignore it.
  38805. return IGNORE;
  38806. }
  38807. var /** @type {?} */ position = undefined;
  38808. if (targetExpression && targetExpression.__symbolic == 'resolved') {
  38809. var /** @type {?} */ line = targetExpression.line;
  38810. var /** @type {?} */ character = targetExpression.character;
  38811. var /** @type {?} */ fileName = targetExpression.fileName;
  38812. if (fileName != null && line != null && character != null) {
  38813. position = { fileName: fileName, line: line, column: character };
  38814. }
  38815. }
  38816. self.error({
  38817. message: FUNCTION_CALL_NOT_SUPPORTED,
  38818. context: functionSymbol,
  38819. value: targetFunction, position: position
  38820. }, context);
  38821. }
  38822. /**
  38823. * @param {?} expression
  38824. * @return {?}
  38825. */
  38826. function simplify(expression) {
  38827. if (isPrimitive(expression)) {
  38828. return expression;
  38829. }
  38830. if (expression instanceof Array) {
  38831. var /** @type {?} */ result_2 = [];
  38832. for (var _i = 0, _a = (/** @type {?} */ (expression)); _i < _a.length; _i++) {
  38833. var item = _a[_i];
  38834. // Check for a spread expression
  38835. if (item && item.__symbolic === 'spread') {
  38836. // We call with references as 0 because we require the actual value and cannot
  38837. // tolerate a reference here.
  38838. var /** @type {?} */ spreadArray = simplifyEagerly(item.expression);
  38839. if (Array.isArray(spreadArray)) {
  38840. for (var _b = 0, spreadArray_1 = spreadArray; _b < spreadArray_1.length; _b++) {
  38841. var spreadItem = spreadArray_1[_b];
  38842. result_2.push(spreadItem);
  38843. }
  38844. continue;
  38845. }
  38846. }
  38847. var /** @type {?} */ value_2 = simplify(item);
  38848. if (shouldIgnore(value_2)) {
  38849. continue;
  38850. }
  38851. result_2.push(value_2);
  38852. }
  38853. return result_2;
  38854. }
  38855. if (expression instanceof StaticSymbol) {
  38856. // Stop simplification at builtin symbols or if we are in a reference context and
  38857. // the symbol doesn't have members.
  38858. if (expression === self.injectionToken || self.conversionMap.has(expression) ||
  38859. (references > 0 && !expression.members.length)) {
  38860. return expression;
  38861. }
  38862. else {
  38863. var /** @type {?} */ staticSymbol = expression;
  38864. var /** @type {?} */ declarationValue = resolveReferenceValue(staticSymbol);
  38865. if (declarationValue != null) {
  38866. return simplifyNested(staticSymbol, declarationValue);
  38867. }
  38868. else {
  38869. return staticSymbol;
  38870. }
  38871. }
  38872. }
  38873. if (expression) {
  38874. if (expression['__symbolic']) {
  38875. var /** @type {?} */ staticSymbol = void 0;
  38876. switch (expression['__symbolic']) {
  38877. case 'binop':
  38878. var /** @type {?} */ left = simplify(expression['left']);
  38879. if (shouldIgnore(left))
  38880. return left;
  38881. var /** @type {?} */ right = simplify(expression['right']);
  38882. if (shouldIgnore(right))
  38883. return right;
  38884. switch (expression['operator']) {
  38885. case '&&':
  38886. return left && right;
  38887. case '||':
  38888. return left || right;
  38889. case '|':
  38890. return left | right;
  38891. case '^':
  38892. return left ^ right;
  38893. case '&':
  38894. return left & right;
  38895. case '==':
  38896. return left == right;
  38897. case '!=':
  38898. return left != right;
  38899. case '===':
  38900. return left === right;
  38901. case '!==':
  38902. return left !== right;
  38903. case '<':
  38904. return left < right;
  38905. case '>':
  38906. return left > right;
  38907. case '<=':
  38908. return left <= right;
  38909. case '>=':
  38910. return left >= right;
  38911. case '<<':
  38912. return left << right;
  38913. case '>>':
  38914. return left >> right;
  38915. case '+':
  38916. return left + right;
  38917. case '-':
  38918. return left - right;
  38919. case '*':
  38920. return left * right;
  38921. case '/':
  38922. return left / right;
  38923. case '%':
  38924. return left % right;
  38925. }
  38926. return null;
  38927. case 'if':
  38928. var /** @type {?} */ condition = simplify(expression['condition']);
  38929. return condition ? simplify(expression['thenExpression']) :
  38930. simplify(expression['elseExpression']);
  38931. case 'pre':
  38932. var /** @type {?} */ operand = simplify(expression['operand']);
  38933. if (shouldIgnore(operand))
  38934. return operand;
  38935. switch (expression['operator']) {
  38936. case '+':
  38937. return operand;
  38938. case '-':
  38939. return -operand;
  38940. case '!':
  38941. return !operand;
  38942. case '~':
  38943. return ~operand;
  38944. }
  38945. return null;
  38946. case 'index':
  38947. var /** @type {?} */ indexTarget = simplifyEagerly(expression['expression']);
  38948. var /** @type {?} */ index = simplifyEagerly(expression['index']);
  38949. if (indexTarget && isPrimitive(index))
  38950. return indexTarget[index];
  38951. return null;
  38952. case 'select':
  38953. var /** @type {?} */ member = expression['member'];
  38954. var /** @type {?} */ selectContext = context;
  38955. var /** @type {?} */ selectTarget = simplify(expression['expression']);
  38956. if (selectTarget instanceof StaticSymbol) {
  38957. var /** @type {?} */ members = selectTarget.members.concat(member);
  38958. selectContext =
  38959. self.getStaticSymbol(selectTarget.filePath, selectTarget.name, members);
  38960. var /** @type {?} */ declarationValue = resolveReferenceValue(selectContext);
  38961. if (declarationValue != null) {
  38962. return simplifyNested(selectContext, declarationValue);
  38963. }
  38964. else {
  38965. return selectContext;
  38966. }
  38967. }
  38968. if (selectTarget && isPrimitive(member))
  38969. return simplifyNested(selectContext, selectTarget[member]);
  38970. return null;
  38971. case 'reference':
  38972. // Note: This only has to deal with variable references, as symbol references have
  38973. // been converted into 'resolved'
  38974. // in the StaticSymbolResolver.
  38975. var /** @type {?} */ name_2 = expression['name'];
  38976. var /** @type {?} */ localValue = scope.resolve(name_2);
  38977. if (localValue != BindingScope.missing) {
  38978. return localValue;
  38979. }
  38980. break;
  38981. case 'resolved':
  38982. try {
  38983. return simplify(expression.symbol);
  38984. }
  38985. catch (/** @type {?} */ e) {
  38986. // If an error is reported evaluating the symbol record the position of the
  38987. // reference in the error so it can
  38988. // be reported in the error message generated from the exception.
  38989. if (isMetadataError(e) && expression.fileName != null &&
  38990. expression.line != null && expression.character != null) {
  38991. e.position = {
  38992. fileName: expression.fileName,
  38993. line: expression.line,
  38994. column: expression.character
  38995. };
  38996. }
  38997. throw e;
  38998. }
  38999. case 'class':
  39000. return context;
  39001. case 'function':
  39002. return context;
  39003. case 'new':
  39004. case 'call':
  39005. // Determine if the function is a built-in conversion
  39006. staticSymbol = simplifyInContext(context, expression['expression'], depth + 1, /* references */ 0);
  39007. if (staticSymbol instanceof StaticSymbol) {
  39008. if (staticSymbol === self.injectionToken || staticSymbol === self.opaqueToken) {
  39009. // if somebody calls new InjectionToken, don't create an InjectionToken,
  39010. // but rather return the symbol to which the InjectionToken is assigned to.
  39011. // OpaqueToken is supported too as it is required by the language service to
  39012. // support v4 and prior versions of Angular.
  39013. return context;
  39014. }
  39015. var /** @type {?} */ argExpressions = expression['arguments'] || [];
  39016. var /** @type {?} */ converter = self.conversionMap.get(staticSymbol);
  39017. if (converter) {
  39018. var /** @type {?} */ args = argExpressions.map(function (arg) { return simplifyNested(context, arg); })
  39019. .map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
  39020. return converter(context, args);
  39021. }
  39022. else {
  39023. // Determine if the function is one we can simplify.
  39024. var /** @type {?} */ targetFunction = resolveReferenceValue(staticSymbol);
  39025. return simplifyCall(staticSymbol, targetFunction, argExpressions, expression['expression']);
  39026. }
  39027. }
  39028. return IGNORE;
  39029. case 'error':
  39030. var /** @type {?} */ message = expression.message;
  39031. if (expression['line'] != null) {
  39032. self.error({
  39033. message: message,
  39034. context: expression.context,
  39035. value: expression,
  39036. position: {
  39037. fileName: expression['fileName'],
  39038. line: expression['line'],
  39039. column: expression['character']
  39040. }
  39041. }, context);
  39042. }
  39043. else {
  39044. self.error({ message: message, context: expression.context }, context);
  39045. }
  39046. return IGNORE;
  39047. case 'ignore':
  39048. return expression;
  39049. }
  39050. return null;
  39051. }
  39052. return mapStringMap(expression, function (value, name) {
  39053. if (REFERENCE_SET.has(name)) {
  39054. if (name === USE_VALUE && PROVIDE in expression) {
  39055. // If this is a provider expression, check for special tokens that need the value
  39056. // during analysis.
  39057. var /** @type {?} */ provide = simplify(expression.provide);
  39058. if (provide === self.ROUTES || provide == self.ANALYZE_FOR_ENTRY_COMPONENTS) {
  39059. return simplify(value);
  39060. }
  39061. }
  39062. return simplifyLazily(value);
  39063. }
  39064. return simplify(value);
  39065. });
  39066. }
  39067. return IGNORE;
  39068. }
  39069. return simplify(value);
  39070. }
  39071. var /** @type {?} */ result;
  39072. try {
  39073. result = simplifyInContext(context, value, 0, 0);
  39074. }
  39075. catch (/** @type {?} */ e) {
  39076. if (this.errorRecorder) {
  39077. this.reportError(e, context);
  39078. }
  39079. else {
  39080. throw formatMetadataError(e, context);
  39081. }
  39082. }
  39083. if (shouldIgnore(result)) {
  39084. return undefined;
  39085. }
  39086. return result;
  39087. };
  39088. /**
  39089. * @param {?} type
  39090. * @return {?}
  39091. */
  39092. StaticReflector.prototype.getTypeMetadata = /**
  39093. * @param {?} type
  39094. * @return {?}
  39095. */
  39096. function (type) {
  39097. var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(type);
  39098. return resolvedSymbol && resolvedSymbol.metadata ? resolvedSymbol.metadata :
  39099. { __symbolic: 'class' };
  39100. };
  39101. /**
  39102. * @param {?} error
  39103. * @param {?} context
  39104. * @param {?=} path
  39105. * @return {?}
  39106. */
  39107. StaticReflector.prototype.reportError = /**
  39108. * @param {?} error
  39109. * @param {?} context
  39110. * @param {?=} path
  39111. * @return {?}
  39112. */
  39113. function (error, context, path) {
  39114. if (this.errorRecorder) {
  39115. this.errorRecorder(formatMetadataError(error, context), (context && context.filePath) || path);
  39116. }
  39117. else {
  39118. throw error;
  39119. }
  39120. };
  39121. /**
  39122. * @param {?} __0
  39123. * @param {?} reportingContext
  39124. * @return {?}
  39125. */
  39126. StaticReflector.prototype.error = /**
  39127. * @param {?} __0
  39128. * @param {?} reportingContext
  39129. * @return {?}
  39130. */
  39131. function (_a, reportingContext) {
  39132. var message = _a.message, summary = _a.summary, advise = _a.advise, position = _a.position, context = _a.context, value = _a.value, symbol = _a.symbol, chain = _a.chain;
  39133. this.reportError(metadataError(message, summary, advise, position, symbol, context, chain), reportingContext);
  39134. };
  39135. return StaticReflector;
  39136. }());
  39137. var METADATA_ERROR = 'ngMetadataError';
  39138. /**
  39139. * @param {?} message
  39140. * @param {?=} summary
  39141. * @param {?=} advise
  39142. * @param {?=} position
  39143. * @param {?=} symbol
  39144. * @param {?=} context
  39145. * @param {?=} chain
  39146. * @return {?}
  39147. */
  39148. function metadataError(message, summary, advise, position, symbol, context, chain) {
  39149. var /** @type {?} */ error = /** @type {?} */ (syntaxError(message));
  39150. (/** @type {?} */ (error))[METADATA_ERROR] = true;
  39151. if (advise)
  39152. error.advise = advise;
  39153. if (position)
  39154. error.position = position;
  39155. if (summary)
  39156. error.summary = summary;
  39157. if (context)
  39158. error.context = context;
  39159. if (chain)
  39160. error.chain = chain;
  39161. if (symbol)
  39162. error.symbol = symbol;
  39163. return error;
  39164. }
  39165. /**
  39166. * @param {?} error
  39167. * @return {?}
  39168. */
  39169. function isMetadataError(error) {
  39170. return !!(/** @type {?} */ (error))[METADATA_ERROR];
  39171. }
  39172. var REFERENCE_TO_NONEXPORTED_CLASS = 'Reference to non-exported class';
  39173. var VARIABLE_NOT_INITIALIZED = 'Variable not initialized';
  39174. var DESTRUCTURE_NOT_SUPPORTED = 'Destructuring not supported';
  39175. var COULD_NOT_RESOLVE_TYPE = 'Could not resolve type';
  39176. var FUNCTION_CALL_NOT_SUPPORTED = 'Function call not supported';
  39177. var REFERENCE_TO_LOCAL_SYMBOL = 'Reference to a local symbol';
  39178. var LAMBDA_NOT_SUPPORTED = 'Lambda not supported';
  39179. /**
  39180. * @param {?} message
  39181. * @param {?} context
  39182. * @return {?}
  39183. */
  39184. function expandedMessage(message, context) {
  39185. switch (message) {
  39186. case REFERENCE_TO_NONEXPORTED_CLASS:
  39187. if (context && context.className) {
  39188. return "References to a non-exported class are not supported in decorators but " + context.className + " was referenced.";
  39189. }
  39190. break;
  39191. case VARIABLE_NOT_INITIALIZED:
  39192. return 'Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler';
  39193. case DESTRUCTURE_NOT_SUPPORTED:
  39194. return 'Referencing an exported destructured variable or constant is not supported in decorators and this value is needed by the template compiler';
  39195. case COULD_NOT_RESOLVE_TYPE:
  39196. if (context && context.typeName) {
  39197. return "Could not resolve type " + context.typeName;
  39198. }
  39199. break;
  39200. case FUNCTION_CALL_NOT_SUPPORTED:
  39201. if (context && context.name) {
  39202. return "Function calls are not supported in decorators but '" + context.name + "' was called";
  39203. }
  39204. return 'Function calls are not supported in decorators';
  39205. case REFERENCE_TO_LOCAL_SYMBOL:
  39206. if (context && context.name) {
  39207. return "Reference to a local (non-exported) symbols are not supported in decorators but '" + context.name + "' was referenced";
  39208. }
  39209. break;
  39210. case LAMBDA_NOT_SUPPORTED:
  39211. return "Function expressions are not supported in decorators";
  39212. }
  39213. return message;
  39214. }
  39215. /**
  39216. * @param {?} message
  39217. * @param {?} context
  39218. * @return {?}
  39219. */
  39220. function messageAdvise(message, context) {
  39221. switch (message) {
  39222. case REFERENCE_TO_NONEXPORTED_CLASS:
  39223. if (context && context.className) {
  39224. return "Consider exporting '" + context.className + "'";
  39225. }
  39226. break;
  39227. case DESTRUCTURE_NOT_SUPPORTED:
  39228. return 'Consider simplifying to avoid destructuring';
  39229. case REFERENCE_TO_LOCAL_SYMBOL:
  39230. if (context && context.name) {
  39231. return "Consider exporting '" + context.name + "'";
  39232. }
  39233. break;
  39234. case LAMBDA_NOT_SUPPORTED:
  39235. return "Consider changing the function expression into an exported function";
  39236. }
  39237. return undefined;
  39238. }
  39239. /**
  39240. * @param {?} error
  39241. * @return {?}
  39242. */
  39243. function errorSummary(error) {
  39244. if (error.summary) {
  39245. return error.summary;
  39246. }
  39247. switch (error.message) {
  39248. case REFERENCE_TO_NONEXPORTED_CLASS:
  39249. if (error.context && error.context.className) {
  39250. return "references non-exported class " + error.context.className;
  39251. }
  39252. break;
  39253. case VARIABLE_NOT_INITIALIZED:
  39254. return 'is not initialized';
  39255. case DESTRUCTURE_NOT_SUPPORTED:
  39256. return 'is a destructured variable';
  39257. case COULD_NOT_RESOLVE_TYPE:
  39258. return 'could not be resolved';
  39259. case FUNCTION_CALL_NOT_SUPPORTED:
  39260. if (error.context && error.context.name) {
  39261. return "calls '" + error.context.name + "'";
  39262. }
  39263. return "calls a function";
  39264. case REFERENCE_TO_LOCAL_SYMBOL:
  39265. if (error.context && error.context.name) {
  39266. return "references local variable " + error.context.name;
  39267. }
  39268. return "references a local variable";
  39269. }
  39270. return 'contains the error';
  39271. }
  39272. /**
  39273. * @param {?} input
  39274. * @param {?} transform
  39275. * @return {?}
  39276. */
  39277. function mapStringMap(input, transform) {
  39278. if (!input)
  39279. return {};
  39280. var /** @type {?} */ result = {};
  39281. Object.keys(input).forEach(function (key) {
  39282. var /** @type {?} */ value = transform(input[key], key);
  39283. if (!shouldIgnore(value)) {
  39284. if (HIDDEN_KEY.test(key)) {
  39285. Object.defineProperty(result, key, { enumerable: false, configurable: true, value: value });
  39286. }
  39287. else {
  39288. result[key] = value;
  39289. }
  39290. }
  39291. });
  39292. return result;
  39293. }
  39294. /**
  39295. * @param {?} o
  39296. * @return {?}
  39297. */
  39298. function isPrimitive(o) {
  39299. return o === null || (typeof o !== 'function' && typeof o !== 'object');
  39300. }
  39301. /**
  39302. * @abstract
  39303. */
  39304. var BindingScope = /** @class */ (function () {
  39305. function BindingScope() {
  39306. }
  39307. /**
  39308. * @return {?}
  39309. */
  39310. BindingScope.build = /**
  39311. * @return {?}
  39312. */
  39313. function () {
  39314. var /** @type {?} */ current = new Map();
  39315. return {
  39316. define: function (name, value) {
  39317. current.set(name, value);
  39318. return this;
  39319. },
  39320. done: function () {
  39321. return current.size > 0 ? new PopulatedScope(current) : BindingScope.empty;
  39322. }
  39323. };
  39324. };
  39325. BindingScope.missing = {};
  39326. BindingScope.empty = { resolve: function (name) { return BindingScope.missing; } };
  39327. return BindingScope;
  39328. }());
  39329. var PopulatedScope = /** @class */ (function (_super) {
  39330. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PopulatedScope, _super);
  39331. function PopulatedScope(bindings) {
  39332. var _this = _super.call(this) || this;
  39333. _this.bindings = bindings;
  39334. return _this;
  39335. }
  39336. /**
  39337. * @param {?} name
  39338. * @return {?}
  39339. */
  39340. PopulatedScope.prototype.resolve = /**
  39341. * @param {?} name
  39342. * @return {?}
  39343. */
  39344. function (name) {
  39345. return this.bindings.has(name) ? this.bindings.get(name) : BindingScope.missing;
  39346. };
  39347. return PopulatedScope;
  39348. }(BindingScope));
  39349. /**
  39350. * @param {?} chain
  39351. * @param {?} advise
  39352. * @return {?}
  39353. */
  39354. function formatMetadataMessageChain(chain, advise) {
  39355. var /** @type {?} */ expanded = expandedMessage(chain.message, chain.context);
  39356. var /** @type {?} */ nesting = chain.symbol ? " in '" + chain.symbol.name + "'" : '';
  39357. var /** @type {?} */ message = "" + expanded + nesting;
  39358. var /** @type {?} */ position = chain.position;
  39359. var /** @type {?} */ next = chain.next ?
  39360. formatMetadataMessageChain(chain.next, advise) :
  39361. advise ? { message: advise } : undefined;
  39362. return { message: message, position: position, next: next };
  39363. }
  39364. /**
  39365. * @param {?} e
  39366. * @param {?} context
  39367. * @return {?}
  39368. */
  39369. function formatMetadataError(e, context) {
  39370. if (isMetadataError(e)) {
  39371. // Produce a formatted version of the and leaving enough information in the original error
  39372. // to recover the formatting information to eventually produce a diagnostic error message.
  39373. var /** @type {?} */ position = e.position;
  39374. var /** @type {?} */ chain = {
  39375. message: "Error during template compile of '" + context.name + "'",
  39376. position: position,
  39377. next: { message: e.message, next: e.chain, context: e.context, symbol: e.symbol }
  39378. };
  39379. var /** @type {?} */ advise = e.advise || messageAdvise(e.message, e.context);
  39380. return formattedError(formatMetadataMessageChain(chain, advise));
  39381. }
  39382. return e;
  39383. }
  39384. /**
  39385. * @fileoverview added by tsickle
  39386. * @suppress {checkTypes} checked by tsc
  39387. */
  39388. /**
  39389. * @license
  39390. * Copyright Google Inc. All Rights Reserved.
  39391. *
  39392. * Use of this source code is governed by an MIT-style license that can be
  39393. * found in the LICENSE file at https://angular.io/license
  39394. */
  39395. /**
  39396. * @record
  39397. */
  39398. var AotSummaryResolver = /** @class */ (function () {
  39399. function AotSummaryResolver(host, staticSymbolCache) {
  39400. this.host = host;
  39401. this.staticSymbolCache = staticSymbolCache;
  39402. this.summaryCache = new Map();
  39403. this.loadedFilePaths = new Map();
  39404. this.importAs = new Map();
  39405. this.knownFileNameToModuleNames = new Map();
  39406. }
  39407. /**
  39408. * @param {?} filePath
  39409. * @return {?}
  39410. */
  39411. AotSummaryResolver.prototype.isLibraryFile = /**
  39412. * @param {?} filePath
  39413. * @return {?}
  39414. */
  39415. function (filePath) {
  39416. // Note: We need to strip the .ngfactory. file path,
  39417. // so this method also works for generated files
  39418. // (for which host.isSourceFile will always return false).
  39419. return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath));
  39420. };
  39421. /**
  39422. * @param {?} filePath
  39423. * @param {?} referringSrcFileName
  39424. * @return {?}
  39425. */
  39426. AotSummaryResolver.prototype.toSummaryFileName = /**
  39427. * @param {?} filePath
  39428. * @param {?} referringSrcFileName
  39429. * @return {?}
  39430. */
  39431. function (filePath, referringSrcFileName) {
  39432. return this.host.toSummaryFileName(filePath, referringSrcFileName);
  39433. };
  39434. /**
  39435. * @param {?} fileName
  39436. * @param {?} referringLibFileName
  39437. * @return {?}
  39438. */
  39439. AotSummaryResolver.prototype.fromSummaryFileName = /**
  39440. * @param {?} fileName
  39441. * @param {?} referringLibFileName
  39442. * @return {?}
  39443. */
  39444. function (fileName, referringLibFileName) {
  39445. return this.host.fromSummaryFileName(fileName, referringLibFileName);
  39446. };
  39447. /**
  39448. * @param {?} staticSymbol
  39449. * @return {?}
  39450. */
  39451. AotSummaryResolver.prototype.resolveSummary = /**
  39452. * @param {?} staticSymbol
  39453. * @return {?}
  39454. */
  39455. function (staticSymbol) {
  39456. var /** @type {?} */ rootSymbol = staticSymbol.members.length ?
  39457. this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) :
  39458. staticSymbol;
  39459. var /** @type {?} */ summary = this.summaryCache.get(rootSymbol);
  39460. if (!summary) {
  39461. this._loadSummaryFile(staticSymbol.filePath);
  39462. summary = /** @type {?} */ ((this.summaryCache.get(staticSymbol)));
  39463. }
  39464. return (rootSymbol === staticSymbol && summary) || null;
  39465. };
  39466. /**
  39467. * @param {?} filePath
  39468. * @return {?}
  39469. */
  39470. AotSummaryResolver.prototype.getSymbolsOf = /**
  39471. * @param {?} filePath
  39472. * @return {?}
  39473. */
  39474. function (filePath) {
  39475. if (this._loadSummaryFile(filePath)) {
  39476. return Array.from(this.summaryCache.keys()).filter(function (symbol) { return symbol.filePath === filePath; });
  39477. }
  39478. return null;
  39479. };
  39480. /**
  39481. * @param {?} staticSymbol
  39482. * @return {?}
  39483. */
  39484. AotSummaryResolver.prototype.getImportAs = /**
  39485. * @param {?} staticSymbol
  39486. * @return {?}
  39487. */
  39488. function (staticSymbol) {
  39489. staticSymbol.assertNoMembers();
  39490. return /** @type {?} */ ((this.importAs.get(staticSymbol)));
  39491. };
  39492. /**
  39493. * Converts a file path to a module name that can be used as an `import`.
  39494. */
  39495. /**
  39496. * Converts a file path to a module name that can be used as an `import`.
  39497. * @param {?} importedFilePath
  39498. * @return {?}
  39499. */
  39500. AotSummaryResolver.prototype.getKnownModuleName = /**
  39501. * Converts a file path to a module name that can be used as an `import`.
  39502. * @param {?} importedFilePath
  39503. * @return {?}
  39504. */
  39505. function (importedFilePath) {
  39506. return this.knownFileNameToModuleNames.get(importedFilePath) || null;
  39507. };
  39508. /**
  39509. * @param {?} summary
  39510. * @return {?}
  39511. */
  39512. AotSummaryResolver.prototype.addSummary = /**
  39513. * @param {?} summary
  39514. * @return {?}
  39515. */
  39516. function (summary) { this.summaryCache.set(summary.symbol, summary); };
  39517. /**
  39518. * @param {?} filePath
  39519. * @return {?}
  39520. */
  39521. AotSummaryResolver.prototype._loadSummaryFile = /**
  39522. * @param {?} filePath
  39523. * @return {?}
  39524. */
  39525. function (filePath) {
  39526. var _this = this;
  39527. var /** @type {?} */ hasSummary = this.loadedFilePaths.get(filePath);
  39528. if (hasSummary != null) {
  39529. return hasSummary;
  39530. }
  39531. var /** @type {?} */ json = null;
  39532. if (this.isLibraryFile(filePath)) {
  39533. var /** @type {?} */ summaryFilePath = summaryFileName(filePath);
  39534. try {
  39535. json = this.host.loadSummary(summaryFilePath);
  39536. }
  39537. catch (/** @type {?} */ e) {
  39538. console.error("Error loading summary file " + summaryFilePath);
  39539. throw e;
  39540. }
  39541. }
  39542. hasSummary = json != null;
  39543. this.loadedFilePaths.set(filePath, hasSummary);
  39544. if (json) {
  39545. var _a = deserializeSummaries(this.staticSymbolCache, this, filePath, json), moduleName = _a.moduleName, summaries = _a.summaries, importAs = _a.importAs;
  39546. summaries.forEach(function (summary) { return _this.summaryCache.set(summary.symbol, summary); });
  39547. if (moduleName) {
  39548. this.knownFileNameToModuleNames.set(filePath, moduleName);
  39549. }
  39550. importAs.forEach(function (importAs) { _this.importAs.set(importAs.symbol, importAs.importAs); });
  39551. }
  39552. return hasSummary;
  39553. };
  39554. return AotSummaryResolver;
  39555. }());
  39556. /**
  39557. * @fileoverview added by tsickle
  39558. * @suppress {checkTypes} checked by tsc
  39559. */
  39560. /**
  39561. * @license
  39562. * Copyright Google Inc. All Rights Reserved.
  39563. *
  39564. * Use of this source code is governed by an MIT-style license that can be
  39565. * found in the LICENSE file at https://angular.io/license
  39566. */
  39567. /**
  39568. * @param {?} host
  39569. * @return {?}
  39570. */
  39571. function createAotUrlResolver(host) {
  39572. return {
  39573. resolve: function (basePath, url) {
  39574. var /** @type {?} */ filePath = host.resourceNameToFileName(url, basePath);
  39575. if (!filePath) {
  39576. throw syntaxError("Couldn't resolve resource " + url + " from " + basePath);
  39577. }
  39578. return filePath;
  39579. }
  39580. };
  39581. }
  39582. /**
  39583. * Creates a new AotCompiler based on options and a host.
  39584. * @param {?} compilerHost
  39585. * @param {?} options
  39586. * @param {?=} errorCollector
  39587. * @return {?}
  39588. */
  39589. function createAotCompiler(compilerHost, options, errorCollector) {
  39590. var /** @type {?} */ translations = options.translations || '';
  39591. var /** @type {?} */ urlResolver = createAotUrlResolver(compilerHost);
  39592. var /** @type {?} */ symbolCache = new StaticSymbolCache();
  39593. var /** @type {?} */ summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);
  39594. var /** @type {?} */ symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);
  39595. var /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);
  39596. var /** @type {?} */ htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);
  39597. var /** @type {?} */ config = new CompilerConfig({
  39598. defaultEncapsulation: ViewEncapsulation.Emulated,
  39599. useJit: false,
  39600. enableLegacyTemplate: options.enableLegacyTemplate === true,
  39601. missingTranslation: options.missingTranslation,
  39602. preserveWhitespaces: options.preserveWhitespaces,
  39603. strictInjectionParameters: options.strictInjectionParameters,
  39604. });
  39605. var /** @type {?} */ normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);
  39606. var /** @type {?} */ expressionParser = new Parser(new Lexer());
  39607. var /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry();
  39608. var /** @type {?} */ tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);
  39609. var /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);
  39610. // TODO(vicb): do not pass options.i18nFormat here
  39611. var /** @type {?} */ viewCompiler = new ViewCompiler(staticReflector);
  39612. var /** @type {?} */ typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);
  39613. var /** @type {?} */ compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new TypeScriptEmitter(), summaryResolver, symbolResolver);
  39614. return { compiler: compiler, reflector: staticReflector };
  39615. }
  39616. /**
  39617. * @fileoverview added by tsickle
  39618. * @suppress {checkTypes} checked by tsc
  39619. */
  39620. /**
  39621. * @record
  39622. */
  39623. /**
  39624. * @abstract
  39625. */
  39626. var SummaryResolver = /** @class */ (function () {
  39627. function SummaryResolver() {
  39628. }
  39629. return SummaryResolver;
  39630. }());
  39631. var JitSummaryResolver = /** @class */ (function () {
  39632. function JitSummaryResolver() {
  39633. this._summaries = new Map();
  39634. }
  39635. /**
  39636. * @return {?}
  39637. */
  39638. JitSummaryResolver.prototype.isLibraryFile = /**
  39639. * @return {?}
  39640. */
  39641. function () { return false; };
  39642. /**
  39643. * @param {?} fileName
  39644. * @return {?}
  39645. */
  39646. JitSummaryResolver.prototype.toSummaryFileName = /**
  39647. * @param {?} fileName
  39648. * @return {?}
  39649. */
  39650. function (fileName) { return fileName; };
  39651. /**
  39652. * @param {?} fileName
  39653. * @return {?}
  39654. */
  39655. JitSummaryResolver.prototype.fromSummaryFileName = /**
  39656. * @param {?} fileName
  39657. * @return {?}
  39658. */
  39659. function (fileName) { return fileName; };
  39660. /**
  39661. * @param {?} reference
  39662. * @return {?}
  39663. */
  39664. JitSummaryResolver.prototype.resolveSummary = /**
  39665. * @param {?} reference
  39666. * @return {?}
  39667. */
  39668. function (reference) {
  39669. return this._summaries.get(reference) || null;
  39670. };
  39671. /**
  39672. * @return {?}
  39673. */
  39674. JitSummaryResolver.prototype.getSymbolsOf = /**
  39675. * @return {?}
  39676. */
  39677. function () { return []; };
  39678. /**
  39679. * @param {?} reference
  39680. * @return {?}
  39681. */
  39682. JitSummaryResolver.prototype.getImportAs = /**
  39683. * @param {?} reference
  39684. * @return {?}
  39685. */
  39686. function (reference) { return reference; };
  39687. /**
  39688. * @param {?} fileName
  39689. * @return {?}
  39690. */
  39691. JitSummaryResolver.prototype.getKnownModuleName = /**
  39692. * @param {?} fileName
  39693. * @return {?}
  39694. */
  39695. function (fileName) { return null; };
  39696. /**
  39697. * @param {?} summary
  39698. * @return {?}
  39699. */
  39700. JitSummaryResolver.prototype.addSummary = /**
  39701. * @param {?} summary
  39702. * @return {?}
  39703. */
  39704. function (summary) { this._summaries.set(summary.symbol, summary); };
  39705. return JitSummaryResolver;
  39706. }());
  39707. /**
  39708. * @fileoverview added by tsickle
  39709. * @suppress {checkTypes} checked by tsc
  39710. */
  39711. /**
  39712. * @license
  39713. * Copyright Google Inc. All Rights Reserved.
  39714. *
  39715. * Use of this source code is governed by an MIT-style license that can be
  39716. * found in the LICENSE file at https://angular.io/license
  39717. */
  39718. /**
  39719. * @param {?} statements
  39720. * @param {?} reflector
  39721. * @return {?}
  39722. */
  39723. function interpretStatements(statements, reflector) {
  39724. var /** @type {?} */ ctx = new _ExecutionContext(null, null, null, new Map());
  39725. var /** @type {?} */ visitor = new StatementInterpreter(reflector);
  39726. visitor.visitAllStatements(statements, ctx);
  39727. var /** @type {?} */ result = {};
  39728. ctx.exports.forEach(function (exportName) { result[exportName] = ctx.vars.get(exportName); });
  39729. return result;
  39730. }
  39731. /**
  39732. * @param {?} varNames
  39733. * @param {?} varValues
  39734. * @param {?} statements
  39735. * @param {?} ctx
  39736. * @param {?} visitor
  39737. * @return {?}
  39738. */
  39739. function _executeFunctionStatements(varNames, varValues, statements, ctx, visitor) {
  39740. var /** @type {?} */ childCtx = ctx.createChildWihtLocalVars();
  39741. for (var /** @type {?} */ i = 0; i < varNames.length; i++) {
  39742. childCtx.vars.set(varNames[i], varValues[i]);
  39743. }
  39744. var /** @type {?} */ result = visitor.visitAllStatements(statements, childCtx);
  39745. return result ? result.value : null;
  39746. }
  39747. var _ExecutionContext = /** @class */ (function () {
  39748. function _ExecutionContext(parent, instance, className, vars) {
  39749. this.parent = parent;
  39750. this.instance = instance;
  39751. this.className = className;
  39752. this.vars = vars;
  39753. this.exports = [];
  39754. }
  39755. /**
  39756. * @return {?}
  39757. */
  39758. _ExecutionContext.prototype.createChildWihtLocalVars = /**
  39759. * @return {?}
  39760. */
  39761. function () {
  39762. return new _ExecutionContext(this, this.instance, this.className, new Map());
  39763. };
  39764. return _ExecutionContext;
  39765. }());
  39766. var ReturnValue = /** @class */ (function () {
  39767. function ReturnValue(value) {
  39768. this.value = value;
  39769. }
  39770. return ReturnValue;
  39771. }());
  39772. /**
  39773. * @param {?} _classStmt
  39774. * @param {?} _ctx
  39775. * @param {?} _visitor
  39776. * @return {?}
  39777. */
  39778. function createDynamicClass(_classStmt, _ctx, _visitor) {
  39779. var /** @type {?} */ propertyDescriptors = {};
  39780. _classStmt.getters.forEach(function (getter) {
  39781. // Note: use `function` instead of arrow function to capture `this`
  39782. propertyDescriptors[getter.name] = {
  39783. configurable: false,
  39784. get: function () {
  39785. var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
  39786. return _executeFunctionStatements([], [], getter.body, instanceCtx, _visitor);
  39787. }
  39788. };
  39789. });
  39790. _classStmt.methods.forEach(function (method) {
  39791. var /** @type {?} */ paramNames = method.params.map(function (param) { return param.name; });
  39792. // Note: use `function` instead of arrow function to capture `this`
  39793. propertyDescriptors[/** @type {?} */ ((method.name))] = {
  39794. writable: false,
  39795. configurable: false,
  39796. value: function () {
  39797. var args = [];
  39798. for (var _i = 0; _i < arguments.length; _i++) {
  39799. args[_i] = arguments[_i];
  39800. }
  39801. var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
  39802. return _executeFunctionStatements(paramNames, args, method.body, instanceCtx, _visitor);
  39803. }
  39804. };
  39805. });
  39806. var /** @type {?} */ ctorParamNames = _classStmt.constructorMethod.params.map(function (param) { return param.name; });
  39807. // Note: use `function` instead of arrow function to capture `this`
  39808. var /** @type {?} */ ctor = function () {
  39809. var _this = this;
  39810. var args = [];
  39811. for (var _i = 0; _i < arguments.length; _i++) {
  39812. args[_i] = arguments[_i];
  39813. }
  39814. var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
  39815. _classStmt.fields.forEach(function (field) { _this[field.name] = undefined; });
  39816. _executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor);
  39817. };
  39818. var /** @type {?} */ superClass = _classStmt.parent ? _classStmt.parent.visitExpression(_visitor, _ctx) : Object;
  39819. ctor.prototype = Object.create(superClass.prototype, propertyDescriptors);
  39820. return ctor;
  39821. }
  39822. var StatementInterpreter = /** @class */ (function () {
  39823. function StatementInterpreter(reflector) {
  39824. this.reflector = reflector;
  39825. }
  39826. /**
  39827. * @param {?} ast
  39828. * @return {?}
  39829. */
  39830. StatementInterpreter.prototype.debugAst = /**
  39831. * @param {?} ast
  39832. * @return {?}
  39833. */
  39834. function (ast) { return debugOutputAstAsTypeScript(ast); };
  39835. /**
  39836. * @param {?} stmt
  39837. * @param {?} ctx
  39838. * @return {?}
  39839. */
  39840. StatementInterpreter.prototype.visitDeclareVarStmt = /**
  39841. * @param {?} stmt
  39842. * @param {?} ctx
  39843. * @return {?}
  39844. */
  39845. function (stmt, ctx) {
  39846. ctx.vars.set(stmt.name, stmt.value.visitExpression(this, ctx));
  39847. if (stmt.hasModifier(StmtModifier.Exported)) {
  39848. ctx.exports.push(stmt.name);
  39849. }
  39850. return null;
  39851. };
  39852. /**
  39853. * @param {?} expr
  39854. * @param {?} ctx
  39855. * @return {?}
  39856. */
  39857. StatementInterpreter.prototype.visitWriteVarExpr = /**
  39858. * @param {?} expr
  39859. * @param {?} ctx
  39860. * @return {?}
  39861. */
  39862. function (expr, ctx) {
  39863. var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
  39864. var /** @type {?} */ currCtx = ctx;
  39865. while (currCtx != null) {
  39866. if (currCtx.vars.has(expr.name)) {
  39867. currCtx.vars.set(expr.name, value);
  39868. return value;
  39869. }
  39870. currCtx = /** @type {?} */ ((currCtx.parent));
  39871. }
  39872. throw new Error("Not declared variable " + expr.name);
  39873. };
  39874. /**
  39875. * @param {?} ast
  39876. * @param {?} ctx
  39877. * @return {?}
  39878. */
  39879. StatementInterpreter.prototype.visitReadVarExpr = /**
  39880. * @param {?} ast
  39881. * @param {?} ctx
  39882. * @return {?}
  39883. */
  39884. function (ast, ctx) {
  39885. var /** @type {?} */ varName = /** @type {?} */ ((ast.name));
  39886. if (ast.builtin != null) {
  39887. switch (ast.builtin) {
  39888. case BuiltinVar.Super:
  39889. return ctx.instance.__proto__;
  39890. case BuiltinVar.This:
  39891. return ctx.instance;
  39892. case BuiltinVar.CatchError:
  39893. varName = CATCH_ERROR_VAR$2;
  39894. break;
  39895. case BuiltinVar.CatchStack:
  39896. varName = CATCH_STACK_VAR$2;
  39897. break;
  39898. default:
  39899. throw new Error("Unknown builtin variable " + ast.builtin);
  39900. }
  39901. }
  39902. var /** @type {?} */ currCtx = ctx;
  39903. while (currCtx != null) {
  39904. if (currCtx.vars.has(varName)) {
  39905. return currCtx.vars.get(varName);
  39906. }
  39907. currCtx = /** @type {?} */ ((currCtx.parent));
  39908. }
  39909. throw new Error("Not declared variable " + varName);
  39910. };
  39911. /**
  39912. * @param {?} expr
  39913. * @param {?} ctx
  39914. * @return {?}
  39915. */
  39916. StatementInterpreter.prototype.visitWriteKeyExpr = /**
  39917. * @param {?} expr
  39918. * @param {?} ctx
  39919. * @return {?}
  39920. */
  39921. function (expr, ctx) {
  39922. var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
  39923. var /** @type {?} */ index = expr.index.visitExpression(this, ctx);
  39924. var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
  39925. receiver[index] = value;
  39926. return value;
  39927. };
  39928. /**
  39929. * @param {?} expr
  39930. * @param {?} ctx
  39931. * @return {?}
  39932. */
  39933. StatementInterpreter.prototype.visitWritePropExpr = /**
  39934. * @param {?} expr
  39935. * @param {?} ctx
  39936. * @return {?}
  39937. */
  39938. function (expr, ctx) {
  39939. var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
  39940. var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
  39941. receiver[expr.name] = value;
  39942. return value;
  39943. };
  39944. /**
  39945. * @param {?} expr
  39946. * @param {?} ctx
  39947. * @return {?}
  39948. */
  39949. StatementInterpreter.prototype.visitInvokeMethodExpr = /**
  39950. * @param {?} expr
  39951. * @param {?} ctx
  39952. * @return {?}
  39953. */
  39954. function (expr, ctx) {
  39955. var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
  39956. var /** @type {?} */ args = this.visitAllExpressions(expr.args, ctx);
  39957. var /** @type {?} */ result;
  39958. if (expr.builtin != null) {
  39959. switch (expr.builtin) {
  39960. case BuiltinMethod.ConcatArray:
  39961. result = receiver.concat.apply(receiver, args);
  39962. break;
  39963. case BuiltinMethod.SubscribeObservable:
  39964. result = receiver.subscribe({ next: args[0] });
  39965. break;
  39966. case BuiltinMethod.Bind:
  39967. result = receiver.bind.apply(receiver, args);
  39968. break;
  39969. default:
  39970. throw new Error("Unknown builtin method " + expr.builtin);
  39971. }
  39972. }
  39973. else {
  39974. result = receiver[/** @type {?} */ ((expr.name))].apply(receiver, args);
  39975. }
  39976. return result;
  39977. };
  39978. /**
  39979. * @param {?} stmt
  39980. * @param {?} ctx
  39981. * @return {?}
  39982. */
  39983. StatementInterpreter.prototype.visitInvokeFunctionExpr = /**
  39984. * @param {?} stmt
  39985. * @param {?} ctx
  39986. * @return {?}
  39987. */
  39988. function (stmt, ctx) {
  39989. var /** @type {?} */ args = this.visitAllExpressions(stmt.args, ctx);
  39990. var /** @type {?} */ fnExpr = stmt.fn;
  39991. if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
  39992. ctx.instance.constructor.prototype.constructor.apply(ctx.instance, args);
  39993. return null;
  39994. }
  39995. else {
  39996. var /** @type {?} */ fn$$1 = stmt.fn.visitExpression(this, ctx);
  39997. return fn$$1.apply(null, args);
  39998. }
  39999. };
  40000. /**
  40001. * @param {?} stmt
  40002. * @param {?} ctx
  40003. * @return {?}
  40004. */
  40005. StatementInterpreter.prototype.visitReturnStmt = /**
  40006. * @param {?} stmt
  40007. * @param {?} ctx
  40008. * @return {?}
  40009. */
  40010. function (stmt, ctx) {
  40011. return new ReturnValue(stmt.value.visitExpression(this, ctx));
  40012. };
  40013. /**
  40014. * @param {?} stmt
  40015. * @param {?} ctx
  40016. * @return {?}
  40017. */
  40018. StatementInterpreter.prototype.visitDeclareClassStmt = /**
  40019. * @param {?} stmt
  40020. * @param {?} ctx
  40021. * @return {?}
  40022. */
  40023. function (stmt, ctx) {
  40024. var /** @type {?} */ clazz = createDynamicClass(stmt, ctx, this);
  40025. ctx.vars.set(stmt.name, clazz);
  40026. if (stmt.hasModifier(StmtModifier.Exported)) {
  40027. ctx.exports.push(stmt.name);
  40028. }
  40029. return null;
  40030. };
  40031. /**
  40032. * @param {?} stmt
  40033. * @param {?} ctx
  40034. * @return {?}
  40035. */
  40036. StatementInterpreter.prototype.visitExpressionStmt = /**
  40037. * @param {?} stmt
  40038. * @param {?} ctx
  40039. * @return {?}
  40040. */
  40041. function (stmt, ctx) {
  40042. return stmt.expr.visitExpression(this, ctx);
  40043. };
  40044. /**
  40045. * @param {?} stmt
  40046. * @param {?} ctx
  40047. * @return {?}
  40048. */
  40049. StatementInterpreter.prototype.visitIfStmt = /**
  40050. * @param {?} stmt
  40051. * @param {?} ctx
  40052. * @return {?}
  40053. */
  40054. function (stmt, ctx) {
  40055. var /** @type {?} */ condition = stmt.condition.visitExpression(this, ctx);
  40056. if (condition) {
  40057. return this.visitAllStatements(stmt.trueCase, ctx);
  40058. }
  40059. else if (stmt.falseCase != null) {
  40060. return this.visitAllStatements(stmt.falseCase, ctx);
  40061. }
  40062. return null;
  40063. };
  40064. /**
  40065. * @param {?} stmt
  40066. * @param {?} ctx
  40067. * @return {?}
  40068. */
  40069. StatementInterpreter.prototype.visitTryCatchStmt = /**
  40070. * @param {?} stmt
  40071. * @param {?} ctx
  40072. * @return {?}
  40073. */
  40074. function (stmt, ctx) {
  40075. try {
  40076. return this.visitAllStatements(stmt.bodyStmts, ctx);
  40077. }
  40078. catch (/** @type {?} */ e) {
  40079. var /** @type {?} */ childCtx = ctx.createChildWihtLocalVars();
  40080. childCtx.vars.set(CATCH_ERROR_VAR$2, e);
  40081. childCtx.vars.set(CATCH_STACK_VAR$2, e.stack);
  40082. return this.visitAllStatements(stmt.catchStmts, childCtx);
  40083. }
  40084. };
  40085. /**
  40086. * @param {?} stmt
  40087. * @param {?} ctx
  40088. * @return {?}
  40089. */
  40090. StatementInterpreter.prototype.visitThrowStmt = /**
  40091. * @param {?} stmt
  40092. * @param {?} ctx
  40093. * @return {?}
  40094. */
  40095. function (stmt, ctx) {
  40096. throw stmt.error.visitExpression(this, ctx);
  40097. };
  40098. /**
  40099. * @param {?} stmt
  40100. * @param {?=} context
  40101. * @return {?}
  40102. */
  40103. StatementInterpreter.prototype.visitCommentStmt = /**
  40104. * @param {?} stmt
  40105. * @param {?=} context
  40106. * @return {?}
  40107. */
  40108. function (stmt, context) { return null; };
  40109. /**
  40110. * @param {?} ast
  40111. * @param {?} ctx
  40112. * @return {?}
  40113. */
  40114. StatementInterpreter.prototype.visitInstantiateExpr = /**
  40115. * @param {?} ast
  40116. * @param {?} ctx
  40117. * @return {?}
  40118. */
  40119. function (ast, ctx) {
  40120. var /** @type {?} */ args = this.visitAllExpressions(ast.args, ctx);
  40121. var /** @type {?} */ clazz = ast.classExpr.visitExpression(this, ctx);
  40122. return new (clazz.bind.apply(clazz, [void 0].concat(args)))();
  40123. };
  40124. /**
  40125. * @param {?} ast
  40126. * @param {?} ctx
  40127. * @return {?}
  40128. */
  40129. StatementInterpreter.prototype.visitLiteralExpr = /**
  40130. * @param {?} ast
  40131. * @param {?} ctx
  40132. * @return {?}
  40133. */
  40134. function (ast, ctx) { return ast.value; };
  40135. /**
  40136. * @param {?} ast
  40137. * @param {?} ctx
  40138. * @return {?}
  40139. */
  40140. StatementInterpreter.prototype.visitExternalExpr = /**
  40141. * @param {?} ast
  40142. * @param {?} ctx
  40143. * @return {?}
  40144. */
  40145. function (ast, ctx) {
  40146. return this.reflector.resolveExternalReference(ast.value);
  40147. };
  40148. /**
  40149. * @param {?} ast
  40150. * @param {?} ctx
  40151. * @return {?}
  40152. */
  40153. StatementInterpreter.prototype.visitConditionalExpr = /**
  40154. * @param {?} ast
  40155. * @param {?} ctx
  40156. * @return {?}
  40157. */
  40158. function (ast, ctx) {
  40159. if (ast.condition.visitExpression(this, ctx)) {
  40160. return ast.trueCase.visitExpression(this, ctx);
  40161. }
  40162. else if (ast.falseCase != null) {
  40163. return ast.falseCase.visitExpression(this, ctx);
  40164. }
  40165. return null;
  40166. };
  40167. /**
  40168. * @param {?} ast
  40169. * @param {?} ctx
  40170. * @return {?}
  40171. */
  40172. StatementInterpreter.prototype.visitNotExpr = /**
  40173. * @param {?} ast
  40174. * @param {?} ctx
  40175. * @return {?}
  40176. */
  40177. function (ast, ctx) {
  40178. return !ast.condition.visitExpression(this, ctx);
  40179. };
  40180. /**
  40181. * @param {?} ast
  40182. * @param {?} ctx
  40183. * @return {?}
  40184. */
  40185. StatementInterpreter.prototype.visitAssertNotNullExpr = /**
  40186. * @param {?} ast
  40187. * @param {?} ctx
  40188. * @return {?}
  40189. */
  40190. function (ast, ctx) {
  40191. return ast.condition.visitExpression(this, ctx);
  40192. };
  40193. /**
  40194. * @param {?} ast
  40195. * @param {?} ctx
  40196. * @return {?}
  40197. */
  40198. StatementInterpreter.prototype.visitCastExpr = /**
  40199. * @param {?} ast
  40200. * @param {?} ctx
  40201. * @return {?}
  40202. */
  40203. function (ast, ctx) {
  40204. return ast.value.visitExpression(this, ctx);
  40205. };
  40206. /**
  40207. * @param {?} ast
  40208. * @param {?} ctx
  40209. * @return {?}
  40210. */
  40211. StatementInterpreter.prototype.visitFunctionExpr = /**
  40212. * @param {?} ast
  40213. * @param {?} ctx
  40214. * @return {?}
  40215. */
  40216. function (ast, ctx) {
  40217. var /** @type {?} */ paramNames = ast.params.map(function (param) { return param.name; });
  40218. return _declareFn(paramNames, ast.statements, ctx, this);
  40219. };
  40220. /**
  40221. * @param {?} stmt
  40222. * @param {?} ctx
  40223. * @return {?}
  40224. */
  40225. StatementInterpreter.prototype.visitDeclareFunctionStmt = /**
  40226. * @param {?} stmt
  40227. * @param {?} ctx
  40228. * @return {?}
  40229. */
  40230. function (stmt, ctx) {
  40231. var /** @type {?} */ paramNames = stmt.params.map(function (param) { return param.name; });
  40232. ctx.vars.set(stmt.name, _declareFn(paramNames, stmt.statements, ctx, this));
  40233. if (stmt.hasModifier(StmtModifier.Exported)) {
  40234. ctx.exports.push(stmt.name);
  40235. }
  40236. return null;
  40237. };
  40238. /**
  40239. * @param {?} ast
  40240. * @param {?} ctx
  40241. * @return {?}
  40242. */
  40243. StatementInterpreter.prototype.visitBinaryOperatorExpr = /**
  40244. * @param {?} ast
  40245. * @param {?} ctx
  40246. * @return {?}
  40247. */
  40248. function (ast, ctx) {
  40249. var _this = this;
  40250. var /** @type {?} */ lhs = function () { return ast.lhs.visitExpression(_this, ctx); };
  40251. var /** @type {?} */ rhs = function () { return ast.rhs.visitExpression(_this, ctx); };
  40252. switch (ast.operator) {
  40253. case BinaryOperator.Equals:
  40254. return lhs() == rhs();
  40255. case BinaryOperator.Identical:
  40256. return lhs() === rhs();
  40257. case BinaryOperator.NotEquals:
  40258. return lhs() != rhs();
  40259. case BinaryOperator.NotIdentical:
  40260. return lhs() !== rhs();
  40261. case BinaryOperator.And:
  40262. return lhs() && rhs();
  40263. case BinaryOperator.Or:
  40264. return lhs() || rhs();
  40265. case BinaryOperator.Plus:
  40266. return lhs() + rhs();
  40267. case BinaryOperator.Minus:
  40268. return lhs() - rhs();
  40269. case BinaryOperator.Divide:
  40270. return lhs() / rhs();
  40271. case BinaryOperator.Multiply:
  40272. return lhs() * rhs();
  40273. case BinaryOperator.Modulo:
  40274. return lhs() % rhs();
  40275. case BinaryOperator.Lower:
  40276. return lhs() < rhs();
  40277. case BinaryOperator.LowerEquals:
  40278. return lhs() <= rhs();
  40279. case BinaryOperator.Bigger:
  40280. return lhs() > rhs();
  40281. case BinaryOperator.BiggerEquals:
  40282. return lhs() >= rhs();
  40283. default:
  40284. throw new Error("Unknown operator " + ast.operator);
  40285. }
  40286. };
  40287. /**
  40288. * @param {?} ast
  40289. * @param {?} ctx
  40290. * @return {?}
  40291. */
  40292. StatementInterpreter.prototype.visitReadPropExpr = /**
  40293. * @param {?} ast
  40294. * @param {?} ctx
  40295. * @return {?}
  40296. */
  40297. function (ast, ctx) {
  40298. var /** @type {?} */ result;
  40299. var /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx);
  40300. result = receiver[ast.name];
  40301. return result;
  40302. };
  40303. /**
  40304. * @param {?} ast
  40305. * @param {?} ctx
  40306. * @return {?}
  40307. */
  40308. StatementInterpreter.prototype.visitReadKeyExpr = /**
  40309. * @param {?} ast
  40310. * @param {?} ctx
  40311. * @return {?}
  40312. */
  40313. function (ast, ctx) {
  40314. var /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx);
  40315. var /** @type {?} */ prop = ast.index.visitExpression(this, ctx);
  40316. return receiver[prop];
  40317. };
  40318. /**
  40319. * @param {?} ast
  40320. * @param {?} ctx
  40321. * @return {?}
  40322. */
  40323. StatementInterpreter.prototype.visitLiteralArrayExpr = /**
  40324. * @param {?} ast
  40325. * @param {?} ctx
  40326. * @return {?}
  40327. */
  40328. function (ast, ctx) {
  40329. return this.visitAllExpressions(ast.entries, ctx);
  40330. };
  40331. /**
  40332. * @param {?} ast
  40333. * @param {?} ctx
  40334. * @return {?}
  40335. */
  40336. StatementInterpreter.prototype.visitLiteralMapExpr = /**
  40337. * @param {?} ast
  40338. * @param {?} ctx
  40339. * @return {?}
  40340. */
  40341. function (ast, ctx) {
  40342. var _this = this;
  40343. var /** @type {?} */ result = {};
  40344. ast.entries.forEach(function (entry) { return result[entry.key] = entry.value.visitExpression(_this, ctx); });
  40345. return result;
  40346. };
  40347. /**
  40348. * @param {?} ast
  40349. * @param {?} context
  40350. * @return {?}
  40351. */
  40352. StatementInterpreter.prototype.visitCommaExpr = /**
  40353. * @param {?} ast
  40354. * @param {?} context
  40355. * @return {?}
  40356. */
  40357. function (ast, context) {
  40358. var /** @type {?} */ values = this.visitAllExpressions(ast.parts, context);
  40359. return values[values.length - 1];
  40360. };
  40361. /**
  40362. * @param {?} expressions
  40363. * @param {?} ctx
  40364. * @return {?}
  40365. */
  40366. StatementInterpreter.prototype.visitAllExpressions = /**
  40367. * @param {?} expressions
  40368. * @param {?} ctx
  40369. * @return {?}
  40370. */
  40371. function (expressions, ctx) {
  40372. var _this = this;
  40373. return expressions.map(function (expr) { return expr.visitExpression(_this, ctx); });
  40374. };
  40375. /**
  40376. * @param {?} statements
  40377. * @param {?} ctx
  40378. * @return {?}
  40379. */
  40380. StatementInterpreter.prototype.visitAllStatements = /**
  40381. * @param {?} statements
  40382. * @param {?} ctx
  40383. * @return {?}
  40384. */
  40385. function (statements, ctx) {
  40386. for (var /** @type {?} */ i = 0; i < statements.length; i++) {
  40387. var /** @type {?} */ stmt = statements[i];
  40388. var /** @type {?} */ val = stmt.visitStatement(this, ctx);
  40389. if (val instanceof ReturnValue) {
  40390. return val;
  40391. }
  40392. }
  40393. return null;
  40394. };
  40395. return StatementInterpreter;
  40396. }());
  40397. /**
  40398. * @param {?} varNames
  40399. * @param {?} statements
  40400. * @param {?} ctx
  40401. * @param {?} visitor
  40402. * @return {?}
  40403. */
  40404. function _declareFn(varNames, statements, ctx, visitor) {
  40405. return function () {
  40406. var args = [];
  40407. for (var _i = 0; _i < arguments.length; _i++) {
  40408. args[_i] = arguments[_i];
  40409. }
  40410. return _executeFunctionStatements(varNames, args, statements, ctx, visitor);
  40411. };
  40412. }
  40413. var CATCH_ERROR_VAR$2 = 'error';
  40414. var CATCH_STACK_VAR$2 = 'stack';
  40415. /**
  40416. * @fileoverview added by tsickle
  40417. * @suppress {checkTypes} checked by tsc
  40418. */
  40419. /**
  40420. * @license
  40421. * Copyright Google Inc. All Rights Reserved.
  40422. *
  40423. * Use of this source code is governed by an MIT-style license that can be
  40424. * found in the LICENSE file at https://angular.io/license
  40425. */
  40426. /**
  40427. * @abstract
  40428. */
  40429. var AbstractJsEmitterVisitor = /** @class */ (function (_super) {
  40430. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AbstractJsEmitterVisitor, _super);
  40431. function AbstractJsEmitterVisitor() {
  40432. return _super.call(this, false) || this;
  40433. }
  40434. /**
  40435. * @param {?} stmt
  40436. * @param {?} ctx
  40437. * @return {?}
  40438. */
  40439. AbstractJsEmitterVisitor.prototype.visitDeclareClassStmt = /**
  40440. * @param {?} stmt
  40441. * @param {?} ctx
  40442. * @return {?}
  40443. */
  40444. function (stmt, ctx) {
  40445. var _this = this;
  40446. ctx.pushClass(stmt);
  40447. this._visitClassConstructor(stmt, ctx);
  40448. if (stmt.parent != null) {
  40449. ctx.print(stmt, stmt.name + ".prototype = Object.create(");
  40450. stmt.parent.visitExpression(this, ctx);
  40451. ctx.println(stmt, ".prototype);");
  40452. }
  40453. stmt.getters.forEach(function (getter) { return _this._visitClassGetter(stmt, getter, ctx); });
  40454. stmt.methods.forEach(function (method) { return _this._visitClassMethod(stmt, method, ctx); });
  40455. ctx.popClass();
  40456. return null;
  40457. };
  40458. /**
  40459. * @param {?} stmt
  40460. * @param {?} ctx
  40461. * @return {?}
  40462. */
  40463. AbstractJsEmitterVisitor.prototype._visitClassConstructor = /**
  40464. * @param {?} stmt
  40465. * @param {?} ctx
  40466. * @return {?}
  40467. */
  40468. function (stmt, ctx) {
  40469. ctx.print(stmt, "function " + stmt.name + "(");
  40470. if (stmt.constructorMethod != null) {
  40471. this._visitParams(stmt.constructorMethod.params, ctx);
  40472. }
  40473. ctx.println(stmt, ") {");
  40474. ctx.incIndent();
  40475. if (stmt.constructorMethod != null) {
  40476. if (stmt.constructorMethod.body.length > 0) {
  40477. ctx.println(stmt, "var self = this;");
  40478. this.visitAllStatements(stmt.constructorMethod.body, ctx);
  40479. }
  40480. }
  40481. ctx.decIndent();
  40482. ctx.println(stmt, "}");
  40483. };
  40484. /**
  40485. * @param {?} stmt
  40486. * @param {?} getter
  40487. * @param {?} ctx
  40488. * @return {?}
  40489. */
  40490. AbstractJsEmitterVisitor.prototype._visitClassGetter = /**
  40491. * @param {?} stmt
  40492. * @param {?} getter
  40493. * @param {?} ctx
  40494. * @return {?}
  40495. */
  40496. function (stmt, getter, ctx) {
  40497. ctx.println(stmt, "Object.defineProperty(" + stmt.name + ".prototype, '" + getter.name + "', { get: function() {");
  40498. ctx.incIndent();
  40499. if (getter.body.length > 0) {
  40500. ctx.println(stmt, "var self = this;");
  40501. this.visitAllStatements(getter.body, ctx);
  40502. }
  40503. ctx.decIndent();
  40504. ctx.println(stmt, "}});");
  40505. };
  40506. /**
  40507. * @param {?} stmt
  40508. * @param {?} method
  40509. * @param {?} ctx
  40510. * @return {?}
  40511. */
  40512. AbstractJsEmitterVisitor.prototype._visitClassMethod = /**
  40513. * @param {?} stmt
  40514. * @param {?} method
  40515. * @param {?} ctx
  40516. * @return {?}
  40517. */
  40518. function (stmt, method, ctx) {
  40519. ctx.print(stmt, stmt.name + ".prototype." + method.name + " = function(");
  40520. this._visitParams(method.params, ctx);
  40521. ctx.println(stmt, ") {");
  40522. ctx.incIndent();
  40523. if (method.body.length > 0) {
  40524. ctx.println(stmt, "var self = this;");
  40525. this.visitAllStatements(method.body, ctx);
  40526. }
  40527. ctx.decIndent();
  40528. ctx.println(stmt, "};");
  40529. };
  40530. /**
  40531. * @param {?} ast
  40532. * @param {?} ctx
  40533. * @return {?}
  40534. */
  40535. AbstractJsEmitterVisitor.prototype.visitReadVarExpr = /**
  40536. * @param {?} ast
  40537. * @param {?} ctx
  40538. * @return {?}
  40539. */
  40540. function (ast, ctx) {
  40541. if (ast.builtin === BuiltinVar.This) {
  40542. ctx.print(ast, 'self');
  40543. }
  40544. else if (ast.builtin === BuiltinVar.Super) {
  40545. throw new Error("'super' needs to be handled at a parent ast node, not at the variable level!");
  40546. }
  40547. else {
  40548. _super.prototype.visitReadVarExpr.call(this, ast, ctx);
  40549. }
  40550. return null;
  40551. };
  40552. /**
  40553. * @param {?} stmt
  40554. * @param {?} ctx
  40555. * @return {?}
  40556. */
  40557. AbstractJsEmitterVisitor.prototype.visitDeclareVarStmt = /**
  40558. * @param {?} stmt
  40559. * @param {?} ctx
  40560. * @return {?}
  40561. */
  40562. function (stmt, ctx) {
  40563. ctx.print(stmt, "var " + stmt.name + " = ");
  40564. stmt.value.visitExpression(this, ctx);
  40565. ctx.println(stmt, ";");
  40566. return null;
  40567. };
  40568. /**
  40569. * @param {?} ast
  40570. * @param {?} ctx
  40571. * @return {?}
  40572. */
  40573. AbstractJsEmitterVisitor.prototype.visitCastExpr = /**
  40574. * @param {?} ast
  40575. * @param {?} ctx
  40576. * @return {?}
  40577. */
  40578. function (ast, ctx) {
  40579. ast.value.visitExpression(this, ctx);
  40580. return null;
  40581. };
  40582. /**
  40583. * @param {?} expr
  40584. * @param {?} ctx
  40585. * @return {?}
  40586. */
  40587. AbstractJsEmitterVisitor.prototype.visitInvokeFunctionExpr = /**
  40588. * @param {?} expr
  40589. * @param {?} ctx
  40590. * @return {?}
  40591. */
  40592. function (expr, ctx) {
  40593. var /** @type {?} */ fnExpr = expr.fn;
  40594. if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
  40595. /** @type {?} */ ((/** @type {?} */ ((ctx.currentClass)).parent)).visitExpression(this, ctx);
  40596. ctx.print(expr, ".call(this");
  40597. if (expr.args.length > 0) {
  40598. ctx.print(expr, ", ");
  40599. this.visitAllExpressions(expr.args, ctx, ',');
  40600. }
  40601. ctx.print(expr, ")");
  40602. }
  40603. else {
  40604. _super.prototype.visitInvokeFunctionExpr.call(this, expr, ctx);
  40605. }
  40606. return null;
  40607. };
  40608. /**
  40609. * @param {?} ast
  40610. * @param {?} ctx
  40611. * @return {?}
  40612. */
  40613. AbstractJsEmitterVisitor.prototype.visitFunctionExpr = /**
  40614. * @param {?} ast
  40615. * @param {?} ctx
  40616. * @return {?}
  40617. */
  40618. function (ast, ctx) {
  40619. ctx.print(ast, "function(");
  40620. this._visitParams(ast.params, ctx);
  40621. ctx.println(ast, ") {");
  40622. ctx.incIndent();
  40623. this.visitAllStatements(ast.statements, ctx);
  40624. ctx.decIndent();
  40625. ctx.print(ast, "}");
  40626. return null;
  40627. };
  40628. /**
  40629. * @param {?} stmt
  40630. * @param {?} ctx
  40631. * @return {?}
  40632. */
  40633. AbstractJsEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
  40634. * @param {?} stmt
  40635. * @param {?} ctx
  40636. * @return {?}
  40637. */
  40638. function (stmt, ctx) {
  40639. ctx.print(stmt, "function " + stmt.name + "(");
  40640. this._visitParams(stmt.params, ctx);
  40641. ctx.println(stmt, ") {");
  40642. ctx.incIndent();
  40643. this.visitAllStatements(stmt.statements, ctx);
  40644. ctx.decIndent();
  40645. ctx.println(stmt, "}");
  40646. return null;
  40647. };
  40648. /**
  40649. * @param {?} stmt
  40650. * @param {?} ctx
  40651. * @return {?}
  40652. */
  40653. AbstractJsEmitterVisitor.prototype.visitTryCatchStmt = /**
  40654. * @param {?} stmt
  40655. * @param {?} ctx
  40656. * @return {?}
  40657. */
  40658. function (stmt, ctx) {
  40659. ctx.println(stmt, "try {");
  40660. ctx.incIndent();
  40661. this.visitAllStatements(stmt.bodyStmts, ctx);
  40662. ctx.decIndent();
  40663. ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
  40664. ctx.incIndent();
  40665. var /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack')).toDeclStmt(null, [
  40666. StmtModifier.Final
  40667. ]))].concat(stmt.catchStmts);
  40668. this.visitAllStatements(catchStmts, ctx);
  40669. ctx.decIndent();
  40670. ctx.println(stmt, "}");
  40671. return null;
  40672. };
  40673. /**
  40674. * @param {?} params
  40675. * @param {?} ctx
  40676. * @return {?}
  40677. */
  40678. AbstractJsEmitterVisitor.prototype._visitParams = /**
  40679. * @param {?} params
  40680. * @param {?} ctx
  40681. * @return {?}
  40682. */
  40683. function (params, ctx) {
  40684. this.visitAllObjects(function (param) { return ctx.print(null, param.name); }, params, ctx, ',');
  40685. };
  40686. /**
  40687. * @param {?} method
  40688. * @return {?}
  40689. */
  40690. AbstractJsEmitterVisitor.prototype.getBuiltinMethodName = /**
  40691. * @param {?} method
  40692. * @return {?}
  40693. */
  40694. function (method) {
  40695. var /** @type {?} */ name;
  40696. switch (method) {
  40697. case BuiltinMethod.ConcatArray:
  40698. name = 'concat';
  40699. break;
  40700. case BuiltinMethod.SubscribeObservable:
  40701. name = 'subscribe';
  40702. break;
  40703. case BuiltinMethod.Bind:
  40704. name = 'bind';
  40705. break;
  40706. default:
  40707. throw new Error("Unknown builtin method: " + method);
  40708. }
  40709. return name;
  40710. };
  40711. return AbstractJsEmitterVisitor;
  40712. }(AbstractEmitterVisitor));
  40713. /**
  40714. * @fileoverview added by tsickle
  40715. * @suppress {checkTypes} checked by tsc
  40716. */
  40717. /**
  40718. * @license
  40719. * Copyright Google Inc. All Rights Reserved.
  40720. *
  40721. * Use of this source code is governed by an MIT-style license that can be
  40722. * found in the LICENSE file at https://angular.io/license
  40723. */
  40724. /**
  40725. * @param {?} sourceUrl
  40726. * @param {?} ctx
  40727. * @param {?} vars
  40728. * @param {?} createSourceMap
  40729. * @return {?}
  40730. */
  40731. function evalExpression(sourceUrl, ctx, vars, createSourceMap) {
  40732. var /** @type {?} */ fnBody = ctx.toSource() + "\n//# sourceURL=" + sourceUrl;
  40733. var /** @type {?} */ fnArgNames = [];
  40734. var /** @type {?} */ fnArgValues = [];
  40735. for (var /** @type {?} */ argName in vars) {
  40736. fnArgNames.push(argName);
  40737. fnArgValues.push(vars[argName]);
  40738. }
  40739. if (createSourceMap) {
  40740. // using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise
  40741. // E.g. ```
  40742. // function anonymous(a,b,c
  40743. // /**/) { ... }```
  40744. // We don't want to hard code this fact, so we auto detect it via an empty function first.
  40745. var /** @type {?} */ emptyFn = new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat('return null;'))))().toString();
  40746. var /** @type {?} */ headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\n').length - 1;
  40747. fnBody += "\n" + ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment();
  40748. }
  40749. return new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat(fnBody))))().apply(void 0, fnArgValues);
  40750. }
  40751. /**
  40752. * @param {?} sourceUrl
  40753. * @param {?} statements
  40754. * @param {?} reflector
  40755. * @param {?} createSourceMaps
  40756. * @return {?}
  40757. */
  40758. function jitStatements(sourceUrl, statements, reflector, createSourceMaps) {
  40759. var /** @type {?} */ converter = new JitEmitterVisitor(reflector);
  40760. var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
  40761. converter.visitAllStatements(statements, ctx);
  40762. converter.createReturnStmt(ctx);
  40763. return evalExpression(sourceUrl, ctx, converter.getArgs(), createSourceMaps);
  40764. }
  40765. var JitEmitterVisitor = /** @class */ (function (_super) {
  40766. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(JitEmitterVisitor, _super);
  40767. function JitEmitterVisitor(reflector) {
  40768. var _this = _super.call(this) || this;
  40769. _this.reflector = reflector;
  40770. _this._evalArgNames = [];
  40771. _this._evalArgValues = [];
  40772. _this._evalExportedVars = [];
  40773. return _this;
  40774. }
  40775. /**
  40776. * @param {?} ctx
  40777. * @return {?}
  40778. */
  40779. JitEmitterVisitor.prototype.createReturnStmt = /**
  40780. * @param {?} ctx
  40781. * @return {?}
  40782. */
  40783. function (ctx) {
  40784. var /** @type {?} */ stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(function (resultVar) { return new LiteralMapEntry(resultVar, variable(resultVar), false); })));
  40785. stmt.visitStatement(this, ctx);
  40786. };
  40787. /**
  40788. * @return {?}
  40789. */
  40790. JitEmitterVisitor.prototype.getArgs = /**
  40791. * @return {?}
  40792. */
  40793. function () {
  40794. var /** @type {?} */ result = {};
  40795. for (var /** @type {?} */ i = 0; i < this._evalArgNames.length; i++) {
  40796. result[this._evalArgNames[i]] = this._evalArgValues[i];
  40797. }
  40798. return result;
  40799. };
  40800. /**
  40801. * @param {?} ast
  40802. * @param {?} ctx
  40803. * @return {?}
  40804. */
  40805. JitEmitterVisitor.prototype.visitExternalExpr = /**
  40806. * @param {?} ast
  40807. * @param {?} ctx
  40808. * @return {?}
  40809. */
  40810. function (ast, ctx) {
  40811. var /** @type {?} */ value = this.reflector.resolveExternalReference(ast.value);
  40812. var /** @type {?} */ id = this._evalArgValues.indexOf(value);
  40813. if (id === -1) {
  40814. id = this._evalArgValues.length;
  40815. this._evalArgValues.push(value);
  40816. var /** @type {?} */ name_1 = identifierName({ reference: value }) || 'val';
  40817. this._evalArgNames.push("jit_" + name_1 + "_" + id);
  40818. }
  40819. ctx.print(ast, this._evalArgNames[id]);
  40820. return null;
  40821. };
  40822. /**
  40823. * @param {?} stmt
  40824. * @param {?} ctx
  40825. * @return {?}
  40826. */
  40827. JitEmitterVisitor.prototype.visitDeclareVarStmt = /**
  40828. * @param {?} stmt
  40829. * @param {?} ctx
  40830. * @return {?}
  40831. */
  40832. function (stmt, ctx) {
  40833. if (stmt.hasModifier(StmtModifier.Exported)) {
  40834. this._evalExportedVars.push(stmt.name);
  40835. }
  40836. return _super.prototype.visitDeclareVarStmt.call(this, stmt, ctx);
  40837. };
  40838. /**
  40839. * @param {?} stmt
  40840. * @param {?} ctx
  40841. * @return {?}
  40842. */
  40843. JitEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
  40844. * @param {?} stmt
  40845. * @param {?} ctx
  40846. * @return {?}
  40847. */
  40848. function (stmt, ctx) {
  40849. if (stmt.hasModifier(StmtModifier.Exported)) {
  40850. this._evalExportedVars.push(stmt.name);
  40851. }
  40852. return _super.prototype.visitDeclareFunctionStmt.call(this, stmt, ctx);
  40853. };
  40854. /**
  40855. * @param {?} stmt
  40856. * @param {?} ctx
  40857. * @return {?}
  40858. */
  40859. JitEmitterVisitor.prototype.visitDeclareClassStmt = /**
  40860. * @param {?} stmt
  40861. * @param {?} ctx
  40862. * @return {?}
  40863. */
  40864. function (stmt, ctx) {
  40865. if (stmt.hasModifier(StmtModifier.Exported)) {
  40866. this._evalExportedVars.push(stmt.name);
  40867. }
  40868. return _super.prototype.visitDeclareClassStmt.call(this, stmt, ctx);
  40869. };
  40870. return JitEmitterVisitor;
  40871. }(AbstractJsEmitterVisitor));
  40872. /**
  40873. * @fileoverview added by tsickle
  40874. * @suppress {checkTypes} checked by tsc
  40875. */
  40876. /**
  40877. * @license
  40878. * Copyright Google Inc. All Rights Reserved.
  40879. *
  40880. * Use of this source code is governed by an MIT-style license that can be
  40881. * found in the LICENSE file at https://angular.io/license
  40882. */
  40883. /**
  40884. * @record
  40885. */
  40886. /**
  40887. * An internal module of the Angular compiler that begins with component types,
  40888. * extracts templates, and eventually produces a compiled version of the component
  40889. * ready for linking into an application.
  40890. *
  40891. * \@security When compiling templates at runtime, you must ensure that the entire template comes
  40892. * from a trusted source. Attacker-controlled data introduced by a template could expose your
  40893. * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
  40894. */
  40895. var JitCompiler = /** @class */ (function () {
  40896. function JitCompiler(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _compilerConfig, _console, getExtraNgModuleProviders) {
  40897. this._metadataResolver = _metadataResolver;
  40898. this._templateParser = _templateParser;
  40899. this._styleCompiler = _styleCompiler;
  40900. this._viewCompiler = _viewCompiler;
  40901. this._ngModuleCompiler = _ngModuleCompiler;
  40902. this._summaryResolver = _summaryResolver;
  40903. this._reflector = _reflector;
  40904. this._compilerConfig = _compilerConfig;
  40905. this._console = _console;
  40906. this.getExtraNgModuleProviders = getExtraNgModuleProviders;
  40907. this._compiledTemplateCache = new Map();
  40908. this._compiledHostTemplateCache = new Map();
  40909. this._compiledDirectiveWrapperCache = new Map();
  40910. this._compiledNgModuleCache = new Map();
  40911. this._sharedStylesheetCount = 0;
  40912. this._addedAotSummaries = new Set();
  40913. }
  40914. /**
  40915. * @param {?} moduleType
  40916. * @return {?}
  40917. */
  40918. JitCompiler.prototype.compileModuleSync = /**
  40919. * @param {?} moduleType
  40920. * @return {?}
  40921. */
  40922. function (moduleType) {
  40923. return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true));
  40924. };
  40925. /**
  40926. * @param {?} moduleType
  40927. * @return {?}
  40928. */
  40929. JitCompiler.prototype.compileModuleAsync = /**
  40930. * @param {?} moduleType
  40931. * @return {?}
  40932. */
  40933. function (moduleType) {
  40934. return Promise.resolve(this._compileModuleAndComponents(moduleType, false));
  40935. };
  40936. /**
  40937. * @param {?} moduleType
  40938. * @return {?}
  40939. */
  40940. JitCompiler.prototype.compileModuleAndAllComponentsSync = /**
  40941. * @param {?} moduleType
  40942. * @return {?}
  40943. */
  40944. function (moduleType) {
  40945. return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true));
  40946. };
  40947. /**
  40948. * @param {?} moduleType
  40949. * @return {?}
  40950. */
  40951. JitCompiler.prototype.compileModuleAndAllComponentsAsync = /**
  40952. * @param {?} moduleType
  40953. * @return {?}
  40954. */
  40955. function (moduleType) {
  40956. return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false));
  40957. };
  40958. /**
  40959. * @param {?} component
  40960. * @return {?}
  40961. */
  40962. JitCompiler.prototype.getComponentFactory = /**
  40963. * @param {?} component
  40964. * @return {?}
  40965. */
  40966. function (component) {
  40967. var /** @type {?} */ summary = this._metadataResolver.getDirectiveSummary(component);
  40968. return /** @type {?} */ (summary.componentFactory);
  40969. };
  40970. /**
  40971. * @param {?} summaries
  40972. * @return {?}
  40973. */
  40974. JitCompiler.prototype.loadAotSummaries = /**
  40975. * @param {?} summaries
  40976. * @return {?}
  40977. */
  40978. function (summaries) {
  40979. this.clearCache();
  40980. this._addAotSummaries(summaries);
  40981. };
  40982. /**
  40983. * @param {?} fn
  40984. * @return {?}
  40985. */
  40986. JitCompiler.prototype._addAotSummaries = /**
  40987. * @param {?} fn
  40988. * @return {?}
  40989. */
  40990. function (fn$$1) {
  40991. if (this._addedAotSummaries.has(fn$$1)) {
  40992. return;
  40993. }
  40994. this._addedAotSummaries.add(fn$$1);
  40995. var /** @type {?} */ summaries = fn$$1();
  40996. for (var /** @type {?} */ i = 0; i < summaries.length; i++) {
  40997. var /** @type {?} */ entry = summaries[i];
  40998. if (typeof entry === 'function') {
  40999. this._addAotSummaries(entry);
  41000. }
  41001. else {
  41002. var /** @type {?} */ summary = /** @type {?} */ (entry);
  41003. this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary });
  41004. }
  41005. }
  41006. };
  41007. /**
  41008. * @param {?} ref
  41009. * @return {?}
  41010. */
  41011. JitCompiler.prototype.hasAotSummary = /**
  41012. * @param {?} ref
  41013. * @return {?}
  41014. */
  41015. function (ref) { return !!this._summaryResolver.resolveSummary(ref); };
  41016. /**
  41017. * @param {?} ids
  41018. * @return {?}
  41019. */
  41020. JitCompiler.prototype._filterJitIdentifiers = /**
  41021. * @param {?} ids
  41022. * @return {?}
  41023. */
  41024. function (ids) {
  41025. var _this = this;
  41026. return ids.map(function (mod) { return mod.reference; }).filter(function (ref) { return !_this.hasAotSummary(ref); });
  41027. };
  41028. /**
  41029. * @param {?} moduleType
  41030. * @param {?} isSync
  41031. * @return {?}
  41032. */
  41033. JitCompiler.prototype._compileModuleAndComponents = /**
  41034. * @param {?} moduleType
  41035. * @param {?} isSync
  41036. * @return {?}
  41037. */
  41038. function (moduleType, isSync) {
  41039. var _this = this;
  41040. return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
  41041. _this._compileComponents(moduleType, null);
  41042. return _this._compileModule(moduleType);
  41043. });
  41044. };
  41045. /**
  41046. * @param {?} moduleType
  41047. * @param {?} isSync
  41048. * @return {?}
  41049. */
  41050. JitCompiler.prototype._compileModuleAndAllComponents = /**
  41051. * @param {?} moduleType
  41052. * @param {?} isSync
  41053. * @return {?}
  41054. */
  41055. function (moduleType, isSync) {
  41056. var _this = this;
  41057. return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
  41058. var /** @type {?} */ componentFactories = [];
  41059. _this._compileComponents(moduleType, componentFactories);
  41060. return {
  41061. ngModuleFactory: _this._compileModule(moduleType),
  41062. componentFactories: componentFactories
  41063. };
  41064. });
  41065. };
  41066. /**
  41067. * @param {?} mainModule
  41068. * @param {?} isSync
  41069. * @return {?}
  41070. */
  41071. JitCompiler.prototype._loadModules = /**
  41072. * @param {?} mainModule
  41073. * @param {?} isSync
  41074. * @return {?}
  41075. */
  41076. function (mainModule, isSync) {
  41077. var _this = this;
  41078. var /** @type {?} */ loading = [];
  41079. var /** @type {?} */ mainNgModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule)));
  41080. // Note: for runtime compilation, we want to transitively compile all modules,
  41081. // so we also need to load the declared directives / pipes for all nested modules.
  41082. this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach(function (nestedNgModule) {
  41083. // getNgModuleMetadata only returns null if the value passed in is not an NgModule
  41084. var /** @type {?} */ moduleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(nestedNgModule)));
  41085. _this._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach(function (ref) {
  41086. var /** @type {?} */ promise = _this._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync);
  41087. if (promise) {
  41088. loading.push(promise);
  41089. }
  41090. });
  41091. _this._filterJitIdentifiers(moduleMeta.declaredPipes)
  41092. .forEach(function (ref) { return _this._metadataResolver.getOrLoadPipeMetadata(ref); });
  41093. });
  41094. return SyncAsync.all(loading);
  41095. };
  41096. /**
  41097. * @param {?} moduleType
  41098. * @return {?}
  41099. */
  41100. JitCompiler.prototype._compileModule = /**
  41101. * @param {?} moduleType
  41102. * @return {?}
  41103. */
  41104. function (moduleType) {
  41105. var /** @type {?} */ ngModuleFactory = /** @type {?} */ ((this._compiledNgModuleCache.get(moduleType)));
  41106. if (!ngModuleFactory) {
  41107. var /** @type {?} */ moduleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(moduleType)));
  41108. // Always provide a bound Compiler
  41109. var /** @type {?} */ extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference);
  41110. var /** @type {?} */ outputCtx = createOutputContext();
  41111. var /** @type {?} */ compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders);
  41112. ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar];
  41113. this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory);
  41114. }
  41115. return ngModuleFactory;
  41116. };
  41117. /**
  41118. * @internal
  41119. */
  41120. /**
  41121. * \@internal
  41122. * @param {?} mainModule
  41123. * @param {?} allComponentFactories
  41124. * @return {?}
  41125. */
  41126. JitCompiler.prototype._compileComponents = /**
  41127. * \@internal
  41128. * @param {?} mainModule
  41129. * @param {?} allComponentFactories
  41130. * @return {?}
  41131. */
  41132. function (mainModule, allComponentFactories) {
  41133. var _this = this;
  41134. var /** @type {?} */ ngModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule)));
  41135. var /** @type {?} */ moduleByJitDirective = new Map();
  41136. var /** @type {?} */ templates = new Set();
  41137. var /** @type {?} */ transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules);
  41138. transJitModules.forEach(function (localMod) {
  41139. var /** @type {?} */ localModuleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(localMod)));
  41140. _this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
  41141. moduleByJitDirective.set(dirRef, localModuleMeta);
  41142. var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
  41143. if (dirMeta.isComponent) {
  41144. templates.add(_this._createCompiledTemplate(dirMeta, localModuleMeta));
  41145. if (allComponentFactories) {
  41146. var /** @type {?} */ template = _this._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta);
  41147. templates.add(template);
  41148. allComponentFactories.push(/** @type {?} */ (dirMeta.componentFactory));
  41149. }
  41150. }
  41151. });
  41152. });
  41153. transJitModules.forEach(function (localMod) {
  41154. var /** @type {?} */ localModuleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(localMod)));
  41155. _this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
  41156. var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
  41157. if (dirMeta.isComponent) {
  41158. dirMeta.entryComponents.forEach(function (entryComponentType) {
  41159. var /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType)));
  41160. templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
  41161. });
  41162. }
  41163. });
  41164. localModuleMeta.entryComponents.forEach(function (entryComponentType) {
  41165. if (!_this.hasAotSummary(entryComponentType.componentType.reference)) {
  41166. var /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType)));
  41167. templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
  41168. }
  41169. });
  41170. });
  41171. templates.forEach(function (template) { return _this._compileTemplate(template); });
  41172. };
  41173. /**
  41174. * @param {?} type
  41175. * @return {?}
  41176. */
  41177. JitCompiler.prototype.clearCacheFor = /**
  41178. * @param {?} type
  41179. * @return {?}
  41180. */
  41181. function (type) {
  41182. this._compiledNgModuleCache.delete(type);
  41183. this._metadataResolver.clearCacheFor(type);
  41184. this._compiledHostTemplateCache.delete(type);
  41185. var /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(type);
  41186. if (compiledTemplate) {
  41187. this._compiledTemplateCache.delete(type);
  41188. }
  41189. };
  41190. /**
  41191. * @return {?}
  41192. */
  41193. JitCompiler.prototype.clearCache = /**
  41194. * @return {?}
  41195. */
  41196. function () {
  41197. // Note: don't clear the _addedAotSummaries, as they don't change!
  41198. this._metadataResolver.clearCache();
  41199. this._compiledTemplateCache.clear();
  41200. this._compiledHostTemplateCache.clear();
  41201. this._compiledNgModuleCache.clear();
  41202. };
  41203. /**
  41204. * @param {?} compType
  41205. * @param {?} ngModule
  41206. * @return {?}
  41207. */
  41208. JitCompiler.prototype._createCompiledHostTemplate = /**
  41209. * @param {?} compType
  41210. * @param {?} ngModule
  41211. * @return {?}
  41212. */
  41213. function (compType, ngModule) {
  41214. if (!ngModule) {
  41215. throw new Error("Component " + stringify(compType) + " is not part of any NgModule or the module has not been imported into your module.");
  41216. }
  41217. var /** @type {?} */ compiledTemplate = this._compiledHostTemplateCache.get(compType);
  41218. if (!compiledTemplate) {
  41219. var /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(compType);
  41220. assertComponent(compMeta);
  41221. var /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, (/** @type {?} */ (compMeta.componentFactory)).viewDefFactory);
  41222. compiledTemplate =
  41223. new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]);
  41224. this._compiledHostTemplateCache.set(compType, compiledTemplate);
  41225. }
  41226. return compiledTemplate;
  41227. };
  41228. /**
  41229. * @param {?} compMeta
  41230. * @param {?} ngModule
  41231. * @return {?}
  41232. */
  41233. JitCompiler.prototype._createCompiledTemplate = /**
  41234. * @param {?} compMeta
  41235. * @param {?} ngModule
  41236. * @return {?}
  41237. */
  41238. function (compMeta, ngModule) {
  41239. var /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference);
  41240. if (!compiledTemplate) {
  41241. assertComponent(compMeta);
  41242. compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives);
  41243. this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate);
  41244. }
  41245. return compiledTemplate;
  41246. };
  41247. /**
  41248. * @param {?} template
  41249. * @return {?}
  41250. */
  41251. JitCompiler.prototype._compileTemplate = /**
  41252. * @param {?} template
  41253. * @return {?}
  41254. */
  41255. function (template) {
  41256. var _this = this;
  41257. if (template.isCompiled) {
  41258. return;
  41259. }
  41260. var /** @type {?} */ compMeta = template.compMeta;
  41261. var /** @type {?} */ externalStylesheetsByModuleUrl = new Map();
  41262. var /** @type {?} */ outputContext = createOutputContext();
  41263. var /** @type {?} */ componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta); /** @type {?} */
  41264. ((compMeta.template)).externalStylesheets.forEach(function (stylesheetMeta) {
  41265. var /** @type {?} */ compiledStylesheet = _this._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta);
  41266. externalStylesheetsByModuleUrl.set(/** @type {?} */ ((stylesheetMeta.moduleUrl)), compiledStylesheet);
  41267. });
  41268. this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl);
  41269. var /** @type {?} */ pipes = template.ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  41270. var _a = this._parseTemplate(compMeta, template.ngModule, template.directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
  41271. var /** @type {?} */ compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, variable(componentStylesheet.stylesVar), usedPipes);
  41272. var /** @type {?} */ evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements);
  41273. var /** @type {?} */ viewClass = evalResult[compileResult.viewClassVar];
  41274. var /** @type {?} */ rendererType = evalResult[compileResult.rendererTypeVar];
  41275. template.compiled(viewClass, rendererType);
  41276. };
  41277. /**
  41278. * @param {?} compMeta
  41279. * @param {?} ngModule
  41280. * @param {?} directiveIdentifiers
  41281. * @return {?}
  41282. */
  41283. JitCompiler.prototype._parseTemplate = /**
  41284. * @param {?} compMeta
  41285. * @param {?} ngModule
  41286. * @param {?} directiveIdentifiers
  41287. * @return {?}
  41288. */
  41289. function (compMeta, ngModule, directiveIdentifiers) {
  41290. var _this = this;
  41291. // Note: ! is ok here as components always have a template.
  41292. var /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((compMeta.template)).preserveWhitespaces;
  41293. var /** @type {?} */ directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
  41294. var /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  41295. return this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces);
  41296. };
  41297. /**
  41298. * @param {?} result
  41299. * @param {?} externalStylesheetsByModuleUrl
  41300. * @return {?}
  41301. */
  41302. JitCompiler.prototype._resolveStylesCompileResult = /**
  41303. * @param {?} result
  41304. * @param {?} externalStylesheetsByModuleUrl
  41305. * @return {?}
  41306. */
  41307. function (result, externalStylesheetsByModuleUrl) {
  41308. var _this = this;
  41309. result.dependencies.forEach(function (dep, i) {
  41310. var /** @type {?} */ nestedCompileResult = /** @type {?} */ ((externalStylesheetsByModuleUrl.get(dep.moduleUrl)));
  41311. var /** @type {?} */ nestedStylesArr = _this._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl);
  41312. dep.setValue(nestedStylesArr);
  41313. });
  41314. };
  41315. /**
  41316. * @param {?} result
  41317. * @param {?} externalStylesheetsByModuleUrl
  41318. * @return {?}
  41319. */
  41320. JitCompiler.prototype._resolveAndEvalStylesCompileResult = /**
  41321. * @param {?} result
  41322. * @param {?} externalStylesheetsByModuleUrl
  41323. * @return {?}
  41324. */
  41325. function (result, externalStylesheetsByModuleUrl) {
  41326. this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl);
  41327. return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar];
  41328. };
  41329. /**
  41330. * @param {?} sourceUrl
  41331. * @param {?} statements
  41332. * @return {?}
  41333. */
  41334. JitCompiler.prototype._interpretOrJit = /**
  41335. * @param {?} sourceUrl
  41336. * @param {?} statements
  41337. * @return {?}
  41338. */
  41339. function (sourceUrl, statements) {
  41340. if (!this._compilerConfig.useJit) {
  41341. return interpretStatements(statements, this._reflector);
  41342. }
  41343. else {
  41344. return jitStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode);
  41345. }
  41346. };
  41347. return JitCompiler;
  41348. }());
  41349. var CompiledTemplate = /** @class */ (function () {
  41350. function CompiledTemplate(isHost, compType, compMeta, ngModule, directives) {
  41351. this.isHost = isHost;
  41352. this.compType = compType;
  41353. this.compMeta = compMeta;
  41354. this.ngModule = ngModule;
  41355. this.directives = directives;
  41356. this._viewClass = /** @type {?} */ ((null));
  41357. this.isCompiled = false;
  41358. }
  41359. /**
  41360. * @param {?} viewClass
  41361. * @param {?} rendererType
  41362. * @return {?}
  41363. */
  41364. CompiledTemplate.prototype.compiled = /**
  41365. * @param {?} viewClass
  41366. * @param {?} rendererType
  41367. * @return {?}
  41368. */
  41369. function (viewClass, rendererType) {
  41370. this._viewClass = viewClass;
  41371. (/** @type {?} */ (this.compMeta.componentViewType)).setDelegate(viewClass);
  41372. for (var /** @type {?} */ prop in rendererType) {
  41373. (/** @type {?} */ (this.compMeta.rendererType))[prop] = rendererType[prop];
  41374. }
  41375. this.isCompiled = true;
  41376. };
  41377. return CompiledTemplate;
  41378. }());
  41379. /**
  41380. * @param {?} meta
  41381. * @return {?}
  41382. */
  41383. function assertComponent(meta) {
  41384. if (!meta.isComponent) {
  41385. throw new Error("Could not compile '" + identifierName(meta.type) + "' because it is not a component.");
  41386. }
  41387. }
  41388. /**
  41389. * @return {?}
  41390. */
  41391. function createOutputContext() {
  41392. var /** @type {?} */ importExpr$$1 = function (symbol) {
  41393. return importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol });
  41394. };
  41395. return { statements: [], genFilePath: '', importExpr: importExpr$$1 };
  41396. }
  41397. /**
  41398. * @fileoverview added by tsickle
  41399. * @suppress {checkTypes} checked by tsc
  41400. */
  41401. /**
  41402. * @license
  41403. * Copyright Google Inc. All Rights Reserved.
  41404. *
  41405. * Use of this source code is governed by an MIT-style license that can be
  41406. * found in the LICENSE file at https://angular.io/license
  41407. */
  41408. /**
  41409. * Provides access to reflection data about symbols that the compiler needs.
  41410. * @abstract
  41411. */
  41412. var CompileReflector = /** @class */ (function () {
  41413. function CompileReflector() {
  41414. }
  41415. return CompileReflector;
  41416. }());
  41417. /**
  41418. * @fileoverview added by tsickle
  41419. * @suppress {checkTypes} checked by tsc
  41420. */
  41421. /**
  41422. * @license
  41423. * Copyright Google Inc. All Rights Reserved.
  41424. *
  41425. * Use of this source code is governed by an MIT-style license that can be
  41426. * found in the LICENSE file at https://angular.io/license
  41427. */
  41428. /**
  41429. * Create a {\@link UrlResolver} with no package prefix.
  41430. * @return {?}
  41431. */
  41432. function createUrlResolverWithoutPackagePrefix() {
  41433. return new UrlResolver();
  41434. }
  41435. /**
  41436. * @return {?}
  41437. */
  41438. function createOfflineCompileUrlResolver() {
  41439. return new UrlResolver('.');
  41440. }
  41441. /**
  41442. * @record
  41443. */
  41444. var UrlResolver = /** @class */ (function () {
  41445. function UrlResolverImpl(_packagePrefix) {
  41446. if (_packagePrefix === void 0) { _packagePrefix = null; }
  41447. this._packagePrefix = _packagePrefix;
  41448. }
  41449. /**
  41450. * Resolves the `url` given the `baseUrl`:
  41451. * - when the `url` is null, the `baseUrl` is returned,
  41452. * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
  41453. * `baseUrl` and `url`,
  41454. * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
  41455. * returned as is (ignoring the `baseUrl`)
  41456. */
  41457. /**
  41458. * Resolves the `url` given the `baseUrl`:
  41459. * - when the `url` is null, the `baseUrl` is returned,
  41460. * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
  41461. * `baseUrl` and `url`,
  41462. * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
  41463. * returned as is (ignoring the `baseUrl`)
  41464. * @param {?} baseUrl
  41465. * @param {?} url
  41466. * @return {?}
  41467. */
  41468. UrlResolverImpl.prototype.resolve = /**
  41469. * Resolves the `url` given the `baseUrl`:
  41470. * - when the `url` is null, the `baseUrl` is returned,
  41471. * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
  41472. * `baseUrl` and `url`,
  41473. * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
  41474. * returned as is (ignoring the `baseUrl`)
  41475. * @param {?} baseUrl
  41476. * @param {?} url
  41477. * @return {?}
  41478. */
  41479. function (baseUrl, url) {
  41480. var /** @type {?} */ resolvedUrl = url;
  41481. if (baseUrl != null && baseUrl.length > 0) {
  41482. resolvedUrl = _resolveUrl(baseUrl, resolvedUrl);
  41483. }
  41484. var /** @type {?} */ resolvedParts = _split(resolvedUrl);
  41485. var /** @type {?} */ prefix = this._packagePrefix;
  41486. if (prefix != null && resolvedParts != null &&
  41487. resolvedParts[_ComponentIndex.Scheme] == 'package') {
  41488. var /** @type {?} */ path = resolvedParts[_ComponentIndex.Path];
  41489. prefix = prefix.replace(/\/+$/, '');
  41490. path = path.replace(/^\/+/, '');
  41491. return prefix + "/" + path;
  41492. }
  41493. return resolvedUrl;
  41494. };
  41495. return UrlResolverImpl;
  41496. }());
  41497. /**
  41498. * Extract the scheme of a URL.
  41499. * @param {?} url
  41500. * @return {?}
  41501. */
  41502. function getUrlScheme(url) {
  41503. var /** @type {?} */ match = _split(url);
  41504. return (match && match[_ComponentIndex.Scheme]) || '';
  41505. }
  41506. /**
  41507. * Builds a URI string from already-encoded parts.
  41508. *
  41509. * No encoding is performed. Any component may be omitted as either null or
  41510. * undefined.
  41511. *
  41512. * @param {?=} opt_scheme The scheme such as 'http'.
  41513. * @param {?=} opt_userInfo The user name before the '\@'.
  41514. * @param {?=} opt_domain The domain such as 'www.google.com', already
  41515. * URI-encoded.
  41516. * @param {?=} opt_port The port number.
  41517. * @param {?=} opt_path The path, already URI-encoded. If it is not
  41518. * empty, it must begin with a slash.
  41519. * @param {?=} opt_queryData The URI-encoded query data.
  41520. * @param {?=} opt_fragment The URI-encoded fragment identifier.
  41521. * @return {?} The fully combined URI.
  41522. */
  41523. function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
  41524. var /** @type {?} */ out = [];
  41525. if (opt_scheme != null) {
  41526. out.push(opt_scheme + ':');
  41527. }
  41528. if (opt_domain != null) {
  41529. out.push('//');
  41530. if (opt_userInfo != null) {
  41531. out.push(opt_userInfo + '@');
  41532. }
  41533. out.push(opt_domain);
  41534. if (opt_port != null) {
  41535. out.push(':' + opt_port);
  41536. }
  41537. }
  41538. if (opt_path != null) {
  41539. out.push(opt_path);
  41540. }
  41541. if (opt_queryData != null) {
  41542. out.push('?' + opt_queryData);
  41543. }
  41544. if (opt_fragment != null) {
  41545. out.push('#' + opt_fragment);
  41546. }
  41547. return out.join('');
  41548. }
  41549. /**
  41550. * A regular expression for breaking a URI into its component parts.
  41551. *
  41552. * {\@link http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234} says
  41553. * As the "first-match-wins" algorithm is identical to the "greedy"
  41554. * disambiguation method used by POSIX regular expressions, it is natural and
  41555. * commonplace to use a regular expression for parsing the potential five
  41556. * components of a URI reference.
  41557. *
  41558. * The following line is the regular expression for breaking-down a
  41559. * well-formed URI reference into its components.
  41560. *
  41561. * <pre>
  41562. * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
  41563. * 12 3 4 5 6 7 8 9
  41564. * </pre>
  41565. *
  41566. * The numbers in the second line above are only to assist readability; they
  41567. * indicate the reference points for each subexpression (i.e., each paired
  41568. * parenthesis). We refer to the value matched for subexpression <n> as $<n>.
  41569. * For example, matching the above expression to
  41570. * <pre>
  41571. * http://www.ics.uci.edu/pub/ietf/uri/#Related
  41572. * </pre>
  41573. * results in the following subexpression matches:
  41574. * <pre>
  41575. * $1 = http:
  41576. * $2 = http
  41577. * $3 = //www.ics.uci.edu
  41578. * $4 = www.ics.uci.edu
  41579. * $5 = /pub/ietf/uri/
  41580. * $6 = <undefined>
  41581. * $7 = <undefined>
  41582. * $8 = #Related
  41583. * $9 = Related
  41584. * </pre>
  41585. * where <undefined> indicates that the component is not present, as is the
  41586. * case for the query component in the above example. Therefore, we can
  41587. * determine the value of the five components as
  41588. * <pre>
  41589. * scheme = $2
  41590. * authority = $4
  41591. * path = $5
  41592. * query = $7
  41593. * fragment = $9
  41594. * </pre>
  41595. *
  41596. * The regular expression has been modified slightly to expose the
  41597. * userInfo, domain, and port separately from the authority.
  41598. * The modified version yields
  41599. * <pre>
  41600. * $1 = http scheme
  41601. * $2 = <undefined> userInfo -\
  41602. * $3 = www.ics.uci.edu domain | authority
  41603. * $4 = <undefined> port -/
  41604. * $5 = /pub/ietf/uri/ path
  41605. * $6 = <undefined> query without ?
  41606. * $7 = Related fragment without #
  41607. * </pre>
  41608. * \@internal
  41609. */
  41610. var _splitRe = new RegExp('^' +
  41611. '(?:' +
  41612. '([^:/?#.]+)' + // scheme - ignore special characters
  41613. ':)?' +
  41614. '(?://' +
  41615. '(?:([^/?#]*)@)?' + // userInfo
  41616. '([\\w\\d\\-\\u0100-\\uffff.%]*)' + // domain - restrict to letters,
  41617. '(?::([0-9]+))?' + // port
  41618. ')?' +
  41619. '([^?#]+)?' + // path
  41620. '(?:\\?([^#]*))?' + // query
  41621. '(?:#(.*))?' + // fragment
  41622. '$');
  41623. /** @enum {number} */
  41624. var _ComponentIndex = {
  41625. Scheme: 1,
  41626. UserInfo: 2,
  41627. Domain: 3,
  41628. Port: 4,
  41629. Path: 5,
  41630. QueryData: 6,
  41631. Fragment: 7,
  41632. };
  41633. _ComponentIndex[_ComponentIndex.Scheme] = "Scheme";
  41634. _ComponentIndex[_ComponentIndex.UserInfo] = "UserInfo";
  41635. _ComponentIndex[_ComponentIndex.Domain] = "Domain";
  41636. _ComponentIndex[_ComponentIndex.Port] = "Port";
  41637. _ComponentIndex[_ComponentIndex.Path] = "Path";
  41638. _ComponentIndex[_ComponentIndex.QueryData] = "QueryData";
  41639. _ComponentIndex[_ComponentIndex.Fragment] = "Fragment";
  41640. /**
  41641. * Splits a URI into its component parts.
  41642. *
  41643. * Each component can be accessed via the component indices; for example:
  41644. * <pre>
  41645. * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA];
  41646. * </pre>
  41647. *
  41648. * @param {?} uri The URI string to examine.
  41649. * @return {?} Each component still URI-encoded.
  41650. * Each component that is present will contain the encoded value, whereas
  41651. * components that are not present will be undefined or empty, depending
  41652. * on the browser's regular expression implementation. Never null, since
  41653. * arbitrary strings may still look like path names.
  41654. */
  41655. function _split(uri) {
  41656. return /** @type {?} */ ((uri.match(_splitRe)));
  41657. }
  41658. /**
  41659. * Removes dot segments in given path component, as described in
  41660. * RFC 3986, section 5.2.4.
  41661. *
  41662. * @param {?} path A non-empty path component.
  41663. * @return {?} Path component with removed dot segments.
  41664. */
  41665. function _removeDotSegments(path) {
  41666. if (path == '/')
  41667. return '/';
  41668. var /** @type {?} */ leadingSlash = path[0] == '/' ? '/' : '';
  41669. var /** @type {?} */ trailingSlash = path[path.length - 1] === '/' ? '/' : '';
  41670. var /** @type {?} */ segments = path.split('/');
  41671. var /** @type {?} */ out = [];
  41672. var /** @type {?} */ up = 0;
  41673. for (var /** @type {?} */ pos = 0; pos < segments.length; pos++) {
  41674. var /** @type {?} */ segment = segments[pos];
  41675. switch (segment) {
  41676. case '':
  41677. case '.':
  41678. break;
  41679. case '..':
  41680. if (out.length > 0) {
  41681. out.pop();
  41682. }
  41683. else {
  41684. up++;
  41685. }
  41686. break;
  41687. default:
  41688. out.push(segment);
  41689. }
  41690. }
  41691. if (leadingSlash == '') {
  41692. while (up-- > 0) {
  41693. out.unshift('..');
  41694. }
  41695. if (out.length === 0)
  41696. out.push('.');
  41697. }
  41698. return leadingSlash + out.join('/') + trailingSlash;
  41699. }
  41700. /**
  41701. * Takes an array of the parts from split and canonicalizes the path part
  41702. * and then joins all the parts.
  41703. * @param {?} parts
  41704. * @return {?}
  41705. */
  41706. function _joinAndCanonicalizePath(parts) {
  41707. var /** @type {?} */ path = parts[_ComponentIndex.Path];
  41708. path = path == null ? '' : _removeDotSegments(path);
  41709. parts[_ComponentIndex.Path] = path;
  41710. return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);
  41711. }
  41712. /**
  41713. * Resolves a URL.
  41714. * @param {?} base The URL acting as the base URL.
  41715. * @param {?} url
  41716. * @return {?}
  41717. */
  41718. function _resolveUrl(base, url) {
  41719. var /** @type {?} */ parts = _split(encodeURI(url));
  41720. var /** @type {?} */ baseParts = _split(base);
  41721. if (parts[_ComponentIndex.Scheme] != null) {
  41722. return _joinAndCanonicalizePath(parts);
  41723. }
  41724. else {
  41725. parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];
  41726. }
  41727. for (var /** @type {?} */ i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {
  41728. if (parts[i] == null) {
  41729. parts[i] = baseParts[i];
  41730. }
  41731. }
  41732. if (parts[_ComponentIndex.Path][0] == '/') {
  41733. return _joinAndCanonicalizePath(parts);
  41734. }
  41735. var /** @type {?} */ path = baseParts[_ComponentIndex.Path];
  41736. if (path == null)
  41737. path = '/';
  41738. var /** @type {?} */ index = path.lastIndexOf('/');
  41739. path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];
  41740. parts[_ComponentIndex.Path] = path;
  41741. return _joinAndCanonicalizePath(parts);
  41742. }
  41743. /**
  41744. * @fileoverview added by tsickle
  41745. * @suppress {checkTypes} checked by tsc
  41746. */
  41747. /**
  41748. * @license
  41749. * Copyright Google Inc. All Rights Reserved.
  41750. *
  41751. * Use of this source code is governed by an MIT-style license that can be
  41752. * found in the LICENSE file at https://angular.io/license
  41753. */
  41754. /**
  41755. * An interface for retrieving documents by URL that the compiler uses
  41756. * to load templates.
  41757. */
  41758. var ResourceLoader = /** @class */ (function () {
  41759. function ResourceLoader() {
  41760. }
  41761. /**
  41762. * @param {?} url
  41763. * @return {?}
  41764. */
  41765. ResourceLoader.prototype.get = /**
  41766. * @param {?} url
  41767. * @return {?}
  41768. */
  41769. function (url) { return ''; };
  41770. return ResourceLoader;
  41771. }());
  41772. /**
  41773. * @fileoverview added by tsickle
  41774. * @suppress {checkTypes} checked by tsc
  41775. */
  41776. /**
  41777. * @license
  41778. * Copyright Google Inc. All Rights Reserved.
  41779. *
  41780. * Use of this source code is governed by an MIT-style license that can be
  41781. * found in the LICENSE file at https://angular.io/license
  41782. */
  41783. /**
  41784. * The host of the Extractor disconnects the implementation from TypeScript / other language
  41785. * services and from underlying file systems.
  41786. * @record
  41787. */
  41788. var Extractor = /** @class */ (function () {
  41789. function Extractor(host, staticSymbolResolver, messageBundle, metadataResolver) {
  41790. this.host = host;
  41791. this.staticSymbolResolver = staticSymbolResolver;
  41792. this.messageBundle = messageBundle;
  41793. this.metadataResolver = metadataResolver;
  41794. }
  41795. /**
  41796. * @param {?} rootFiles
  41797. * @return {?}
  41798. */
  41799. Extractor.prototype.extract = /**
  41800. * @param {?} rootFiles
  41801. * @return {?}
  41802. */
  41803. function (rootFiles) {
  41804. var _this = this;
  41805. var _a = analyzeAndValidateNgModules(rootFiles, this.host, this.staticSymbolResolver, this.metadataResolver), files = _a.files, ngModules = _a.ngModules;
  41806. return Promise
  41807. .all(ngModules.map(function (ngModule) {
  41808. return _this.metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false);
  41809. }))
  41810. .then(function () {
  41811. var /** @type {?} */ errors = [];
  41812. files.forEach(function (file) {
  41813. var /** @type {?} */ compMetas = [];
  41814. file.directives.forEach(function (directiveType) {
  41815. var /** @type {?} */ dirMeta = _this.metadataResolver.getDirectiveMetadata(directiveType);
  41816. if (dirMeta && dirMeta.isComponent) {
  41817. compMetas.push(dirMeta);
  41818. }
  41819. });
  41820. compMetas.forEach(function (compMeta) {
  41821. var /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template));
  41822. var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation);
  41823. errors.push.apply(errors, /** @type {?} */ ((_this.messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig))));
  41824. });
  41825. });
  41826. if (errors.length) {
  41827. throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
  41828. }
  41829. return _this.messageBundle;
  41830. });
  41831. };
  41832. /**
  41833. * @param {?} host
  41834. * @param {?} locale
  41835. * @return {?}
  41836. */
  41837. Extractor.create = /**
  41838. * @param {?} host
  41839. * @param {?} locale
  41840. * @return {?}
  41841. */
  41842. function (host, locale) {
  41843. var /** @type {?} */ htmlParser = new HtmlParser();
  41844. var /** @type {?} */ urlResolver = createAotUrlResolver(host);
  41845. var /** @type {?} */ symbolCache = new StaticSymbolCache();
  41846. var /** @type {?} */ summaryResolver = new AotSummaryResolver(host, symbolCache);
  41847. var /** @type {?} */ staticSymbolResolver = new StaticSymbolResolver(host, symbolCache, summaryResolver);
  41848. var /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, staticSymbolResolver);
  41849. var /** @type {?} */ config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false });
  41850. var /** @type {?} */ normalizer = new DirectiveNormalizer({ get: function (url) { return host.loadResource(url); } }, urlResolver, htmlParser, config);
  41851. var /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry();
  41852. var /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector);
  41853. // TODO(vicb): implicit tags & attributes
  41854. var /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale);
  41855. var /** @type {?} */ extractor = new Extractor(host, staticSymbolResolver, messageBundle, resolver);
  41856. return { extractor: extractor, staticReflector: staticReflector };
  41857. };
  41858. return Extractor;
  41859. }());
  41860. /**
  41861. * @fileoverview added by tsickle
  41862. * @suppress {checkTypes} checked by tsc
  41863. */
  41864. /**
  41865. * @license
  41866. * Copyright Google Inc. All Rights Reserved.
  41867. *
  41868. * Use of this source code is governed by an MIT-style license that can be
  41869. * found in the LICENSE file at https://angular.io/license
  41870. */
  41871. /**
  41872. * @fileoverview added by tsickle
  41873. * @suppress {checkTypes} checked by tsc
  41874. */
  41875. /**
  41876. * @license
  41877. * Copyright Google Inc. All Rights Reserved.
  41878. *
  41879. * Use of this source code is governed by an MIT-style license that can be
  41880. * found in the LICENSE file at https://angular.io/license
  41881. */
  41882. // This file only reexports content of the `src` folder. Keep it that way.
  41883. /**
  41884. * @fileoverview added by tsickle
  41885. * @suppress {checkTypes} checked by tsc
  41886. */
  41887. /**
  41888. * @license
  41889. * Copyright Google Inc. All Rights Reserved.
  41890. *
  41891. * Use of this source code is governed by an MIT-style license that can be
  41892. * found in the LICENSE file at https://angular.io/license
  41893. */
  41894. /**
  41895. * @module
  41896. * @description
  41897. * Entry point for all public APIs of this package.
  41898. */
  41899. // This file only reexports content of the `src` folder. Keep it that way.
  41900. /**
  41901. * @fileoverview added by tsickle
  41902. * @suppress {checkTypes} checked by tsc
  41903. */
  41904. /**
  41905. * @license
  41906. * Copyright Google Inc. All Rights Reserved.
  41907. *
  41908. * Use of this source code is governed by an MIT-style license that can be
  41909. * found in the LICENSE file at https://angular.io/license
  41910. */
  41911. // This file is not used to build this module. It is only used during editing
  41912. // by the TypeScript language service and during build for verification. `ngc`
  41913. // replaces this file with production index.ts when it rewrites private symbol
  41914. // names.
  41915. //# sourceMappingURL=compiler.js.map
  41916. /***/ }),
  41917. /***/ "./node_modules/@angular/core/esm5/core.js":
  41918. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41919. "use strict";
  41920. /* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export createPlatform */
  41921. /* unused harmony export assertPlatform */
  41922. /* unused harmony export destroyPlatform */
  41923. /* unused harmony export getPlatform */
  41924. /* unused harmony export PlatformRef */
  41925. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ApplicationRef; });
  41926. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_6", function() { return enableProdMode; });
  41927. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_8", function() { return isDevMode; });
  41928. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_5", function() { return createPlatformFactory; });
  41929. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return NgProbeToken; });
  41930. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return APP_ID; });
  41931. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return PACKAGE_ROOT_URL; });
  41932. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return PLATFORM_INITIALIZER; });
  41933. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return PLATFORM_ID; });
  41934. /* unused harmony export APP_BOOTSTRAP_LISTENER */
  41935. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return APP_INITIALIZER; });
  41936. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ApplicationInitStatus; });
  41937. /* unused harmony export DebugElement */
  41938. /* unused harmony export DebugNode */
  41939. /* unused harmony export asNativeElements */
  41940. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_7", function() { return getDebugNode; });
  41941. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_0", function() { return Testability; });
  41942. /* unused harmony export TestabilityRegistry */
  41943. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_10", function() { return setTestabilityGetter; });
  41944. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return TRANSLATIONS; });
  41945. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return TRANSLATIONS_FORMAT; });
  41946. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return LOCALE_ID; });
  41947. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return MissingTranslationStrategy; });
  41948. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ApplicationModule; });
  41949. /* unused harmony export wtfCreateScope */
  41950. /* unused harmony export wtfLeave */
  41951. /* unused harmony export wtfStartTimeRange */
  41952. /* unused harmony export wtfEndTimeRange */
  41953. /* unused harmony export Type */
  41954. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return EventEmitter; });
  41955. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return ErrorHandler; });
  41956. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return Sanitizer; });
  41957. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return SecurityContext; });
  41958. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; });
  41959. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return Attribute; });
  41960. /* unused harmony export ContentChild */
  41961. /* unused harmony export ContentChildren */
  41962. /* unused harmony export Query */
  41963. /* unused harmony export ViewChild */
  41964. /* unused harmony export ViewChildren */
  41965. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Component; });
  41966. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return Directive; });
  41967. /* unused harmony export HostBinding */
  41968. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return HostListener; });
  41969. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return Input; });
  41970. /* unused harmony export Output */
  41971. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return Pipe; });
  41972. /* unused harmony export CUSTOM_ELEMENTS_SCHEMA */
  41973. /* unused harmony export NO_ERRORS_SCHEMA */
  41974. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return NgModule; });
  41975. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_3", function() { return ViewEncapsulation; });
  41976. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_1", function() { return Version; });
  41977. /* unused harmony export VERSION */
  41978. /* unused harmony export forwardRef */
  41979. /* unused harmony export resolveForwardRef */
  41980. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return Injector; });
  41981. /* unused harmony export ReflectiveInjector */
  41982. /* unused harmony export ResolvedReflectiveFactory */
  41983. /* unused harmony export ReflectiveKey */
  41984. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return InjectionToken; });
  41985. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return Inject; });
  41986. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return Optional; });
  41987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return Injectable; });
  41988. /* unused harmony export Self */
  41989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return SkipSelf; });
  41990. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return Host; });
  41991. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return NgZone; });
  41992. /* unused harmony export RenderComponentType */
  41993. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return Renderer; });
  41994. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return Renderer2; });
  41995. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return RendererFactory2; });
  41996. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return RendererStyleFlags2; });
  41997. /* unused harmony export RootRenderer */
  41998. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return COMPILER_OPTIONS; });
  41999. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return Compiler; });
  42000. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return CompilerFactory; });
  42001. /* unused harmony export ModuleWithComponentFactories */
  42002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return ComponentFactory; });
  42003. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return ComponentRef; });
  42004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return ComponentFactoryResolver; });
  42005. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ElementRef; });
  42006. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return NgModuleFactory; });
  42007. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return NgModuleRef; });
  42008. /* unused harmony export NgModuleFactoryLoader */
  42009. /* unused harmony export getModuleFactory */
  42010. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return QueryList; });
  42011. /* unused harmony export SystemJsNgModuleLoader */
  42012. /* unused harmony export SystemJsNgModuleLoaderConfig */
  42013. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return TemplateRef; });
  42014. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_2", function() { return ViewContainerRef; });
  42015. /* unused harmony export EmbeddedViewRef */
  42016. /* unused harmony export ViewRef */
  42017. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ChangeDetectionStrategy; });
  42018. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return ChangeDetectorRef; });
  42019. /* unused harmony export DefaultIterableDiffer */
  42020. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return IterableDiffers; });
  42021. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return KeyValueDiffers; });
  42022. /* unused harmony export SimpleChange */
  42023. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_4", function() { return WrappedValue; });
  42024. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_9", function() { return platformCore; });
  42025. /* unused harmony export ɵALLOW_MULTIPLE_PLATFORMS */
  42026. /* unused harmony export ɵAPP_ID_RANDOM_PROVIDER */
  42027. /* unused harmony export ɵdevModeEqual */
  42028. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_25", function() { return isListLikeIterable; });
  42029. /* unused harmony export ɵChangeDetectorStatus */
  42030. /* unused harmony export ɵisDefaultChangeDetectionStrategy */
  42031. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_12", function() { return Console; });
  42032. /* unused harmony export ɵComponentFactory */
  42033. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_11", function() { return CodegenComponentFactoryResolver; });
  42034. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_15", function() { return ReflectionCapabilities; });
  42035. /* unused harmony export ɵRenderDebugInfo */
  42036. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_22", function() { return _global; });
  42037. /* unused harmony export ɵlooseIdentical */
  42038. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_39", function() { return stringify; });
  42039. /* unused harmony export ɵmakeDecorator */
  42040. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_26", function() { return isObservable; });
  42041. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_27", function() { return isPromise; });
  42042. /* unused harmony export ɵclearOverrides */
  42043. /* unused harmony export ɵoverrideComponentView */
  42044. /* unused harmony export ɵoverrideProvider */
  42045. /* unused harmony export ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR */
  42046. /* unused harmony export ɵdefineComponent */
  42047. /* unused harmony export ɵdetectChanges */
  42048. /* unused harmony export ɵrenderComponent */
  42049. /* unused harmony export ɵC */
  42050. /* unused harmony export ɵD */
  42051. /* unused harmony export ɵE */
  42052. /* unused harmony export ɵT */
  42053. /* unused harmony export ɵV */
  42054. /* unused harmony export ɵb */
  42055. /* unused harmony export ɵb1 */
  42056. /* unused harmony export ɵc */
  42057. /* unused harmony export ɵcR */
  42058. /* unused harmony export ɵcr */
  42059. /* unused harmony export ɵe */
  42060. /* unused harmony export ɵp */
  42061. /* unused harmony export ɵs */
  42062. /* unused harmony export ɵt */
  42063. /* unused harmony export ɵv */
  42064. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_38", function() { return registerModuleFactory; });
  42065. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_13", function() { return EMPTY_ARRAY; });
  42066. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_14", function() { return EMPTY_MAP; });
  42067. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_16", function() { return anchorDef; });
  42068. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_17", function() { return createComponentFactory; });
  42069. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_18", function() { return createNgModuleFactory; });
  42070. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_19", function() { return createRendererType2; });
  42071. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_20", function() { return directiveDef; });
  42072. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_21", function() { return elementDef; });
  42073. /* unused harmony export ɵelementEventFullName */
  42074. /* unused harmony export ɵgetComponentViewDefinitionFactory */
  42075. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_23", function() { return inlineInterpolate; });
  42076. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_24", function() { return interpolate; });
  42077. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_28", function() { return moduleDef; });
  42078. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_29", function() { return moduleProvideDef; });
  42079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_30", function() { return ngContentDef; });
  42080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_31", function() { return nodeValue; });
  42081. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_33", function() { return pipeDef; });
  42082. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_36", function() { return providerDef; });
  42083. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_32", function() { return pureArrayDef; });
  42084. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_34", function() { return pureObjectDef; });
  42085. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_35", function() { return purePipeDef; });
  42086. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_37", function() { return queryDef; });
  42087. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_40", function() { return textDef; });
  42088. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_41", function() { return unwrapValue; });
  42089. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_42", function() { return viewDef; });
  42090. /* unused harmony export AUTO_STYLE */
  42091. /* unused harmony export trigger */
  42092. /* unused harmony export animate */
  42093. /* unused harmony export group */
  42094. /* unused harmony export sequence */
  42095. /* unused harmony export style */
  42096. /* unused harmony export state */
  42097. /* unused harmony export keyframes */
  42098. /* unused harmony export transition */
  42099. /* unused harmony export ɵbf */
  42100. /* unused harmony export ɵbg */
  42101. /* unused harmony export ɵbk */
  42102. /* unused harmony export ɵbh */
  42103. /* unused harmony export ɵbj */
  42104. /* unused harmony export ɵbi */
  42105. /* unused harmony export ɵbl */
  42106. /* unused harmony export ɵbe */
  42107. /* unused harmony export ɵn */
  42108. /* unused harmony export ɵo */
  42109. /* unused harmony export ɵq */
  42110. /* unused harmony export ɵi */
  42111. /* unused harmony export ɵj */
  42112. /* unused harmony export ɵk */
  42113. /* unused harmony export ɵl */
  42114. /* unused harmony export ɵm */
  42115. /* unused harmony export ɵf */
  42116. /* unused harmony export ɵg */
  42117. /* unused harmony export ɵh */
  42118. /* unused harmony export ɵr */
  42119. /* unused harmony export ɵw */
  42120. /* unused harmony export ɵu */
  42121. /* unused harmony export ɵz */
  42122. /* unused harmony export ɵx */
  42123. /* unused harmony export ɵy */
  42124. /* unused harmony export ɵbc */
  42125. /* unused harmony export ɵa */
  42126. /* unused harmony export ɵd */
  42127. /* unused harmony export ɵba */
  42128. /* unused harmony export ɵbb */
  42129. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
  42130. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  42131. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/merge.js");
  42132. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__ = __webpack_require__("./node_modules/rxjs/_esm5/operator/share.js");
  42133. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__ = __webpack_require__("./node_modules/rxjs/_esm5/Subject.js");
  42134. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
  42135. /**
  42136. * @license Angular v5.2.9
  42137. * (c) 2010-2018 Google, Inc. https://angular.io/
  42138. * License: MIT
  42139. */
  42140. /**
  42141. * @fileoverview added by tsickle
  42142. * @suppress {checkTypes} checked by tsc
  42143. */
  42144. /**
  42145. * @license
  42146. * Copyright Google Inc. All Rights Reserved.
  42147. *
  42148. * Use of this source code is governed by an MIT-style license that can be
  42149. * found in the LICENSE file at https://angular.io/license
  42150. */
  42151. /**
  42152. * Creates a token that can be used in a DI Provider.
  42153. *
  42154. * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
  42155. * runtime representation) such as when injecting an interface, callable type, array or
  42156. * parametrized type.
  42157. *
  42158. * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
  42159. * the `Injector`. This provides additional level of type safety.
  42160. *
  42161. * ```
  42162. * interface MyInterface {...}
  42163. * var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
  42164. * // myInterface is inferred to be MyInterface.
  42165. * ```
  42166. *
  42167. * ### Example
  42168. *
  42169. * {\@example core/di/ts/injector_spec.ts region='InjectionToken'}
  42170. *
  42171. * \@stable
  42172. */
  42173. var InjectionToken = /** @class */ (function () {
  42174. function InjectionToken(_desc) {
  42175. this._desc = _desc;
  42176. /**
  42177. * \@internal
  42178. */
  42179. this.ngMetadataName = 'InjectionToken';
  42180. }
  42181. /**
  42182. * @return {?}
  42183. */
  42184. InjectionToken.prototype.toString = /**
  42185. * @return {?}
  42186. */
  42187. function () { return "InjectionToken " + this._desc; };
  42188. return InjectionToken;
  42189. }());
  42190. /**
  42191. * @fileoverview added by tsickle
  42192. * @suppress {checkTypes} checked by tsc
  42193. */
  42194. /**
  42195. * @license
  42196. * Copyright Google Inc. All Rights Reserved.
  42197. *
  42198. * Use of this source code is governed by an MIT-style license that can be
  42199. * found in the LICENSE file at https://angular.io/license
  42200. */
  42201. /**
  42202. * An interface implemented by all Angular type decorators, which allows them to be used as ES7
  42203. * decorators as well as
  42204. * Angular DSL syntax.
  42205. *
  42206. * ES7 syntax:
  42207. *
  42208. * ```
  42209. * \@ng.Component({...})
  42210. * class MyClass {...}
  42211. * ```
  42212. * \@stable
  42213. * @record
  42214. */
  42215. var ANNOTATIONS = '__annotations__';
  42216. var PARAMETERS = '__paramaters__';
  42217. var PROP_METADATA = '__prop__metadata__';
  42218. /**
  42219. * @suppress {globalThis}
  42220. * @param {?} name
  42221. * @param {?=} props
  42222. * @param {?=} parentClass
  42223. * @param {?=} chainFn
  42224. * @return {?}
  42225. */
  42226. function makeDecorator(name, props, parentClass, chainFn) {
  42227. var /** @type {?} */ metaCtor = makeMetadataCtor(props);
  42228. /**
  42229. * @param {?} objOrType
  42230. * @return {?}
  42231. */
  42232. function DecoratorFactory(objOrType) {
  42233. if (this instanceof DecoratorFactory) {
  42234. metaCtor.call(this, objOrType);
  42235. return this;
  42236. }
  42237. var /** @type {?} */ annotationInstance = new (/** @type {?} */ (DecoratorFactory))(objOrType);
  42238. var /** @type {?} */ TypeDecorator = /** @type {?} */ (function TypeDecorator(cls) {
  42239. // Use of Object.defineProperty is important since it creates non-enumerable property which
  42240. // prevents the property is copied during subclassing.
  42241. var /** @type {?} */ annotations = cls.hasOwnProperty(ANNOTATIONS) ?
  42242. (/** @type {?} */ (cls))[ANNOTATIONS] :
  42243. Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
  42244. annotations.push(annotationInstance);
  42245. return cls;
  42246. });
  42247. if (chainFn)
  42248. chainFn(TypeDecorator);
  42249. return TypeDecorator;
  42250. }
  42251. if (parentClass) {
  42252. DecoratorFactory.prototype = Object.create(parentClass.prototype);
  42253. }
  42254. DecoratorFactory.prototype.ngMetadataName = name;
  42255. (/** @type {?} */ (DecoratorFactory)).annotationCls = DecoratorFactory;
  42256. return /** @type {?} */ (DecoratorFactory);
  42257. }
  42258. /**
  42259. * @param {?=} props
  42260. * @return {?}
  42261. */
  42262. function makeMetadataCtor(props) {
  42263. return function ctor() {
  42264. var args = [];
  42265. for (var _i = 0; _i < arguments.length; _i++) {
  42266. args[_i] = arguments[_i];
  42267. }
  42268. if (props) {
  42269. var /** @type {?} */ values = props.apply(void 0, args);
  42270. for (var /** @type {?} */ propName in values) {
  42271. this[propName] = values[propName];
  42272. }
  42273. }
  42274. };
  42275. }
  42276. /**
  42277. * @param {?} name
  42278. * @param {?=} props
  42279. * @param {?=} parentClass
  42280. * @return {?}
  42281. */
  42282. function makeParamDecorator(name, props, parentClass) {
  42283. var /** @type {?} */ metaCtor = makeMetadataCtor(props);
  42284. /**
  42285. * @param {...?} args
  42286. * @return {?}
  42287. */
  42288. function ParamDecoratorFactory() {
  42289. var args = [];
  42290. for (var _i = 0; _i < arguments.length; _i++) {
  42291. args[_i] = arguments[_i];
  42292. }
  42293. if (this instanceof ParamDecoratorFactory) {
  42294. metaCtor.apply(this, args);
  42295. return this;
  42296. }
  42297. var /** @type {?} */ annotationInstance = new ((_a = (/** @type {?} */ (ParamDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
  42298. (/** @type {?} */ (ParamDecorator)).annotation = annotationInstance;
  42299. return ParamDecorator;
  42300. /**
  42301. * @param {?} cls
  42302. * @param {?} unusedKey
  42303. * @param {?} index
  42304. * @return {?}
  42305. */
  42306. function ParamDecorator(cls, unusedKey, index) {
  42307. // Use of Object.defineProperty is important since it creates non-enumerable property which
  42308. // prevents the property is copied during subclassing.
  42309. var /** @type {?} */ parameters = cls.hasOwnProperty(PARAMETERS) ?
  42310. (/** @type {?} */ (cls))[PARAMETERS] :
  42311. Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
  42312. // there might be gaps if some in between parameters do not have annotations.
  42313. // we pad with nulls.
  42314. while (parameters.length <= index) {
  42315. parameters.push(null);
  42316. }
  42317. (parameters[index] = parameters[index] || []).push(annotationInstance);
  42318. return cls;
  42319. }
  42320. var _a;
  42321. }
  42322. if (parentClass) {
  42323. ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
  42324. }
  42325. ParamDecoratorFactory.prototype.ngMetadataName = name;
  42326. (/** @type {?} */ (ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
  42327. return ParamDecoratorFactory;
  42328. }
  42329. /**
  42330. * @param {?} name
  42331. * @param {?=} props
  42332. * @param {?=} parentClass
  42333. * @return {?}
  42334. */
  42335. function makePropDecorator(name, props, parentClass) {
  42336. var /** @type {?} */ metaCtor = makeMetadataCtor(props);
  42337. /**
  42338. * @param {...?} args
  42339. * @return {?}
  42340. */
  42341. function PropDecoratorFactory() {
  42342. var args = [];
  42343. for (var _i = 0; _i < arguments.length; _i++) {
  42344. args[_i] = arguments[_i];
  42345. }
  42346. if (this instanceof PropDecoratorFactory) {
  42347. metaCtor.apply(this, args);
  42348. return this;
  42349. }
  42350. var /** @type {?} */ decoratorInstance = new ((_a = (/** @type {?} */ (PropDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
  42351. return function PropDecorator(target, name) {
  42352. var /** @type {?} */ constructor = target.constructor;
  42353. // Use of Object.defineProperty is important since it creates non-enumerable property which
  42354. // prevents the property is copied during subclassing.
  42355. var /** @type {?} */ meta = constructor.hasOwnProperty(PROP_METADATA) ?
  42356. (/** @type {?} */ (constructor))[PROP_METADATA] :
  42357. Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
  42358. meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
  42359. meta[name].unshift(decoratorInstance);
  42360. };
  42361. var _a;
  42362. }
  42363. if (parentClass) {
  42364. PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
  42365. }
  42366. PropDecoratorFactory.prototype.ngMetadataName = name;
  42367. (/** @type {?} */ (PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
  42368. return PropDecoratorFactory;
  42369. }
  42370. /**
  42371. * @fileoverview added by tsickle
  42372. * @suppress {checkTypes} checked by tsc
  42373. */
  42374. /**
  42375. * @license
  42376. * Copyright Google Inc. All Rights Reserved.
  42377. *
  42378. * Use of this source code is governed by an MIT-style license that can be
  42379. * found in the LICENSE file at https://angular.io/license
  42380. */
  42381. /**
  42382. * This token can be used to create a virtual provider that will populate the
  42383. * `entryComponents` fields of components and ng modules based on its `useValue`.
  42384. * All components that are referenced in the `useValue` value (either directly
  42385. * or in a nested array or map) will be added to the `entryComponents` property.
  42386. *
  42387. * ### Example
  42388. * The following example shows how the router can populate the `entryComponents`
  42389. * field of an NgModule based on the router configuration which refers
  42390. * to components.
  42391. *
  42392. * ```typescript
  42393. * // helper function inside the router
  42394. * function provideRoutes(routes) {
  42395. * return [
  42396. * {provide: ROUTES, useValue: routes},
  42397. * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
  42398. * ];
  42399. * }
  42400. *
  42401. * // user code
  42402. * let routes = [
  42403. * {path: '/root', component: RootComp},
  42404. * {path: '/teams', component: TeamsComp}
  42405. * ];
  42406. *
  42407. * \@NgModule({
  42408. * providers: [provideRoutes(routes)]
  42409. * })
  42410. * class ModuleWithRoutes {}
  42411. * ```
  42412. *
  42413. * \@experimental
  42414. */
  42415. var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
  42416. /**
  42417. * Type of the Attribute decorator / constructor function.
  42418. *
  42419. * \@stable
  42420. * @record
  42421. */
  42422. /**
  42423. * Attribute decorator and metadata.
  42424. *
  42425. * \@stable
  42426. * \@Annotation
  42427. */
  42428. var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
  42429. /**
  42430. * Base class for query metadata.
  42431. *
  42432. * See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
  42433. * more information.
  42434. *
  42435. * \@stable
  42436. * @abstract
  42437. */
  42438. var Query = /** @class */ (function () {
  42439. function Query() {
  42440. }
  42441. return Query;
  42442. }());
  42443. /**
  42444. * Type of the ContentChildren decorator / constructor function.
  42445. *
  42446. * See {\@link ContentChildren}.
  42447. *
  42448. * \@stable
  42449. * @record
  42450. */
  42451. /**
  42452. * ContentChildren decorator and metadata.
  42453. *
  42454. * \@stable
  42455. * \@Annotation
  42456. */
  42457. var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
  42458. if (data === void 0) { data = {}; }
  42459. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
  42460. }, Query);
  42461. /**
  42462. * Type of the ContentChild decorator / constructor function.
  42463. *
  42464. *
  42465. * \@stable
  42466. * @record
  42467. */
  42468. /**
  42469. * ContentChild decorator and metadata.
  42470. *
  42471. * \@stable
  42472. * \@Annotation
  42473. */
  42474. var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
  42475. if (data === void 0) { data = {}; }
  42476. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
  42477. }, Query);
  42478. /**
  42479. * Type of the ViewChildren decorator / constructor function.
  42480. *
  42481. * See {\@link ViewChildren}.
  42482. *
  42483. * \@stable
  42484. * @record
  42485. */
  42486. /**
  42487. * ViewChildren decorator and metadata.
  42488. *
  42489. * \@stable
  42490. * \@Annotation
  42491. */
  42492. var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
  42493. if (data === void 0) { data = {}; }
  42494. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
  42495. }, Query);
  42496. /**
  42497. * Type of the ViewChild decorator / constructor function.
  42498. *
  42499. * See {\@link ViewChild}
  42500. *
  42501. * \@stable
  42502. * @record
  42503. */
  42504. /**
  42505. * ViewChild decorator and metadata.
  42506. *
  42507. * \@stable
  42508. * \@Annotation
  42509. */
  42510. var ViewChild = makePropDecorator('ViewChild', function (selector, data) {
  42511. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
  42512. }, Query);
  42513. /**
  42514. * @fileoverview added by tsickle
  42515. * @suppress {checkTypes} checked by tsc
  42516. */
  42517. /**
  42518. * @license
  42519. * Copyright Google Inc. All Rights Reserved.
  42520. *
  42521. * Use of this source code is governed by an MIT-style license that can be
  42522. * found in the LICENSE file at https://angular.io/license
  42523. */
  42524. /** @enum {number} */
  42525. var ChangeDetectionStrategy = {
  42526. /**
  42527. * `OnPush` means that the change detector's mode will be initially set to `CheckOnce`.
  42528. */
  42529. OnPush: 0,
  42530. /**
  42531. * `Default` means that the change detector's mode will be initially set to `CheckAlways`.
  42532. */
  42533. Default: 1,
  42534. };
  42535. ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
  42536. ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
  42537. /** @enum {number} */
  42538. var ChangeDetectorStatus = {
  42539. /**
  42540. * `CheckOnce` means that after calling detectChanges the mode of the change detector
  42541. * will become `Checked`.
  42542. */
  42543. CheckOnce: 0,
  42544. /**
  42545. * `Checked` means that the change detector should be skipped until its mode changes to
  42546. * `CheckOnce`.
  42547. */
  42548. Checked: 1,
  42549. /**
  42550. * `CheckAlways` means that after calling detectChanges the mode of the change detector
  42551. * will remain `CheckAlways`.
  42552. */
  42553. CheckAlways: 2,
  42554. /**
  42555. * `Detached` means that the change detector sub tree is not a part of the main tree and
  42556. * should be skipped.
  42557. */
  42558. Detached: 3,
  42559. /**
  42560. * `Errored` means that the change detector encountered an error checking a binding
  42561. * or calling a directive lifecycle method and is now in an inconsistent state. Change
  42562. * detectors in this state will no longer detect changes.
  42563. */
  42564. Errored: 4,
  42565. /**
  42566. * `Destroyed` means that the change detector is destroyed.
  42567. */
  42568. Destroyed: 5,
  42569. };
  42570. ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
  42571. ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
  42572. ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
  42573. ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
  42574. ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
  42575. ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
  42576. /**
  42577. * @param {?} changeDetectionStrategy
  42578. * @return {?}
  42579. */
  42580. function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
  42581. return changeDetectionStrategy == null ||
  42582. changeDetectionStrategy === ChangeDetectionStrategy.Default;
  42583. }
  42584. /**
  42585. * @fileoverview added by tsickle
  42586. * @suppress {checkTypes} checked by tsc
  42587. */
  42588. /**
  42589. * @license
  42590. * Copyright Google Inc. All Rights Reserved.
  42591. *
  42592. * Use of this source code is governed by an MIT-style license that can be
  42593. * found in the LICENSE file at https://angular.io/license
  42594. */
  42595. /**
  42596. * Type of the Directive decorator / constructor function.
  42597. *
  42598. * \@stable
  42599. * @record
  42600. */
  42601. /**
  42602. * Directive decorator and metadata.
  42603. *
  42604. * \@stable
  42605. * \@Annotation
  42606. */
  42607. var Directive = makeDecorator('Directive', function (dir) {
  42608. if (dir === void 0) { dir = {}; }
  42609. return dir;
  42610. });
  42611. /**
  42612. * Type of the Component decorator / constructor function.
  42613. *
  42614. * \@stable
  42615. * @record
  42616. */
  42617. /**
  42618. * Component decorator and metadata.
  42619. *
  42620. * \@stable
  42621. * \@Annotation
  42622. */
  42623. var Component = makeDecorator('Component', function (c) {
  42624. if (c === void 0) { c = {}; }
  42625. return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ changeDetection: ChangeDetectionStrategy.Default }, c));
  42626. }, Directive);
  42627. /**
  42628. * Type of the Pipe decorator / constructor function.
  42629. *
  42630. * \@stable
  42631. * @record
  42632. */
  42633. /**
  42634. * Pipe decorator and metadata.
  42635. *
  42636. * \@stable
  42637. * \@Annotation
  42638. */
  42639. var Pipe = makeDecorator('Pipe', function (p) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ pure: true }, p)); });
  42640. /**
  42641. * Type of the Input decorator / constructor function.
  42642. *
  42643. * \@stable
  42644. * @record
  42645. */
  42646. /**
  42647. * Input decorator and metadata.
  42648. *
  42649. * \@stable
  42650. * \@Annotation
  42651. */
  42652. var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  42653. /**
  42654. * Type of the Output decorator / constructor function.
  42655. *
  42656. * \@stable
  42657. * @record
  42658. */
  42659. /**
  42660. * Output decorator and metadata.
  42661. *
  42662. * \@stable
  42663. * \@Annotation
  42664. */
  42665. var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  42666. /**
  42667. * Type of the HostBinding decorator / constructor function.
  42668. *
  42669. * \@stable
  42670. * @record
  42671. */
  42672. /**
  42673. * HostBinding decorator and metadata.
  42674. *
  42675. * \@stable
  42676. * \@Annotation
  42677. */
  42678. var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
  42679. /**
  42680. * Type of the HostListener decorator / constructor function.
  42681. *
  42682. * \@stable
  42683. * @record
  42684. */
  42685. /**
  42686. * HostListener decorator and metadata.
  42687. *
  42688. * \@stable
  42689. * \@Annotation
  42690. */
  42691. var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
  42692. /**
  42693. * @fileoverview added by tsickle
  42694. * @suppress {checkTypes} checked by tsc
  42695. */
  42696. /**
  42697. * @license
  42698. * Copyright Google Inc. All Rights Reserved.
  42699. *
  42700. * Use of this source code is governed by an MIT-style license that can be
  42701. * found in the LICENSE file at https://angular.io/license
  42702. */
  42703. /**
  42704. * A wrapper around a module that also includes the providers.
  42705. *
  42706. * \@stable
  42707. * @record
  42708. */
  42709. /**
  42710. * Interface for schema definitions in \@NgModules.
  42711. *
  42712. * \@experimental
  42713. * @record
  42714. */
  42715. /**
  42716. * Defines a schema that will allow:
  42717. * - any non-Angular elements with a `-` in their name,
  42718. * - any properties on elements with a `-` in their name which is the common rule for custom
  42719. * elements.
  42720. *
  42721. * \@stable
  42722. */
  42723. var CUSTOM_ELEMENTS_SCHEMA = {
  42724. name: 'custom-elements'
  42725. };
  42726. /**
  42727. * Defines a schema that will allow any property on any element.
  42728. *
  42729. * \@experimental
  42730. */
  42731. var NO_ERRORS_SCHEMA = {
  42732. name: 'no-errors-schema'
  42733. };
  42734. /**
  42735. * Type of the NgModule decorator / constructor function.
  42736. *
  42737. * \@stable
  42738. * @record
  42739. */
  42740. /**
  42741. * NgModule decorator and metadata.
  42742. *
  42743. * \@stable
  42744. * \@Annotation
  42745. */
  42746. var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; });
  42747. /**
  42748. * @fileoverview added by tsickle
  42749. * @suppress {checkTypes} checked by tsc
  42750. */
  42751. /**
  42752. * @license
  42753. * Copyright Google Inc. All Rights Reserved.
  42754. *
  42755. * Use of this source code is governed by an MIT-style license that can be
  42756. * found in the LICENSE file at https://angular.io/license
  42757. */
  42758. /** @enum {number} */
  42759. var ViewEncapsulation = {
  42760. /**
  42761. * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
  42762. * Element and pre-processing the style rules provided via {@link Component#styles styles} or
  42763. * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all
  42764. * selectors.
  42765. *
  42766. * This is the default option.
  42767. */
  42768. Emulated: 0,
  42769. /**
  42770. * Use the native encapsulation mechanism of the renderer.
  42771. *
  42772. * For the DOM this means using [Shadow DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
  42773. * creating a ShadowRoot for Component's Host Element.
  42774. */
  42775. Native: 1,
  42776. /**
  42777. * Don't provide any template or style encapsulation.
  42778. */
  42779. None: 2,
  42780. };
  42781. ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
  42782. ViewEncapsulation[ViewEncapsulation.Native] = "Native";
  42783. ViewEncapsulation[ViewEncapsulation.None] = "None";
  42784. /**
  42785. * @fileoverview added by tsickle
  42786. * @suppress {checkTypes} checked by tsc
  42787. */
  42788. /**
  42789. * @license
  42790. * Copyright Google Inc. All Rights Reserved.
  42791. *
  42792. * Use of this source code is governed by an MIT-style license that can be
  42793. * found in the LICENSE file at https://angular.io/license
  42794. */
  42795. /**
  42796. * @fileoverview added by tsickle
  42797. * @suppress {checkTypes} checked by tsc
  42798. */
  42799. /**
  42800. * @license
  42801. * Copyright Google Inc. All Rights Reserved.
  42802. *
  42803. * Use of this source code is governed by an MIT-style license that can be
  42804. * found in the LICENSE file at https://angular.io/license
  42805. */
  42806. /**
  42807. * \@whatItDoes Represents the version of Angular
  42808. *
  42809. * \@stable
  42810. */
  42811. var Version = /** @class */ (function () {
  42812. function Version(full) {
  42813. this.full = full;
  42814. this.major = full.split('.')[0];
  42815. this.minor = full.split('.')[1];
  42816. this.patch = full.split('.').slice(2).join('.');
  42817. }
  42818. return Version;
  42819. }());
  42820. /**
  42821. * \@stable
  42822. */
  42823. var VERSION = new Version('5.2.9');
  42824. /**
  42825. * @fileoverview added by tsickle
  42826. * @suppress {checkTypes} checked by tsc
  42827. */
  42828. /**
  42829. * @license
  42830. * Copyright Google Inc. All Rights Reserved.
  42831. *
  42832. * Use of this source code is governed by an MIT-style license that can be
  42833. * found in the LICENSE file at https://angular.io/license
  42834. */
  42835. /**
  42836. * Type of the Inject decorator / constructor function.
  42837. *
  42838. * \@stable
  42839. * @record
  42840. */
  42841. /**
  42842. * Inject decorator and metadata.
  42843. *
  42844. * \@stable
  42845. * \@Annotation
  42846. */
  42847. var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
  42848. /**
  42849. * Type of the Optional decorator / constructor function.
  42850. *
  42851. * \@stable
  42852. * @record
  42853. */
  42854. /**
  42855. * Optional decorator and metadata.
  42856. *
  42857. * \@stable
  42858. * \@Annotation
  42859. */
  42860. var Optional = makeParamDecorator('Optional');
  42861. /**
  42862. * Type of the Injectable decorator / constructor function.
  42863. *
  42864. * \@stable
  42865. * @record
  42866. */
  42867. /**
  42868. * Injectable decorator and metadata.
  42869. *
  42870. * \@stable
  42871. * \@Annotation
  42872. */
  42873. var Injectable = makeDecorator('Injectable');
  42874. /**
  42875. * Type of the Self decorator / constructor function.
  42876. *
  42877. * \@stable
  42878. * @record
  42879. */
  42880. /**
  42881. * Self decorator and metadata.
  42882. *
  42883. * \@stable
  42884. * \@Annotation
  42885. */
  42886. var Self = makeParamDecorator('Self');
  42887. /**
  42888. * Type of the SkipSelf decorator / constructor function.
  42889. *
  42890. * \@stable
  42891. * @record
  42892. */
  42893. /**
  42894. * SkipSelf decorator and metadata.
  42895. *
  42896. * \@stable
  42897. * \@Annotation
  42898. */
  42899. var SkipSelf = makeParamDecorator('SkipSelf');
  42900. /**
  42901. * Type of the Host decorator / constructor function.
  42902. *
  42903. * \@stable
  42904. * @record
  42905. */
  42906. /**
  42907. * Host decorator and metadata.
  42908. *
  42909. * \@stable
  42910. * \@Annotation
  42911. */
  42912. var Host = makeParamDecorator('Host');
  42913. /**
  42914. * @fileoverview added by tsickle
  42915. * @suppress {checkTypes} checked by tsc
  42916. */
  42917. /**
  42918. * @license
  42919. * Copyright Google Inc. All Rights Reserved.
  42920. *
  42921. * Use of this source code is governed by an MIT-style license that can be
  42922. * found in the LICENSE file at https://angular.io/license
  42923. */
  42924. var __window = typeof window !== 'undefined' && window;
  42925. var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
  42926. self instanceof WorkerGlobalScope && self;
  42927. var __global = typeof global !== 'undefined' && global;
  42928. var _global = __window || __global || __self;
  42929. var promise = Promise.resolve(0);
  42930. var _symbolIterator = null;
  42931. /**
  42932. * @return {?}
  42933. */
  42934. function getSymbolIterator() {
  42935. if (!_symbolIterator) {
  42936. var /** @type {?} */ Symbol_1 = _global['Symbol'];
  42937. if (Symbol_1 && Symbol_1.iterator) {
  42938. _symbolIterator = Symbol_1.iterator;
  42939. }
  42940. else {
  42941. // es6-shim specific logic
  42942. var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
  42943. for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
  42944. var /** @type {?} */ key = keys[i];
  42945. if (key !== 'entries' && key !== 'size' &&
  42946. (/** @type {?} */ (Map)).prototype[key] === Map.prototype['entries']) {
  42947. _symbolIterator = key;
  42948. }
  42949. }
  42950. }
  42951. }
  42952. return _symbolIterator;
  42953. }
  42954. /**
  42955. * @param {?} fn
  42956. * @return {?}
  42957. */
  42958. function scheduleMicroTask(fn) {
  42959. if (typeof Zone === 'undefined') {
  42960. // use promise to schedule microTask instead of use Zone
  42961. promise.then(function () { fn && fn.apply(null, null); });
  42962. }
  42963. else {
  42964. Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
  42965. }
  42966. }
  42967. /**
  42968. * @param {?} a
  42969. * @param {?} b
  42970. * @return {?}
  42971. */
  42972. function looseIdentical(a, b) {
  42973. return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
  42974. }
  42975. /**
  42976. * @param {?} token
  42977. * @return {?}
  42978. */
  42979. function stringify(token) {
  42980. if (typeof token === 'string') {
  42981. return token;
  42982. }
  42983. if (token instanceof Array) {
  42984. return '[' + token.map(stringify).join(', ') + ']';
  42985. }
  42986. if (token == null) {
  42987. return '' + token;
  42988. }
  42989. if (token.overriddenName) {
  42990. return "" + token.overriddenName;
  42991. }
  42992. if (token.name) {
  42993. return "" + token.name;
  42994. }
  42995. var /** @type {?} */ res = token.toString();
  42996. if (res == null) {
  42997. return '' + res;
  42998. }
  42999. var /** @type {?} */ newLineIndex = res.indexOf('\n');
  43000. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  43001. }
  43002. /**
  43003. * @fileoverview added by tsickle
  43004. * @suppress {checkTypes} checked by tsc
  43005. */
  43006. /**
  43007. * @license
  43008. * Copyright Google Inc. All Rights Reserved.
  43009. *
  43010. * Use of this source code is governed by an MIT-style license that can be
  43011. * found in the LICENSE file at https://angular.io/license
  43012. */
  43013. /**
  43014. * An interface that a function passed into {\@link forwardRef} has to implement.
  43015. *
  43016. * ### Example
  43017. *
  43018. * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'}
  43019. * \@experimental
  43020. * @record
  43021. */
  43022. /**
  43023. * Allows to refer to references which are not yet defined.
  43024. *
  43025. * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
  43026. * DI is declared,
  43027. * but not yet defined. It is also used when the `token` which we use when creating a query is not
  43028. * yet defined.
  43029. *
  43030. * ### Example
  43031. * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
  43032. * \@experimental
  43033. * @param {?} forwardRefFn
  43034. * @return {?}
  43035. */
  43036. function forwardRef(forwardRefFn) {
  43037. (/** @type {?} */ (forwardRefFn)).__forward_ref__ = forwardRef;
  43038. (/** @type {?} */ (forwardRefFn)).toString = function () { return stringify(this()); };
  43039. return (/** @type {?} */ (/** @type {?} */ (forwardRefFn)));
  43040. }
  43041. /**
  43042. * Lazily retrieves the reference value from a forwardRef.
  43043. *
  43044. * Acts as the identity function when given a non-forward-ref value.
  43045. *
  43046. * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
  43047. *
  43048. * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
  43049. *
  43050. * See: {\@link forwardRef}
  43051. * \@experimental
  43052. * @param {?} type
  43053. * @return {?}
  43054. */
  43055. function resolveForwardRef(type) {
  43056. if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
  43057. type.__forward_ref__ === forwardRef) {
  43058. return (/** @type {?} */ (type))();
  43059. }
  43060. else {
  43061. return type;
  43062. }
  43063. }
  43064. /**
  43065. * @fileoverview added by tsickle
  43066. * @suppress {checkTypes} checked by tsc
  43067. */
  43068. /**
  43069. * @license
  43070. * Copyright Google Inc. All Rights Reserved.
  43071. *
  43072. * Use of this source code is governed by an MIT-style license that can be
  43073. * found in the LICENSE file at https://angular.io/license
  43074. */
  43075. var SOURCE = '__source';
  43076. var _THROW_IF_NOT_FOUND = new Object();
  43077. var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
  43078. var _NullInjector = /** @class */ (function () {
  43079. function _NullInjector() {
  43080. }
  43081. /**
  43082. * @param {?} token
  43083. * @param {?=} notFoundValue
  43084. * @return {?}
  43085. */
  43086. _NullInjector.prototype.get = /**
  43087. * @param {?} token
  43088. * @param {?=} notFoundValue
  43089. * @return {?}
  43090. */
  43091. function (token, notFoundValue) {
  43092. if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
  43093. if (notFoundValue === _THROW_IF_NOT_FOUND) {
  43094. throw new Error("NullInjectorError: No provider for " + stringify(token) + "!");
  43095. }
  43096. return notFoundValue;
  43097. };
  43098. return _NullInjector;
  43099. }());
  43100. /**
  43101. * \@whatItDoes Injector interface
  43102. * \@howToUse
  43103. * ```
  43104. * const injector: Injector = ...;
  43105. * injector.get(...);
  43106. * ```
  43107. *
  43108. * \@description
  43109. * For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
  43110. *
  43111. * ### Example
  43112. *
  43113. * {\@example core/di/ts/injector_spec.ts region='Injector'}
  43114. *
  43115. * `Injector` returns itself when given `Injector` as a token:
  43116. * {\@example core/di/ts/injector_spec.ts region='injectInjector'}
  43117. *
  43118. * \@stable
  43119. * @abstract
  43120. */
  43121. var Injector = /** @class */ (function () {
  43122. function Injector() {
  43123. }
  43124. /**
  43125. * Create a new Injector which is configure using `StaticProvider`s.
  43126. *
  43127. * ### Example
  43128. *
  43129. * {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
  43130. */
  43131. /**
  43132. * Create a new Injector which is configure using `StaticProvider`s.
  43133. *
  43134. * ### Example
  43135. *
  43136. * {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
  43137. * @param {?} options
  43138. * @param {?=} parent
  43139. * @return {?}
  43140. */
  43141. Injector.create = /**
  43142. * Create a new Injector which is configure using `StaticProvider`s.
  43143. *
  43144. * ### Example
  43145. *
  43146. * {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
  43147. * @param {?} options
  43148. * @param {?=} parent
  43149. * @return {?}
  43150. */
  43151. function (options, parent) {
  43152. if (Array.isArray(options)) {
  43153. return new StaticInjector(options, parent);
  43154. }
  43155. else {
  43156. return new StaticInjector(options.providers, options.parent, options.name || null);
  43157. }
  43158. };
  43159. Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
  43160. Injector.NULL = new _NullInjector();
  43161. return Injector;
  43162. }());
  43163. var IDENT = function (value) {
  43164. return value;
  43165. };
  43166. var EMPTY = /** @type {?} */ ([]);
  43167. var CIRCULAR = IDENT;
  43168. var MULTI_PROVIDER_FN = function () {
  43169. return Array.prototype.slice.call(arguments);
  43170. };
  43171. var GET_PROPERTY_NAME = /** @type {?} */ ({});
  43172. var ɵ2 = GET_PROPERTY_NAME;
  43173. var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: ɵ2 });
  43174. var NG_TOKEN_PATH = 'ngTokenPath';
  43175. var NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
  43176. var NULL_INJECTOR = Injector.NULL;
  43177. var NEW_LINE = /\n/gm;
  43178. var NO_NEW_LINE = 'ɵ';
  43179. var StaticInjector = /** @class */ (function () {
  43180. function StaticInjector(providers, parent, source) {
  43181. if (parent === void 0) { parent = NULL_INJECTOR; }
  43182. if (source === void 0) { source = null; }
  43183. this.parent = parent;
  43184. this.source = source;
  43185. var /** @type {?} */ records = this._records = new Map();
  43186. records.set(Injector, /** @type {?} */ ({ token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false }));
  43187. recursivelyProcessProviders(records, providers);
  43188. }
  43189. /**
  43190. * @param {?} token
  43191. * @param {?=} notFoundValue
  43192. * @return {?}
  43193. */
  43194. StaticInjector.prototype.get = /**
  43195. * @param {?} token
  43196. * @param {?=} notFoundValue
  43197. * @return {?}
  43198. */
  43199. function (token, notFoundValue) {
  43200. var /** @type {?} */ record = this._records.get(token);
  43201. try {
  43202. return tryResolveToken(token, record, this._records, this.parent, notFoundValue);
  43203. }
  43204. catch (/** @type {?} */ e) {
  43205. var /** @type {?} */ tokenPath = e[NG_TEMP_TOKEN_PATH];
  43206. if (token[SOURCE]) {
  43207. tokenPath.unshift(token[SOURCE]);
  43208. }
  43209. e.message = formatError('\n' + e.message, tokenPath, this.source);
  43210. e[NG_TOKEN_PATH] = tokenPath;
  43211. e[NG_TEMP_TOKEN_PATH] = null;
  43212. throw e;
  43213. }
  43214. };
  43215. /**
  43216. * @return {?}
  43217. */
  43218. StaticInjector.prototype.toString = /**
  43219. * @return {?}
  43220. */
  43221. function () {
  43222. var /** @type {?} */ tokens = /** @type {?} */ ([]), /** @type {?} */ records = this._records;
  43223. records.forEach(function (v, token) { return tokens.push(stringify(token)); });
  43224. return "StaticInjector[" + tokens.join(', ') + "]";
  43225. };
  43226. return StaticInjector;
  43227. }());
  43228. /**
  43229. * @param {?} provider
  43230. * @return {?}
  43231. */
  43232. function resolveProvider(provider) {
  43233. var /** @type {?} */ deps = computeDeps(provider);
  43234. var /** @type {?} */ fn = IDENT;
  43235. var /** @type {?} */ value = EMPTY;
  43236. var /** @type {?} */ useNew = false;
  43237. var /** @type {?} */ provide = resolveForwardRef(provider.provide);
  43238. if (USE_VALUE in provider) {
  43239. // We need to use USE_VALUE in provider since provider.useValue could be defined as undefined.
  43240. value = (/** @type {?} */ (provider)).useValue;
  43241. }
  43242. else if ((/** @type {?} */ (provider)).useFactory) {
  43243. fn = (/** @type {?} */ (provider)).useFactory;
  43244. }
  43245. else if ((/** @type {?} */ (provider)).useExisting) {
  43246. // Just use IDENT
  43247. }
  43248. else if ((/** @type {?} */ (provider)).useClass) {
  43249. useNew = true;
  43250. fn = resolveForwardRef((/** @type {?} */ (provider)).useClass);
  43251. }
  43252. else if (typeof provide == 'function') {
  43253. useNew = true;
  43254. fn = provide;
  43255. }
  43256. else {
  43257. throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider);
  43258. }
  43259. return { deps: deps, fn: fn, useNew: useNew, value: value };
  43260. }
  43261. /**
  43262. * @param {?} token
  43263. * @return {?}
  43264. */
  43265. function multiProviderMixError(token) {
  43266. return staticError('Cannot mix multi providers and regular providers', token);
  43267. }
  43268. /**
  43269. * @param {?} records
  43270. * @param {?} provider
  43271. * @return {?}
  43272. */
  43273. function recursivelyProcessProviders(records, provider) {
  43274. if (provider) {
  43275. provider = resolveForwardRef(provider);
  43276. if (provider instanceof Array) {
  43277. // if we have an array recurse into the array
  43278. for (var /** @type {?} */ i = 0; i < provider.length; i++) {
  43279. recursivelyProcessProviders(records, provider[i]);
  43280. }
  43281. }
  43282. else if (typeof provider === 'function') {
  43283. // Functions were supported in ReflectiveInjector, but are not here. For safety give useful
  43284. // error messages
  43285. throw staticError('Function/Class not supported', provider);
  43286. }
  43287. else if (provider && typeof provider === 'object' && provider.provide) {
  43288. // At this point we have what looks like a provider: {provide: ?, ....}
  43289. var /** @type {?} */ token = resolveForwardRef(provider.provide);
  43290. var /** @type {?} */ resolvedProvider = resolveProvider(provider);
  43291. if (provider.multi === true) {
  43292. // This is a multi provider.
  43293. var /** @type {?} */ multiProvider = records.get(token);
  43294. if (multiProvider) {
  43295. if (multiProvider.fn !== MULTI_PROVIDER_FN) {
  43296. throw multiProviderMixError(token);
  43297. }
  43298. }
  43299. else {
  43300. // Create a placeholder factory which will look up the constituents of the multi provider.
  43301. records.set(token, multiProvider = /** @type {?} */ ({
  43302. token: provider.provide,
  43303. deps: [],
  43304. useNew: false,
  43305. fn: MULTI_PROVIDER_FN,
  43306. value: EMPTY
  43307. }));
  43308. }
  43309. // Treat the provider as the token.
  43310. token = provider;
  43311. multiProvider.deps.push({ token: token, options: 6 /* Default */ });
  43312. }
  43313. var /** @type {?} */ record = records.get(token);
  43314. if (record && record.fn == MULTI_PROVIDER_FN) {
  43315. throw multiProviderMixError(token);
  43316. }
  43317. records.set(token, resolvedProvider);
  43318. }
  43319. else {
  43320. throw staticError('Unexpected provider', provider);
  43321. }
  43322. }
  43323. }
  43324. /**
  43325. * @param {?} token
  43326. * @param {?} record
  43327. * @param {?} records
  43328. * @param {?} parent
  43329. * @param {?} notFoundValue
  43330. * @return {?}
  43331. */
  43332. function tryResolveToken(token, record, records, parent, notFoundValue) {
  43333. try {
  43334. return resolveToken(token, record, records, parent, notFoundValue);
  43335. }
  43336. catch (/** @type {?} */ e) {
  43337. // ensure that 'e' is of type Error.
  43338. if (!(e instanceof Error)) {
  43339. e = new Error(e);
  43340. }
  43341. var /** @type {?} */ path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
  43342. path.unshift(token);
  43343. if (record && record.value == CIRCULAR) {
  43344. // Reset the Circular flag.
  43345. record.value = EMPTY;
  43346. }
  43347. throw e;
  43348. }
  43349. }
  43350. /**
  43351. * @param {?} token
  43352. * @param {?} record
  43353. * @param {?} records
  43354. * @param {?} parent
  43355. * @param {?} notFoundValue
  43356. * @return {?}
  43357. */
  43358. function resolveToken(token, record, records, parent, notFoundValue) {
  43359. var /** @type {?} */ value;
  43360. if (record) {
  43361. // If we don't have a record, this implies that we don't own the provider hence don't know how
  43362. // to resolve it.
  43363. value = record.value;
  43364. if (value == CIRCULAR) {
  43365. throw Error(NO_NEW_LINE + 'Circular dependency');
  43366. }
  43367. else if (value === EMPTY) {
  43368. record.value = CIRCULAR;
  43369. var /** @type {?} */ obj = undefined;
  43370. var /** @type {?} */ useNew = record.useNew;
  43371. var /** @type {?} */ fn = record.fn;
  43372. var /** @type {?} */ depRecords = record.deps;
  43373. var /** @type {?} */ deps = EMPTY;
  43374. if (depRecords.length) {
  43375. deps = [];
  43376. for (var /** @type {?} */ i = 0; i < depRecords.length; i++) {
  43377. var /** @type {?} */ depRecord = depRecords[i];
  43378. var /** @type {?} */ options = depRecord.options;
  43379. var /** @type {?} */ childRecord = options & 2 /* CheckSelf */ ? records.get(depRecord.token) : undefined;
  43380. deps.push(tryResolveToken(
  43381. // Current Token to resolve
  43382. depRecord.token, childRecord, records,
  43383. // If we don't know how to resolve dependency and we should not check parent for it,
  43384. // than pass in Null injector.
  43385. !childRecord && !(options & 4 /* CheckParent */) ? NULL_INJECTOR : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND));
  43386. }
  43387. }
  43388. record.value = value = useNew ? new ((_a = (/** @type {?} */ (fn))).bind.apply(_a, [void 0].concat(deps)))() : fn.apply(obj, deps);
  43389. }
  43390. }
  43391. else {
  43392. value = parent.get(token, notFoundValue);
  43393. }
  43394. return value;
  43395. var _a;
  43396. }
  43397. /**
  43398. * @param {?} provider
  43399. * @return {?}
  43400. */
  43401. function computeDeps(provider) {
  43402. var /** @type {?} */ deps = EMPTY;
  43403. var /** @type {?} */ providerDeps = (/** @type {?} */ (provider)).deps;
  43404. if (providerDeps && providerDeps.length) {
  43405. deps = [];
  43406. for (var /** @type {?} */ i = 0; i < providerDeps.length; i++) {
  43407. var /** @type {?} */ options = 6;
  43408. var /** @type {?} */ token = resolveForwardRef(providerDeps[i]);
  43409. if (token instanceof Array) {
  43410. for (var /** @type {?} */ j = 0, /** @type {?} */ annotations = token; j < annotations.length; j++) {
  43411. var /** @type {?} */ annotation = annotations[j];
  43412. if (annotation instanceof Optional || annotation == Optional) {
  43413. options = options | 1 /* Optional */;
  43414. }
  43415. else if (annotation instanceof SkipSelf || annotation == SkipSelf) {
  43416. options = options & ~2 /* CheckSelf */;
  43417. }
  43418. else if (annotation instanceof Self || annotation == Self) {
  43419. options = options & ~4 /* CheckParent */;
  43420. }
  43421. else if (annotation instanceof Inject) {
  43422. token = (/** @type {?} */ (annotation)).token;
  43423. }
  43424. else {
  43425. token = resolveForwardRef(annotation);
  43426. }
  43427. }
  43428. }
  43429. deps.push({ token: token, options: options });
  43430. }
  43431. }
  43432. else if ((/** @type {?} */ (provider)).useExisting) {
  43433. var /** @type {?} */ token = resolveForwardRef((/** @type {?} */ (provider)).useExisting);
  43434. deps = [{ token: token, options: 6 /* Default */ }];
  43435. }
  43436. else if (!providerDeps && !(USE_VALUE in provider)) {
  43437. // useValue & useExisting are the only ones which are exempt from deps all others need it.
  43438. throw staticError('\'deps\' required', provider);
  43439. }
  43440. return deps;
  43441. }
  43442. /**
  43443. * @param {?} text
  43444. * @param {?} obj
  43445. * @param {?=} source
  43446. * @return {?}
  43447. */
  43448. function formatError(text, obj, source) {
  43449. if (source === void 0) { source = null; }
  43450. text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text;
  43451. var /** @type {?} */ context = stringify(obj);
  43452. if (obj instanceof Array) {
  43453. context = obj.map(stringify).join(' -> ');
  43454. }
  43455. else if (typeof obj === 'object') {
  43456. var /** @type {?} */ parts = /** @type {?} */ ([]);
  43457. for (var /** @type {?} */ key in obj) {
  43458. if (obj.hasOwnProperty(key)) {
  43459. var /** @type {?} */ value = obj[key];
  43460. parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
  43461. }
  43462. }
  43463. context = "{" + parts.join(', ') + "}";
  43464. }
  43465. return "StaticInjectorError" + (source ? '(' + source + ')' : '') + "[" + context + "]: " + text.replace(NEW_LINE, '\n ');
  43466. }
  43467. /**
  43468. * @param {?} text
  43469. * @param {?} obj
  43470. * @return {?}
  43471. */
  43472. function staticError(text, obj) {
  43473. return new Error(formatError(text, obj));
  43474. }
  43475. /**
  43476. * @template T
  43477. * @param {?} objWithPropertyToExtract
  43478. * @return {?}
  43479. */
  43480. function getClosureSafeProperty(objWithPropertyToExtract) {
  43481. for (var /** @type {?} */ key in objWithPropertyToExtract) {
  43482. if (objWithPropertyToExtract[key] === GET_PROPERTY_NAME) {
  43483. return key;
  43484. }
  43485. }
  43486. throw Error('!prop');
  43487. }
  43488. /**
  43489. * @fileoverview added by tsickle
  43490. * @suppress {checkTypes} checked by tsc
  43491. */
  43492. /**
  43493. * @license
  43494. * Copyright Google Inc. All Rights Reserved.
  43495. *
  43496. * Use of this source code is governed by an MIT-style license that can be
  43497. * found in the LICENSE file at https://angular.io/license
  43498. */
  43499. var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
  43500. var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
  43501. var ERROR_LOGGER = 'ngErrorLogger';
  43502. /**
  43503. * @param {?} error
  43504. * @return {?}
  43505. */
  43506. /**
  43507. * @param {?} error
  43508. * @return {?}
  43509. */
  43510. function getDebugContext(error) {
  43511. return (/** @type {?} */ (error))[ERROR_DEBUG_CONTEXT];
  43512. }
  43513. /**
  43514. * @param {?} error
  43515. * @return {?}
  43516. */
  43517. function getOriginalError(error) {
  43518. return (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR];
  43519. }
  43520. /**
  43521. * @param {?} error
  43522. * @return {?}
  43523. */
  43524. function getErrorLogger(error) {
  43525. return (/** @type {?} */ (error))[ERROR_LOGGER] || defaultErrorLogger;
  43526. }
  43527. /**
  43528. * @param {?} console
  43529. * @param {...?} values
  43530. * @return {?}
  43531. */
  43532. function defaultErrorLogger(console) {
  43533. var values = [];
  43534. for (var _i = 1; _i < arguments.length; _i++) {
  43535. values[_i - 1] = arguments[_i];
  43536. }
  43537. console.error.apply(console, values);
  43538. }
  43539. /**
  43540. * @fileoverview added by tsickle
  43541. * @suppress {checkTypes} checked by tsc
  43542. */
  43543. /**
  43544. * @license
  43545. * Copyright Google Inc. All Rights Reserved.
  43546. *
  43547. * Use of this source code is governed by an MIT-style license that can be
  43548. * found in the LICENSE file at https://angular.io/license
  43549. */
  43550. /**
  43551. * \@whatItDoes Provides a hook for centralized exception handling.
  43552. *
  43553. * \@description
  43554. *
  43555. * The default implementation of `ErrorHandler` prints error messages to the `console`. To
  43556. * intercept error handling, write a custom exception handler that replaces this default as
  43557. * appropriate for your app.
  43558. *
  43559. * ### Example
  43560. *
  43561. * ```
  43562. * class MyErrorHandler implements ErrorHandler {
  43563. * handleError(error) {
  43564. * // do something with the exception
  43565. * }
  43566. * }
  43567. *
  43568. * \@NgModule({
  43569. * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
  43570. * })
  43571. * class MyModule {}
  43572. * ```
  43573. *
  43574. * \@stable
  43575. */
  43576. var ErrorHandler = /** @class */ (function () {
  43577. function ErrorHandler() {
  43578. /**
  43579. * \@internal
  43580. */
  43581. this._console = console;
  43582. }
  43583. /**
  43584. * @param {?} error
  43585. * @return {?}
  43586. */
  43587. ErrorHandler.prototype.handleError = /**
  43588. * @param {?} error
  43589. * @return {?}
  43590. */
  43591. function (error) {
  43592. var /** @type {?} */ originalError = this._findOriginalError(error);
  43593. var /** @type {?} */ context = this._findContext(error);
  43594. // Note: Browser consoles show the place from where console.error was called.
  43595. // We can use this to give users additional information about the error.
  43596. var /** @type {?} */ errorLogger = getErrorLogger(error);
  43597. errorLogger(this._console, "ERROR", error);
  43598. if (originalError) {
  43599. errorLogger(this._console, "ORIGINAL ERROR", originalError);
  43600. }
  43601. if (context) {
  43602. errorLogger(this._console, 'ERROR CONTEXT', context);
  43603. }
  43604. };
  43605. /** @internal */
  43606. /**
  43607. * \@internal
  43608. * @param {?} error
  43609. * @return {?}
  43610. */
  43611. ErrorHandler.prototype._findContext = /**
  43612. * \@internal
  43613. * @param {?} error
  43614. * @return {?}
  43615. */
  43616. function (error) {
  43617. if (error) {
  43618. return getDebugContext(error) ? getDebugContext(error) :
  43619. this._findContext(getOriginalError(error));
  43620. }
  43621. return null;
  43622. };
  43623. /** @internal */
  43624. /**
  43625. * \@internal
  43626. * @param {?} error
  43627. * @return {?}
  43628. */
  43629. ErrorHandler.prototype._findOriginalError = /**
  43630. * \@internal
  43631. * @param {?} error
  43632. * @return {?}
  43633. */
  43634. function (error) {
  43635. var /** @type {?} */ e = getOriginalError(error);
  43636. while (e && getOriginalError(e)) {
  43637. e = getOriginalError(e);
  43638. }
  43639. return e;
  43640. };
  43641. return ErrorHandler;
  43642. }());
  43643. /**
  43644. * @param {?} message
  43645. * @param {?} originalError
  43646. * @return {?}
  43647. */
  43648. function wrappedError(message, originalError) {
  43649. var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
  43650. var /** @type {?} */ error = Error(msg);
  43651. (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError;
  43652. return error;
  43653. }
  43654. /**
  43655. * @fileoverview added by tsickle
  43656. * @suppress {checkTypes} checked by tsc
  43657. */
  43658. /**
  43659. * @license
  43660. * Copyright Google Inc. All Rights Reserved.
  43661. *
  43662. * Use of this source code is governed by an MIT-style license that can be
  43663. * found in the LICENSE file at https://angular.io/license
  43664. */
  43665. /**
  43666. * @param {?} keys
  43667. * @return {?}
  43668. */
  43669. function findFirstClosedCycle(keys) {
  43670. var /** @type {?} */ res = [];
  43671. for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
  43672. if (res.indexOf(keys[i]) > -1) {
  43673. res.push(keys[i]);
  43674. return res;
  43675. }
  43676. res.push(keys[i]);
  43677. }
  43678. return res;
  43679. }
  43680. /**
  43681. * @param {?} keys
  43682. * @return {?}
  43683. */
  43684. function constructResolvingPath(keys) {
  43685. if (keys.length > 1) {
  43686. var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse());
  43687. var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); });
  43688. return ' (' + tokenStrs.join(' -> ') + ')';
  43689. }
  43690. return '';
  43691. }
  43692. /**
  43693. * @record
  43694. */
  43695. /**
  43696. * @param {?} injector
  43697. * @param {?} key
  43698. * @param {?} constructResolvingMessage
  43699. * @param {?=} originalError
  43700. * @return {?}
  43701. */
  43702. function injectionError(injector, key, constructResolvingMessage, originalError) {
  43703. var /** @type {?} */ keys = [key];
  43704. var /** @type {?} */ errMsg = constructResolvingMessage(keys);
  43705. var /** @type {?} */ error = /** @type {?} */ ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg)));
  43706. error.addKey = addKey;
  43707. error.keys = keys;
  43708. error.injectors = [injector];
  43709. error.constructResolvingMessage = constructResolvingMessage;
  43710. (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError;
  43711. return error;
  43712. }
  43713. /**
  43714. * @this {?}
  43715. * @param {?} injector
  43716. * @param {?} key
  43717. * @return {?}
  43718. */
  43719. function addKey(injector, key) {
  43720. this.injectors.push(injector);
  43721. this.keys.push(key);
  43722. // Note: This updated message won't be reflected in the `.stack` property
  43723. this.message = this.constructResolvingMessage(this.keys);
  43724. }
  43725. /**
  43726. * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the
  43727. * {\@link Injector} does not have a {\@link Provider} for the given key.
  43728. *
  43729. * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview))
  43730. *
  43731. * ```typescript
  43732. * class A {
  43733. * constructor(b:B) {}
  43734. * }
  43735. *
  43736. * expect(() => Injector.resolveAndCreate([A])).toThrowError();
  43737. * ```
  43738. * @param {?} injector
  43739. * @param {?} key
  43740. * @return {?}
  43741. */
  43742. function noProviderError(injector, key) {
  43743. return injectionError(injector, key, function (keys) {
  43744. var /** @type {?} */ first = stringify(keys[0].token);
  43745. return "No provider for " + first + "!" + constructResolvingPath(keys);
  43746. });
  43747. }
  43748. /**
  43749. * Thrown when dependencies form a cycle.
  43750. *
  43751. * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info))
  43752. *
  43753. * ```typescript
  43754. * var injector = Injector.resolveAndCreate([
  43755. * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
  43756. * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
  43757. * ]);
  43758. *
  43759. * expect(() => injector.get("one")).toThrowError();
  43760. * ```
  43761. *
  43762. * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
  43763. * @param {?} injector
  43764. * @param {?} key
  43765. * @return {?}
  43766. */
  43767. function cyclicDependencyError(injector, key) {
  43768. return injectionError(injector, key, function (keys) {
  43769. return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
  43770. });
  43771. }
  43772. /**
  43773. * Thrown when a constructing type returns with an Error.
  43774. *
  43775. * The `InstantiationError` class contains the original error plus the dependency graph which caused
  43776. * this object to be instantiated.
  43777. *
  43778. * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview))
  43779. *
  43780. * ```typescript
  43781. * class A {
  43782. * constructor() {
  43783. * throw new Error('message');
  43784. * }
  43785. * }
  43786. *
  43787. * var injector = Injector.resolveAndCreate([A]);
  43788. * try {
  43789. * injector.get(A);
  43790. * } catch (e) {
  43791. * expect(e instanceof InstantiationError).toBe(true);
  43792. * expect(e.originalException.message).toEqual("message");
  43793. * expect(e.originalStack).toBeDefined();
  43794. * }
  43795. * ```
  43796. * @param {?} injector
  43797. * @param {?} originalException
  43798. * @param {?} originalStack
  43799. * @param {?} key
  43800. * @return {?}
  43801. */
  43802. function instantiationError(injector, originalException, originalStack, key) {
  43803. return injectionError(injector, key, function (keys) {
  43804. var /** @type {?} */ first = stringify(keys[0].token);
  43805. return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
  43806. }, originalException);
  43807. }
  43808. /**
  43809. * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector}
  43810. * creation.
  43811. *
  43812. * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview))
  43813. *
  43814. * ```typescript
  43815. * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
  43816. * ```
  43817. * @param {?} provider
  43818. * @return {?}
  43819. */
  43820. function invalidProviderError(provider) {
  43821. return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
  43822. }
  43823. /**
  43824. * Thrown when the class has no annotation information.
  43825. *
  43826. * Lack of annotation information prevents the {\@link Injector} from determining which dependencies
  43827. * need to be injected into the constructor.
  43828. *
  43829. * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview))
  43830. *
  43831. * ```typescript
  43832. * class A {
  43833. * constructor(b) {}
  43834. * }
  43835. *
  43836. * expect(() => Injector.resolveAndCreate([A])).toThrowError();
  43837. * ```
  43838. *
  43839. * This error is also thrown when the class not marked with {\@link Injectable} has parameter types.
  43840. *
  43841. * ```typescript
  43842. * class B {}
  43843. *
  43844. * class A {
  43845. * constructor(b:B) {} // no information about the parameter types of A is available at runtime.
  43846. * }
  43847. *
  43848. * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
  43849. * ```
  43850. * \@stable
  43851. * @param {?} typeOrFunc
  43852. * @param {?} params
  43853. * @return {?}
  43854. */
  43855. function noAnnotationError(typeOrFunc, params) {
  43856. var /** @type {?} */ signature = [];
  43857. for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) {
  43858. var /** @type {?} */ parameter = params[i];
  43859. if (!parameter || parameter.length == 0) {
  43860. signature.push('?');
  43861. }
  43862. else {
  43863. signature.push(parameter.map(stringify).join(' '));
  43864. }
  43865. }
  43866. return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
  43867. signature.join(', ') + '). ' +
  43868. 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
  43869. stringify(typeOrFunc) + '\' is decorated with Injectable.');
  43870. }
  43871. /**
  43872. * Thrown when getting an object by index.
  43873. *
  43874. * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview))
  43875. *
  43876. * ```typescript
  43877. * class A {}
  43878. *
  43879. * var injector = Injector.resolveAndCreate([A]);
  43880. *
  43881. * expect(() => injector.getAt(100)).toThrowError();
  43882. * ```
  43883. * \@stable
  43884. * @param {?} index
  43885. * @return {?}
  43886. */
  43887. function outOfBoundsError(index) {
  43888. return Error("Index " + index + " is out-of-bounds.");
  43889. }
  43890. /**
  43891. * Thrown when a multi provider and a regular provider are bound to the same token.
  43892. *
  43893. * ### Example
  43894. *
  43895. * ```typescript
  43896. * expect(() => Injector.resolveAndCreate([
  43897. * { provide: "Strings", useValue: "string1", multi: true},
  43898. * { provide: "Strings", useValue: "string2", multi: false}
  43899. * ])).toThrowError();
  43900. * ```
  43901. * @param {?} provider1
  43902. * @param {?} provider2
  43903. * @return {?}
  43904. */
  43905. function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
  43906. return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
  43907. }
  43908. /**
  43909. * @fileoverview added by tsickle
  43910. * @suppress {checkTypes} checked by tsc
  43911. */
  43912. /**
  43913. * @license
  43914. * Copyright Google Inc. All Rights Reserved.
  43915. *
  43916. * Use of this source code is governed by an MIT-style license that can be
  43917. * found in the LICENSE file at https://angular.io/license
  43918. */
  43919. /**
  43920. * A unique object used for retrieving items from the {\@link ReflectiveInjector}.
  43921. *
  43922. * Keys have:
  43923. * - a system-wide unique `id`.
  43924. * - a `token`.
  43925. *
  43926. * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows
  43927. * the
  43928. * injector to store created objects in a more efficient way.
  43929. *
  43930. * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when
  43931. * resolving
  43932. * providers.
  43933. * @deprecated No replacement
  43934. */
  43935. var ReflectiveKey = /** @class */ (function () {
  43936. /**
  43937. * Private
  43938. */
  43939. function ReflectiveKey(token, id) {
  43940. this.token = token;
  43941. this.id = id;
  43942. if (!token) {
  43943. throw new Error('Token must be defined!');
  43944. }
  43945. this.displayName = stringify(this.token);
  43946. }
  43947. /**
  43948. * Retrieves a `Key` for a token.
  43949. */
  43950. /**
  43951. * Retrieves a `Key` for a token.
  43952. * @param {?} token
  43953. * @return {?}
  43954. */
  43955. ReflectiveKey.get = /**
  43956. * Retrieves a `Key` for a token.
  43957. * @param {?} token
  43958. * @return {?}
  43959. */
  43960. function (token) {
  43961. return _globalKeyRegistry.get(resolveForwardRef(token));
  43962. };
  43963. Object.defineProperty(ReflectiveKey, "numberOfKeys", {
  43964. /**
  43965. * @returns the number of keys registered in the system.
  43966. */
  43967. get: /**
  43968. * @return {?} the number of keys registered in the system.
  43969. */
  43970. function () { return _globalKeyRegistry.numberOfKeys; },
  43971. enumerable: true,
  43972. configurable: true
  43973. });
  43974. return ReflectiveKey;
  43975. }());
  43976. var KeyRegistry = /** @class */ (function () {
  43977. function KeyRegistry() {
  43978. this._allKeys = new Map();
  43979. }
  43980. /**
  43981. * @param {?} token
  43982. * @return {?}
  43983. */
  43984. KeyRegistry.prototype.get = /**
  43985. * @param {?} token
  43986. * @return {?}
  43987. */
  43988. function (token) {
  43989. if (token instanceof ReflectiveKey)
  43990. return token;
  43991. if (this._allKeys.has(token)) {
  43992. return /** @type {?} */ ((this._allKeys.get(token)));
  43993. }
  43994. var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
  43995. this._allKeys.set(token, newKey);
  43996. return newKey;
  43997. };
  43998. Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
  43999. get: /**
  44000. * @return {?}
  44001. */
  44002. function () { return this._allKeys.size; },
  44003. enumerable: true,
  44004. configurable: true
  44005. });
  44006. return KeyRegistry;
  44007. }());
  44008. var _globalKeyRegistry = new KeyRegistry();
  44009. /**
  44010. * @fileoverview added by tsickle
  44011. * @suppress {checkTypes} checked by tsc
  44012. */
  44013. /**
  44014. * @license
  44015. * Copyright Google Inc. All Rights Reserved.
  44016. *
  44017. * Use of this source code is governed by an MIT-style license that can be
  44018. * found in the LICENSE file at https://angular.io/license
  44019. */
  44020. /**
  44021. * \@whatItDoes Represents a type that a Component or other object is instances of.
  44022. *
  44023. * \@description
  44024. *
  44025. * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
  44026. * the `MyCustomComponent` constructor function.
  44027. *
  44028. * \@stable
  44029. */
  44030. var Type = Function;
  44031. /**
  44032. * @param {?} v
  44033. * @return {?}
  44034. */
  44035. function isType(v) {
  44036. return typeof v === 'function';
  44037. }
  44038. /**
  44039. * @fileoverview added by tsickle
  44040. * @suppress {checkTypes} checked by tsc
  44041. */
  44042. /**
  44043. * @license
  44044. * Copyright Google Inc. All Rights Reserved.
  44045. *
  44046. * Use of this source code is governed by an MIT-style license that can be
  44047. * found in the LICENSE file at https://angular.io/license
  44048. */
  44049. /**
  44050. * Attention: These regex has to hold even if the code is minified!
  44051. */
  44052. var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
  44053. var INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{/;
  44054. var INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{[\s\S]*constructor\s*\(/;
  44055. var ReflectionCapabilities = /** @class */ (function () {
  44056. function ReflectionCapabilities(reflect) {
  44057. this._reflect = reflect || _global['Reflect'];
  44058. }
  44059. /**
  44060. * @return {?}
  44061. */
  44062. ReflectionCapabilities.prototype.isReflectionEnabled = /**
  44063. * @return {?}
  44064. */
  44065. function () { return true; };
  44066. /**
  44067. * @template T
  44068. * @param {?} t
  44069. * @return {?}
  44070. */
  44071. ReflectionCapabilities.prototype.factory = /**
  44072. * @template T
  44073. * @param {?} t
  44074. * @return {?}
  44075. */
  44076. function (t) { return function () {
  44077. var args = [];
  44078. for (var _i = 0; _i < arguments.length; _i++) {
  44079. args[_i] = arguments[_i];
  44080. }
  44081. return new (t.bind.apply(t, [void 0].concat(args)))();
  44082. }; };
  44083. /** @internal */
  44084. /**
  44085. * \@internal
  44086. * @param {?} paramTypes
  44087. * @param {?} paramAnnotations
  44088. * @return {?}
  44089. */
  44090. ReflectionCapabilities.prototype._zipTypesAndAnnotations = /**
  44091. * \@internal
  44092. * @param {?} paramTypes
  44093. * @param {?} paramAnnotations
  44094. * @return {?}
  44095. */
  44096. function (paramTypes, paramAnnotations) {
  44097. var /** @type {?} */ result;
  44098. if (typeof paramTypes === 'undefined') {
  44099. result = new Array(paramAnnotations.length);
  44100. }
  44101. else {
  44102. result = new Array(paramTypes.length);
  44103. }
  44104. for (var /** @type {?} */ i = 0; i < result.length; i++) {
  44105. // TS outputs Object for parameters without types, while Traceur omits
  44106. // the annotations. For now we preserve the Traceur behavior to aid
  44107. // migration, but this can be revisited.
  44108. if (typeof paramTypes === 'undefined') {
  44109. result[i] = [];
  44110. }
  44111. else if (paramTypes[i] != Object) {
  44112. result[i] = [paramTypes[i]];
  44113. }
  44114. else {
  44115. result[i] = [];
  44116. }
  44117. if (paramAnnotations && paramAnnotations[i] != null) {
  44118. result[i] = result[i].concat(paramAnnotations[i]);
  44119. }
  44120. }
  44121. return result;
  44122. };
  44123. /**
  44124. * @param {?} type
  44125. * @param {?} parentCtor
  44126. * @return {?}
  44127. */
  44128. ReflectionCapabilities.prototype._ownParameters = /**
  44129. * @param {?} type
  44130. * @param {?} parentCtor
  44131. * @return {?}
  44132. */
  44133. function (type, parentCtor) {
  44134. var /** @type {?} */ typeStr = type.toString();
  44135. // If we have no decorators, we only have function.length as metadata.
  44136. // In that case, to detect whether a child class declared an own constructor or not,
  44137. // we need to look inside of that constructor to check whether it is
  44138. // just calling the parent.
  44139. // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
  44140. // that sets 'design:paramtypes' to []
  44141. // if a class inherits from another class but has no ctor declared itself.
  44142. if (DELEGATE_CTOR.exec(typeStr) ||
  44143. (INHERITED_CLASS.exec(typeStr) && !INHERITED_CLASS_WITH_CTOR.exec(typeStr))) {
  44144. return null;
  44145. }
  44146. // Prefer the direct API.
  44147. if ((/** @type {?} */ (type)).parameters && (/** @type {?} */ (type)).parameters !== parentCtor.parameters) {
  44148. return (/** @type {?} */ (type)).parameters;
  44149. }
  44150. // API of tsickle for lowering decorators to properties on the class.
  44151. var /** @type {?} */ tsickleCtorParams = (/** @type {?} */ (type)).ctorParameters;
  44152. if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
  44153. // Newer tsickle uses a function closure
  44154. // Retain the non-function case for compatibility with older tsickle
  44155. var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
  44156. var /** @type {?} */ paramTypes_1 = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
  44157. var /** @type {?} */ paramAnnotations_1 = ctorParameters.map(function (ctorParam) {
  44158. return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
  44159. });
  44160. return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
  44161. }
  44162. // API for metadata created by invoking the decorators.
  44163. var /** @type {?} */ paramAnnotations = type.hasOwnProperty(PARAMETERS) && (/** @type {?} */ (type))[PARAMETERS];
  44164. var /** @type {?} */ paramTypes = this._reflect && this._reflect.getOwnMetadata &&
  44165. this._reflect.getOwnMetadata('design:paramtypes', type);
  44166. if (paramTypes || paramAnnotations) {
  44167. return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
  44168. }
  44169. // If a class has no decorators, at least create metadata
  44170. // based on function.length.
  44171. // Note: We know that this is a real constructor as we checked
  44172. // the content of the constructor above.
  44173. return new Array((/** @type {?} */ (type.length))).fill(undefined);
  44174. };
  44175. /**
  44176. * @param {?} type
  44177. * @return {?}
  44178. */
  44179. ReflectionCapabilities.prototype.parameters = /**
  44180. * @param {?} type
  44181. * @return {?}
  44182. */
  44183. function (type) {
  44184. // Note: only report metadata if we have at least one class decorator
  44185. // to stay in sync with the static reflector.
  44186. if (!isType(type)) {
  44187. return [];
  44188. }
  44189. var /** @type {?} */ parentCtor = getParentCtor(type);
  44190. var /** @type {?} */ parameters = this._ownParameters(type, parentCtor);
  44191. if (!parameters && parentCtor !== Object) {
  44192. parameters = this.parameters(parentCtor);
  44193. }
  44194. return parameters || [];
  44195. };
  44196. /**
  44197. * @param {?} typeOrFunc
  44198. * @param {?} parentCtor
  44199. * @return {?}
  44200. */
  44201. ReflectionCapabilities.prototype._ownAnnotations = /**
  44202. * @param {?} typeOrFunc
  44203. * @param {?} parentCtor
  44204. * @return {?}
  44205. */
  44206. function (typeOrFunc, parentCtor) {
  44207. // Prefer the direct API.
  44208. if ((/** @type {?} */ (typeOrFunc)).annotations && (/** @type {?} */ (typeOrFunc)).annotations !== parentCtor.annotations) {
  44209. var /** @type {?} */ annotations = (/** @type {?} */ (typeOrFunc)).annotations;
  44210. if (typeof annotations === 'function' && annotations.annotations) {
  44211. annotations = annotations.annotations;
  44212. }
  44213. return annotations;
  44214. }
  44215. // API of tsickle for lowering decorators to properties on the class.
  44216. if ((/** @type {?} */ (typeOrFunc)).decorators && (/** @type {?} */ (typeOrFunc)).decorators !== parentCtor.decorators) {
  44217. return convertTsickleDecoratorIntoMetadata((/** @type {?} */ (typeOrFunc)).decorators);
  44218. }
  44219. // API for metadata created by invoking the decorators.
  44220. if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
  44221. return (/** @type {?} */ (typeOrFunc))[ANNOTATIONS];
  44222. }
  44223. return null;
  44224. };
  44225. /**
  44226. * @param {?} typeOrFunc
  44227. * @return {?}
  44228. */
  44229. ReflectionCapabilities.prototype.annotations = /**
  44230. * @param {?} typeOrFunc
  44231. * @return {?}
  44232. */
  44233. function (typeOrFunc) {
  44234. if (!isType(typeOrFunc)) {
  44235. return [];
  44236. }
  44237. var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
  44238. var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
  44239. var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
  44240. return parentAnnotations.concat(ownAnnotations);
  44241. };
  44242. /**
  44243. * @param {?} typeOrFunc
  44244. * @param {?} parentCtor
  44245. * @return {?}
  44246. */
  44247. ReflectionCapabilities.prototype._ownPropMetadata = /**
  44248. * @param {?} typeOrFunc
  44249. * @param {?} parentCtor
  44250. * @return {?}
  44251. */
  44252. function (typeOrFunc, parentCtor) {
  44253. // Prefer the direct API.
  44254. if ((/** @type {?} */ (typeOrFunc)).propMetadata &&
  44255. (/** @type {?} */ (typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
  44256. var /** @type {?} */ propMetadata = (/** @type {?} */ (typeOrFunc)).propMetadata;
  44257. if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
  44258. propMetadata = propMetadata.propMetadata;
  44259. }
  44260. return propMetadata;
  44261. }
  44262. // API of tsickle for lowering decorators to properties on the class.
  44263. if ((/** @type {?} */ (typeOrFunc)).propDecorators &&
  44264. (/** @type {?} */ (typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
  44265. var /** @type {?} */ propDecorators_1 = (/** @type {?} */ (typeOrFunc)).propDecorators;
  44266. var /** @type {?} */ propMetadata_1 = /** @type {?} */ ({});
  44267. Object.keys(propDecorators_1).forEach(function (prop) {
  44268. propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
  44269. });
  44270. return propMetadata_1;
  44271. }
  44272. // API for metadata created by invoking the decorators.
  44273. if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
  44274. return (/** @type {?} */ (typeOrFunc))[PROP_METADATA];
  44275. }
  44276. return null;
  44277. };
  44278. /**
  44279. * @param {?} typeOrFunc
  44280. * @return {?}
  44281. */
  44282. ReflectionCapabilities.prototype.propMetadata = /**
  44283. * @param {?} typeOrFunc
  44284. * @return {?}
  44285. */
  44286. function (typeOrFunc) {
  44287. if (!isType(typeOrFunc)) {
  44288. return {};
  44289. }
  44290. var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
  44291. var /** @type {?} */ propMetadata = {};
  44292. if (parentCtor !== Object) {
  44293. var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor);
  44294. Object.keys(parentPropMetadata_1).forEach(function (propName) {
  44295. propMetadata[propName] = parentPropMetadata_1[propName];
  44296. });
  44297. }
  44298. var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
  44299. if (ownPropMetadata) {
  44300. Object.keys(ownPropMetadata).forEach(function (propName) {
  44301. var /** @type {?} */ decorators = [];
  44302. if (propMetadata.hasOwnProperty(propName)) {
  44303. decorators.push.apply(decorators, propMetadata[propName]);
  44304. }
  44305. decorators.push.apply(decorators, ownPropMetadata[propName]);
  44306. propMetadata[propName] = decorators;
  44307. });
  44308. }
  44309. return propMetadata;
  44310. };
  44311. /**
  44312. * @param {?} type
  44313. * @param {?} lcProperty
  44314. * @return {?}
  44315. */
  44316. ReflectionCapabilities.prototype.hasLifecycleHook = /**
  44317. * @param {?} type
  44318. * @param {?} lcProperty
  44319. * @return {?}
  44320. */
  44321. function (type, lcProperty) {
  44322. return type instanceof Type && lcProperty in type.prototype;
  44323. };
  44324. /**
  44325. * @param {?} type
  44326. * @return {?}
  44327. */
  44328. ReflectionCapabilities.prototype.guards = /**
  44329. * @param {?} type
  44330. * @return {?}
  44331. */
  44332. function (type) { return {}; };
  44333. /**
  44334. * @param {?} name
  44335. * @return {?}
  44336. */
  44337. ReflectionCapabilities.prototype.getter = /**
  44338. * @param {?} name
  44339. * @return {?}
  44340. */
  44341. function (name) { return /** @type {?} */ (new Function('o', 'return o.' + name + ';')); };
  44342. /**
  44343. * @param {?} name
  44344. * @return {?}
  44345. */
  44346. ReflectionCapabilities.prototype.setter = /**
  44347. * @param {?} name
  44348. * @return {?}
  44349. */
  44350. function (name) {
  44351. return /** @type {?} */ (new Function('o', 'v', 'return o.' + name + ' = v;'));
  44352. };
  44353. /**
  44354. * @param {?} name
  44355. * @return {?}
  44356. */
  44357. ReflectionCapabilities.prototype.method = /**
  44358. * @param {?} name
  44359. * @return {?}
  44360. */
  44361. function (name) {
  44362. var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
  44363. return /** @type {?} */ (new Function('o', 'args', functionBody));
  44364. };
  44365. // There is not a concept of import uri in Js, but this is useful in developing Dart applications.
  44366. /**
  44367. * @param {?} type
  44368. * @return {?}
  44369. */
  44370. ReflectionCapabilities.prototype.importUri = /**
  44371. * @param {?} type
  44372. * @return {?}
  44373. */
  44374. function (type) {
  44375. // StaticSymbol
  44376. if (typeof type === 'object' && type['filePath']) {
  44377. return type['filePath'];
  44378. }
  44379. // Runtime type
  44380. return "./" + stringify(type);
  44381. };
  44382. /**
  44383. * @param {?} type
  44384. * @return {?}
  44385. */
  44386. ReflectionCapabilities.prototype.resourceUri = /**
  44387. * @param {?} type
  44388. * @return {?}
  44389. */
  44390. function (type) { return "./" + stringify(type); };
  44391. /**
  44392. * @param {?} name
  44393. * @param {?} moduleUrl
  44394. * @param {?} members
  44395. * @param {?} runtime
  44396. * @return {?}
  44397. */
  44398. ReflectionCapabilities.prototype.resolveIdentifier = /**
  44399. * @param {?} name
  44400. * @param {?} moduleUrl
  44401. * @param {?} members
  44402. * @param {?} runtime
  44403. * @return {?}
  44404. */
  44405. function (name, moduleUrl, members, runtime) {
  44406. return runtime;
  44407. };
  44408. /**
  44409. * @param {?} enumIdentifier
  44410. * @param {?} name
  44411. * @return {?}
  44412. */
  44413. ReflectionCapabilities.prototype.resolveEnum = /**
  44414. * @param {?} enumIdentifier
  44415. * @param {?} name
  44416. * @return {?}
  44417. */
  44418. function (enumIdentifier, name) { return enumIdentifier[name]; };
  44419. return ReflectionCapabilities;
  44420. }());
  44421. /**
  44422. * @param {?} decoratorInvocations
  44423. * @return {?}
  44424. */
  44425. function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
  44426. if (!decoratorInvocations) {
  44427. return [];
  44428. }
  44429. return decoratorInvocations.map(function (decoratorInvocation) {
  44430. var /** @type {?} */ decoratorType = decoratorInvocation.type;
  44431. var /** @type {?} */ annotationCls = decoratorType.annotationCls;
  44432. var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
  44433. return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
  44434. });
  44435. }
  44436. /**
  44437. * @param {?} ctor
  44438. * @return {?}
  44439. */
  44440. function getParentCtor(ctor) {
  44441. var /** @type {?} */ parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
  44442. var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null;
  44443. // Note: We always use `Object` as the null value
  44444. // to simplify checking later on.
  44445. return parentCtor || Object;
  44446. }
  44447. /**
  44448. * @fileoverview added by tsickle
  44449. * @suppress {checkTypes} checked by tsc
  44450. */
  44451. /**
  44452. * @license
  44453. * Copyright Google Inc. All Rights Reserved.
  44454. *
  44455. * Use of this source code is governed by an MIT-style license that can be
  44456. * found in the LICENSE file at https://angular.io/license
  44457. */
  44458. /**
  44459. * Provides access to reflection data about symbols. Used internally by Angular
  44460. * to power dependency injection and compilation.
  44461. */
  44462. var Reflector = /** @class */ (function () {
  44463. function Reflector(reflectionCapabilities) {
  44464. this.reflectionCapabilities = reflectionCapabilities;
  44465. }
  44466. /**
  44467. * @param {?} caps
  44468. * @return {?}
  44469. */
  44470. Reflector.prototype.updateCapabilities = /**
  44471. * @param {?} caps
  44472. * @return {?}
  44473. */
  44474. function (caps) { this.reflectionCapabilities = caps; };
  44475. /**
  44476. * @param {?} type
  44477. * @return {?}
  44478. */
  44479. Reflector.prototype.factory = /**
  44480. * @param {?} type
  44481. * @return {?}
  44482. */
  44483. function (type) { return this.reflectionCapabilities.factory(type); };
  44484. /**
  44485. * @param {?} typeOrFunc
  44486. * @return {?}
  44487. */
  44488. Reflector.prototype.parameters = /**
  44489. * @param {?} typeOrFunc
  44490. * @return {?}
  44491. */
  44492. function (typeOrFunc) {
  44493. return this.reflectionCapabilities.parameters(typeOrFunc);
  44494. };
  44495. /**
  44496. * @param {?} typeOrFunc
  44497. * @return {?}
  44498. */
  44499. Reflector.prototype.annotations = /**
  44500. * @param {?} typeOrFunc
  44501. * @return {?}
  44502. */
  44503. function (typeOrFunc) {
  44504. return this.reflectionCapabilities.annotations(typeOrFunc);
  44505. };
  44506. /**
  44507. * @param {?} typeOrFunc
  44508. * @return {?}
  44509. */
  44510. Reflector.prototype.propMetadata = /**
  44511. * @param {?} typeOrFunc
  44512. * @return {?}
  44513. */
  44514. function (typeOrFunc) {
  44515. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  44516. };
  44517. /**
  44518. * @param {?} type
  44519. * @param {?} lcProperty
  44520. * @return {?}
  44521. */
  44522. Reflector.prototype.hasLifecycleHook = /**
  44523. * @param {?} type
  44524. * @param {?} lcProperty
  44525. * @return {?}
  44526. */
  44527. function (type, lcProperty) {
  44528. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  44529. };
  44530. /**
  44531. * @param {?} name
  44532. * @return {?}
  44533. */
  44534. Reflector.prototype.getter = /**
  44535. * @param {?} name
  44536. * @return {?}
  44537. */
  44538. function (name) { return this.reflectionCapabilities.getter(name); };
  44539. /**
  44540. * @param {?} name
  44541. * @return {?}
  44542. */
  44543. Reflector.prototype.setter = /**
  44544. * @param {?} name
  44545. * @return {?}
  44546. */
  44547. function (name) { return this.reflectionCapabilities.setter(name); };
  44548. /**
  44549. * @param {?} name
  44550. * @return {?}
  44551. */
  44552. Reflector.prototype.method = /**
  44553. * @param {?} name
  44554. * @return {?}
  44555. */
  44556. function (name) { return this.reflectionCapabilities.method(name); };
  44557. /**
  44558. * @param {?} type
  44559. * @return {?}
  44560. */
  44561. Reflector.prototype.importUri = /**
  44562. * @param {?} type
  44563. * @return {?}
  44564. */
  44565. function (type) { return this.reflectionCapabilities.importUri(type); };
  44566. /**
  44567. * @param {?} type
  44568. * @return {?}
  44569. */
  44570. Reflector.prototype.resourceUri = /**
  44571. * @param {?} type
  44572. * @return {?}
  44573. */
  44574. function (type) { return this.reflectionCapabilities.resourceUri(type); };
  44575. /**
  44576. * @param {?} name
  44577. * @param {?} moduleUrl
  44578. * @param {?} members
  44579. * @param {?} runtime
  44580. * @return {?}
  44581. */
  44582. Reflector.prototype.resolveIdentifier = /**
  44583. * @param {?} name
  44584. * @param {?} moduleUrl
  44585. * @param {?} members
  44586. * @param {?} runtime
  44587. * @return {?}
  44588. */
  44589. function (name, moduleUrl, members, runtime) {
  44590. return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
  44591. };
  44592. /**
  44593. * @param {?} identifier
  44594. * @param {?} name
  44595. * @return {?}
  44596. */
  44597. Reflector.prototype.resolveEnum = /**
  44598. * @param {?} identifier
  44599. * @param {?} name
  44600. * @return {?}
  44601. */
  44602. function (identifier, name) {
  44603. return this.reflectionCapabilities.resolveEnum(identifier, name);
  44604. };
  44605. return Reflector;
  44606. }());
  44607. /**
  44608. * @fileoverview added by tsickle
  44609. * @suppress {checkTypes} checked by tsc
  44610. */
  44611. /**
  44612. * @license
  44613. * Copyright Google Inc. All Rights Reserved.
  44614. *
  44615. * Use of this source code is governed by an MIT-style license that can be
  44616. * found in the LICENSE file at https://angular.io/license
  44617. */
  44618. /**
  44619. * The {\@link Reflector} used internally in Angular to access metadata
  44620. * about symbols.
  44621. */
  44622. var reflector = new Reflector(new ReflectionCapabilities());
  44623. /**
  44624. * @fileoverview added by tsickle
  44625. * @suppress {checkTypes} checked by tsc
  44626. */
  44627. /**
  44628. * @license
  44629. * Copyright Google Inc. All Rights Reserved.
  44630. *
  44631. * Use of this source code is governed by an MIT-style license that can be
  44632. * found in the LICENSE file at https://angular.io/license
  44633. */
  44634. /**
  44635. * `Dependency` is used by the framework to extend DI.
  44636. * This is internal to Angular and should not be used directly.
  44637. */
  44638. var ReflectiveDependency = /** @class */ (function () {
  44639. function ReflectiveDependency(key, optional, visibility) {
  44640. this.key = key;
  44641. this.optional = optional;
  44642. this.visibility = visibility;
  44643. }
  44644. /**
  44645. * @param {?} key
  44646. * @return {?}
  44647. */
  44648. ReflectiveDependency.fromKey = /**
  44649. * @param {?} key
  44650. * @return {?}
  44651. */
  44652. function (key) {
  44653. return new ReflectiveDependency(key, false, null);
  44654. };
  44655. return ReflectiveDependency;
  44656. }());
  44657. var _EMPTY_LIST = [];
  44658. /**
  44659. * An internal resolved representation of a {\@link Provider} used by the {\@link Injector}.
  44660. *
  44661. * It is usually created automatically by `Injector.resolveAndCreate`.
  44662. *
  44663. * It can be created manually, as follows:
  44664. *
  44665. * ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview))
  44666. *
  44667. * ```typescript
  44668. * var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]);
  44669. * var injector = Injector.fromResolvedProviders(resolvedProviders);
  44670. *
  44671. * expect(injector.get('message')).toEqual('Hello');
  44672. * ```
  44673. *
  44674. * \@experimental
  44675. * @record
  44676. */
  44677. var ResolvedReflectiveProvider_ = /** @class */ (function () {
  44678. function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
  44679. this.key = key;
  44680. this.resolvedFactories = resolvedFactories;
  44681. this.multiProvider = multiProvider;
  44682. this.resolvedFactory = this.resolvedFactories[0];
  44683. }
  44684. return ResolvedReflectiveProvider_;
  44685. }());
  44686. /**
  44687. * An internal resolved representation of a factory function created by resolving {\@link
  44688. * Provider}.
  44689. * \@experimental
  44690. */
  44691. var ResolvedReflectiveFactory = /** @class */ (function () {
  44692. function ResolvedReflectiveFactory(factory, dependencies) {
  44693. this.factory = factory;
  44694. this.dependencies = dependencies;
  44695. }
  44696. return ResolvedReflectiveFactory;
  44697. }());
  44698. /**
  44699. * Resolve a single provider.
  44700. * @param {?} provider
  44701. * @return {?}
  44702. */
  44703. function resolveReflectiveFactory(provider) {
  44704. var /** @type {?} */ factoryFn;
  44705. var /** @type {?} */ resolvedDeps;
  44706. if (provider.useClass) {
  44707. var /** @type {?} */ useClass = resolveForwardRef(provider.useClass);
  44708. factoryFn = reflector.factory(useClass);
  44709. resolvedDeps = _dependenciesFor(useClass);
  44710. }
  44711. else if (provider.useExisting) {
  44712. factoryFn = function (aliasInstance) { return aliasInstance; };
  44713. resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
  44714. }
  44715. else if (provider.useFactory) {
  44716. factoryFn = provider.useFactory;
  44717. resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
  44718. }
  44719. else {
  44720. factoryFn = function () { return provider.useValue; };
  44721. resolvedDeps = _EMPTY_LIST;
  44722. }
  44723. return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
  44724. }
  44725. /**
  44726. * Converts the {\@link Provider} into {\@link ResolvedProvider}.
  44727. *
  44728. * {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains
  44729. * convenience provider syntax.
  44730. * @param {?} provider
  44731. * @return {?}
  44732. */
  44733. function resolveReflectiveProvider(provider) {
  44734. return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
  44735. }
  44736. /**
  44737. * Resolve a list of Providers.
  44738. * @param {?} providers
  44739. * @return {?}
  44740. */
  44741. function resolveReflectiveProviders(providers) {
  44742. var /** @type {?} */ normalized = _normalizeProviders(providers, []);
  44743. var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider);
  44744. var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
  44745. return Array.from(resolvedProviderMap.values());
  44746. }
  44747. /**
  44748. * Merges a list of ResolvedProviders into a list where
  44749. * each key is contained exactly once and multi providers
  44750. * have been merged.
  44751. * @param {?} providers
  44752. * @param {?} normalizedProvidersMap
  44753. * @return {?}
  44754. */
  44755. function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
  44756. for (var /** @type {?} */ i = 0; i < providers.length; i++) {
  44757. var /** @type {?} */ provider = providers[i];
  44758. var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
  44759. if (existing) {
  44760. if (provider.multiProvider !== existing.multiProvider) {
  44761. throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
  44762. }
  44763. if (provider.multiProvider) {
  44764. for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
  44765. existing.resolvedFactories.push(provider.resolvedFactories[j]);
  44766. }
  44767. }
  44768. else {
  44769. normalizedProvidersMap.set(provider.key.id, provider);
  44770. }
  44771. }
  44772. else {
  44773. var /** @type {?} */ resolvedProvider = void 0;
  44774. if (provider.multiProvider) {
  44775. resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
  44776. }
  44777. else {
  44778. resolvedProvider = provider;
  44779. }
  44780. normalizedProvidersMap.set(provider.key.id, resolvedProvider);
  44781. }
  44782. }
  44783. return normalizedProvidersMap;
  44784. }
  44785. /**
  44786. * @param {?} providers
  44787. * @param {?} res
  44788. * @return {?}
  44789. */
  44790. function _normalizeProviders(providers, res) {
  44791. providers.forEach(function (b) {
  44792. if (b instanceof Type) {
  44793. res.push({ provide: b, useClass: b });
  44794. }
  44795. else if (b && typeof b == 'object' && (/** @type {?} */ (b)).provide !== undefined) {
  44796. res.push(/** @type {?} */ (b));
  44797. }
  44798. else if (b instanceof Array) {
  44799. _normalizeProviders(b, res);
  44800. }
  44801. else {
  44802. throw invalidProviderError(b);
  44803. }
  44804. });
  44805. return res;
  44806. }
  44807. /**
  44808. * @param {?} typeOrFunc
  44809. * @param {?=} dependencies
  44810. * @return {?}
  44811. */
  44812. function constructDependencies(typeOrFunc, dependencies) {
  44813. if (!dependencies) {
  44814. return _dependenciesFor(typeOrFunc);
  44815. }
  44816. else {
  44817. var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; });
  44818. return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
  44819. }
  44820. }
  44821. /**
  44822. * @param {?} typeOrFunc
  44823. * @return {?}
  44824. */
  44825. function _dependenciesFor(typeOrFunc) {
  44826. var /** @type {?} */ params = reflector.parameters(typeOrFunc);
  44827. if (!params)
  44828. return [];
  44829. if (params.some(function (p) { return p == null; })) {
  44830. throw noAnnotationError(typeOrFunc, params);
  44831. }
  44832. return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
  44833. }
  44834. /**
  44835. * @param {?} typeOrFunc
  44836. * @param {?} metadata
  44837. * @param {?} params
  44838. * @return {?}
  44839. */
  44840. function _extractToken(typeOrFunc, metadata, params) {
  44841. var /** @type {?} */ token = null;
  44842. var /** @type {?} */ optional = false;
  44843. if (!Array.isArray(metadata)) {
  44844. if (metadata instanceof Inject) {
  44845. return _createDependency(metadata.token, optional, null);
  44846. }
  44847. else {
  44848. return _createDependency(metadata, optional, null);
  44849. }
  44850. }
  44851. var /** @type {?} */ visibility = null;
  44852. for (var /** @type {?} */ i = 0; i < metadata.length; ++i) {
  44853. var /** @type {?} */ paramMetadata = metadata[i];
  44854. if (paramMetadata instanceof Type) {
  44855. token = paramMetadata;
  44856. }
  44857. else if (paramMetadata instanceof Inject) {
  44858. token = paramMetadata.token;
  44859. }
  44860. else if (paramMetadata instanceof Optional) {
  44861. optional = true;
  44862. }
  44863. else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
  44864. visibility = paramMetadata;
  44865. }
  44866. else if (paramMetadata instanceof InjectionToken) {
  44867. token = paramMetadata;
  44868. }
  44869. }
  44870. token = resolveForwardRef(token);
  44871. if (token != null) {
  44872. return _createDependency(token, optional, visibility);
  44873. }
  44874. else {
  44875. throw noAnnotationError(typeOrFunc, params);
  44876. }
  44877. }
  44878. /**
  44879. * @param {?} token
  44880. * @param {?} optional
  44881. * @param {?} visibility
  44882. * @return {?}
  44883. */
  44884. function _createDependency(token, optional, visibility) {
  44885. return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
  44886. }
  44887. /**
  44888. * @fileoverview added by tsickle
  44889. * @suppress {checkTypes} checked by tsc
  44890. */
  44891. /**
  44892. * @license
  44893. * Copyright Google Inc. All Rights Reserved.
  44894. *
  44895. * Use of this source code is governed by an MIT-style license that can be
  44896. * found in the LICENSE file at https://angular.io/license
  44897. */
  44898. // Threshold for the dynamic version
  44899. var UNDEFINED = new Object();
  44900. /**
  44901. * A ReflectiveDependency injection container used for instantiating objects and resolving
  44902. * dependencies.
  44903. *
  44904. * An `Injector` is a replacement for a `new` operator, which can automatically resolve the
  44905. * constructor dependencies.
  44906. *
  44907. * In typical use, application code asks for the dependencies in the constructor and they are
  44908. * resolved by the `Injector`.
  44909. *
  44910. * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview))
  44911. *
  44912. * The following example creates an `Injector` configured to create `Engine` and `Car`.
  44913. *
  44914. * ```typescript
  44915. * \@Injectable()
  44916. * class Engine {
  44917. * }
  44918. *
  44919. * \@Injectable()
  44920. * class Car {
  44921. * constructor(public engine:Engine) {}
  44922. * }
  44923. *
  44924. * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
  44925. * var car = injector.get(Car);
  44926. * expect(car instanceof Car).toBe(true);
  44927. * expect(car.engine instanceof Engine).toBe(true);
  44928. * ```
  44929. *
  44930. * Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
  44931. * resolve all of the object's dependencies automatically.
  44932. *
  44933. * @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
  44934. * @abstract
  44935. */
  44936. var ReflectiveInjector = /** @class */ (function () {
  44937. function ReflectiveInjector() {
  44938. }
  44939. /**
  44940. * Turns an array of provider definitions into an array of resolved providers.
  44941. *
  44942. * A resolution is a process of flattening multiple nested arrays and converting individual
  44943. * providers into an array of {@link ResolvedReflectiveProvider}s.
  44944. *
  44945. * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
  44946. *
  44947. * ```typescript
  44948. * @Injectable()
  44949. * class Engine {
  44950. * }
  44951. *
  44952. * @Injectable()
  44953. * class Car {
  44954. * constructor(public engine:Engine) {}
  44955. * }
  44956. *
  44957. * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
  44958. *
  44959. * expect(providers.length).toEqual(2);
  44960. *
  44961. * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
  44962. * expect(providers[0].key.displayName).toBe("Car");
  44963. * expect(providers[0].dependencies.length).toEqual(1);
  44964. * expect(providers[0].factory).toBeDefined();
  44965. *
  44966. * expect(providers[1].key.displayName).toBe("Engine");
  44967. * });
  44968. * ```
  44969. *
  44970. * See {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
  44971. */
  44972. /**
  44973. * Turns an array of provider definitions into an array of resolved providers.
  44974. *
  44975. * A resolution is a process of flattening multiple nested arrays and converting individual
  44976. * providers into an array of {\@link ResolvedReflectiveProvider}s.
  44977. *
  44978. * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
  44979. *
  44980. * ```typescript
  44981. * \@Injectable()
  44982. * class Engine {
  44983. * }
  44984. *
  44985. * \@Injectable()
  44986. * class Car {
  44987. * constructor(public engine:Engine) {}
  44988. * }
  44989. *
  44990. * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
  44991. *
  44992. * expect(providers.length).toEqual(2);
  44993. *
  44994. * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
  44995. * expect(providers[0].key.displayName).toBe("Car");
  44996. * expect(providers[0].dependencies.length).toEqual(1);
  44997. * expect(providers[0].factory).toBeDefined();
  44998. *
  44999. * expect(providers[1].key.displayName).toBe("Engine");
  45000. * });
  45001. * ```
  45002. *
  45003. * See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
  45004. * @param {?} providers
  45005. * @return {?}
  45006. */
  45007. ReflectiveInjector.resolve = /**
  45008. * Turns an array of provider definitions into an array of resolved providers.
  45009. *
  45010. * A resolution is a process of flattening multiple nested arrays and converting individual
  45011. * providers into an array of {\@link ResolvedReflectiveProvider}s.
  45012. *
  45013. * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
  45014. *
  45015. * ```typescript
  45016. * \@Injectable()
  45017. * class Engine {
  45018. * }
  45019. *
  45020. * \@Injectable()
  45021. * class Car {
  45022. * constructor(public engine:Engine) {}
  45023. * }
  45024. *
  45025. * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
  45026. *
  45027. * expect(providers.length).toEqual(2);
  45028. *
  45029. * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
  45030. * expect(providers[0].key.displayName).toBe("Car");
  45031. * expect(providers[0].dependencies.length).toEqual(1);
  45032. * expect(providers[0].factory).toBeDefined();
  45033. *
  45034. * expect(providers[1].key.displayName).toBe("Engine");
  45035. * });
  45036. * ```
  45037. *
  45038. * See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
  45039. * @param {?} providers
  45040. * @return {?}
  45041. */
  45042. function (providers) {
  45043. return resolveReflectiveProviders(providers);
  45044. };
  45045. /**
  45046. * Resolves an array of providers and creates an injector from those providers.
  45047. *
  45048. * The passed-in providers can be an array of `Type`, {@link Provider},
  45049. * or a recursive array of more providers.
  45050. *
  45051. * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
  45052. *
  45053. * ```typescript
  45054. * @Injectable()
  45055. * class Engine {
  45056. * }
  45057. *
  45058. * @Injectable()
  45059. * class Car {
  45060. * constructor(public engine:Engine) {}
  45061. * }
  45062. *
  45063. * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
  45064. * expect(injector.get(Car) instanceof Car).toBe(true);
  45065. * ```
  45066. *
  45067. * This function is slower than the corresponding `fromResolvedProviders`
  45068. * because it needs to resolve the passed-in providers first.
  45069. * See {@link ReflectiveInjector#resolve resolve} and
  45070. * {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
  45071. */
  45072. /**
  45073. * Resolves an array of providers and creates an injector from those providers.
  45074. *
  45075. * The passed-in providers can be an array of `Type`, {\@link Provider},
  45076. * or a recursive array of more providers.
  45077. *
  45078. * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
  45079. *
  45080. * ```typescript
  45081. * \@Injectable()
  45082. * class Engine {
  45083. * }
  45084. *
  45085. * \@Injectable()
  45086. * class Car {
  45087. * constructor(public engine:Engine) {}
  45088. * }
  45089. *
  45090. * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
  45091. * expect(injector.get(Car) instanceof Car).toBe(true);
  45092. * ```
  45093. *
  45094. * This function is slower than the corresponding `fromResolvedProviders`
  45095. * because it needs to resolve the passed-in providers first.
  45096. * See {\@link ReflectiveInjector#resolve resolve} and
  45097. * {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
  45098. * @param {?} providers
  45099. * @param {?=} parent
  45100. * @return {?}
  45101. */
  45102. ReflectiveInjector.resolveAndCreate = /**
  45103. * Resolves an array of providers and creates an injector from those providers.
  45104. *
  45105. * The passed-in providers can be an array of `Type`, {\@link Provider},
  45106. * or a recursive array of more providers.
  45107. *
  45108. * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
  45109. *
  45110. * ```typescript
  45111. * \@Injectable()
  45112. * class Engine {
  45113. * }
  45114. *
  45115. * \@Injectable()
  45116. * class Car {
  45117. * constructor(public engine:Engine) {}
  45118. * }
  45119. *
  45120. * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
  45121. * expect(injector.get(Car) instanceof Car).toBe(true);
  45122. * ```
  45123. *
  45124. * This function is slower than the corresponding `fromResolvedProviders`
  45125. * because it needs to resolve the passed-in providers first.
  45126. * See {\@link ReflectiveInjector#resolve resolve} and
  45127. * {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
  45128. * @param {?} providers
  45129. * @param {?=} parent
  45130. * @return {?}
  45131. */
  45132. function (providers, parent) {
  45133. var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
  45134. return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
  45135. };
  45136. /**
  45137. * Creates an injector from previously resolved providers.
  45138. *
  45139. * This API is the recommended way to construct injectors in performance-sensitive parts.
  45140. *
  45141. * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
  45142. *
  45143. * ```typescript
  45144. * @Injectable()
  45145. * class Engine {
  45146. * }
  45147. *
  45148. * @Injectable()
  45149. * class Car {
  45150. * constructor(public engine:Engine) {}
  45151. * }
  45152. *
  45153. * var providers = ReflectiveInjector.resolve([Car, Engine]);
  45154. * var injector = ReflectiveInjector.fromResolvedProviders(providers);
  45155. * expect(injector.get(Car) instanceof Car).toBe(true);
  45156. * ```
  45157. * @experimental
  45158. */
  45159. /**
  45160. * Creates an injector from previously resolved providers.
  45161. *
  45162. * This API is the recommended way to construct injectors in performance-sensitive parts.
  45163. *
  45164. * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
  45165. *
  45166. * ```typescript
  45167. * \@Injectable()
  45168. * class Engine {
  45169. * }
  45170. *
  45171. * \@Injectable()
  45172. * class Car {
  45173. * constructor(public engine:Engine) {}
  45174. * }
  45175. *
  45176. * var providers = ReflectiveInjector.resolve([Car, Engine]);
  45177. * var injector = ReflectiveInjector.fromResolvedProviders(providers);
  45178. * expect(injector.get(Car) instanceof Car).toBe(true);
  45179. * ```
  45180. * \@experimental
  45181. * @param {?} providers
  45182. * @param {?=} parent
  45183. * @return {?}
  45184. */
  45185. ReflectiveInjector.fromResolvedProviders = /**
  45186. * Creates an injector from previously resolved providers.
  45187. *
  45188. * This API is the recommended way to construct injectors in performance-sensitive parts.
  45189. *
  45190. * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
  45191. *
  45192. * ```typescript
  45193. * \@Injectable()
  45194. * class Engine {
  45195. * }
  45196. *
  45197. * \@Injectable()
  45198. * class Car {
  45199. * constructor(public engine:Engine) {}
  45200. * }
  45201. *
  45202. * var providers = ReflectiveInjector.resolve([Car, Engine]);
  45203. * var injector = ReflectiveInjector.fromResolvedProviders(providers);
  45204. * expect(injector.get(Car) instanceof Car).toBe(true);
  45205. * ```
  45206. * \@experimental
  45207. * @param {?} providers
  45208. * @param {?=} parent
  45209. * @return {?}
  45210. */
  45211. function (providers, parent) {
  45212. return new ReflectiveInjector_(providers, parent);
  45213. };
  45214. return ReflectiveInjector;
  45215. }());
  45216. var ReflectiveInjector_ = /** @class */ (function () {
  45217. /**
  45218. * Private
  45219. */
  45220. function ReflectiveInjector_(_providers, _parent) {
  45221. /**
  45222. * \@internal
  45223. */
  45224. this._constructionCounter = 0;
  45225. this._providers = _providers;
  45226. this.parent = _parent || null;
  45227. var /** @type {?} */ len = _providers.length;
  45228. this.keyIds = new Array(len);
  45229. this.objs = new Array(len);
  45230. for (var /** @type {?} */ i = 0; i < len; i++) {
  45231. this.keyIds[i] = _providers[i].key.id;
  45232. this.objs[i] = UNDEFINED;
  45233. }
  45234. }
  45235. /**
  45236. * @param {?} token
  45237. * @param {?=} notFoundValue
  45238. * @return {?}
  45239. */
  45240. ReflectiveInjector_.prototype.get = /**
  45241. * @param {?} token
  45242. * @param {?=} notFoundValue
  45243. * @return {?}
  45244. */
  45245. function (token, notFoundValue) {
  45246. if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
  45247. return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
  45248. };
  45249. /**
  45250. * @param {?} providers
  45251. * @return {?}
  45252. */
  45253. ReflectiveInjector_.prototype.resolveAndCreateChild = /**
  45254. * @param {?} providers
  45255. * @return {?}
  45256. */
  45257. function (providers) {
  45258. var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
  45259. return this.createChildFromResolved(ResolvedReflectiveProviders);
  45260. };
  45261. /**
  45262. * @param {?} providers
  45263. * @return {?}
  45264. */
  45265. ReflectiveInjector_.prototype.createChildFromResolved = /**
  45266. * @param {?} providers
  45267. * @return {?}
  45268. */
  45269. function (providers) {
  45270. var /** @type {?} */ inj = new ReflectiveInjector_(providers);
  45271. (/** @type {?} */ (inj)).parent = this;
  45272. return inj;
  45273. };
  45274. /**
  45275. * @param {?} provider
  45276. * @return {?}
  45277. */
  45278. ReflectiveInjector_.prototype.resolveAndInstantiate = /**
  45279. * @param {?} provider
  45280. * @return {?}
  45281. */
  45282. function (provider) {
  45283. return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
  45284. };
  45285. /**
  45286. * @param {?} provider
  45287. * @return {?}
  45288. */
  45289. ReflectiveInjector_.prototype.instantiateResolved = /**
  45290. * @param {?} provider
  45291. * @return {?}
  45292. */
  45293. function (provider) {
  45294. return this._instantiateProvider(provider);
  45295. };
  45296. /**
  45297. * @param {?} index
  45298. * @return {?}
  45299. */
  45300. ReflectiveInjector_.prototype.getProviderAtIndex = /**
  45301. * @param {?} index
  45302. * @return {?}
  45303. */
  45304. function (index) {
  45305. if (index < 0 || index >= this._providers.length) {
  45306. throw outOfBoundsError(index);
  45307. }
  45308. return this._providers[index];
  45309. };
  45310. /** @internal */
  45311. /**
  45312. * \@internal
  45313. * @param {?} provider
  45314. * @return {?}
  45315. */
  45316. ReflectiveInjector_.prototype._new = /**
  45317. * \@internal
  45318. * @param {?} provider
  45319. * @return {?}
  45320. */
  45321. function (provider) {
  45322. if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
  45323. throw cyclicDependencyError(this, provider.key);
  45324. }
  45325. return this._instantiateProvider(provider);
  45326. };
  45327. /**
  45328. * @return {?}
  45329. */
  45330. ReflectiveInjector_.prototype._getMaxNumberOfObjects = /**
  45331. * @return {?}
  45332. */
  45333. function () { return this.objs.length; };
  45334. /**
  45335. * @param {?} provider
  45336. * @return {?}
  45337. */
  45338. ReflectiveInjector_.prototype._instantiateProvider = /**
  45339. * @param {?} provider
  45340. * @return {?}
  45341. */
  45342. function (provider) {
  45343. if (provider.multiProvider) {
  45344. var /** @type {?} */ res = new Array(provider.resolvedFactories.length);
  45345. for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) {
  45346. res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
  45347. }
  45348. return res;
  45349. }
  45350. else {
  45351. return this._instantiate(provider, provider.resolvedFactories[0]);
  45352. }
  45353. };
  45354. /**
  45355. * @param {?} provider
  45356. * @param {?} ResolvedReflectiveFactory
  45357. * @return {?}
  45358. */
  45359. ReflectiveInjector_.prototype._instantiate = /**
  45360. * @param {?} provider
  45361. * @param {?} ResolvedReflectiveFactory
  45362. * @return {?}
  45363. */
  45364. function (provider, ResolvedReflectiveFactory$$1) {
  45365. var _this = this;
  45366. var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory;
  45367. var /** @type {?} */ deps;
  45368. try {
  45369. deps =
  45370. ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
  45371. }
  45372. catch (/** @type {?} */ e) {
  45373. if (e.addKey) {
  45374. e.addKey(this, provider.key);
  45375. }
  45376. throw e;
  45377. }
  45378. var /** @type {?} */ obj;
  45379. try {
  45380. obj = factory.apply(void 0, deps);
  45381. }
  45382. catch (/** @type {?} */ e) {
  45383. throw instantiationError(this, e, e.stack, provider.key);
  45384. }
  45385. return obj;
  45386. };
  45387. /**
  45388. * @param {?} dep
  45389. * @return {?}
  45390. */
  45391. ReflectiveInjector_.prototype._getByReflectiveDependency = /**
  45392. * @param {?} dep
  45393. * @return {?}
  45394. */
  45395. function (dep) {
  45396. return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
  45397. };
  45398. /**
  45399. * @param {?} key
  45400. * @param {?} visibility
  45401. * @param {?} notFoundValue
  45402. * @return {?}
  45403. */
  45404. ReflectiveInjector_.prototype._getByKey = /**
  45405. * @param {?} key
  45406. * @param {?} visibility
  45407. * @param {?} notFoundValue
  45408. * @return {?}
  45409. */
  45410. function (key, visibility, notFoundValue) {
  45411. if (key === ReflectiveInjector_.INJECTOR_KEY) {
  45412. return this;
  45413. }
  45414. if (visibility instanceof Self) {
  45415. return this._getByKeySelf(key, notFoundValue);
  45416. }
  45417. else {
  45418. return this._getByKeyDefault(key, notFoundValue, visibility);
  45419. }
  45420. };
  45421. /**
  45422. * @param {?} keyId
  45423. * @return {?}
  45424. */
  45425. ReflectiveInjector_.prototype._getObjByKeyId = /**
  45426. * @param {?} keyId
  45427. * @return {?}
  45428. */
  45429. function (keyId) {
  45430. for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) {
  45431. if (this.keyIds[i] === keyId) {
  45432. if (this.objs[i] === UNDEFINED) {
  45433. this.objs[i] = this._new(this._providers[i]);
  45434. }
  45435. return this.objs[i];
  45436. }
  45437. }
  45438. return UNDEFINED;
  45439. };
  45440. /** @internal */
  45441. /**
  45442. * \@internal
  45443. * @param {?} key
  45444. * @param {?} notFoundValue
  45445. * @return {?}
  45446. */
  45447. ReflectiveInjector_.prototype._throwOrNull = /**
  45448. * \@internal
  45449. * @param {?} key
  45450. * @param {?} notFoundValue
  45451. * @return {?}
  45452. */
  45453. function (key, notFoundValue) {
  45454. if (notFoundValue !== THROW_IF_NOT_FOUND) {
  45455. return notFoundValue;
  45456. }
  45457. else {
  45458. throw noProviderError(this, key);
  45459. }
  45460. };
  45461. /** @internal */
  45462. /**
  45463. * \@internal
  45464. * @param {?} key
  45465. * @param {?} notFoundValue
  45466. * @return {?}
  45467. */
  45468. ReflectiveInjector_.prototype._getByKeySelf = /**
  45469. * \@internal
  45470. * @param {?} key
  45471. * @param {?} notFoundValue
  45472. * @return {?}
  45473. */
  45474. function (key, notFoundValue) {
  45475. var /** @type {?} */ obj = this._getObjByKeyId(key.id);
  45476. return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
  45477. };
  45478. /** @internal */
  45479. /**
  45480. * \@internal
  45481. * @param {?} key
  45482. * @param {?} notFoundValue
  45483. * @param {?} visibility
  45484. * @return {?}
  45485. */
  45486. ReflectiveInjector_.prototype._getByKeyDefault = /**
  45487. * \@internal
  45488. * @param {?} key
  45489. * @param {?} notFoundValue
  45490. * @param {?} visibility
  45491. * @return {?}
  45492. */
  45493. function (key, notFoundValue, visibility) {
  45494. var /** @type {?} */ inj;
  45495. if (visibility instanceof SkipSelf) {
  45496. inj = this.parent;
  45497. }
  45498. else {
  45499. inj = this;
  45500. }
  45501. while (inj instanceof ReflectiveInjector_) {
  45502. var /** @type {?} */ inj_ = /** @type {?} */ (inj);
  45503. var /** @type {?} */ obj = inj_._getObjByKeyId(key.id);
  45504. if (obj !== UNDEFINED)
  45505. return obj;
  45506. inj = inj_.parent;
  45507. }
  45508. if (inj !== null) {
  45509. return inj.get(key.token, notFoundValue);
  45510. }
  45511. else {
  45512. return this._throwOrNull(key, notFoundValue);
  45513. }
  45514. };
  45515. Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
  45516. get: /**
  45517. * @return {?}
  45518. */
  45519. function () {
  45520. var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
  45521. .join(', ');
  45522. return "ReflectiveInjector(providers: [" + providers + "])";
  45523. },
  45524. enumerable: true,
  45525. configurable: true
  45526. });
  45527. /**
  45528. * @return {?}
  45529. */
  45530. ReflectiveInjector_.prototype.toString = /**
  45531. * @return {?}
  45532. */
  45533. function () { return this.displayName; };
  45534. ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
  45535. return ReflectiveInjector_;
  45536. }());
  45537. /**
  45538. * @param {?} injector
  45539. * @param {?} fn
  45540. * @return {?}
  45541. */
  45542. function _mapProviders(injector, fn) {
  45543. var /** @type {?} */ res = new Array(injector._providers.length);
  45544. for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) {
  45545. res[i] = fn(injector.getProviderAtIndex(i));
  45546. }
  45547. return res;
  45548. }
  45549. /**
  45550. * @fileoverview added by tsickle
  45551. * @suppress {checkTypes} checked by tsc
  45552. */
  45553. /**
  45554. * @license
  45555. * Copyright Google Inc. All Rights Reserved.
  45556. *
  45557. * Use of this source code is governed by an MIT-style license that can be
  45558. * found in the LICENSE file at https://angular.io/license
  45559. */
  45560. /**
  45561. * @module
  45562. * @description
  45563. * The `di` module provides dependency injection container services.
  45564. */
  45565. /**
  45566. * @fileoverview added by tsickle
  45567. * @suppress {checkTypes} checked by tsc
  45568. */
  45569. /**
  45570. * @license
  45571. * Copyright Google Inc. All Rights Reserved.
  45572. *
  45573. * Use of this source code is governed by an MIT-style license that can be
  45574. * found in the LICENSE file at https://angular.io/license
  45575. */
  45576. /**
  45577. * Determine if the argument is shaped like a Promise
  45578. * @param {?} obj
  45579. * @return {?}
  45580. */
  45581. function isPromise(obj) {
  45582. // allow any Promise/A+ compliant thenable.
  45583. // It's up to the caller to ensure that obj.then conforms to the spec
  45584. return !!obj && typeof obj.then === 'function';
  45585. }
  45586. /**
  45587. * Determine if the argument is an Observable
  45588. * @param {?} obj
  45589. * @return {?}
  45590. */
  45591. function isObservable(obj) {
  45592. // TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
  45593. return !!obj && typeof obj.subscribe === 'function';
  45594. }
  45595. /**
  45596. * @fileoverview added by tsickle
  45597. * @suppress {checkTypes} checked by tsc
  45598. */
  45599. /**
  45600. * @license
  45601. * Copyright Google Inc. All Rights Reserved.
  45602. *
  45603. * Use of this source code is governed by an MIT-style license that can be
  45604. * found in the LICENSE file at https://angular.io/license
  45605. */
  45606. /**
  45607. * A function that will be executed when an application is initialized.
  45608. * \@experimental
  45609. */
  45610. var APP_INITIALIZER = new InjectionToken('Application Initializer');
  45611. /**
  45612. * A class that reflects the state of running {\@link APP_INITIALIZER}s.
  45613. *
  45614. * \@experimental
  45615. */
  45616. var ApplicationInitStatus = /** @class */ (function () {
  45617. function ApplicationInitStatus(appInits) {
  45618. var _this = this;
  45619. this.appInits = appInits;
  45620. this.initialized = false;
  45621. this.done = false;
  45622. this.donePromise = new Promise(function (res, rej) {
  45623. _this.resolve = res;
  45624. _this.reject = rej;
  45625. });
  45626. }
  45627. /** @internal */
  45628. /**
  45629. * \@internal
  45630. * @return {?}
  45631. */
  45632. ApplicationInitStatus.prototype.runInitializers = /**
  45633. * \@internal
  45634. * @return {?}
  45635. */
  45636. function () {
  45637. var _this = this;
  45638. if (this.initialized) {
  45639. return;
  45640. }
  45641. var /** @type {?} */ asyncInitPromises = [];
  45642. var /** @type {?} */ complete = function () {
  45643. (/** @type {?} */ (_this)).done = true;
  45644. _this.resolve();
  45645. };
  45646. if (this.appInits) {
  45647. for (var /** @type {?} */ i = 0; i < this.appInits.length; i++) {
  45648. var /** @type {?} */ initResult = this.appInits[i]();
  45649. if (isPromise(initResult)) {
  45650. asyncInitPromises.push(initResult);
  45651. }
  45652. }
  45653. }
  45654. Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
  45655. if (asyncInitPromises.length === 0) {
  45656. complete();
  45657. }
  45658. this.initialized = true;
  45659. };
  45660. ApplicationInitStatus.decorators = [
  45661. { type: Injectable },
  45662. ];
  45663. /** @nocollapse */
  45664. ApplicationInitStatus.ctorParameters = function () { return [
  45665. { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
  45666. ]; };
  45667. return ApplicationInitStatus;
  45668. }());
  45669. /**
  45670. * @fileoverview added by tsickle
  45671. * @suppress {checkTypes} checked by tsc
  45672. */
  45673. /**
  45674. * @license
  45675. * Copyright Google Inc. All Rights Reserved.
  45676. *
  45677. * Use of this source code is governed by an MIT-style license that can be
  45678. * found in the LICENSE file at https://angular.io/license
  45679. */
  45680. /**
  45681. * A DI Token representing a unique string id assigned to the application by Angular and used
  45682. * primarily for prefixing application attributes and CSS styles when
  45683. * {\@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
  45684. *
  45685. * If you need to avoid randomly generated value to be used as an application id, you can provide
  45686. * a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector}
  45687. * using this token.
  45688. * \@experimental
  45689. */
  45690. var APP_ID = new InjectionToken('AppId');
  45691. /**
  45692. * @return {?}
  45693. */
  45694. function _appIdRandomProviderFactory() {
  45695. return "" + _randomChar() + _randomChar() + _randomChar();
  45696. }
  45697. /**
  45698. * Providers that will generate a random APP_ID_TOKEN.
  45699. * \@experimental
  45700. */
  45701. var APP_ID_RANDOM_PROVIDER = {
  45702. provide: APP_ID,
  45703. useFactory: _appIdRandomProviderFactory,
  45704. deps: /** @type {?} */ ([]),
  45705. };
  45706. /**
  45707. * @return {?}
  45708. */
  45709. function _randomChar() {
  45710. return String.fromCharCode(97 + Math.floor(Math.random() * 25));
  45711. }
  45712. /**
  45713. * A function that will be executed when a platform is initialized.
  45714. * \@experimental
  45715. */
  45716. var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
  45717. /**
  45718. * A token that indicates an opaque platform id.
  45719. * \@experimental
  45720. */
  45721. var PLATFORM_ID = new InjectionToken('Platform ID');
  45722. /**
  45723. * All callbacks provided via this token will be called for every component that is bootstrapped.
  45724. * Signature of the callback:
  45725. *
  45726. * `(componentRef: ComponentRef) => void`.
  45727. *
  45728. * \@experimental
  45729. */
  45730. var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
  45731. /**
  45732. * A token which indicates the root directory of the application
  45733. * \@experimental
  45734. */
  45735. var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
  45736. /**
  45737. * @fileoverview added by tsickle
  45738. * @suppress {checkTypes} checked by tsc
  45739. */
  45740. /**
  45741. * @license
  45742. * Copyright Google Inc. All Rights Reserved.
  45743. *
  45744. * Use of this source code is governed by an MIT-style license that can be
  45745. * found in the LICENSE file at https://angular.io/license
  45746. */
  45747. var Console = /** @class */ (function () {
  45748. function Console() {
  45749. }
  45750. /**
  45751. * @param {?} message
  45752. * @return {?}
  45753. */
  45754. Console.prototype.log = /**
  45755. * @param {?} message
  45756. * @return {?}
  45757. */
  45758. function (message) {
  45759. // tslint:disable-next-line:no-console
  45760. console.log(message);
  45761. };
  45762. // Note: for reporting errors use `DOM.logError()` as it is platform specific
  45763. /**
  45764. * @param {?} message
  45765. * @return {?}
  45766. */
  45767. Console.prototype.warn = /**
  45768. * @param {?} message
  45769. * @return {?}
  45770. */
  45771. function (message) {
  45772. // tslint:disable-next-line:no-console
  45773. console.warn(message);
  45774. };
  45775. Console.decorators = [
  45776. { type: Injectable },
  45777. ];
  45778. /** @nocollapse */
  45779. Console.ctorParameters = function () { return []; };
  45780. return Console;
  45781. }());
  45782. /**
  45783. * @fileoverview added by tsickle
  45784. * @suppress {checkTypes} checked by tsc
  45785. */
  45786. /**
  45787. * @license
  45788. * Copyright Google Inc. All Rights Reserved.
  45789. *
  45790. * Use of this source code is governed by an MIT-style license that can be
  45791. * found in the LICENSE file at https://angular.io/license
  45792. */
  45793. /**
  45794. * Combination of NgModuleFactory and ComponentFactorys.
  45795. *
  45796. * \@experimental
  45797. */
  45798. var ModuleWithComponentFactories = /** @class */ (function () {
  45799. function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
  45800. this.ngModuleFactory = ngModuleFactory;
  45801. this.componentFactories = componentFactories;
  45802. }
  45803. return ModuleWithComponentFactories;
  45804. }());
  45805. /**
  45806. * @return {?}
  45807. */
  45808. function _throwError() {
  45809. throw new Error("Runtime compiler is not loaded");
  45810. }
  45811. /**
  45812. * Low-level service for running the angular compiler during runtime
  45813. * to create {\@link ComponentFactory}s, which
  45814. * can later be used to create and render a Component instance.
  45815. *
  45816. * Each `\@NgModule` provides an own `Compiler` to its injector,
  45817. * that will use the directives/pipes of the ng module for compilation
  45818. * of components.
  45819. * \@stable
  45820. */
  45821. var Compiler = /** @class */ (function () {
  45822. function Compiler() {
  45823. }
  45824. /**
  45825. * Compiles the given NgModule and all of its components. All templates of the components listed
  45826. * in `entryComponents` have to be inlined.
  45827. */
  45828. /**
  45829. * Compiles the given NgModule and all of its components. All templates of the components listed
  45830. * in `entryComponents` have to be inlined.
  45831. * @template T
  45832. * @param {?} moduleType
  45833. * @return {?}
  45834. */
  45835. Compiler.prototype.compileModuleSync = /**
  45836. * Compiles the given NgModule and all of its components. All templates of the components listed
  45837. * in `entryComponents` have to be inlined.
  45838. * @template T
  45839. * @param {?} moduleType
  45840. * @return {?}
  45841. */
  45842. function (moduleType) { throw _throwError(); };
  45843. /**
  45844. * Compiles the given NgModule and all of its components
  45845. */
  45846. /**
  45847. * Compiles the given NgModule and all of its components
  45848. * @template T
  45849. * @param {?} moduleType
  45850. * @return {?}
  45851. */
  45852. Compiler.prototype.compileModuleAsync = /**
  45853. * Compiles the given NgModule and all of its components
  45854. * @template T
  45855. * @param {?} moduleType
  45856. * @return {?}
  45857. */
  45858. function (moduleType) { throw _throwError(); };
  45859. /**
  45860. * Same as {@link #compileModuleSync} but also creates ComponentFactories for all components.
  45861. */
  45862. /**
  45863. * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
  45864. * @template T
  45865. * @param {?} moduleType
  45866. * @return {?}
  45867. */
  45868. Compiler.prototype.compileModuleAndAllComponentsSync = /**
  45869. * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
  45870. * @template T
  45871. * @param {?} moduleType
  45872. * @return {?}
  45873. */
  45874. function (moduleType) {
  45875. throw _throwError();
  45876. };
  45877. /**
  45878. * Same as {@link #compileModuleAsync} but also creates ComponentFactories for all components.
  45879. */
  45880. /**
  45881. * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
  45882. * @template T
  45883. * @param {?} moduleType
  45884. * @return {?}
  45885. */
  45886. Compiler.prototype.compileModuleAndAllComponentsAsync = /**
  45887. * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
  45888. * @template T
  45889. * @param {?} moduleType
  45890. * @return {?}
  45891. */
  45892. function (moduleType) {
  45893. throw _throwError();
  45894. };
  45895. /**
  45896. * Clears all caches.
  45897. */
  45898. /**
  45899. * Clears all caches.
  45900. * @return {?}
  45901. */
  45902. Compiler.prototype.clearCache = /**
  45903. * Clears all caches.
  45904. * @return {?}
  45905. */
  45906. function () { };
  45907. /**
  45908. * Clears the cache for the given component/ngModule.
  45909. */
  45910. /**
  45911. * Clears the cache for the given component/ngModule.
  45912. * @param {?} type
  45913. * @return {?}
  45914. */
  45915. Compiler.prototype.clearCacheFor = /**
  45916. * Clears the cache for the given component/ngModule.
  45917. * @param {?} type
  45918. * @return {?}
  45919. */
  45920. function (type) { };
  45921. Compiler.decorators = [
  45922. { type: Injectable },
  45923. ];
  45924. /** @nocollapse */
  45925. Compiler.ctorParameters = function () { return []; };
  45926. return Compiler;
  45927. }());
  45928. /**
  45929. * Token to provide CompilerOptions in the platform injector.
  45930. *
  45931. * \@experimental
  45932. */
  45933. var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
  45934. /**
  45935. * A factory for creating a Compiler
  45936. *
  45937. * \@experimental
  45938. * @abstract
  45939. */
  45940. var CompilerFactory = /** @class */ (function () {
  45941. function CompilerFactory() {
  45942. }
  45943. return CompilerFactory;
  45944. }());
  45945. /**
  45946. * @fileoverview added by tsickle
  45947. * @suppress {checkTypes} checked by tsc
  45948. */
  45949. /**
  45950. * @license
  45951. * Copyright Google Inc. All Rights Reserved.
  45952. *
  45953. * Use of this source code is governed by an MIT-style license that can be
  45954. * found in the LICENSE file at https://angular.io/license
  45955. */
  45956. /**
  45957. * Represents an instance of a Component created via a {\@link ComponentFactory}.
  45958. *
  45959. * `ComponentRef` provides access to the Component Instance as well other objects related to this
  45960. * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy}
  45961. * method.
  45962. * \@stable
  45963. * @abstract
  45964. */
  45965. var ComponentRef = /** @class */ (function () {
  45966. function ComponentRef() {
  45967. }
  45968. return ComponentRef;
  45969. }());
  45970. /**
  45971. * \@stable
  45972. * @abstract
  45973. */
  45974. var ComponentFactory = /** @class */ (function () {
  45975. function ComponentFactory() {
  45976. }
  45977. return ComponentFactory;
  45978. }());
  45979. /**
  45980. * @fileoverview added by tsickle
  45981. * @suppress {checkTypes} checked by tsc
  45982. */
  45983. /**
  45984. * @license
  45985. * Copyright Google Inc. All Rights Reserved.
  45986. *
  45987. * Use of this source code is governed by an MIT-style license that can be
  45988. * found in the LICENSE file at https://angular.io/license
  45989. */
  45990. /**
  45991. * @param {?} component
  45992. * @return {?}
  45993. */
  45994. function noComponentFactoryError(component) {
  45995. var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
  45996. (/** @type {?} */ (error))[ERROR_COMPONENT] = component;
  45997. return error;
  45998. }
  45999. var ERROR_COMPONENT = 'ngComponent';
  46000. /**
  46001. * @param {?} error
  46002. * @return {?}
  46003. */
  46004. var _NullComponentFactoryResolver = /** @class */ (function () {
  46005. function _NullComponentFactoryResolver() {
  46006. }
  46007. /**
  46008. * @template T
  46009. * @param {?} component
  46010. * @return {?}
  46011. */
  46012. _NullComponentFactoryResolver.prototype.resolveComponentFactory = /**
  46013. * @template T
  46014. * @param {?} component
  46015. * @return {?}
  46016. */
  46017. function (component) {
  46018. throw noComponentFactoryError(component);
  46019. };
  46020. return _NullComponentFactoryResolver;
  46021. }());
  46022. /**
  46023. * \@stable
  46024. * @abstract
  46025. */
  46026. var ComponentFactoryResolver = /** @class */ (function () {
  46027. function ComponentFactoryResolver() {
  46028. }
  46029. ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
  46030. return ComponentFactoryResolver;
  46031. }());
  46032. var CodegenComponentFactoryResolver = /** @class */ (function () {
  46033. function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
  46034. this._parent = _parent;
  46035. this._ngModule = _ngModule;
  46036. this._factories = new Map();
  46037. for (var /** @type {?} */ i = 0; i < factories.length; i++) {
  46038. var /** @type {?} */ factory = factories[i];
  46039. this._factories.set(factory.componentType, factory);
  46040. }
  46041. }
  46042. /**
  46043. * @template T
  46044. * @param {?} component
  46045. * @return {?}
  46046. */
  46047. CodegenComponentFactoryResolver.prototype.resolveComponentFactory = /**
  46048. * @template T
  46049. * @param {?} component
  46050. * @return {?}
  46051. */
  46052. function (component) {
  46053. var /** @type {?} */ factory = this._factories.get(component);
  46054. if (!factory && this._parent) {
  46055. factory = this._parent.resolveComponentFactory(component);
  46056. }
  46057. if (!factory) {
  46058. throw noComponentFactoryError(component);
  46059. }
  46060. return new ComponentFactoryBoundToModule(factory, this._ngModule);
  46061. };
  46062. return CodegenComponentFactoryResolver;
  46063. }());
  46064. var ComponentFactoryBoundToModule = /** @class */ (function (_super) {
  46065. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentFactoryBoundToModule, _super);
  46066. function ComponentFactoryBoundToModule(factory, ngModule) {
  46067. var _this = _super.call(this) || this;
  46068. _this.factory = factory;
  46069. _this.ngModule = ngModule;
  46070. _this.selector = factory.selector;
  46071. _this.componentType = factory.componentType;
  46072. _this.ngContentSelectors = factory.ngContentSelectors;
  46073. _this.inputs = factory.inputs;
  46074. _this.outputs = factory.outputs;
  46075. return _this;
  46076. }
  46077. /**
  46078. * @param {?} injector
  46079. * @param {?=} projectableNodes
  46080. * @param {?=} rootSelectorOrNode
  46081. * @param {?=} ngModule
  46082. * @return {?}
  46083. */
  46084. ComponentFactoryBoundToModule.prototype.create = /**
  46085. * @param {?} injector
  46086. * @param {?=} projectableNodes
  46087. * @param {?=} rootSelectorOrNode
  46088. * @param {?=} ngModule
  46089. * @return {?}
  46090. */
  46091. function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
  46092. return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
  46093. };
  46094. return ComponentFactoryBoundToModule;
  46095. }(ComponentFactory));
  46096. /**
  46097. * @fileoverview added by tsickle
  46098. * @suppress {checkTypes} checked by tsc
  46099. */
  46100. /**
  46101. * @license
  46102. * Copyright Google Inc. All Rights Reserved.
  46103. *
  46104. * Use of this source code is governed by an MIT-style license that can be
  46105. * found in the LICENSE file at https://angular.io/license
  46106. */
  46107. /**
  46108. * Represents an instance of an NgModule created via a {\@link NgModuleFactory}.
  46109. *
  46110. * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
  46111. * NgModule Instance.
  46112. *
  46113. * \@stable
  46114. * @abstract
  46115. */
  46116. var NgModuleRef = /** @class */ (function () {
  46117. function NgModuleRef() {
  46118. }
  46119. return NgModuleRef;
  46120. }());
  46121. /**
  46122. * @record
  46123. */
  46124. /**
  46125. * \@experimental
  46126. * @abstract
  46127. */
  46128. var NgModuleFactory = /** @class */ (function () {
  46129. function NgModuleFactory() {
  46130. }
  46131. return NgModuleFactory;
  46132. }());
  46133. /**
  46134. * @fileoverview added by tsickle
  46135. * @suppress {checkTypes} checked by tsc
  46136. */
  46137. /**
  46138. * @license
  46139. * Copyright Google Inc. All Rights Reserved.
  46140. *
  46141. * Use of this source code is governed by an MIT-style license that can be
  46142. * found in the LICENSE file at https://angular.io/license
  46143. */
  46144. /**
  46145. * A scope function for the Web Tracing Framework (WTF).
  46146. *
  46147. * \@experimental
  46148. * @record
  46149. */
  46150. /**
  46151. * @record
  46152. */
  46153. /**
  46154. * @record
  46155. */
  46156. var trace;
  46157. var events;
  46158. /**
  46159. * @return {?}
  46160. */
  46161. function detectWTF() {
  46162. var /** @type {?} */ wtf = (/** @type {?} */ (_global /** TODO #9100 */) /** TODO #9100 */)['wtf'];
  46163. if (wtf) {
  46164. trace = wtf['trace'];
  46165. if (trace) {
  46166. events = trace['events'];
  46167. return true;
  46168. }
  46169. }
  46170. return false;
  46171. }
  46172. /**
  46173. * @param {?} signature
  46174. * @param {?=} flags
  46175. * @return {?}
  46176. */
  46177. function createScope(signature, flags) {
  46178. if (flags === void 0) { flags = null; }
  46179. return events.createScope(signature, flags);
  46180. }
  46181. /**
  46182. * @template T
  46183. * @param {?} scope
  46184. * @param {?=} returnValue
  46185. * @return {?}
  46186. */
  46187. function leave(scope, returnValue) {
  46188. trace.leaveScope(scope, returnValue);
  46189. return returnValue;
  46190. }
  46191. /**
  46192. * @param {?} rangeType
  46193. * @param {?} action
  46194. * @return {?}
  46195. */
  46196. function startTimeRange(rangeType, action) {
  46197. return trace.beginTimeRange(rangeType, action);
  46198. }
  46199. /**
  46200. * @param {?} range
  46201. * @return {?}
  46202. */
  46203. function endTimeRange(range) {
  46204. trace.endTimeRange(range);
  46205. }
  46206. /**
  46207. * @fileoverview added by tsickle
  46208. * @suppress {checkTypes} checked by tsc
  46209. */
  46210. /**
  46211. * @license
  46212. * Copyright Google Inc. All Rights Reserved.
  46213. *
  46214. * Use of this source code is governed by an MIT-style license that can be
  46215. * found in the LICENSE file at https://angular.io/license
  46216. */
  46217. /**
  46218. * True if WTF is enabled.
  46219. */
  46220. var wtfEnabled = detectWTF();
  46221. /**
  46222. * @param {?=} arg0
  46223. * @param {?=} arg1
  46224. * @return {?}
  46225. */
  46226. function noopScope(arg0, arg1) {
  46227. return null;
  46228. }
  46229. /**
  46230. * Create trace scope.
  46231. *
  46232. * Scopes must be strictly nested and are analogous to stack frames, but
  46233. * do not have to follow the stack frames. Instead it is recommended that they follow logical
  46234. * nesting. You may want to use
  46235. * [Event
  46236. * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
  46237. * as they are defined in WTF.
  46238. *
  46239. * Used to mark scope entry. The return value is used to leave the scope.
  46240. *
  46241. * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
  46242. *
  46243. * someMethod() {
  46244. * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
  46245. * // DO SOME WORK HERE
  46246. * return wtfLeave(s, 123); // Return value 123
  46247. * }
  46248. *
  46249. * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
  46250. * negatively impact the performance of your application. For this reason we recommend that
  46251. * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
  46252. * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
  46253. * exception, will produce incorrect trace, but presence of exception signifies logic error which
  46254. * needs to be fixed before the app should be profiled. Add try-finally only when you expect that
  46255. * an exception is expected during normal execution while profiling.
  46256. *
  46257. * \@experimental
  46258. */
  46259. var wtfCreateScope = wtfEnabled ? createScope : function (signature, flags) { return noopScope; };
  46260. /**
  46261. * Used to mark end of Scope.
  46262. *
  46263. * - `scope` to end.
  46264. * - `returnValue` (optional) to be passed to the WTF.
  46265. *
  46266. * Returns the `returnValue for easy chaining.
  46267. * \@experimental
  46268. */
  46269. var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
  46270. /**
  46271. * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
  46272. * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
  46273. * enabled.
  46274. *
  46275. * someMethod() {
  46276. * var s = wtfStartTimeRange('HTTP:GET', 'some.url');
  46277. * var future = new Future.delay(5).then((_) {
  46278. * wtfEndTimeRange(s);
  46279. * });
  46280. * }
  46281. * \@experimental
  46282. */
  46283. var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
  46284. /**
  46285. * Ends a async time range operation.
  46286. * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
  46287. * enabled.
  46288. * \@experimental
  46289. */
  46290. var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
  46291. /**
  46292. * @fileoverview added by tsickle
  46293. * @suppress {checkTypes} checked by tsc
  46294. */
  46295. /**
  46296. * @license
  46297. * Copyright Google Inc. All Rights Reserved.
  46298. *
  46299. * Use of this source code is governed by an MIT-style license that can be
  46300. * found in the LICENSE file at https://angular.io/license
  46301. */
  46302. /**
  46303. * Use by directives and components to emit custom Events.
  46304. *
  46305. * ### Examples
  46306. *
  46307. * In the following example, `Zippy` alternatively emits `open` and `close` events when its
  46308. * title gets clicked:
  46309. *
  46310. * ```
  46311. * \@Component({
  46312. * selector: 'zippy',
  46313. * template: `
  46314. * <div class="zippy">
  46315. * <div (click)="toggle()">Toggle</div>
  46316. * <div [hidden]="!visible">
  46317. * <ng-content></ng-content>
  46318. * </div>
  46319. * </div>`})
  46320. * export class Zippy {
  46321. * visible: boolean = true;
  46322. * \@Output() open: EventEmitter<any> = new EventEmitter();
  46323. * \@Output() close: EventEmitter<any> = new EventEmitter();
  46324. *
  46325. * toggle() {
  46326. * this.visible = !this.visible;
  46327. * if (this.visible) {
  46328. * this.open.emit(null);
  46329. * } else {
  46330. * this.close.emit(null);
  46331. * }
  46332. * }
  46333. * }
  46334. * ```
  46335. *
  46336. * The events payload can be accessed by the parameter `$event` on the components output event
  46337. * handler:
  46338. *
  46339. * ```
  46340. * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
  46341. * ```
  46342. *
  46343. * Uses Rx.Observable but provides an adapter to make it work as specified here:
  46344. * https://github.com/jhusain/observable-spec
  46345. *
  46346. * Once a reference implementation of the spec is available, switch to it.
  46347. * \@stable
  46348. */
  46349. var EventEmitter = /** @class */ (function (_super) {
  46350. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EventEmitter, _super);
  46351. /**
  46352. * Creates an instance of {@link EventEmitter}, which depending on `isAsync`,
  46353. * delivers events synchronously or asynchronously.
  46354. *
  46355. * @param isAsync By default, events are delivered synchronously (default value: `false`).
  46356. * Set to `true` for asynchronous event delivery.
  46357. */
  46358. function EventEmitter(isAsync) {
  46359. if (isAsync === void 0) { isAsync = false; }
  46360. var _this = _super.call(this) || this;
  46361. _this.__isAsync = isAsync;
  46362. return _this;
  46363. }
  46364. /**
  46365. * @param {?=} value
  46366. * @return {?}
  46367. */
  46368. EventEmitter.prototype.emit = /**
  46369. * @param {?=} value
  46370. * @return {?}
  46371. */
  46372. function (value) { _super.prototype.next.call(this, value); };
  46373. /**
  46374. * @param {?=} generatorOrNext
  46375. * @param {?=} error
  46376. * @param {?=} complete
  46377. * @return {?}
  46378. */
  46379. EventEmitter.prototype.subscribe = /**
  46380. * @param {?=} generatorOrNext
  46381. * @param {?=} error
  46382. * @param {?=} complete
  46383. * @return {?}
  46384. */
  46385. function (generatorOrNext, error, complete) {
  46386. var /** @type {?} */ schedulerFn;
  46387. var /** @type {?} */ errorFn = function (err) { return null; };
  46388. var /** @type {?} */ completeFn = function () { return null; };
  46389. if (generatorOrNext && typeof generatorOrNext === 'object') {
  46390. schedulerFn = this.__isAsync ? function (value) {
  46391. setTimeout(function () { return generatorOrNext.next(value); });
  46392. } : function (value) { generatorOrNext.next(value); };
  46393. if (generatorOrNext.error) {
  46394. errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
  46395. function (err) { generatorOrNext.error(err); };
  46396. }
  46397. if (generatorOrNext.complete) {
  46398. completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
  46399. function () { generatorOrNext.complete(); };
  46400. }
  46401. }
  46402. else {
  46403. schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
  46404. function (value) { generatorOrNext(value); };
  46405. if (error) {
  46406. errorFn =
  46407. this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
  46408. }
  46409. if (complete) {
  46410. completeFn =
  46411. this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
  46412. }
  46413. }
  46414. var /** @type {?} */ sink = _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
  46415. if (generatorOrNext instanceof __WEBPACK_IMPORTED_MODULE_5_rxjs_Subscription__["a" /* Subscription */]) {
  46416. generatorOrNext.add(sink);
  46417. }
  46418. return sink;
  46419. };
  46420. return EventEmitter;
  46421. }(__WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__["a" /* Subject */]));
  46422. /**
  46423. * @fileoverview added by tsickle
  46424. * @suppress {checkTypes} checked by tsc
  46425. */
  46426. /**
  46427. * @license
  46428. * Copyright Google Inc. All Rights Reserved.
  46429. *
  46430. * Use of this source code is governed by an MIT-style license that can be
  46431. * found in the LICENSE file at https://angular.io/license
  46432. */
  46433. /**
  46434. * An injectable service for executing work inside or outside of the Angular zone.
  46435. *
  46436. * The most common use of this service is to optimize performance when starting a work consisting of
  46437. * one or more asynchronous tasks that don't require UI updates or error handling to be handled by
  46438. * Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks
  46439. * can reenter the Angular zone via {\@link #run}.
  46440. *
  46441. * <!-- TODO: add/fix links to:
  46442. * - docs explaining zones and the use of zones in Angular and change-detection
  46443. * - link to runOutsideAngular/run (throughout this file!)
  46444. * -->
  46445. *
  46446. * ### Example
  46447. *
  46448. * ```
  46449. * import {Component, NgZone} from '\@angular/core';
  46450. * import {NgIf} from '\@angular/common';
  46451. *
  46452. * \@Component({
  46453. * selector: 'ng-zone-demo',
  46454. * template: `
  46455. * <h2>Demo: NgZone</h2>
  46456. *
  46457. * <p>Progress: {{progress}}%</p>
  46458. * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
  46459. *
  46460. * <button (click)="processWithinAngularZone()">Process within Angular zone</button>
  46461. * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
  46462. * `,
  46463. * })
  46464. * export class NgZoneDemo {
  46465. * progress: number = 0;
  46466. * label: string;
  46467. *
  46468. * constructor(private _ngZone: NgZone) {}
  46469. *
  46470. * // Loop inside the Angular zone
  46471. * // so the UI DOES refresh after each setTimeout cycle
  46472. * processWithinAngularZone() {
  46473. * this.label = 'inside';
  46474. * this.progress = 0;
  46475. * this._increaseProgress(() => console.log('Inside Done!'));
  46476. * }
  46477. *
  46478. * // Loop outside of the Angular zone
  46479. * // so the UI DOES NOT refresh after each setTimeout cycle
  46480. * processOutsideOfAngularZone() {
  46481. * this.label = 'outside';
  46482. * this.progress = 0;
  46483. * this._ngZone.runOutsideAngular(() => {
  46484. * this._increaseProgress(() => {
  46485. * // reenter the Angular zone and display done
  46486. * this._ngZone.run(() => { console.log('Outside Done!'); });
  46487. * });
  46488. * });
  46489. * }
  46490. *
  46491. * _increaseProgress(doneCallback: () => void) {
  46492. * this.progress += 1;
  46493. * console.log(`Current progress: ${this.progress}%`);
  46494. *
  46495. * if (this.progress < 100) {
  46496. * window.setTimeout(() => this._increaseProgress(doneCallback), 10);
  46497. * } else {
  46498. * doneCallback();
  46499. * }
  46500. * }
  46501. * }
  46502. * ```
  46503. *
  46504. * \@experimental
  46505. */
  46506. var NgZone = /** @class */ (function () {
  46507. function NgZone(_a) {
  46508. var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
  46509. this.hasPendingMicrotasks = false;
  46510. this.hasPendingMacrotasks = false;
  46511. /**
  46512. * Whether there are no outstanding microtasks or macrotasks.
  46513. */
  46514. this.isStable = true;
  46515. /**
  46516. * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
  46517. */
  46518. this.onUnstable = new EventEmitter(false);
  46519. /**
  46520. * Notifies when there is no more microtasks enqueued in the current VM Turn.
  46521. * This is a hint for Angular to do change detection, which may enqueue more microtasks.
  46522. * For this reason this event can fire multiple times per VM Turn.
  46523. */
  46524. this.onMicrotaskEmpty = new EventEmitter(false);
  46525. /**
  46526. * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
  46527. * implies we are about to relinquish VM turn.
  46528. * This event gets called just once.
  46529. */
  46530. this.onStable = new EventEmitter(false);
  46531. /**
  46532. * Notifies that an error has been delivered.
  46533. */
  46534. this.onError = new EventEmitter(false);
  46535. if (typeof Zone == 'undefined') {
  46536. throw new Error("In this configuration Angular requires Zone.js");
  46537. }
  46538. Zone.assertZonePatched();
  46539. var /** @type {?} */ self = /** @type {?} */ ((this));
  46540. self._nesting = 0;
  46541. self._outer = self._inner = Zone.current;
  46542. if ((/** @type {?} */ (Zone))['wtfZoneSpec']) {
  46543. self._inner = self._inner.fork((/** @type {?} */ (Zone))['wtfZoneSpec']);
  46544. }
  46545. if (enableLongStackTrace && (/** @type {?} */ (Zone))['longStackTraceZoneSpec']) {
  46546. self._inner = self._inner.fork((/** @type {?} */ (Zone))['longStackTraceZoneSpec']);
  46547. }
  46548. forkInnerZoneWithAngularBehavior(self);
  46549. }
  46550. /**
  46551. * @return {?}
  46552. */
  46553. NgZone.isInAngularZone = /**
  46554. * @return {?}
  46555. */
  46556. function () { return Zone.current.get('isAngularZone') === true; };
  46557. /**
  46558. * @return {?}
  46559. */
  46560. NgZone.assertInAngularZone = /**
  46561. * @return {?}
  46562. */
  46563. function () {
  46564. if (!NgZone.isInAngularZone()) {
  46565. throw new Error('Expected to be in Angular Zone, but it is not!');
  46566. }
  46567. };
  46568. /**
  46569. * @return {?}
  46570. */
  46571. NgZone.assertNotInAngularZone = /**
  46572. * @return {?}
  46573. */
  46574. function () {
  46575. if (NgZone.isInAngularZone()) {
  46576. throw new Error('Expected to not be in Angular Zone, but it is!');
  46577. }
  46578. };
  46579. /**
  46580. * Executes the `fn` function synchronously within the Angular zone and returns value returned by
  46581. * the function.
  46582. *
  46583. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  46584. * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
  46585. *
  46586. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46587. * within the Angular zone.
  46588. *
  46589. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  46590. */
  46591. /**
  46592. * Executes the `fn` function synchronously within the Angular zone and returns value returned by
  46593. * the function.
  46594. *
  46595. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  46596. * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
  46597. *
  46598. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46599. * within the Angular zone.
  46600. *
  46601. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  46602. * @template T
  46603. * @param {?} fn
  46604. * @param {?=} applyThis
  46605. * @param {?=} applyArgs
  46606. * @return {?}
  46607. */
  46608. NgZone.prototype.run = /**
  46609. * Executes the `fn` function synchronously within the Angular zone and returns value returned by
  46610. * the function.
  46611. *
  46612. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  46613. * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
  46614. *
  46615. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46616. * within the Angular zone.
  46617. *
  46618. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  46619. * @template T
  46620. * @param {?} fn
  46621. * @param {?=} applyThis
  46622. * @param {?=} applyArgs
  46623. * @return {?}
  46624. */
  46625. function (fn, applyThis, applyArgs) {
  46626. return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.run(fn, applyThis, applyArgs));
  46627. };
  46628. /**
  46629. * Executes the `fn` function synchronously within the Angular zone as a task and returns value
  46630. * returned by the function.
  46631. *
  46632. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  46633. * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
  46634. *
  46635. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46636. * within the Angular zone.
  46637. *
  46638. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  46639. */
  46640. /**
  46641. * Executes the `fn` function synchronously within the Angular zone as a task and returns value
  46642. * returned by the function.
  46643. *
  46644. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  46645. * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
  46646. *
  46647. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46648. * within the Angular zone.
  46649. *
  46650. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  46651. * @template T
  46652. * @param {?} fn
  46653. * @param {?=} applyThis
  46654. * @param {?=} applyArgs
  46655. * @param {?=} name
  46656. * @return {?}
  46657. */
  46658. NgZone.prototype.runTask = /**
  46659. * Executes the `fn` function synchronously within the Angular zone as a task and returns value
  46660. * returned by the function.
  46661. *
  46662. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  46663. * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
  46664. *
  46665. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46666. * within the Angular zone.
  46667. *
  46668. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  46669. * @template T
  46670. * @param {?} fn
  46671. * @param {?=} applyThis
  46672. * @param {?=} applyArgs
  46673. * @param {?=} name
  46674. * @return {?}
  46675. */
  46676. function (fn, applyThis, applyArgs, name) {
  46677. var /** @type {?} */ zone = (/** @type {?} */ ((this)))._inner;
  46678. var /** @type {?} */ task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
  46679. try {
  46680. return /** @type {?} */ (zone.runTask(task, applyThis, applyArgs));
  46681. }
  46682. finally {
  46683. zone.cancelTask(task);
  46684. }
  46685. };
  46686. /**
  46687. * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
  46688. * rethrown.
  46689. */
  46690. /**
  46691. * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
  46692. * rethrown.
  46693. * @template T
  46694. * @param {?} fn
  46695. * @param {?=} applyThis
  46696. * @param {?=} applyArgs
  46697. * @return {?}
  46698. */
  46699. NgZone.prototype.runGuarded = /**
  46700. * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
  46701. * rethrown.
  46702. * @template T
  46703. * @param {?} fn
  46704. * @param {?=} applyThis
  46705. * @param {?=} applyArgs
  46706. * @return {?}
  46707. */
  46708. function (fn, applyThis, applyArgs) {
  46709. return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.runGuarded(fn, applyThis, applyArgs));
  46710. };
  46711. /**
  46712. * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
  46713. * the function.
  46714. *
  46715. * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
  46716. * work that
  46717. * doesn't trigger Angular change-detection or is subject to Angular's error handling.
  46718. *
  46719. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46720. * outside of the Angular zone.
  46721. *
  46722. * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
  46723. */
  46724. /**
  46725. * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
  46726. * the function.
  46727. *
  46728. * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
  46729. * work that
  46730. * doesn't trigger Angular change-detection or is subject to Angular's error handling.
  46731. *
  46732. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46733. * outside of the Angular zone.
  46734. *
  46735. * Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
  46736. * @template T
  46737. * @param {?} fn
  46738. * @return {?}
  46739. */
  46740. NgZone.prototype.runOutsideAngular = /**
  46741. * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
  46742. * the function.
  46743. *
  46744. * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
  46745. * work that
  46746. * doesn't trigger Angular change-detection or is subject to Angular's error handling.
  46747. *
  46748. * Any future tasks or microtasks scheduled from within this function will continue executing from
  46749. * outside of the Angular zone.
  46750. *
  46751. * Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
  46752. * @template T
  46753. * @param {?} fn
  46754. * @return {?}
  46755. */
  46756. function (fn) {
  46757. return /** @type {?} */ ((/** @type {?} */ ((this)))._outer.run(fn));
  46758. };
  46759. return NgZone;
  46760. }());
  46761. /**
  46762. * @return {?}
  46763. */
  46764. function noop() { }
  46765. var EMPTY_PAYLOAD = {};
  46766. /**
  46767. * @param {?} zone
  46768. * @return {?}
  46769. */
  46770. function checkStable(zone) {
  46771. if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
  46772. try {
  46773. zone._nesting++;
  46774. zone.onMicrotaskEmpty.emit(null);
  46775. }
  46776. finally {
  46777. zone._nesting--;
  46778. if (!zone.hasPendingMicrotasks) {
  46779. try {
  46780. zone.runOutsideAngular(function () { return zone.onStable.emit(null); });
  46781. }
  46782. finally {
  46783. zone.isStable = true;
  46784. }
  46785. }
  46786. }
  46787. }
  46788. }
  46789. /**
  46790. * @param {?} zone
  46791. * @return {?}
  46792. */
  46793. function forkInnerZoneWithAngularBehavior(zone) {
  46794. zone._inner = zone._inner.fork({
  46795. name: 'angular',
  46796. properties: /** @type {?} */ ({ 'isAngularZone': true }),
  46797. onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
  46798. try {
  46799. onEnter(zone);
  46800. return delegate.invokeTask(target, task, applyThis, applyArgs);
  46801. }
  46802. finally {
  46803. onLeave(zone);
  46804. }
  46805. },
  46806. onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
  46807. try {
  46808. onEnter(zone);
  46809. return delegate.invoke(target, callback, applyThis, applyArgs, source);
  46810. }
  46811. finally {
  46812. onLeave(zone);
  46813. }
  46814. },
  46815. onHasTask: function (delegate, current, target, hasTaskState) {
  46816. delegate.hasTask(target, hasTaskState);
  46817. if (current === target) {
  46818. // We are only interested in hasTask events which originate from our zone
  46819. // (A child hasTask event is not interesting to us)
  46820. if (hasTaskState.change == 'microTask') {
  46821. zone.hasPendingMicrotasks = hasTaskState.microTask;
  46822. checkStable(zone);
  46823. }
  46824. else if (hasTaskState.change == 'macroTask') {
  46825. zone.hasPendingMacrotasks = hasTaskState.macroTask;
  46826. }
  46827. }
  46828. },
  46829. onHandleError: function (delegate, current, target, error) {
  46830. delegate.handleError(target, error);
  46831. zone.runOutsideAngular(function () { return zone.onError.emit(error); });
  46832. return false;
  46833. }
  46834. });
  46835. }
  46836. /**
  46837. * @param {?} zone
  46838. * @return {?}
  46839. */
  46840. function onEnter(zone) {
  46841. zone._nesting++;
  46842. if (zone.isStable) {
  46843. zone.isStable = false;
  46844. zone.onUnstable.emit(null);
  46845. }
  46846. }
  46847. /**
  46848. * @param {?} zone
  46849. * @return {?}
  46850. */
  46851. function onLeave(zone) {
  46852. zone._nesting--;
  46853. checkStable(zone);
  46854. }
  46855. /**
  46856. * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls
  46857. * to framework to perform rendering.
  46858. */
  46859. var NoopNgZone = /** @class */ (function () {
  46860. function NoopNgZone() {
  46861. this.hasPendingMicrotasks = false;
  46862. this.hasPendingMacrotasks = false;
  46863. this.isStable = true;
  46864. this.onUnstable = new EventEmitter();
  46865. this.onMicrotaskEmpty = new EventEmitter();
  46866. this.onStable = new EventEmitter();
  46867. this.onError = new EventEmitter();
  46868. }
  46869. /**
  46870. * @param {?} fn
  46871. * @return {?}
  46872. */
  46873. NoopNgZone.prototype.run = /**
  46874. * @param {?} fn
  46875. * @return {?}
  46876. */
  46877. function (fn) { return fn(); };
  46878. /**
  46879. * @param {?} fn
  46880. * @return {?}
  46881. */
  46882. NoopNgZone.prototype.runGuarded = /**
  46883. * @param {?} fn
  46884. * @return {?}
  46885. */
  46886. function (fn) { return fn(); };
  46887. /**
  46888. * @param {?} fn
  46889. * @return {?}
  46890. */
  46891. NoopNgZone.prototype.runOutsideAngular = /**
  46892. * @param {?} fn
  46893. * @return {?}
  46894. */
  46895. function (fn) { return fn(); };
  46896. /**
  46897. * @template T
  46898. * @param {?} fn
  46899. * @return {?}
  46900. */
  46901. NoopNgZone.prototype.runTask = /**
  46902. * @template T
  46903. * @param {?} fn
  46904. * @return {?}
  46905. */
  46906. function (fn) { return fn(); };
  46907. return NoopNgZone;
  46908. }());
  46909. /**
  46910. * @fileoverview added by tsickle
  46911. * @suppress {checkTypes} checked by tsc
  46912. */
  46913. /**
  46914. * @license
  46915. * Copyright Google Inc. All Rights Reserved.
  46916. *
  46917. * Use of this source code is governed by an MIT-style license that can be
  46918. * found in the LICENSE file at https://angular.io/license
  46919. */
  46920. /**
  46921. * The Testability service provides testing hooks that can be accessed from
  46922. * the browser and by services such as Protractor. Each bootstrapped Angular
  46923. * application on the page will have an instance of Testability.
  46924. * \@experimental
  46925. */
  46926. var Testability = /** @class */ (function () {
  46927. function Testability(_ngZone) {
  46928. this._ngZone = _ngZone;
  46929. /**
  46930. * \@internal
  46931. */
  46932. this._pendingCount = 0;
  46933. /**
  46934. * \@internal
  46935. */
  46936. this._isZoneStable = true;
  46937. /**
  46938. * Whether any work was done since the last 'whenStable' callback. This is
  46939. * useful to detect if this could have potentially destabilized another
  46940. * component while it is stabilizing.
  46941. * \@internal
  46942. */
  46943. this._didWork = false;
  46944. /**
  46945. * \@internal
  46946. */
  46947. this._callbacks = [];
  46948. this._watchAngularEvents();
  46949. }
  46950. /** @internal */
  46951. /**
  46952. * \@internal
  46953. * @return {?}
  46954. */
  46955. Testability.prototype._watchAngularEvents = /**
  46956. * \@internal
  46957. * @return {?}
  46958. */
  46959. function () {
  46960. var _this = this;
  46961. this._ngZone.onUnstable.subscribe({
  46962. next: function () {
  46963. _this._didWork = true;
  46964. _this._isZoneStable = false;
  46965. }
  46966. });
  46967. this._ngZone.runOutsideAngular(function () {
  46968. _this._ngZone.onStable.subscribe({
  46969. next: function () {
  46970. NgZone.assertNotInAngularZone();
  46971. scheduleMicroTask(function () {
  46972. _this._isZoneStable = true;
  46973. _this._runCallbacksIfReady();
  46974. });
  46975. }
  46976. });
  46977. });
  46978. };
  46979. /**
  46980. * Increases the number of pending request
  46981. */
  46982. /**
  46983. * Increases the number of pending request
  46984. * @return {?}
  46985. */
  46986. Testability.prototype.increasePendingRequestCount = /**
  46987. * Increases the number of pending request
  46988. * @return {?}
  46989. */
  46990. function () {
  46991. this._pendingCount += 1;
  46992. this._didWork = true;
  46993. return this._pendingCount;
  46994. };
  46995. /**
  46996. * Decreases the number of pending request
  46997. */
  46998. /**
  46999. * Decreases the number of pending request
  47000. * @return {?}
  47001. */
  47002. Testability.prototype.decreasePendingRequestCount = /**
  47003. * Decreases the number of pending request
  47004. * @return {?}
  47005. */
  47006. function () {
  47007. this._pendingCount -= 1;
  47008. if (this._pendingCount < 0) {
  47009. throw new Error('pending async requests below zero');
  47010. }
  47011. this._runCallbacksIfReady();
  47012. return this._pendingCount;
  47013. };
  47014. /**
  47015. * Whether an associated application is stable
  47016. */
  47017. /**
  47018. * Whether an associated application is stable
  47019. * @return {?}
  47020. */
  47021. Testability.prototype.isStable = /**
  47022. * Whether an associated application is stable
  47023. * @return {?}
  47024. */
  47025. function () {
  47026. return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
  47027. };
  47028. /** @internal */
  47029. /**
  47030. * \@internal
  47031. * @return {?}
  47032. */
  47033. Testability.prototype._runCallbacksIfReady = /**
  47034. * \@internal
  47035. * @return {?}
  47036. */
  47037. function () {
  47038. var _this = this;
  47039. if (this.isStable()) {
  47040. // Schedules the call backs in a new frame so that it is always async.
  47041. scheduleMicroTask(function () {
  47042. while (_this._callbacks.length !== 0) {
  47043. (/** @type {?} */ ((_this._callbacks.pop())))(_this._didWork);
  47044. }
  47045. _this._didWork = false;
  47046. });
  47047. }
  47048. else {
  47049. // Not Ready
  47050. this._didWork = true;
  47051. }
  47052. };
  47053. /**
  47054. * Run callback when the application is stable
  47055. * @param callback function to be called after the application is stable
  47056. */
  47057. /**
  47058. * Run callback when the application is stable
  47059. * @param {?} callback function to be called after the application is stable
  47060. * @return {?}
  47061. */
  47062. Testability.prototype.whenStable = /**
  47063. * Run callback when the application is stable
  47064. * @param {?} callback function to be called after the application is stable
  47065. * @return {?}
  47066. */
  47067. function (callback) {
  47068. this._callbacks.push(callback);
  47069. this._runCallbacksIfReady();
  47070. };
  47071. /**
  47072. * Get the number of pending requests
  47073. */
  47074. /**
  47075. * Get the number of pending requests
  47076. * @return {?}
  47077. */
  47078. Testability.prototype.getPendingRequestCount = /**
  47079. * Get the number of pending requests
  47080. * @return {?}
  47081. */
  47082. function () { return this._pendingCount; };
  47083. /**
  47084. * Find providers by name
  47085. * @param using The root element to search from
  47086. * @param provider The name of binding variable
  47087. * @param exactMatch Whether using exactMatch
  47088. */
  47089. /**
  47090. * Find providers by name
  47091. * @param {?} using The root element to search from
  47092. * @param {?} provider The name of binding variable
  47093. * @param {?} exactMatch Whether using exactMatch
  47094. * @return {?}
  47095. */
  47096. Testability.prototype.findProviders = /**
  47097. * Find providers by name
  47098. * @param {?} using The root element to search from
  47099. * @param {?} provider The name of binding variable
  47100. * @param {?} exactMatch Whether using exactMatch
  47101. * @return {?}
  47102. */
  47103. function (using, provider, exactMatch) {
  47104. // TODO(juliemr): implement.
  47105. return [];
  47106. };
  47107. Testability.decorators = [
  47108. { type: Injectable },
  47109. ];
  47110. /** @nocollapse */
  47111. Testability.ctorParameters = function () { return [
  47112. { type: NgZone, },
  47113. ]; };
  47114. return Testability;
  47115. }());
  47116. /**
  47117. * A global registry of {\@link Testability} instances for specific elements.
  47118. * \@experimental
  47119. */
  47120. var TestabilityRegistry = /** @class */ (function () {
  47121. function TestabilityRegistry() {
  47122. /**
  47123. * \@internal
  47124. */
  47125. this._applications = new Map();
  47126. _testabilityGetter.addToWindow(this);
  47127. }
  47128. /**
  47129. * Registers an application with a testability hook so that it can be tracked
  47130. * @param token token of application, root element
  47131. * @param testability Testability hook
  47132. */
  47133. /**
  47134. * Registers an application with a testability hook so that it can be tracked
  47135. * @param {?} token token of application, root element
  47136. * @param {?} testability Testability hook
  47137. * @return {?}
  47138. */
  47139. TestabilityRegistry.prototype.registerApplication = /**
  47140. * Registers an application with a testability hook so that it can be tracked
  47141. * @param {?} token token of application, root element
  47142. * @param {?} testability Testability hook
  47143. * @return {?}
  47144. */
  47145. function (token, testability) {
  47146. this._applications.set(token, testability);
  47147. };
  47148. /**
  47149. * Unregisters an application.
  47150. * @param token token of application, root element
  47151. */
  47152. /**
  47153. * Unregisters an application.
  47154. * @param {?} token token of application, root element
  47155. * @return {?}
  47156. */
  47157. TestabilityRegistry.prototype.unregisterApplication = /**
  47158. * Unregisters an application.
  47159. * @param {?} token token of application, root element
  47160. * @return {?}
  47161. */
  47162. function (token) { this._applications.delete(token); };
  47163. /**
  47164. * Unregisters all applications
  47165. */
  47166. /**
  47167. * Unregisters all applications
  47168. * @return {?}
  47169. */
  47170. TestabilityRegistry.prototype.unregisterAllApplications = /**
  47171. * Unregisters all applications
  47172. * @return {?}
  47173. */
  47174. function () { this._applications.clear(); };
  47175. /**
  47176. * Get a testability hook associated with the application
  47177. * @param elem root element
  47178. */
  47179. /**
  47180. * Get a testability hook associated with the application
  47181. * @param {?} elem root element
  47182. * @return {?}
  47183. */
  47184. TestabilityRegistry.prototype.getTestability = /**
  47185. * Get a testability hook associated with the application
  47186. * @param {?} elem root element
  47187. * @return {?}
  47188. */
  47189. function (elem) { return this._applications.get(elem) || null; };
  47190. /**
  47191. * Get all registered testabilities
  47192. */
  47193. /**
  47194. * Get all registered testabilities
  47195. * @return {?}
  47196. */
  47197. TestabilityRegistry.prototype.getAllTestabilities = /**
  47198. * Get all registered testabilities
  47199. * @return {?}
  47200. */
  47201. function () { return Array.from(this._applications.values()); };
  47202. /**
  47203. * Get all registered applications(root elements)
  47204. */
  47205. /**
  47206. * Get all registered applications(root elements)
  47207. * @return {?}
  47208. */
  47209. TestabilityRegistry.prototype.getAllRootElements = /**
  47210. * Get all registered applications(root elements)
  47211. * @return {?}
  47212. */
  47213. function () { return Array.from(this._applications.keys()); };
  47214. /**
  47215. * Find testability of a node in the Tree
  47216. * @param elem node
  47217. * @param findInAncestors whether finding testability in ancestors if testability was not found in
  47218. * current node
  47219. */
  47220. /**
  47221. * Find testability of a node in the Tree
  47222. * @param {?} elem node
  47223. * @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in
  47224. * current node
  47225. * @return {?}
  47226. */
  47227. TestabilityRegistry.prototype.findTestabilityInTree = /**
  47228. * Find testability of a node in the Tree
  47229. * @param {?} elem node
  47230. * @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in
  47231. * current node
  47232. * @return {?}
  47233. */
  47234. function (elem, findInAncestors) {
  47235. if (findInAncestors === void 0) { findInAncestors = true; }
  47236. return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
  47237. };
  47238. TestabilityRegistry.decorators = [
  47239. { type: Injectable },
  47240. ];
  47241. /** @nocollapse */
  47242. TestabilityRegistry.ctorParameters = function () { return []; };
  47243. return TestabilityRegistry;
  47244. }());
  47245. /**
  47246. * Adapter interface for retrieving the `Testability` service associated for a
  47247. * particular context.
  47248. *
  47249. * \@experimental Testability apis are primarily intended to be used by e2e test tool vendors like
  47250. * the Protractor team.
  47251. * @record
  47252. */
  47253. var _NoopGetTestability = /** @class */ (function () {
  47254. function _NoopGetTestability() {
  47255. }
  47256. /**
  47257. * @param {?} registry
  47258. * @return {?}
  47259. */
  47260. _NoopGetTestability.prototype.addToWindow = /**
  47261. * @param {?} registry
  47262. * @return {?}
  47263. */
  47264. function (registry) { };
  47265. /**
  47266. * @param {?} registry
  47267. * @param {?} elem
  47268. * @param {?} findInAncestors
  47269. * @return {?}
  47270. */
  47271. _NoopGetTestability.prototype.findTestabilityInTree = /**
  47272. * @param {?} registry
  47273. * @param {?} elem
  47274. * @param {?} findInAncestors
  47275. * @return {?}
  47276. */
  47277. function (registry, elem, findInAncestors) {
  47278. return null;
  47279. };
  47280. return _NoopGetTestability;
  47281. }());
  47282. /**
  47283. * Set the {\@link GetTestability} implementation used by the Angular testing framework.
  47284. * \@experimental
  47285. * @param {?} getter
  47286. * @return {?}
  47287. */
  47288. function setTestabilityGetter(getter) {
  47289. _testabilityGetter = getter;
  47290. }
  47291. var _testabilityGetter = new _NoopGetTestability();
  47292. /**
  47293. * @fileoverview added by tsickle
  47294. * @suppress {checkTypes} checked by tsc
  47295. */
  47296. /**
  47297. * @license
  47298. * Copyright Google Inc. All Rights Reserved.
  47299. *
  47300. * Use of this source code is governed by an MIT-style license that can be
  47301. * found in the LICENSE file at https://angular.io/license
  47302. */
  47303. var _devMode = true;
  47304. var _runModeLocked = false;
  47305. var _platform;
  47306. var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
  47307. /**
  47308. * Disable Angular's development mode, which turns off assertions and other
  47309. * checks within the framework.
  47310. *
  47311. * One important assertion this disables verifies that a change detection pass
  47312. * does not result in additional changes to any bindings (also known as
  47313. * unidirectional data flow).
  47314. *
  47315. * \@stable
  47316. * @return {?}
  47317. */
  47318. function enableProdMode() {
  47319. if (_runModeLocked) {
  47320. throw new Error('Cannot enable prod mode after platform setup.');
  47321. }
  47322. _devMode = false;
  47323. }
  47324. /**
  47325. * Returns whether Angular is in development mode. After called once,
  47326. * the value is locked and won't change any more.
  47327. *
  47328. * By default, this is true, unless a user calls `enableProdMode` before calling this.
  47329. *
  47330. * \@experimental APIs related to application bootstrap are currently under review.
  47331. * @return {?}
  47332. */
  47333. function isDevMode() {
  47334. _runModeLocked = true;
  47335. return _devMode;
  47336. }
  47337. /**
  47338. * A token for third-party components that can register themselves with NgProbe.
  47339. *
  47340. * \@experimental
  47341. */
  47342. var NgProbeToken = /** @class */ (function () {
  47343. function NgProbeToken(name, token) {
  47344. this.name = name;
  47345. this.token = token;
  47346. }
  47347. return NgProbeToken;
  47348. }());
  47349. /**
  47350. * Creates a platform.
  47351. * Platforms have to be eagerly created via this function.
  47352. *
  47353. * \@experimental APIs related to application bootstrap are currently under review.
  47354. * @param {?} injector
  47355. * @return {?}
  47356. */
  47357. function createPlatform(injector) {
  47358. if (_platform && !_platform.destroyed &&
  47359. !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
  47360. throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
  47361. }
  47362. _platform = injector.get(PlatformRef);
  47363. var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null);
  47364. if (inits)
  47365. inits.forEach(function (init) { return init(); });
  47366. return _platform;
  47367. }
  47368. /**
  47369. * Creates a factory for a platform
  47370. *
  47371. * \@experimental APIs related to application bootstrap are currently under review.
  47372. * @param {?} parentPlatformFactory
  47373. * @param {?} name
  47374. * @param {?=} providers
  47375. * @return {?}
  47376. */
  47377. function createPlatformFactory(parentPlatformFactory, name, providers) {
  47378. if (providers === void 0) { providers = []; }
  47379. var /** @type {?} */ desc = "Platform: " + name;
  47380. var /** @type {?} */ marker = new InjectionToken(desc);
  47381. return function (extraProviders) {
  47382. if (extraProviders === void 0) { extraProviders = []; }
  47383. var /** @type {?} */ platform = getPlatform();
  47384. if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
  47385. if (parentPlatformFactory) {
  47386. parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
  47387. }
  47388. else {
  47389. var /** @type {?} */ injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true });
  47390. createPlatform(Injector.create({ providers: injectedProviders, name: desc }));
  47391. }
  47392. }
  47393. return assertPlatform(marker);
  47394. };
  47395. }
  47396. /**
  47397. * Checks that there currently is a platform which contains the given token as a provider.
  47398. *
  47399. * \@experimental APIs related to application bootstrap are currently under review.
  47400. * @param {?} requiredToken
  47401. * @return {?}
  47402. */
  47403. function assertPlatform(requiredToken) {
  47404. var /** @type {?} */ platform = getPlatform();
  47405. if (!platform) {
  47406. throw new Error('No platform exists!');
  47407. }
  47408. if (!platform.injector.get(requiredToken, null)) {
  47409. throw new Error('A platform with a different configuration has been created. Please destroy it first.');
  47410. }
  47411. return platform;
  47412. }
  47413. /**
  47414. * Destroy the existing platform.
  47415. *
  47416. * \@experimental APIs related to application bootstrap are currently under review.
  47417. * @return {?}
  47418. */
  47419. function destroyPlatform() {
  47420. if (_platform && !_platform.destroyed) {
  47421. _platform.destroy();
  47422. }
  47423. }
  47424. /**
  47425. * Returns the current platform.
  47426. *
  47427. * \@experimental APIs related to application bootstrap are currently under review.
  47428. * @return {?}
  47429. */
  47430. function getPlatform() {
  47431. return _platform && !_platform.destroyed ? _platform : null;
  47432. }
  47433. /**
  47434. * Provides additional options to the bootstraping process.
  47435. *
  47436. * \@stable
  47437. * @record
  47438. */
  47439. /**
  47440. * The Angular platform is the entry point for Angular on a web page. Each page
  47441. * has exactly one platform, and services (such as reflection) which are common
  47442. * to every Angular application running on the page are bound in its scope.
  47443. *
  47444. * A page's platform is initialized implicitly when a platform is created via a platform factory
  47445. * (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function.
  47446. *
  47447. * \@stable
  47448. */
  47449. var PlatformRef = /** @class */ (function () {
  47450. /** @internal */
  47451. function PlatformRef(_injector) {
  47452. this._injector = _injector;
  47453. this._modules = [];
  47454. this._destroyListeners = [];
  47455. this._destroyed = false;
  47456. }
  47457. /**
  47458. * Creates an instance of an `@NgModule` for the given platform
  47459. * for offline compilation.
  47460. *
  47461. * ## Simple Example
  47462. *
  47463. * ```typescript
  47464. * my_module.ts:
  47465. *
  47466. * @NgModule({
  47467. * imports: [BrowserModule]
  47468. * })
  47469. * class MyModule {}
  47470. *
  47471. * main.ts:
  47472. * import {MyModuleNgFactory} from './my_module.ngfactory';
  47473. * import {platformBrowser} from '@angular/platform-browser';
  47474. *
  47475. * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
  47476. * ```
  47477. *
  47478. * @experimental APIs related to application bootstrap are currently under review.
  47479. */
  47480. /**
  47481. * Creates an instance of an `\@NgModule` for the given platform
  47482. * for offline compilation.
  47483. *
  47484. * ## Simple Example
  47485. *
  47486. * ```typescript
  47487. * my_module.ts:
  47488. *
  47489. * \@NgModule({
  47490. * imports: [BrowserModule]
  47491. * })
  47492. * class MyModule {}
  47493. *
  47494. * main.ts:
  47495. * import {MyModuleNgFactory} from './my_module.ngfactory';
  47496. * import {platformBrowser} from '\@angular/platform-browser';
  47497. *
  47498. * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
  47499. * ```
  47500. *
  47501. * \@experimental APIs related to application bootstrap are currently under review.
  47502. * @template M
  47503. * @param {?} moduleFactory
  47504. * @param {?=} options
  47505. * @return {?}
  47506. */
  47507. PlatformRef.prototype.bootstrapModuleFactory = /**
  47508. * Creates an instance of an `\@NgModule` for the given platform
  47509. * for offline compilation.
  47510. *
  47511. * ## Simple Example
  47512. *
  47513. * ```typescript
  47514. * my_module.ts:
  47515. *
  47516. * \@NgModule({
  47517. * imports: [BrowserModule]
  47518. * })
  47519. * class MyModule {}
  47520. *
  47521. * main.ts:
  47522. * import {MyModuleNgFactory} from './my_module.ngfactory';
  47523. * import {platformBrowser} from '\@angular/platform-browser';
  47524. *
  47525. * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
  47526. * ```
  47527. *
  47528. * \@experimental APIs related to application bootstrap are currently under review.
  47529. * @template M
  47530. * @param {?} moduleFactory
  47531. * @param {?=} options
  47532. * @return {?}
  47533. */
  47534. function (moduleFactory, options) {
  47535. var _this = this;
  47536. // Note: We need to create the NgZone _before_ we instantiate the module,
  47537. // as instantiating the module creates some providers eagerly.
  47538. // So we create a mini parent injector that just contains the new NgZone and
  47539. // pass that as parent to the NgModuleFactory.
  47540. var /** @type {?} */ ngZoneOption = options ? options.ngZone : undefined;
  47541. var /** @type {?} */ ngZone = getNgZone(ngZoneOption);
  47542. var /** @type {?} */ providers = [{ provide: NgZone, useValue: ngZone }];
  47543. // Attention: Don't use ApplicationRef.run here,
  47544. // as we want to be sure that all possible constructor calls are inside `ngZone.run`!
  47545. return ngZone.run(function () {
  47546. var /** @type {?} */ ngZoneInjector = Injector.create({ providers: providers, parent: _this.injector, name: moduleFactory.moduleType.name });
  47547. var /** @type {?} */ moduleRef = /** @type {?} */ (moduleFactory.create(ngZoneInjector));
  47548. var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
  47549. if (!exceptionHandler) {
  47550. throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
  47551. }
  47552. moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */
  47553. ((ngZone)).runOutsideAngular(function () { return ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); });
  47554. return _callAndReportToErrorHandler(exceptionHandler, /** @type {?} */ ((ngZone)), function () {
  47555. var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus);
  47556. initStatus.runInitializers();
  47557. return initStatus.donePromise.then(function () {
  47558. _this._moduleDoBootstrap(moduleRef);
  47559. return moduleRef;
  47560. });
  47561. });
  47562. });
  47563. };
  47564. /**
  47565. * Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
  47566. *
  47567. * ## Simple Example
  47568. *
  47569. * ```typescript
  47570. * @NgModule({
  47571. * imports: [BrowserModule]
  47572. * })
  47573. * class MyModule {}
  47574. *
  47575. * let moduleRef = platformBrowser().bootstrapModule(MyModule);
  47576. * ```
  47577. * @stable
  47578. */
  47579. /**
  47580. * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
  47581. *
  47582. * ## Simple Example
  47583. *
  47584. * ```typescript
  47585. * \@NgModule({
  47586. * imports: [BrowserModule]
  47587. * })
  47588. * class MyModule {}
  47589. *
  47590. * let moduleRef = platformBrowser().bootstrapModule(MyModule);
  47591. * ```
  47592. * \@stable
  47593. * @template M
  47594. * @param {?} moduleType
  47595. * @param {?=} compilerOptions
  47596. * @return {?}
  47597. */
  47598. PlatformRef.prototype.bootstrapModule = /**
  47599. * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
  47600. *
  47601. * ## Simple Example
  47602. *
  47603. * ```typescript
  47604. * \@NgModule({
  47605. * imports: [BrowserModule]
  47606. * })
  47607. * class MyModule {}
  47608. *
  47609. * let moduleRef = platformBrowser().bootstrapModule(MyModule);
  47610. * ```
  47611. * \@stable
  47612. * @template M
  47613. * @param {?} moduleType
  47614. * @param {?=} compilerOptions
  47615. * @return {?}
  47616. */
  47617. function (moduleType, compilerOptions) {
  47618. var _this = this;
  47619. if (compilerOptions === void 0) { compilerOptions = []; }
  47620. var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory);
  47621. var /** @type {?} */ options = optionsReducer({}, compilerOptions);
  47622. var /** @type {?} */ compiler = compilerFactory.createCompiler([options]);
  47623. return compiler.compileModuleAsync(moduleType)
  47624. .then(function (moduleFactory) { return _this.bootstrapModuleFactory(moduleFactory, options); });
  47625. };
  47626. /**
  47627. * @param {?} moduleRef
  47628. * @return {?}
  47629. */
  47630. PlatformRef.prototype._moduleDoBootstrap = /**
  47631. * @param {?} moduleRef
  47632. * @return {?}
  47633. */
  47634. function (moduleRef) {
  47635. var /** @type {?} */ appRef = /** @type {?} */ (moduleRef.injector.get(ApplicationRef));
  47636. if (moduleRef._bootstrapComponents.length > 0) {
  47637. moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
  47638. }
  47639. else if (moduleRef.instance.ngDoBootstrap) {
  47640. moduleRef.instance.ngDoBootstrap(appRef);
  47641. }
  47642. else {
  47643. throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
  47644. "Please define one of these.");
  47645. }
  47646. this._modules.push(moduleRef);
  47647. };
  47648. /**
  47649. * Register a listener to be called when the platform is disposed.
  47650. */
  47651. /**
  47652. * Register a listener to be called when the platform is disposed.
  47653. * @param {?} callback
  47654. * @return {?}
  47655. */
  47656. PlatformRef.prototype.onDestroy = /**
  47657. * Register a listener to be called when the platform is disposed.
  47658. * @param {?} callback
  47659. * @return {?}
  47660. */
  47661. function (callback) { this._destroyListeners.push(callback); };
  47662. Object.defineProperty(PlatformRef.prototype, "injector", {
  47663. /**
  47664. * Retrieve the platform {@link Injector}, which is the parent injector for
  47665. * every Angular application on the page and provides singleton providers.
  47666. */
  47667. get: /**
  47668. * Retrieve the platform {\@link Injector}, which is the parent injector for
  47669. * every Angular application on the page and provides singleton providers.
  47670. * @return {?}
  47671. */
  47672. function () { return this._injector; },
  47673. enumerable: true,
  47674. configurable: true
  47675. });
  47676. /**
  47677. * Destroy the Angular platform and all Angular applications on the page.
  47678. */
  47679. /**
  47680. * Destroy the Angular platform and all Angular applications on the page.
  47681. * @return {?}
  47682. */
  47683. PlatformRef.prototype.destroy = /**
  47684. * Destroy the Angular platform and all Angular applications on the page.
  47685. * @return {?}
  47686. */
  47687. function () {
  47688. if (this._destroyed) {
  47689. throw new Error('The platform has already been destroyed!');
  47690. }
  47691. this._modules.slice().forEach(function (module) { return module.destroy(); });
  47692. this._destroyListeners.forEach(function (listener) { return listener(); });
  47693. this._destroyed = true;
  47694. };
  47695. Object.defineProperty(PlatformRef.prototype, "destroyed", {
  47696. get: /**
  47697. * @return {?}
  47698. */
  47699. function () { return this._destroyed; },
  47700. enumerable: true,
  47701. configurable: true
  47702. });
  47703. PlatformRef.decorators = [
  47704. { type: Injectable },
  47705. ];
  47706. /** @nocollapse */
  47707. PlatformRef.ctorParameters = function () { return [
  47708. { type: Injector, },
  47709. ]; };
  47710. return PlatformRef;
  47711. }());
  47712. /**
  47713. * @param {?=} ngZoneOption
  47714. * @return {?}
  47715. */
  47716. function getNgZone(ngZoneOption) {
  47717. var /** @type {?} */ ngZone;
  47718. if (ngZoneOption === 'noop') {
  47719. ngZone = new NoopNgZone();
  47720. }
  47721. else {
  47722. ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) ||
  47723. new NgZone({ enableLongStackTrace: isDevMode() });
  47724. }
  47725. return ngZone;
  47726. }
  47727. /**
  47728. * @param {?} errorHandler
  47729. * @param {?} ngZone
  47730. * @param {?} callback
  47731. * @return {?}
  47732. */
  47733. function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
  47734. try {
  47735. var /** @type {?} */ result = callback();
  47736. if (isPromise(result)) {
  47737. return result.catch(function (e) {
  47738. ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
  47739. // rethrow as the exception handler might not do it
  47740. throw e;
  47741. });
  47742. }
  47743. return result;
  47744. }
  47745. catch (/** @type {?} */ e) {
  47746. ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
  47747. // rethrow as the exception handler might not do it
  47748. throw e;
  47749. }
  47750. }
  47751. /**
  47752. * @template T
  47753. * @param {?} dst
  47754. * @param {?} objs
  47755. * @return {?}
  47756. */
  47757. function optionsReducer(dst, objs) {
  47758. if (Array.isArray(objs)) {
  47759. dst = objs.reduce(optionsReducer, dst);
  47760. }
  47761. else {
  47762. dst = Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, dst, (/** @type {?} */ (objs)));
  47763. }
  47764. return dst;
  47765. }
  47766. /**
  47767. * A reference to an Angular application running on a page.
  47768. *
  47769. * \@stable
  47770. */
  47771. var ApplicationRef = /** @class */ (function () {
  47772. /** @internal */
  47773. function ApplicationRef(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
  47774. var _this = this;
  47775. this._zone = _zone;
  47776. this._console = _console;
  47777. this._injector = _injector;
  47778. this._exceptionHandler = _exceptionHandler;
  47779. this._componentFactoryResolver = _componentFactoryResolver;
  47780. this._initStatus = _initStatus;
  47781. this._bootstrapListeners = [];
  47782. this._views = [];
  47783. this._runningTick = false;
  47784. this._enforceNoNewChanges = false;
  47785. this._stable = true;
  47786. /**
  47787. * Get a list of component types registered to this application.
  47788. * This list is populated even before the component is created.
  47789. */
  47790. this.componentTypes = [];
  47791. /**
  47792. * Get a list of components registered to this application.
  47793. */
  47794. this.components = [];
  47795. this._enforceNoNewChanges = isDevMode();
  47796. this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
  47797. var /** @type {?} */ isCurrentlyStable = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__["a" /* Observable */](function (observer) {
  47798. _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
  47799. !_this._zone.hasPendingMicrotasks;
  47800. _this._zone.runOutsideAngular(function () {
  47801. observer.next(_this._stable);
  47802. observer.complete();
  47803. });
  47804. });
  47805. var /** @type {?} */ isStable = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__["a" /* Observable */](function (observer) {
  47806. // Create the subscription to onStable outside the Angular Zone so that
  47807. // the callback is run outside the Angular Zone.
  47808. var /** @type {?} */ stableSub;
  47809. _this._zone.runOutsideAngular(function () {
  47810. stableSub = _this._zone.onStable.subscribe(function () {
  47811. NgZone.assertNotInAngularZone();
  47812. // Check whether there are no pending macro/micro tasks in the next tick
  47813. // to allow for NgZone to update the state.
  47814. scheduleMicroTask(function () {
  47815. if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
  47816. !_this._zone.hasPendingMicrotasks) {
  47817. _this._stable = true;
  47818. observer.next(true);
  47819. }
  47820. });
  47821. });
  47822. });
  47823. var /** @type {?} */ unstableSub = _this._zone.onUnstable.subscribe(function () {
  47824. NgZone.assertInAngularZone();
  47825. if (_this._stable) {
  47826. _this._stable = false;
  47827. _this._zone.runOutsideAngular(function () { observer.next(false); });
  47828. }
  47829. });
  47830. return function () {
  47831. stableSub.unsubscribe();
  47832. unstableSub.unsubscribe();
  47833. };
  47834. });
  47835. (/** @type {?} */ (this)).isStable =
  47836. Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__["a" /* merge */])(isCurrentlyStable, __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__["a" /* share */].call(isStable));
  47837. }
  47838. /**
  47839. * Bootstrap a new component at the root level of the application.
  47840. *
  47841. * ### Bootstrap process
  47842. *
  47843. * When bootstrapping a new root component into an application, Angular mounts the
  47844. * specified application component onto DOM elements identified by the [componentType]'s
  47845. * selector and kicks off automatic change detection to finish initializing the component.
  47846. *
  47847. * Optionally, a component can be mounted onto a DOM element that does not match the
  47848. * [componentType]'s selector.
  47849. *
  47850. * ### Example
  47851. * {@example core/ts/platform/platform.ts region='longform'}
  47852. */
  47853. /**
  47854. * Bootstrap a new component at the root level of the application.
  47855. *
  47856. * ### Bootstrap process
  47857. *
  47858. * When bootstrapping a new root component into an application, Angular mounts the
  47859. * specified application component onto DOM elements identified by the [componentType]'s
  47860. * selector and kicks off automatic change detection to finish initializing the component.
  47861. *
  47862. * Optionally, a component can be mounted onto a DOM element that does not match the
  47863. * [componentType]'s selector.
  47864. *
  47865. * ### Example
  47866. * {\@example core/ts/platform/platform.ts region='longform'}
  47867. * @template C
  47868. * @param {?} componentOrFactory
  47869. * @param {?=} rootSelectorOrNode
  47870. * @return {?}
  47871. */
  47872. ApplicationRef.prototype.bootstrap = /**
  47873. * Bootstrap a new component at the root level of the application.
  47874. *
  47875. * ### Bootstrap process
  47876. *
  47877. * When bootstrapping a new root component into an application, Angular mounts the
  47878. * specified application component onto DOM elements identified by the [componentType]'s
  47879. * selector and kicks off automatic change detection to finish initializing the component.
  47880. *
  47881. * Optionally, a component can be mounted onto a DOM element that does not match the
  47882. * [componentType]'s selector.
  47883. *
  47884. * ### Example
  47885. * {\@example core/ts/platform/platform.ts region='longform'}
  47886. * @template C
  47887. * @param {?} componentOrFactory
  47888. * @param {?=} rootSelectorOrNode
  47889. * @return {?}
  47890. */
  47891. function (componentOrFactory, rootSelectorOrNode) {
  47892. var _this = this;
  47893. if (!this._initStatus.done) {
  47894. throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
  47895. }
  47896. var /** @type {?} */ componentFactory;
  47897. if (componentOrFactory instanceof ComponentFactory) {
  47898. componentFactory = componentOrFactory;
  47899. }
  47900. else {
  47901. componentFactory =
  47902. /** @type {?} */ ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
  47903. }
  47904. this.componentTypes.push(componentFactory.componentType);
  47905. // Create a factory associated with the current module if it's not bound to some other
  47906. var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
  47907. null :
  47908. this._injector.get(NgModuleRef);
  47909. var /** @type {?} */ selectorOrNode = rootSelectorOrNode || componentFactory.selector;
  47910. var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
  47911. compRef.onDestroy(function () { _this._unloadComponent(compRef); });
  47912. var /** @type {?} */ testability = compRef.injector.get(Testability, null);
  47913. if (testability) {
  47914. compRef.injector.get(TestabilityRegistry)
  47915. .registerApplication(compRef.location.nativeElement, testability);
  47916. }
  47917. this._loadComponent(compRef);
  47918. if (isDevMode()) {
  47919. this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
  47920. }
  47921. return compRef;
  47922. };
  47923. /**
  47924. * Invoke this method to explicitly process change detection and its side-effects.
  47925. *
  47926. * In development mode, `tick()` also performs a second change detection cycle to ensure that no
  47927. * further changes are detected. If additional changes are picked up during this second cycle,
  47928. * bindings in the app have side-effects that cannot be resolved in a single change detection
  47929. * pass.
  47930. * In this case, Angular throws an error, since an Angular application can only have one change
  47931. * detection pass during which all change detection must complete.
  47932. */
  47933. /**
  47934. * Invoke this method to explicitly process change detection and its side-effects.
  47935. *
  47936. * In development mode, `tick()` also performs a second change detection cycle to ensure that no
  47937. * further changes are detected. If additional changes are picked up during this second cycle,
  47938. * bindings in the app have side-effects that cannot be resolved in a single change detection
  47939. * pass.
  47940. * In this case, Angular throws an error, since an Angular application can only have one change
  47941. * detection pass during which all change detection must complete.
  47942. * @return {?}
  47943. */
  47944. ApplicationRef.prototype.tick = /**
  47945. * Invoke this method to explicitly process change detection and its side-effects.
  47946. *
  47947. * In development mode, `tick()` also performs a second change detection cycle to ensure that no
  47948. * further changes are detected. If additional changes are picked up during this second cycle,
  47949. * bindings in the app have side-effects that cannot be resolved in a single change detection
  47950. * pass.
  47951. * In this case, Angular throws an error, since an Angular application can only have one change
  47952. * detection pass during which all change detection must complete.
  47953. * @return {?}
  47954. */
  47955. function () {
  47956. var _this = this;
  47957. if (this._runningTick) {
  47958. throw new Error('ApplicationRef.tick is called recursively');
  47959. }
  47960. var /** @type {?} */ scope = ApplicationRef._tickScope();
  47961. try {
  47962. this._runningTick = true;
  47963. this._views.forEach(function (view) { return view.detectChanges(); });
  47964. if (this._enforceNoNewChanges) {
  47965. this._views.forEach(function (view) { return view.checkNoChanges(); });
  47966. }
  47967. }
  47968. catch (/** @type {?} */ e) {
  47969. // Attention: Don't rethrow as it could cancel subscriptions to Observables!
  47970. this._zone.runOutsideAngular(function () { return _this._exceptionHandler.handleError(e); });
  47971. }
  47972. finally {
  47973. this._runningTick = false;
  47974. wtfLeave(scope);
  47975. }
  47976. };
  47977. /**
  47978. * Attaches a view so that it will be dirty checked.
  47979. * The view will be automatically detached when it is destroyed.
  47980. * This will throw if the view is already attached to a ViewContainer.
  47981. */
  47982. /**
  47983. * Attaches a view so that it will be dirty checked.
  47984. * The view will be automatically detached when it is destroyed.
  47985. * This will throw if the view is already attached to a ViewContainer.
  47986. * @param {?} viewRef
  47987. * @return {?}
  47988. */
  47989. ApplicationRef.prototype.attachView = /**
  47990. * Attaches a view so that it will be dirty checked.
  47991. * The view will be automatically detached when it is destroyed.
  47992. * This will throw if the view is already attached to a ViewContainer.
  47993. * @param {?} viewRef
  47994. * @return {?}
  47995. */
  47996. function (viewRef) {
  47997. var /** @type {?} */ view = (/** @type {?} */ (viewRef));
  47998. this._views.push(view);
  47999. view.attachToAppRef(this);
  48000. };
  48001. /**
  48002. * Detaches a view from dirty checking again.
  48003. */
  48004. /**
  48005. * Detaches a view from dirty checking again.
  48006. * @param {?} viewRef
  48007. * @return {?}
  48008. */
  48009. ApplicationRef.prototype.detachView = /**
  48010. * Detaches a view from dirty checking again.
  48011. * @param {?} viewRef
  48012. * @return {?}
  48013. */
  48014. function (viewRef) {
  48015. var /** @type {?} */ view = (/** @type {?} */ (viewRef));
  48016. remove(this._views, view);
  48017. view.detachFromAppRef();
  48018. };
  48019. /**
  48020. * @param {?} componentRef
  48021. * @return {?}
  48022. */
  48023. ApplicationRef.prototype._loadComponent = /**
  48024. * @param {?} componentRef
  48025. * @return {?}
  48026. */
  48027. function (componentRef) {
  48028. this.attachView(componentRef.hostView);
  48029. this.tick();
  48030. this.components.push(componentRef);
  48031. // Get the listeners lazily to prevent DI cycles.
  48032. var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
  48033. listeners.forEach(function (listener) { return listener(componentRef); });
  48034. };
  48035. /**
  48036. * @param {?} componentRef
  48037. * @return {?}
  48038. */
  48039. ApplicationRef.prototype._unloadComponent = /**
  48040. * @param {?} componentRef
  48041. * @return {?}
  48042. */
  48043. function (componentRef) {
  48044. this.detachView(componentRef.hostView);
  48045. remove(this.components, componentRef);
  48046. };
  48047. /** @internal */
  48048. /**
  48049. * \@internal
  48050. * @return {?}
  48051. */
  48052. ApplicationRef.prototype.ngOnDestroy = /**
  48053. * \@internal
  48054. * @return {?}
  48055. */
  48056. function () {
  48057. // TODO(alxhub): Dispose of the NgZone.
  48058. this._views.slice().forEach(function (view) { return view.destroy(); });
  48059. };
  48060. Object.defineProperty(ApplicationRef.prototype, "viewCount", {
  48061. /**
  48062. * Returns the number of attached views.
  48063. */
  48064. get: /**
  48065. * Returns the number of attached views.
  48066. * @return {?}
  48067. */
  48068. function () { return this._views.length; },
  48069. enumerable: true,
  48070. configurable: true
  48071. });
  48072. /**
  48073. * \@internal
  48074. */
  48075. ApplicationRef._tickScope = wtfCreateScope('ApplicationRef#tick()');
  48076. ApplicationRef.decorators = [
  48077. { type: Injectable },
  48078. ];
  48079. /** @nocollapse */
  48080. ApplicationRef.ctorParameters = function () { return [
  48081. { type: NgZone, },
  48082. { type: Console, },
  48083. { type: Injector, },
  48084. { type: ErrorHandler, },
  48085. { type: ComponentFactoryResolver, },
  48086. { type: ApplicationInitStatus, },
  48087. ]; };
  48088. return ApplicationRef;
  48089. }());
  48090. /**
  48091. * @template T
  48092. * @param {?} list
  48093. * @param {?} el
  48094. * @return {?}
  48095. */
  48096. function remove(list, el) {
  48097. var /** @type {?} */ index = list.indexOf(el);
  48098. if (index > -1) {
  48099. list.splice(index, 1);
  48100. }
  48101. }
  48102. /**
  48103. * @fileoverview added by tsickle
  48104. * @suppress {checkTypes} checked by tsc
  48105. */
  48106. /**
  48107. * @license
  48108. * Copyright Google Inc. All Rights Reserved.
  48109. *
  48110. * Use of this source code is governed by an MIT-style license that can be
  48111. * found in the LICENSE file at https://angular.io/license
  48112. */
  48113. /**
  48114. * @fileoverview added by tsickle
  48115. * @suppress {checkTypes} checked by tsc
  48116. */
  48117. /**
  48118. * @license
  48119. * Copyright Google Inc. All Rights Reserved.
  48120. *
  48121. * Use of this source code is governed by an MIT-style license that can be
  48122. * found in the LICENSE file at https://angular.io/license
  48123. */
  48124. /**
  48125. * @deprecated Use `RendererType2` (and `Renderer2`) instead.
  48126. */
  48127. var RenderComponentType = /** @class */ (function () {
  48128. function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
  48129. this.id = id;
  48130. this.templateUrl = templateUrl;
  48131. this.slotCount = slotCount;
  48132. this.encapsulation = encapsulation;
  48133. this.styles = styles;
  48134. this.animations = animations;
  48135. }
  48136. return RenderComponentType;
  48137. }());
  48138. /**
  48139. * @deprecated Debug info is handeled internally in the view engine now.
  48140. * @abstract
  48141. */
  48142. var RenderDebugInfo = /** @class */ (function () {
  48143. function RenderDebugInfo() {
  48144. }
  48145. return RenderDebugInfo;
  48146. }());
  48147. /**
  48148. * @deprecated Use the `Renderer2` instead.
  48149. * @record
  48150. */
  48151. /**
  48152. * @deprecated Use the `Renderer2` instead.
  48153. * @abstract
  48154. */
  48155. var Renderer = /** @class */ (function () {
  48156. function Renderer() {
  48157. }
  48158. return Renderer;
  48159. }());
  48160. var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
  48161. /**
  48162. * Injectable service that provides a low-level interface for modifying the UI.
  48163. *
  48164. * Use this service to bypass Angular's templating and make custom UI changes that can't be
  48165. * expressed declaratively. For example if you need to set a property or an attribute whose name is
  48166. * not statically known, use {\@link Renderer#setElementProperty setElementProperty} or
  48167. * {\@link Renderer#setElementAttribute setElementAttribute} respectively.
  48168. *
  48169. * If you are implementing a custom renderer, you must implement this interface.
  48170. *
  48171. * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
  48172. *
  48173. * @deprecated Use `RendererFactory2` instead.
  48174. * @abstract
  48175. */
  48176. var RootRenderer = /** @class */ (function () {
  48177. function RootRenderer() {
  48178. }
  48179. return RootRenderer;
  48180. }());
  48181. /**
  48182. * \@experimental
  48183. * @record
  48184. */
  48185. /**
  48186. * \@experimental
  48187. * @abstract
  48188. */
  48189. var RendererFactory2 = /** @class */ (function () {
  48190. function RendererFactory2() {
  48191. }
  48192. return RendererFactory2;
  48193. }());
  48194. /** @enum {number} */
  48195. var RendererStyleFlags2 = {
  48196. Important: 1,
  48197. DashCase: 2,
  48198. };
  48199. RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
  48200. RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
  48201. /**
  48202. * \@experimental
  48203. * @abstract
  48204. */
  48205. var Renderer2 = /** @class */ (function () {
  48206. function Renderer2() {
  48207. }
  48208. return Renderer2;
  48209. }());
  48210. /**
  48211. * @fileoverview added by tsickle
  48212. * @suppress {checkTypes} checked by tsc
  48213. */
  48214. /**
  48215. * @license
  48216. * Copyright Google Inc. All Rights Reserved.
  48217. *
  48218. * Use of this source code is governed by an MIT-style license that can be
  48219. * found in the LICENSE file at https://angular.io/license
  48220. */
  48221. /**
  48222. * @fileoverview added by tsickle
  48223. * @suppress {checkTypes} checked by tsc
  48224. */
  48225. /**
  48226. * @license
  48227. * Copyright Google Inc. All Rights Reserved.
  48228. *
  48229. * Use of this source code is governed by an MIT-style license that can be
  48230. * found in the LICENSE file at https://angular.io/license
  48231. */
  48232. /**
  48233. * A wrapper around a native element inside of a View.
  48234. *
  48235. * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
  48236. * element.
  48237. *
  48238. * \@security Permitting direct access to the DOM can make your application more vulnerable to
  48239. * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
  48240. * [Security Guide](http://g.co/ng/security).
  48241. *
  48242. * \@stable
  48243. */
  48244. var ElementRef = /** @class */ (function () {
  48245. function ElementRef(nativeElement) {
  48246. this.nativeElement = nativeElement;
  48247. }
  48248. return ElementRef;
  48249. }());
  48250. /**
  48251. * @fileoverview added by tsickle
  48252. * @suppress {checkTypes} checked by tsc
  48253. */
  48254. /**
  48255. * @license
  48256. * Copyright Google Inc. All Rights Reserved.
  48257. *
  48258. * Use of this source code is governed by an MIT-style license that can be
  48259. * found in the LICENSE file at https://angular.io/license
  48260. */
  48261. /**
  48262. * Used to load ng module factories.
  48263. * \@stable
  48264. * @abstract
  48265. */
  48266. var NgModuleFactoryLoader = /** @class */ (function () {
  48267. function NgModuleFactoryLoader() {
  48268. }
  48269. return NgModuleFactoryLoader;
  48270. }());
  48271. var moduleFactories = new Map();
  48272. /**
  48273. * Registers a loaded module. Should only be called from generated NgModuleFactory code.
  48274. * \@experimental
  48275. * @param {?} id
  48276. * @param {?} factory
  48277. * @return {?}
  48278. */
  48279. function registerModuleFactory(id, factory) {
  48280. var /** @type {?} */ existing = moduleFactories.get(id);
  48281. if (existing) {
  48282. throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
  48283. }
  48284. moduleFactories.set(id, factory);
  48285. }
  48286. /**
  48287. * @return {?}
  48288. */
  48289. /**
  48290. * Returns the NgModuleFactory with the given id, if it exists and has been loaded.
  48291. * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
  48292. * cannot be found.
  48293. * \@experimental
  48294. * @param {?} id
  48295. * @return {?}
  48296. */
  48297. function getModuleFactory(id) {
  48298. var /** @type {?} */ factory = moduleFactories.get(id);
  48299. if (!factory)
  48300. throw new Error("No module with ID " + id + " loaded");
  48301. return factory;
  48302. }
  48303. /**
  48304. * @fileoverview added by tsickle
  48305. * @suppress {checkTypes} checked by tsc
  48306. */
  48307. /**
  48308. * @license
  48309. * Copyright Google Inc. All Rights Reserved.
  48310. *
  48311. * Use of this source code is governed by an MIT-style license that can be
  48312. * found in the LICENSE file at https://angular.io/license
  48313. */
  48314. /**
  48315. * An unmodifiable list of items that Angular keeps up to date when the state
  48316. * of the application changes.
  48317. *
  48318. * The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList}
  48319. * provide.
  48320. *
  48321. * Implements an iterable interface, therefore it can be used in both ES6
  48322. * javascript `for (var i of items)` loops as well as in Angular templates with
  48323. * `*ngFor="let i of myList"`.
  48324. *
  48325. * Changes can be observed by subscribing to the changes `Observable`.
  48326. *
  48327. * NOTE: In the future this class will implement an `Observable` interface.
  48328. *
  48329. * ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
  48330. * ```typescript
  48331. * \@Component({...})
  48332. * class Container {
  48333. * \@ViewChildren(Item) items:QueryList<Item>;
  48334. * }
  48335. * ```
  48336. * \@stable
  48337. */
  48338. var QueryList = /** @class */ (function () {
  48339. function QueryList() {
  48340. this.dirty = true;
  48341. this._results = [];
  48342. this.changes = new EventEmitter();
  48343. this.length = 0;
  48344. }
  48345. /**
  48346. * See
  48347. * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
  48348. */
  48349. /**
  48350. * See
  48351. * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
  48352. * @template U
  48353. * @param {?} fn
  48354. * @return {?}
  48355. */
  48356. QueryList.prototype.map = /**
  48357. * See
  48358. * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
  48359. * @template U
  48360. * @param {?} fn
  48361. * @return {?}
  48362. */
  48363. function (fn) { return this._results.map(fn); };
  48364. /**
  48365. * See
  48366. * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
  48367. */
  48368. /**
  48369. * See
  48370. * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
  48371. * @param {?} fn
  48372. * @return {?}
  48373. */
  48374. QueryList.prototype.filter = /**
  48375. * See
  48376. * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
  48377. * @param {?} fn
  48378. * @return {?}
  48379. */
  48380. function (fn) {
  48381. return this._results.filter(fn);
  48382. };
  48383. /**
  48384. * See
  48385. * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
  48386. */
  48387. /**
  48388. * See
  48389. * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
  48390. * @param {?} fn
  48391. * @return {?}
  48392. */
  48393. QueryList.prototype.find = /**
  48394. * See
  48395. * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
  48396. * @param {?} fn
  48397. * @return {?}
  48398. */
  48399. function (fn) {
  48400. return this._results.find(fn);
  48401. };
  48402. /**
  48403. * See
  48404. * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
  48405. */
  48406. /**
  48407. * See
  48408. * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
  48409. * @template U
  48410. * @param {?} fn
  48411. * @param {?} init
  48412. * @return {?}
  48413. */
  48414. QueryList.prototype.reduce = /**
  48415. * See
  48416. * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
  48417. * @template U
  48418. * @param {?} fn
  48419. * @param {?} init
  48420. * @return {?}
  48421. */
  48422. function (fn, init) {
  48423. return this._results.reduce(fn, init);
  48424. };
  48425. /**
  48426. * See
  48427. * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
  48428. */
  48429. /**
  48430. * See
  48431. * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
  48432. * @param {?} fn
  48433. * @return {?}
  48434. */
  48435. QueryList.prototype.forEach = /**
  48436. * See
  48437. * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
  48438. * @param {?} fn
  48439. * @return {?}
  48440. */
  48441. function (fn) { this._results.forEach(fn); };
  48442. /**
  48443. * See
  48444. * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
  48445. */
  48446. /**
  48447. * See
  48448. * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
  48449. * @param {?} fn
  48450. * @return {?}
  48451. */
  48452. QueryList.prototype.some = /**
  48453. * See
  48454. * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
  48455. * @param {?} fn
  48456. * @return {?}
  48457. */
  48458. function (fn) {
  48459. return this._results.some(fn);
  48460. };
  48461. /**
  48462. * @return {?}
  48463. */
  48464. QueryList.prototype.toArray = /**
  48465. * @return {?}
  48466. */
  48467. function () { return this._results.slice(); };
  48468. /**
  48469. * @return {?}
  48470. */
  48471. QueryList.prototype[getSymbolIterator()] = /**
  48472. * @return {?}
  48473. */
  48474. function () { return (/** @type {?} */ (this._results))[getSymbolIterator()](); };
  48475. /**
  48476. * @return {?}
  48477. */
  48478. QueryList.prototype.toString = /**
  48479. * @return {?}
  48480. */
  48481. function () { return this._results.toString(); };
  48482. /**
  48483. * @param {?} res
  48484. * @return {?}
  48485. */
  48486. QueryList.prototype.reset = /**
  48487. * @param {?} res
  48488. * @return {?}
  48489. */
  48490. function (res) {
  48491. this._results = flatten(res);
  48492. (/** @type {?} */ (this)).dirty = false;
  48493. (/** @type {?} */ (this)).length = this._results.length;
  48494. (/** @type {?} */ (this)).last = this._results[this.length - 1];
  48495. (/** @type {?} */ (this)).first = this._results[0];
  48496. };
  48497. /**
  48498. * @return {?}
  48499. */
  48500. QueryList.prototype.notifyOnChanges = /**
  48501. * @return {?}
  48502. */
  48503. function () { (/** @type {?} */ (this.changes)).emit(this); };
  48504. /** internal */
  48505. /**
  48506. * internal
  48507. * @return {?}
  48508. */
  48509. QueryList.prototype.setDirty = /**
  48510. * internal
  48511. * @return {?}
  48512. */
  48513. function () { (/** @type {?} */ (this)).dirty = true; };
  48514. /** internal */
  48515. /**
  48516. * internal
  48517. * @return {?}
  48518. */
  48519. QueryList.prototype.destroy = /**
  48520. * internal
  48521. * @return {?}
  48522. */
  48523. function () {
  48524. (/** @type {?} */ (this.changes)).complete();
  48525. (/** @type {?} */ (this.changes)).unsubscribe();
  48526. };
  48527. return QueryList;
  48528. }());
  48529. /**
  48530. * @template T
  48531. * @param {?} list
  48532. * @return {?}
  48533. */
  48534. function flatten(list) {
  48535. return list.reduce(function (flat, item) {
  48536. var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
  48537. return (/** @type {?} */ (flat)).concat(flatItem);
  48538. }, []);
  48539. }
  48540. /**
  48541. * @fileoverview added by tsickle
  48542. * @suppress {checkTypes} checked by tsc
  48543. */
  48544. /**
  48545. * @license
  48546. * Copyright Google Inc. All Rights Reserved.
  48547. *
  48548. * Use of this source code is governed by an MIT-style license that can be
  48549. * found in the LICENSE file at https://angular.io/license
  48550. */
  48551. var _SEPARATOR = '#';
  48552. var FACTORY_CLASS_SUFFIX = 'NgFactory';
  48553. /**
  48554. * Configuration for SystemJsNgModuleLoader.
  48555. * token.
  48556. *
  48557. * \@experimental
  48558. * @abstract
  48559. */
  48560. var SystemJsNgModuleLoaderConfig = /** @class */ (function () {
  48561. function SystemJsNgModuleLoaderConfig() {
  48562. }
  48563. return SystemJsNgModuleLoaderConfig;
  48564. }());
  48565. var DEFAULT_CONFIG = {
  48566. factoryPathPrefix: '',
  48567. factoryPathSuffix: '.ngfactory',
  48568. };
  48569. /**
  48570. * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
  48571. * \@experimental
  48572. */
  48573. var SystemJsNgModuleLoader = /** @class */ (function () {
  48574. function SystemJsNgModuleLoader(_compiler, config) {
  48575. this._compiler = _compiler;
  48576. this._config = config || DEFAULT_CONFIG;
  48577. }
  48578. /**
  48579. * @param {?} path
  48580. * @return {?}
  48581. */
  48582. SystemJsNgModuleLoader.prototype.load = /**
  48583. * @param {?} path
  48584. * @return {?}
  48585. */
  48586. function (path) {
  48587. var /** @type {?} */ offlineMode = this._compiler instanceof Compiler;
  48588. return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
  48589. };
  48590. /**
  48591. * @param {?} path
  48592. * @return {?}
  48593. */
  48594. SystemJsNgModuleLoader.prototype.loadAndCompile = /**
  48595. * @param {?} path
  48596. * @return {?}
  48597. */
  48598. function (path) {
  48599. var _this = this;
  48600. var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
  48601. if (exportName === undefined) {
  48602. exportName = 'default';
  48603. }
  48604. return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(module)
  48605. .then(function (module) { return module[exportName]; })
  48606. .then(function (type) { return checkNotEmpty(type, module, exportName); })
  48607. .then(function (type) { return _this._compiler.compileModuleAsync(type); });
  48608. };
  48609. /**
  48610. * @param {?} path
  48611. * @return {?}
  48612. */
  48613. SystemJsNgModuleLoader.prototype.loadFactory = /**
  48614. * @param {?} path
  48615. * @return {?}
  48616. */
  48617. function (path) {
  48618. var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
  48619. var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX;
  48620. if (exportName === undefined) {
  48621. exportName = 'default';
  48622. factoryClassSuffix = '';
  48623. }
  48624. return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
  48625. .then(function (module) { return module[exportName + factoryClassSuffix]; })
  48626. .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
  48627. };
  48628. SystemJsNgModuleLoader.decorators = [
  48629. { type: Injectable },
  48630. ];
  48631. /** @nocollapse */
  48632. SystemJsNgModuleLoader.ctorParameters = function () { return [
  48633. { type: Compiler, },
  48634. { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
  48635. ]; };
  48636. return SystemJsNgModuleLoader;
  48637. }());
  48638. /**
  48639. * @param {?} value
  48640. * @param {?} modulePath
  48641. * @param {?} exportName
  48642. * @return {?}
  48643. */
  48644. function checkNotEmpty(value, modulePath, exportName) {
  48645. if (!value) {
  48646. throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
  48647. }
  48648. return value;
  48649. }
  48650. /**
  48651. * @fileoverview added by tsickle
  48652. * @suppress {checkTypes} checked by tsc
  48653. */
  48654. /**
  48655. * @license
  48656. * Copyright Google Inc. All Rights Reserved.
  48657. *
  48658. * Use of this source code is governed by an MIT-style license that can be
  48659. * found in the LICENSE file at https://angular.io/license
  48660. */
  48661. /**
  48662. * Represents an Embedded Template that can be used to instantiate Embedded Views.
  48663. *
  48664. * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
  48665. * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
  48666. * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
  48667. * the `TemplateRef` from a Component or a Directive via {\@link Query}.
  48668. *
  48669. * To instantiate Embedded Views based on a Template, use {\@link ViewContainerRef#
  48670. * createEmbeddedView}, which will create the View and attach it to the View Container.
  48671. * \@stable
  48672. * @abstract
  48673. */
  48674. var TemplateRef = /** @class */ (function () {
  48675. function TemplateRef() {
  48676. }
  48677. return TemplateRef;
  48678. }());
  48679. /**
  48680. * @fileoverview added by tsickle
  48681. * @suppress {checkTypes} checked by tsc
  48682. */
  48683. /**
  48684. * @license
  48685. * Copyright Google Inc. All Rights Reserved.
  48686. *
  48687. * Use of this source code is governed by an MIT-style license that can be
  48688. * found in the LICENSE file at https://angular.io/license
  48689. */
  48690. /**
  48691. * Represents a container where one or more Views can be attached.
  48692. *
  48693. * The container can contain two kinds of Views. Host Views, created by instantiating a
  48694. * {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an
  48695. * {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}.
  48696. *
  48697. * The location of the View Container within the containing View is specified by the Anchor
  48698. * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
  48699. * have a single View Container.
  48700. *
  48701. * Root elements of Views attached to this container become siblings of the Anchor Element in
  48702. * the Rendered View.
  48703. *
  48704. * To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected
  48705. * with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query.
  48706. * \@stable
  48707. * @abstract
  48708. */
  48709. var ViewContainerRef = /** @class */ (function () {
  48710. function ViewContainerRef() {
  48711. }
  48712. return ViewContainerRef;
  48713. }());
  48714. /**
  48715. * @fileoverview added by tsickle
  48716. * @suppress {checkTypes} checked by tsc
  48717. */
  48718. /**
  48719. * @license
  48720. * Copyright Google Inc. All Rights Reserved.
  48721. *
  48722. * Use of this source code is governed by an MIT-style license that can be
  48723. * found in the LICENSE file at https://angular.io/license
  48724. */
  48725. /**
  48726. * \@stable
  48727. * @abstract
  48728. */
  48729. var ChangeDetectorRef = /** @class */ (function () {
  48730. function ChangeDetectorRef() {
  48731. }
  48732. return ChangeDetectorRef;
  48733. }());
  48734. /**
  48735. * @fileoverview added by tsickle
  48736. * @suppress {checkTypes} checked by tsc
  48737. */
  48738. /**
  48739. * @license
  48740. * Copyright Google Inc. All Rights Reserved.
  48741. *
  48742. * Use of this source code is governed by an MIT-style license that can be
  48743. * found in the LICENSE file at https://angular.io/license
  48744. */
  48745. /**
  48746. * \@stable
  48747. * @abstract
  48748. */
  48749. var ViewRef = /** @class */ (function (_super) {
  48750. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ViewRef, _super);
  48751. function ViewRef() {
  48752. return _super !== null && _super.apply(this, arguments) || this;
  48753. }
  48754. return ViewRef;
  48755. }(ChangeDetectorRef));
  48756. /**
  48757. * Represents an Angular View.
  48758. *
  48759. * <!-- TODO: move the next two paragraphs to the dev guide -->
  48760. * A View is a fundamental building block of the application UI. It is the smallest grouping of
  48761. * Elements which are created and destroyed together.
  48762. *
  48763. * Properties of elements in a View can change, but the structure (number and order) of elements in
  48764. * a View cannot. Changing the structure of Elements can only be done by inserting, moving or
  48765. * removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers.
  48766. * <!-- /TODO -->
  48767. *
  48768. * ### Example
  48769. *
  48770. * Given this template...
  48771. *
  48772. * ```
  48773. * Count: {{items.length}}
  48774. * <ul>
  48775. * <li *ngFor="let item of items">{{item}}</li>
  48776. * </ul>
  48777. * ```
  48778. *
  48779. * We have two {\@link TemplateRef}s:
  48780. *
  48781. * Outer {\@link TemplateRef}:
  48782. * ```
  48783. * Count: {{items.length}}
  48784. * <ul>
  48785. * <ng-template ngFor let-item [ngForOf]="items"></ng-template>
  48786. * </ul>
  48787. * ```
  48788. *
  48789. * Inner {\@link TemplateRef}:
  48790. * ```
  48791. * <li>{{item}}</li>
  48792. * ```
  48793. *
  48794. * Notice that the original template is broken down into two separate {\@link TemplateRef}s.
  48795. *
  48796. * The outer/inner {\@link TemplateRef}s are then assembled into views like so:
  48797. *
  48798. * ```
  48799. * <!-- ViewRef: outer-0 -->
  48800. * Count: 2
  48801. * <ul>
  48802. * <ng-template view-container-ref></ng-template>
  48803. * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
  48804. * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
  48805. * </ul>
  48806. * <!-- /ViewRef: outer-0 -->
  48807. * ```
  48808. * \@experimental
  48809. * @abstract
  48810. */
  48811. var EmbeddedViewRef = /** @class */ (function (_super) {
  48812. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EmbeddedViewRef, _super);
  48813. function EmbeddedViewRef() {
  48814. return _super !== null && _super.apply(this, arguments) || this;
  48815. }
  48816. return EmbeddedViewRef;
  48817. }(ViewRef));
  48818. /**
  48819. * @record
  48820. */
  48821. /**
  48822. * @fileoverview added by tsickle
  48823. * @suppress {checkTypes} checked by tsc
  48824. */
  48825. /**
  48826. * @license
  48827. * Copyright Google Inc. All Rights Reserved.
  48828. *
  48829. * Use of this source code is governed by an MIT-style license that can be
  48830. * found in the LICENSE file at https://angular.io/license
  48831. */
  48832. /**
  48833. * @fileoverview added by tsickle
  48834. * @suppress {checkTypes} checked by tsc
  48835. */
  48836. /**
  48837. * @license
  48838. * Copyright Google Inc. All Rights Reserved.
  48839. *
  48840. * Use of this source code is governed by an MIT-style license that can be
  48841. * found in the LICENSE file at https://angular.io/license
  48842. */
  48843. var EventListener = /** @class */ (function () {
  48844. function EventListener(name, callback) {
  48845. this.name = name;
  48846. this.callback = callback;
  48847. }
  48848. return EventListener;
  48849. }());
  48850. /**
  48851. * \@experimental All debugging apis are currently experimental.
  48852. */
  48853. var DebugNode = /** @class */ (function () {
  48854. function DebugNode(nativeNode, parent, _debugContext) {
  48855. this._debugContext = _debugContext;
  48856. this.nativeNode = nativeNode;
  48857. if (parent && parent instanceof DebugElement) {
  48858. parent.addChild(this);
  48859. }
  48860. else {
  48861. this.parent = null;
  48862. }
  48863. this.listeners = [];
  48864. }
  48865. Object.defineProperty(DebugNode.prototype, "injector", {
  48866. get: /**
  48867. * @return {?}
  48868. */
  48869. function () { return this._debugContext.injector; },
  48870. enumerable: true,
  48871. configurable: true
  48872. });
  48873. Object.defineProperty(DebugNode.prototype, "componentInstance", {
  48874. get: /**
  48875. * @return {?}
  48876. */
  48877. function () { return this._debugContext.component; },
  48878. enumerable: true,
  48879. configurable: true
  48880. });
  48881. Object.defineProperty(DebugNode.prototype, "context", {
  48882. get: /**
  48883. * @return {?}
  48884. */
  48885. function () { return this._debugContext.context; },
  48886. enumerable: true,
  48887. configurable: true
  48888. });
  48889. Object.defineProperty(DebugNode.prototype, "references", {
  48890. get: /**
  48891. * @return {?}
  48892. */
  48893. function () { return this._debugContext.references; },
  48894. enumerable: true,
  48895. configurable: true
  48896. });
  48897. Object.defineProperty(DebugNode.prototype, "providerTokens", {
  48898. get: /**
  48899. * @return {?}
  48900. */
  48901. function () { return this._debugContext.providerTokens; },
  48902. enumerable: true,
  48903. configurable: true
  48904. });
  48905. return DebugNode;
  48906. }());
  48907. /**
  48908. * \@experimental All debugging apis are currently experimental.
  48909. */
  48910. var DebugElement = /** @class */ (function (_super) {
  48911. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DebugElement, _super);
  48912. function DebugElement(nativeNode, parent, _debugContext) {
  48913. var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
  48914. _this.properties = {};
  48915. _this.attributes = {};
  48916. _this.classes = {};
  48917. _this.styles = {};
  48918. _this.childNodes = [];
  48919. _this.nativeElement = nativeNode;
  48920. return _this;
  48921. }
  48922. /**
  48923. * @param {?} child
  48924. * @return {?}
  48925. */
  48926. DebugElement.prototype.addChild = /**
  48927. * @param {?} child
  48928. * @return {?}
  48929. */
  48930. function (child) {
  48931. if (child) {
  48932. this.childNodes.push(child);
  48933. child.parent = this;
  48934. }
  48935. };
  48936. /**
  48937. * @param {?} child
  48938. * @return {?}
  48939. */
  48940. DebugElement.prototype.removeChild = /**
  48941. * @param {?} child
  48942. * @return {?}
  48943. */
  48944. function (child) {
  48945. var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
  48946. if (childIndex !== -1) {
  48947. child.parent = null;
  48948. this.childNodes.splice(childIndex, 1);
  48949. }
  48950. };
  48951. /**
  48952. * @param {?} child
  48953. * @param {?} newChildren
  48954. * @return {?}
  48955. */
  48956. DebugElement.prototype.insertChildrenAfter = /**
  48957. * @param {?} child
  48958. * @param {?} newChildren
  48959. * @return {?}
  48960. */
  48961. function (child, newChildren) {
  48962. var _this = this;
  48963. var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
  48964. if (siblingIndex !== -1) {
  48965. (_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
  48966. newChildren.forEach(function (c) {
  48967. if (c.parent) {
  48968. c.parent.removeChild(c);
  48969. }
  48970. c.parent = _this;
  48971. });
  48972. }
  48973. var _a;
  48974. };
  48975. /**
  48976. * @param {?} refChild
  48977. * @param {?} newChild
  48978. * @return {?}
  48979. */
  48980. DebugElement.prototype.insertBefore = /**
  48981. * @param {?} refChild
  48982. * @param {?} newChild
  48983. * @return {?}
  48984. */
  48985. function (refChild, newChild) {
  48986. var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild);
  48987. if (refIndex === -1) {
  48988. this.addChild(newChild);
  48989. }
  48990. else {
  48991. if (newChild.parent) {
  48992. newChild.parent.removeChild(newChild);
  48993. }
  48994. newChild.parent = this;
  48995. this.childNodes.splice(refIndex, 0, newChild);
  48996. }
  48997. };
  48998. /**
  48999. * @param {?} predicate
  49000. * @return {?}
  49001. */
  49002. DebugElement.prototype.query = /**
  49003. * @param {?} predicate
  49004. * @return {?}
  49005. */
  49006. function (predicate) {
  49007. var /** @type {?} */ results = this.queryAll(predicate);
  49008. return results[0] || null;
  49009. };
  49010. /**
  49011. * @param {?} predicate
  49012. * @return {?}
  49013. */
  49014. DebugElement.prototype.queryAll = /**
  49015. * @param {?} predicate
  49016. * @return {?}
  49017. */
  49018. function (predicate) {
  49019. var /** @type {?} */ matches = [];
  49020. _queryElementChildren(this, predicate, matches);
  49021. return matches;
  49022. };
  49023. /**
  49024. * @param {?} predicate
  49025. * @return {?}
  49026. */
  49027. DebugElement.prototype.queryAllNodes = /**
  49028. * @param {?} predicate
  49029. * @return {?}
  49030. */
  49031. function (predicate) {
  49032. var /** @type {?} */ matches = [];
  49033. _queryNodeChildren(this, predicate, matches);
  49034. return matches;
  49035. };
  49036. Object.defineProperty(DebugElement.prototype, "children", {
  49037. get: /**
  49038. * @return {?}
  49039. */
  49040. function () {
  49041. return /** @type {?} */ (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
  49042. },
  49043. enumerable: true,
  49044. configurable: true
  49045. });
  49046. /**
  49047. * @param {?} eventName
  49048. * @param {?} eventObj
  49049. * @return {?}
  49050. */
  49051. DebugElement.prototype.triggerEventHandler = /**
  49052. * @param {?} eventName
  49053. * @param {?} eventObj
  49054. * @return {?}
  49055. */
  49056. function (eventName, eventObj) {
  49057. this.listeners.forEach(function (listener) {
  49058. if (listener.name == eventName) {
  49059. listener.callback(eventObj);
  49060. }
  49061. });
  49062. };
  49063. return DebugElement;
  49064. }(DebugNode));
  49065. /**
  49066. * \@experimental
  49067. * @param {?} debugEls
  49068. * @return {?}
  49069. */
  49070. function asNativeElements(debugEls) {
  49071. return debugEls.map(function (el) { return el.nativeElement; });
  49072. }
  49073. /**
  49074. * @param {?} element
  49075. * @param {?} predicate
  49076. * @param {?} matches
  49077. * @return {?}
  49078. */
  49079. function _queryElementChildren(element, predicate, matches) {
  49080. element.childNodes.forEach(function (node) {
  49081. if (node instanceof DebugElement) {
  49082. if (predicate(node)) {
  49083. matches.push(node);
  49084. }
  49085. _queryElementChildren(node, predicate, matches);
  49086. }
  49087. });
  49088. }
  49089. /**
  49090. * @param {?} parentNode
  49091. * @param {?} predicate
  49092. * @param {?} matches
  49093. * @return {?}
  49094. */
  49095. function _queryNodeChildren(parentNode, predicate, matches) {
  49096. if (parentNode instanceof DebugElement) {
  49097. parentNode.childNodes.forEach(function (node) {
  49098. if (predicate(node)) {
  49099. matches.push(node);
  49100. }
  49101. if (node instanceof DebugElement) {
  49102. _queryNodeChildren(node, predicate, matches);
  49103. }
  49104. });
  49105. }
  49106. }
  49107. // Need to keep the nodes in a global Map so that multiple angular apps are supported.
  49108. var _nativeNodeToDebugNode = new Map();
  49109. /**
  49110. * \@experimental
  49111. * @param {?} nativeNode
  49112. * @return {?}
  49113. */
  49114. function getDebugNode(nativeNode) {
  49115. return _nativeNodeToDebugNode.get(nativeNode) || null;
  49116. }
  49117. /**
  49118. * @return {?}
  49119. */
  49120. /**
  49121. * @param {?} node
  49122. * @return {?}
  49123. */
  49124. function indexDebugNode(node) {
  49125. _nativeNodeToDebugNode.set(node.nativeNode, node);
  49126. }
  49127. /**
  49128. * @param {?} node
  49129. * @return {?}
  49130. */
  49131. function removeDebugNodeFromIndex(node) {
  49132. _nativeNodeToDebugNode.delete(node.nativeNode);
  49133. }
  49134. /**
  49135. * A boolean-valued function over a value, possibly including context information
  49136. * regarding that value's position in an array.
  49137. *
  49138. * \@experimental All debugging apis are currently experimental.
  49139. * @record
  49140. */
  49141. /**
  49142. * @fileoverview added by tsickle
  49143. * @suppress {checkTypes} checked by tsc
  49144. */
  49145. /**
  49146. * @license
  49147. * Copyright Google Inc. All Rights Reserved.
  49148. *
  49149. * Use of this source code is governed by an MIT-style license that can be
  49150. * found in the LICENSE file at https://angular.io/license
  49151. */
  49152. /**
  49153. * @param {?} a
  49154. * @param {?} b
  49155. * @return {?}
  49156. */
  49157. function devModeEqual(a, b) {
  49158. var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a);
  49159. var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b);
  49160. if (isListLikeIterableA && isListLikeIterableB) {
  49161. return areIterablesEqual(a, b, devModeEqual);
  49162. }
  49163. else {
  49164. var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function');
  49165. var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function');
  49166. if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
  49167. return true;
  49168. }
  49169. else {
  49170. return looseIdentical(a, b);
  49171. }
  49172. }
  49173. }
  49174. /**
  49175. * Indicates that the result of a {\@link Pipe} transformation has changed even though the
  49176. * reference has not changed.
  49177. *
  49178. * Wrapped values are unwrapped automatically during the change detection, and the unwrapped value
  49179. * is stored.
  49180. *
  49181. * Example:
  49182. *
  49183. * ```
  49184. * if (this._latestValue === this._latestReturnedValue) {
  49185. * return this._latestReturnedValue;
  49186. * } else {
  49187. * this._latestReturnedValue = this._latestValue;
  49188. * return WrappedValue.wrap(this._latestValue); // this will force update
  49189. * }
  49190. * ```
  49191. * \@stable
  49192. */
  49193. var WrappedValue = /** @class */ (function () {
  49194. function WrappedValue(value) {
  49195. this.wrapped = value;
  49196. }
  49197. /** Creates a wrapped value. */
  49198. /**
  49199. * Creates a wrapped value.
  49200. * @param {?} value
  49201. * @return {?}
  49202. */
  49203. WrappedValue.wrap = /**
  49204. * Creates a wrapped value.
  49205. * @param {?} value
  49206. * @return {?}
  49207. */
  49208. function (value) { return new WrappedValue(value); };
  49209. /**
  49210. * Returns the underlying value of a wrapped value.
  49211. * Returns the given `value` when it is not wrapped.
  49212. **/
  49213. /**
  49214. * Returns the underlying value of a wrapped value.
  49215. * Returns the given `value` when it is not wrapped.
  49216. *
  49217. * @param {?} value
  49218. * @return {?}
  49219. */
  49220. WrappedValue.unwrap = /**
  49221. * Returns the underlying value of a wrapped value.
  49222. * Returns the given `value` when it is not wrapped.
  49223. *
  49224. * @param {?} value
  49225. * @return {?}
  49226. */
  49227. function (value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; };
  49228. /** Returns true if `value` is a wrapped value. */
  49229. /**
  49230. * Returns true if `value` is a wrapped value.
  49231. * @param {?} value
  49232. * @return {?}
  49233. */
  49234. WrappedValue.isWrapped = /**
  49235. * Returns true if `value` is a wrapped value.
  49236. * @param {?} value
  49237. * @return {?}
  49238. */
  49239. function (value) { return value instanceof WrappedValue; };
  49240. return WrappedValue;
  49241. }());
  49242. /**
  49243. * Represents a basic change from a previous to a new value.
  49244. * \@stable
  49245. */
  49246. var SimpleChange = /** @class */ (function () {
  49247. function SimpleChange(previousValue, currentValue, firstChange) {
  49248. this.previousValue = previousValue;
  49249. this.currentValue = currentValue;
  49250. this.firstChange = firstChange;
  49251. }
  49252. /**
  49253. * Check whether the new value is the first value assigned.
  49254. */
  49255. /**
  49256. * Check whether the new value is the first value assigned.
  49257. * @return {?}
  49258. */
  49259. SimpleChange.prototype.isFirstChange = /**
  49260. * Check whether the new value is the first value assigned.
  49261. * @return {?}
  49262. */
  49263. function () { return this.firstChange; };
  49264. return SimpleChange;
  49265. }());
  49266. /**
  49267. * @param {?} obj
  49268. * @return {?}
  49269. */
  49270. function isListLikeIterable(obj) {
  49271. if (!isJsObject(obj))
  49272. return false;
  49273. return Array.isArray(obj) ||
  49274. (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
  49275. // JS Map are iterables but return entries as [k, v]
  49276. getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
  49277. }
  49278. /**
  49279. * @param {?} a
  49280. * @param {?} b
  49281. * @param {?} comparator
  49282. * @return {?}
  49283. */
  49284. function areIterablesEqual(a, b, comparator) {
  49285. var /** @type {?} */ iterator1 = a[getSymbolIterator()]();
  49286. var /** @type {?} */ iterator2 = b[getSymbolIterator()]();
  49287. while (true) {
  49288. var /** @type {?} */ item1 = iterator1.next();
  49289. var /** @type {?} */ item2 = iterator2.next();
  49290. if (item1.done && item2.done)
  49291. return true;
  49292. if (item1.done || item2.done)
  49293. return false;
  49294. if (!comparator(item1.value, item2.value))
  49295. return false;
  49296. }
  49297. }
  49298. /**
  49299. * @param {?} obj
  49300. * @param {?} fn
  49301. * @return {?}
  49302. */
  49303. function iterateListLike(obj, fn) {
  49304. if (Array.isArray(obj)) {
  49305. for (var /** @type {?} */ i = 0; i < obj.length; i++) {
  49306. fn(obj[i]);
  49307. }
  49308. }
  49309. else {
  49310. var /** @type {?} */ iterator = obj[getSymbolIterator()]();
  49311. var /** @type {?} */ item = void 0;
  49312. while (!((item = iterator.next()).done)) {
  49313. fn(item.value);
  49314. }
  49315. }
  49316. }
  49317. /**
  49318. * @param {?} o
  49319. * @return {?}
  49320. */
  49321. function isJsObject(o) {
  49322. return o !== null && (typeof o === 'function' || typeof o === 'object');
  49323. }
  49324. /**
  49325. * @fileoverview added by tsickle
  49326. * @suppress {checkTypes} checked by tsc
  49327. */
  49328. /**
  49329. * @license
  49330. * Copyright Google Inc. All Rights Reserved.
  49331. *
  49332. * Use of this source code is governed by an MIT-style license that can be
  49333. * found in the LICENSE file at https://angular.io/license
  49334. */
  49335. var DefaultIterableDifferFactory = /** @class */ (function () {
  49336. function DefaultIterableDifferFactory() {
  49337. }
  49338. /**
  49339. * @param {?} obj
  49340. * @return {?}
  49341. */
  49342. DefaultIterableDifferFactory.prototype.supports = /**
  49343. * @param {?} obj
  49344. * @return {?}
  49345. */
  49346. function (obj) { return isListLikeIterable(obj); };
  49347. /**
  49348. * @template V
  49349. * @param {?=} trackByFn
  49350. * @return {?}
  49351. */
  49352. DefaultIterableDifferFactory.prototype.create = /**
  49353. * @template V
  49354. * @param {?=} trackByFn
  49355. * @return {?}
  49356. */
  49357. function (trackByFn) {
  49358. return new DefaultIterableDiffer(trackByFn);
  49359. };
  49360. return DefaultIterableDifferFactory;
  49361. }());
  49362. var trackByIdentity = function (index, item) { return item; };
  49363. /**
  49364. * @deprecated v4.0.0 - Should not be part of public API.
  49365. */
  49366. var DefaultIterableDiffer = /** @class */ (function () {
  49367. function DefaultIterableDiffer(trackByFn) {
  49368. this.length = 0;
  49369. this._linkedRecords = null;
  49370. this._unlinkedRecords = null;
  49371. this._previousItHead = null;
  49372. this._itHead = null;
  49373. this._itTail = null;
  49374. this._additionsHead = null;
  49375. this._additionsTail = null;
  49376. this._movesHead = null;
  49377. this._movesTail = null;
  49378. this._removalsHead = null;
  49379. this._removalsTail = null;
  49380. this._identityChangesHead = null;
  49381. this._identityChangesTail = null;
  49382. this._trackByFn = trackByFn || trackByIdentity;
  49383. }
  49384. /**
  49385. * @param {?} fn
  49386. * @return {?}
  49387. */
  49388. DefaultIterableDiffer.prototype.forEachItem = /**
  49389. * @param {?} fn
  49390. * @return {?}
  49391. */
  49392. function (fn) {
  49393. var /** @type {?} */ record;
  49394. for (record = this._itHead; record !== null; record = record._next) {
  49395. fn(record);
  49396. }
  49397. };
  49398. /**
  49399. * @param {?} fn
  49400. * @return {?}
  49401. */
  49402. DefaultIterableDiffer.prototype.forEachOperation = /**
  49403. * @param {?} fn
  49404. * @return {?}
  49405. */
  49406. function (fn) {
  49407. var /** @type {?} */ nextIt = this._itHead;
  49408. var /** @type {?} */ nextRemove = this._removalsHead;
  49409. var /** @type {?} */ addRemoveOffset = 0;
  49410. var /** @type {?} */ moveOffsets = null;
  49411. while (nextIt || nextRemove) {
  49412. // Figure out which is the next record to process
  49413. // Order: remove, add, move
  49414. var /** @type {?} */ record = !nextRemove ||
  49415. nextIt && /** @type {?} */ ((nextIt.currentIndex)) < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? /** @type {?} */
  49416. ((nextIt)) :
  49417. nextRemove;
  49418. var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
  49419. var /** @type {?} */ currentIndex = record.currentIndex;
  49420. // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
  49421. if (record === nextRemove) {
  49422. addRemoveOffset--;
  49423. nextRemove = nextRemove._nextRemoved;
  49424. }
  49425. else {
  49426. nextIt = /** @type {?} */ ((nextIt))._next;
  49427. if (record.previousIndex == null) {
  49428. addRemoveOffset++;
  49429. }
  49430. else {
  49431. // INVARIANT: currentIndex < previousIndex
  49432. if (!moveOffsets)
  49433. moveOffsets = [];
  49434. var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
  49435. var /** @type {?} */ localCurrentIndex = /** @type {?} */ ((currentIndex)) - addRemoveOffset;
  49436. if (localMovePreviousIndex != localCurrentIndex) {
  49437. for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) {
  49438. var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
  49439. var /** @type {?} */ index = offset + i;
  49440. if (localCurrentIndex <= index && index < localMovePreviousIndex) {
  49441. moveOffsets[i] = offset + 1;
  49442. }
  49443. }
  49444. var /** @type {?} */ previousIndex = record.previousIndex;
  49445. moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
  49446. }
  49447. }
  49448. }
  49449. if (adjPreviousIndex !== currentIndex) {
  49450. fn(record, adjPreviousIndex, currentIndex);
  49451. }
  49452. }
  49453. };
  49454. /**
  49455. * @param {?} fn
  49456. * @return {?}
  49457. */
  49458. DefaultIterableDiffer.prototype.forEachPreviousItem = /**
  49459. * @param {?} fn
  49460. * @return {?}
  49461. */
  49462. function (fn) {
  49463. var /** @type {?} */ record;
  49464. for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
  49465. fn(record);
  49466. }
  49467. };
  49468. /**
  49469. * @param {?} fn
  49470. * @return {?}
  49471. */
  49472. DefaultIterableDiffer.prototype.forEachAddedItem = /**
  49473. * @param {?} fn
  49474. * @return {?}
  49475. */
  49476. function (fn) {
  49477. var /** @type {?} */ record;
  49478. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  49479. fn(record);
  49480. }
  49481. };
  49482. /**
  49483. * @param {?} fn
  49484. * @return {?}
  49485. */
  49486. DefaultIterableDiffer.prototype.forEachMovedItem = /**
  49487. * @param {?} fn
  49488. * @return {?}
  49489. */
  49490. function (fn) {
  49491. var /** @type {?} */ record;
  49492. for (record = this._movesHead; record !== null; record = record._nextMoved) {
  49493. fn(record);
  49494. }
  49495. };
  49496. /**
  49497. * @param {?} fn
  49498. * @return {?}
  49499. */
  49500. DefaultIterableDiffer.prototype.forEachRemovedItem = /**
  49501. * @param {?} fn
  49502. * @return {?}
  49503. */
  49504. function (fn) {
  49505. var /** @type {?} */ record;
  49506. for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
  49507. fn(record);
  49508. }
  49509. };
  49510. /**
  49511. * @param {?} fn
  49512. * @return {?}
  49513. */
  49514. DefaultIterableDiffer.prototype.forEachIdentityChange = /**
  49515. * @param {?} fn
  49516. * @return {?}
  49517. */
  49518. function (fn) {
  49519. var /** @type {?} */ record;
  49520. for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
  49521. fn(record);
  49522. }
  49523. };
  49524. /**
  49525. * @param {?} collection
  49526. * @return {?}
  49527. */
  49528. DefaultIterableDiffer.prototype.diff = /**
  49529. * @param {?} collection
  49530. * @return {?}
  49531. */
  49532. function (collection) {
  49533. if (collection == null)
  49534. collection = [];
  49535. if (!isListLikeIterable(collection)) {
  49536. throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
  49537. }
  49538. if (this.check(collection)) {
  49539. return this;
  49540. }
  49541. else {
  49542. return null;
  49543. }
  49544. };
  49545. /**
  49546. * @return {?}
  49547. */
  49548. DefaultIterableDiffer.prototype.onDestroy = /**
  49549. * @return {?}
  49550. */
  49551. function () { };
  49552. /**
  49553. * @param {?} collection
  49554. * @return {?}
  49555. */
  49556. DefaultIterableDiffer.prototype.check = /**
  49557. * @param {?} collection
  49558. * @return {?}
  49559. */
  49560. function (collection) {
  49561. var _this = this;
  49562. this._reset();
  49563. var /** @type {?} */ record = this._itHead;
  49564. var /** @type {?} */ mayBeDirty = false;
  49565. var /** @type {?} */ index;
  49566. var /** @type {?} */ item;
  49567. var /** @type {?} */ itemTrackBy;
  49568. if (Array.isArray(collection)) {
  49569. (/** @type {?} */ (this)).length = collection.length;
  49570. for (var /** @type {?} */ index_1 = 0; index_1 < this.length; index_1++) {
  49571. item = collection[index_1];
  49572. itemTrackBy = this._trackByFn(index_1, item);
  49573. if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
  49574. record = this._mismatch(record, item, itemTrackBy, index_1);
  49575. mayBeDirty = true;
  49576. }
  49577. else {
  49578. if (mayBeDirty) {
  49579. // TODO(misko): can we limit this to duplicates only?
  49580. record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
  49581. }
  49582. if (!looseIdentical(record.item, item))
  49583. this._addIdentityChange(record, item);
  49584. }
  49585. record = record._next;
  49586. }
  49587. }
  49588. else {
  49589. index = 0;
  49590. iterateListLike(collection, function (item) {
  49591. itemTrackBy = _this._trackByFn(index, item);
  49592. if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
  49593. record = _this._mismatch(record, item, itemTrackBy, index);
  49594. mayBeDirty = true;
  49595. }
  49596. else {
  49597. if (mayBeDirty) {
  49598. // TODO(misko): can we limit this to duplicates only?
  49599. record = _this._verifyReinsertion(record, item, itemTrackBy, index);
  49600. }
  49601. if (!looseIdentical(record.item, item))
  49602. _this._addIdentityChange(record, item);
  49603. }
  49604. record = record._next;
  49605. index++;
  49606. });
  49607. (/** @type {?} */ (this)).length = index;
  49608. }
  49609. this._truncate(record);
  49610. (/** @type {?} */ (this)).collection = collection;
  49611. return this.isDirty;
  49612. };
  49613. Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
  49614. /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
  49615. * changes.
  49616. */
  49617. get: /**
  49618. * @return {?}
  49619. */
  49620. function () {
  49621. return this._additionsHead !== null || this._movesHead !== null ||
  49622. this._removalsHead !== null || this._identityChangesHead !== null;
  49623. },
  49624. enumerable: true,
  49625. configurable: true
  49626. });
  49627. /**
  49628. * Reset the state of the change objects to show no changes. This means set previousKey to
  49629. * currentKey, and clear all of the queues (additions, moves, removals).
  49630. * Set the previousIndexes of moved and added items to their currentIndexes
  49631. * Reset the list of additions, moves and removals
  49632. *
  49633. * @internal
  49634. */
  49635. /**
  49636. * Reset the state of the change objects to show no changes. This means set previousKey to
  49637. * currentKey, and clear all of the queues (additions, moves, removals).
  49638. * Set the previousIndexes of moved and added items to their currentIndexes
  49639. * Reset the list of additions, moves and removals
  49640. *
  49641. * \@internal
  49642. * @return {?}
  49643. */
  49644. DefaultIterableDiffer.prototype._reset = /**
  49645. * Reset the state of the change objects to show no changes. This means set previousKey to
  49646. * currentKey, and clear all of the queues (additions, moves, removals).
  49647. * Set the previousIndexes of moved and added items to their currentIndexes
  49648. * Reset the list of additions, moves and removals
  49649. *
  49650. * \@internal
  49651. * @return {?}
  49652. */
  49653. function () {
  49654. if (this.isDirty) {
  49655. var /** @type {?} */ record = void 0;
  49656. var /** @type {?} */ nextRecord = void 0;
  49657. for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
  49658. record._nextPrevious = record._next;
  49659. }
  49660. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  49661. record.previousIndex = record.currentIndex;
  49662. }
  49663. this._additionsHead = this._additionsTail = null;
  49664. for (record = this._movesHead; record !== null; record = nextRecord) {
  49665. record.previousIndex = record.currentIndex;
  49666. nextRecord = record._nextMoved;
  49667. }
  49668. this._movesHead = this._movesTail = null;
  49669. this._removalsHead = this._removalsTail = null;
  49670. this._identityChangesHead = this._identityChangesTail = null;
  49671. // todo(vicb) when assert gets supported
  49672. // assert(!this.isDirty);
  49673. }
  49674. };
  49675. /**
  49676. * This is the core function which handles differences between collections.
  49677. *
  49678. * - `record` is the record which we saw at this position last time. If null then it is a new
  49679. * item.
  49680. * - `item` is the current item in the collection
  49681. * - `index` is the position of the item in the collection
  49682. *
  49683. * @internal
  49684. */
  49685. /**
  49686. * This is the core function which handles differences between collections.
  49687. *
  49688. * - `record` is the record which we saw at this position last time. If null then it is a new
  49689. * item.
  49690. * - `item` is the current item in the collection
  49691. * - `index` is the position of the item in the collection
  49692. *
  49693. * \@internal
  49694. * @param {?} record
  49695. * @param {?} item
  49696. * @param {?} itemTrackBy
  49697. * @param {?} index
  49698. * @return {?}
  49699. */
  49700. DefaultIterableDiffer.prototype._mismatch = /**
  49701. * This is the core function which handles differences between collections.
  49702. *
  49703. * - `record` is the record which we saw at this position last time. If null then it is a new
  49704. * item.
  49705. * - `item` is the current item in the collection
  49706. * - `index` is the position of the item in the collection
  49707. *
  49708. * \@internal
  49709. * @param {?} record
  49710. * @param {?} item
  49711. * @param {?} itemTrackBy
  49712. * @param {?} index
  49713. * @return {?}
  49714. */
  49715. function (record, item, itemTrackBy, index) {
  49716. // The previous record after which we will append the current one.
  49717. var /** @type {?} */ previousRecord;
  49718. if (record === null) {
  49719. previousRecord = this._itTail;
  49720. }
  49721. else {
  49722. previousRecord = record._prev;
  49723. // Remove the record from the collection since we know it does not match the item.
  49724. this._remove(record);
  49725. }
  49726. // Attempt to see if we have seen the item before.
  49727. record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
  49728. if (record !== null) {
  49729. // We have seen this before, we need to move it forward in the collection.
  49730. // But first we need to check if identity changed, so we can update in view if necessary
  49731. if (!looseIdentical(record.item, item))
  49732. this._addIdentityChange(record, item);
  49733. this._moveAfter(record, previousRecord, index);
  49734. }
  49735. else {
  49736. // Never seen it, check evicted list.
  49737. record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
  49738. if (record !== null) {
  49739. // It is an item which we have evicted earlier: reinsert it back into the list.
  49740. // But first we need to check if identity changed, so we can update in view if necessary
  49741. if (!looseIdentical(record.item, item))
  49742. this._addIdentityChange(record, item);
  49743. this._reinsertAfter(record, previousRecord, index);
  49744. }
  49745. else {
  49746. // It is a new item: add it.
  49747. record =
  49748. this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
  49749. }
  49750. }
  49751. return record;
  49752. };
  49753. /**
  49754. * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
  49755. *
  49756. * Use case: `[a, a]` => `[b, a, a]`
  49757. *
  49758. * If we did not have this check then the insertion of `b` would:
  49759. * 1) evict first `a`
  49760. * 2) insert `b` at `0` index.
  49761. * 3) leave `a` at index `1` as is. <-- this is wrong!
  49762. * 3) reinsert `a` at index 2. <-- this is wrong!
  49763. *
  49764. * The correct behavior is:
  49765. * 1) evict first `a`
  49766. * 2) insert `b` at `0` index.
  49767. * 3) reinsert `a` at index 1.
  49768. * 3) move `a` at from `1` to `2`.
  49769. *
  49770. *
  49771. * Double check that we have not evicted a duplicate item. We need to check if the item type may
  49772. * have already been removed:
  49773. * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
  49774. * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
  49775. * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
  49776. * at the end.
  49777. *
  49778. * @internal
  49779. */
  49780. /**
  49781. * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
  49782. *
  49783. * Use case: `[a, a]` => `[b, a, a]`
  49784. *
  49785. * If we did not have this check then the insertion of `b` would:
  49786. * 1) evict first `a`
  49787. * 2) insert `b` at `0` index.
  49788. * 3) leave `a` at index `1` as is. <-- this is wrong!
  49789. * 3) reinsert `a` at index 2. <-- this is wrong!
  49790. *
  49791. * The correct behavior is:
  49792. * 1) evict first `a`
  49793. * 2) insert `b` at `0` index.
  49794. * 3) reinsert `a` at index 1.
  49795. * 3) move `a` at from `1` to `2`.
  49796. *
  49797. *
  49798. * Double check that we have not evicted a duplicate item. We need to check if the item type may
  49799. * have already been removed:
  49800. * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
  49801. * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
  49802. * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
  49803. * at the end.
  49804. *
  49805. * \@internal
  49806. * @param {?} record
  49807. * @param {?} item
  49808. * @param {?} itemTrackBy
  49809. * @param {?} index
  49810. * @return {?}
  49811. */
  49812. DefaultIterableDiffer.prototype._verifyReinsertion = /**
  49813. * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
  49814. *
  49815. * Use case: `[a, a]` => `[b, a, a]`
  49816. *
  49817. * If we did not have this check then the insertion of `b` would:
  49818. * 1) evict first `a`
  49819. * 2) insert `b` at `0` index.
  49820. * 3) leave `a` at index `1` as is. <-- this is wrong!
  49821. * 3) reinsert `a` at index 2. <-- this is wrong!
  49822. *
  49823. * The correct behavior is:
  49824. * 1) evict first `a`
  49825. * 2) insert `b` at `0` index.
  49826. * 3) reinsert `a` at index 1.
  49827. * 3) move `a` at from `1` to `2`.
  49828. *
  49829. *
  49830. * Double check that we have not evicted a duplicate item. We need to check if the item type may
  49831. * have already been removed:
  49832. * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
  49833. * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
  49834. * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
  49835. * at the end.
  49836. *
  49837. * \@internal
  49838. * @param {?} record
  49839. * @param {?} item
  49840. * @param {?} itemTrackBy
  49841. * @param {?} index
  49842. * @return {?}
  49843. */
  49844. function (record, item, itemTrackBy, index) {
  49845. var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
  49846. if (reinsertRecord !== null) {
  49847. record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index);
  49848. }
  49849. else if (record.currentIndex != index) {
  49850. record.currentIndex = index;
  49851. this._addToMoves(record, index);
  49852. }
  49853. return record;
  49854. };
  49855. /**
  49856. * Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
  49857. *
  49858. * - `record` The first excess {@link IterableChangeRecord_}.
  49859. *
  49860. * @internal
  49861. */
  49862. /**
  49863. * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
  49864. *
  49865. * - `record` The first excess {\@link IterableChangeRecord_}.
  49866. *
  49867. * \@internal
  49868. * @param {?} record
  49869. * @return {?}
  49870. */
  49871. DefaultIterableDiffer.prototype._truncate = /**
  49872. * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
  49873. *
  49874. * - `record` The first excess {\@link IterableChangeRecord_}.
  49875. *
  49876. * \@internal
  49877. * @param {?} record
  49878. * @return {?}
  49879. */
  49880. function (record) {
  49881. // Anything after that needs to be removed;
  49882. while (record !== null) {
  49883. var /** @type {?} */ nextRecord = record._next;
  49884. this._addToRemovals(this._unlink(record));
  49885. record = nextRecord;
  49886. }
  49887. if (this._unlinkedRecords !== null) {
  49888. this._unlinkedRecords.clear();
  49889. }
  49890. if (this._additionsTail !== null) {
  49891. this._additionsTail._nextAdded = null;
  49892. }
  49893. if (this._movesTail !== null) {
  49894. this._movesTail._nextMoved = null;
  49895. }
  49896. if (this._itTail !== null) {
  49897. this._itTail._next = null;
  49898. }
  49899. if (this._removalsTail !== null) {
  49900. this._removalsTail._nextRemoved = null;
  49901. }
  49902. if (this._identityChangesTail !== null) {
  49903. this._identityChangesTail._nextIdentityChange = null;
  49904. }
  49905. };
  49906. /** @internal */
  49907. /**
  49908. * \@internal
  49909. * @param {?} record
  49910. * @param {?} prevRecord
  49911. * @param {?} index
  49912. * @return {?}
  49913. */
  49914. DefaultIterableDiffer.prototype._reinsertAfter = /**
  49915. * \@internal
  49916. * @param {?} record
  49917. * @param {?} prevRecord
  49918. * @param {?} index
  49919. * @return {?}
  49920. */
  49921. function (record, prevRecord, index) {
  49922. if (this._unlinkedRecords !== null) {
  49923. this._unlinkedRecords.remove(record);
  49924. }
  49925. var /** @type {?} */ prev = record._prevRemoved;
  49926. var /** @type {?} */ next = record._nextRemoved;
  49927. if (prev === null) {
  49928. this._removalsHead = next;
  49929. }
  49930. else {
  49931. prev._nextRemoved = next;
  49932. }
  49933. if (next === null) {
  49934. this._removalsTail = prev;
  49935. }
  49936. else {
  49937. next._prevRemoved = prev;
  49938. }
  49939. this._insertAfter(record, prevRecord, index);
  49940. this._addToMoves(record, index);
  49941. return record;
  49942. };
  49943. /** @internal */
  49944. /**
  49945. * \@internal
  49946. * @param {?} record
  49947. * @param {?} prevRecord
  49948. * @param {?} index
  49949. * @return {?}
  49950. */
  49951. DefaultIterableDiffer.prototype._moveAfter = /**
  49952. * \@internal
  49953. * @param {?} record
  49954. * @param {?} prevRecord
  49955. * @param {?} index
  49956. * @return {?}
  49957. */
  49958. function (record, prevRecord, index) {
  49959. this._unlink(record);
  49960. this._insertAfter(record, prevRecord, index);
  49961. this._addToMoves(record, index);
  49962. return record;
  49963. };
  49964. /** @internal */
  49965. /**
  49966. * \@internal
  49967. * @param {?} record
  49968. * @param {?} prevRecord
  49969. * @param {?} index
  49970. * @return {?}
  49971. */
  49972. DefaultIterableDiffer.prototype._addAfter = /**
  49973. * \@internal
  49974. * @param {?} record
  49975. * @param {?} prevRecord
  49976. * @param {?} index
  49977. * @return {?}
  49978. */
  49979. function (record, prevRecord, index) {
  49980. this._insertAfter(record, prevRecord, index);
  49981. if (this._additionsTail === null) {
  49982. // todo(vicb)
  49983. // assert(this._additionsHead === null);
  49984. this._additionsTail = this._additionsHead = record;
  49985. }
  49986. else {
  49987. // todo(vicb)
  49988. // assert(_additionsTail._nextAdded === null);
  49989. // assert(record._nextAdded === null);
  49990. this._additionsTail = this._additionsTail._nextAdded = record;
  49991. }
  49992. return record;
  49993. };
  49994. /** @internal */
  49995. /**
  49996. * \@internal
  49997. * @param {?} record
  49998. * @param {?} prevRecord
  49999. * @param {?} index
  50000. * @return {?}
  50001. */
  50002. DefaultIterableDiffer.prototype._insertAfter = /**
  50003. * \@internal
  50004. * @param {?} record
  50005. * @param {?} prevRecord
  50006. * @param {?} index
  50007. * @return {?}
  50008. */
  50009. function (record, prevRecord, index) {
  50010. // todo(vicb)
  50011. // assert(record != prevRecord);
  50012. // assert(record._next === null);
  50013. // assert(record._prev === null);
  50014. var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next;
  50015. // todo(vicb)
  50016. // assert(next != record);
  50017. // assert(prevRecord != record);
  50018. record._next = next;
  50019. record._prev = prevRecord;
  50020. if (next === null) {
  50021. this._itTail = record;
  50022. }
  50023. else {
  50024. next._prev = record;
  50025. }
  50026. if (prevRecord === null) {
  50027. this._itHead = record;
  50028. }
  50029. else {
  50030. prevRecord._next = record;
  50031. }
  50032. if (this._linkedRecords === null) {
  50033. this._linkedRecords = new _DuplicateMap();
  50034. }
  50035. this._linkedRecords.put(record);
  50036. record.currentIndex = index;
  50037. return record;
  50038. };
  50039. /** @internal */
  50040. /**
  50041. * \@internal
  50042. * @param {?} record
  50043. * @return {?}
  50044. */
  50045. DefaultIterableDiffer.prototype._remove = /**
  50046. * \@internal
  50047. * @param {?} record
  50048. * @return {?}
  50049. */
  50050. function (record) {
  50051. return this._addToRemovals(this._unlink(record));
  50052. };
  50053. /** @internal */
  50054. /**
  50055. * \@internal
  50056. * @param {?} record
  50057. * @return {?}
  50058. */
  50059. DefaultIterableDiffer.prototype._unlink = /**
  50060. * \@internal
  50061. * @param {?} record
  50062. * @return {?}
  50063. */
  50064. function (record) {
  50065. if (this._linkedRecords !== null) {
  50066. this._linkedRecords.remove(record);
  50067. }
  50068. var /** @type {?} */ prev = record._prev;
  50069. var /** @type {?} */ next = record._next;
  50070. // todo(vicb)
  50071. // assert((record._prev = null) === null);
  50072. // assert((record._next = null) === null);
  50073. if (prev === null) {
  50074. this._itHead = next;
  50075. }
  50076. else {
  50077. prev._next = next;
  50078. }
  50079. if (next === null) {
  50080. this._itTail = prev;
  50081. }
  50082. else {
  50083. next._prev = prev;
  50084. }
  50085. return record;
  50086. };
  50087. /** @internal */
  50088. /**
  50089. * \@internal
  50090. * @param {?} record
  50091. * @param {?} toIndex
  50092. * @return {?}
  50093. */
  50094. DefaultIterableDiffer.prototype._addToMoves = /**
  50095. * \@internal
  50096. * @param {?} record
  50097. * @param {?} toIndex
  50098. * @return {?}
  50099. */
  50100. function (record, toIndex) {
  50101. // todo(vicb)
  50102. // assert(record._nextMoved === null);
  50103. if (record.previousIndex === toIndex) {
  50104. return record;
  50105. }
  50106. if (this._movesTail === null) {
  50107. // todo(vicb)
  50108. // assert(_movesHead === null);
  50109. this._movesTail = this._movesHead = record;
  50110. }
  50111. else {
  50112. // todo(vicb)
  50113. // assert(_movesTail._nextMoved === null);
  50114. this._movesTail = this._movesTail._nextMoved = record;
  50115. }
  50116. return record;
  50117. };
  50118. /**
  50119. * @param {?} record
  50120. * @return {?}
  50121. */
  50122. DefaultIterableDiffer.prototype._addToRemovals = /**
  50123. * @param {?} record
  50124. * @return {?}
  50125. */
  50126. function (record) {
  50127. if (this._unlinkedRecords === null) {
  50128. this._unlinkedRecords = new _DuplicateMap();
  50129. }
  50130. this._unlinkedRecords.put(record);
  50131. record.currentIndex = null;
  50132. record._nextRemoved = null;
  50133. if (this._removalsTail === null) {
  50134. // todo(vicb)
  50135. // assert(_removalsHead === null);
  50136. this._removalsTail = this._removalsHead = record;
  50137. record._prevRemoved = null;
  50138. }
  50139. else {
  50140. // todo(vicb)
  50141. // assert(_removalsTail._nextRemoved === null);
  50142. // assert(record._nextRemoved === null);
  50143. record._prevRemoved = this._removalsTail;
  50144. this._removalsTail = this._removalsTail._nextRemoved = record;
  50145. }
  50146. return record;
  50147. };
  50148. /** @internal */
  50149. /**
  50150. * \@internal
  50151. * @param {?} record
  50152. * @param {?} item
  50153. * @return {?}
  50154. */
  50155. DefaultIterableDiffer.prototype._addIdentityChange = /**
  50156. * \@internal
  50157. * @param {?} record
  50158. * @param {?} item
  50159. * @return {?}
  50160. */
  50161. function (record, item) {
  50162. record.item = item;
  50163. if (this._identityChangesTail === null) {
  50164. this._identityChangesTail = this._identityChangesHead = record;
  50165. }
  50166. else {
  50167. this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
  50168. }
  50169. return record;
  50170. };
  50171. return DefaultIterableDiffer;
  50172. }());
  50173. /**
  50174. * \@stable
  50175. */
  50176. var IterableChangeRecord_ = /** @class */ (function () {
  50177. function IterableChangeRecord_(item, trackById) {
  50178. this.item = item;
  50179. this.trackById = trackById;
  50180. this.currentIndex = null;
  50181. this.previousIndex = null;
  50182. /**
  50183. * \@internal
  50184. */
  50185. this._nextPrevious = null;
  50186. /**
  50187. * \@internal
  50188. */
  50189. this._prev = null;
  50190. /**
  50191. * \@internal
  50192. */
  50193. this._next = null;
  50194. /**
  50195. * \@internal
  50196. */
  50197. this._prevDup = null;
  50198. /**
  50199. * \@internal
  50200. */
  50201. this._nextDup = null;
  50202. /**
  50203. * \@internal
  50204. */
  50205. this._prevRemoved = null;
  50206. /**
  50207. * \@internal
  50208. */
  50209. this._nextRemoved = null;
  50210. /**
  50211. * \@internal
  50212. */
  50213. this._nextAdded = null;
  50214. /**
  50215. * \@internal
  50216. */
  50217. this._nextMoved = null;
  50218. /**
  50219. * \@internal
  50220. */
  50221. this._nextIdentityChange = null;
  50222. }
  50223. return IterableChangeRecord_;
  50224. }());
  50225. var _DuplicateItemRecordList = /** @class */ (function () {
  50226. function _DuplicateItemRecordList() {
  50227. /**
  50228. * \@internal
  50229. */
  50230. this._head = null;
  50231. /**
  50232. * \@internal
  50233. */
  50234. this._tail = null;
  50235. }
  50236. /**
  50237. * Append the record to the list of duplicates.
  50238. *
  50239. * Note: by design all records in the list of duplicates hold the same value in record.item.
  50240. */
  50241. /**
  50242. * Append the record to the list of duplicates.
  50243. *
  50244. * Note: by design all records in the list of duplicates hold the same value in record.item.
  50245. * @param {?} record
  50246. * @return {?}
  50247. */
  50248. _DuplicateItemRecordList.prototype.add = /**
  50249. * Append the record to the list of duplicates.
  50250. *
  50251. * Note: by design all records in the list of duplicates hold the same value in record.item.
  50252. * @param {?} record
  50253. * @return {?}
  50254. */
  50255. function (record) {
  50256. if (this._head === null) {
  50257. this._head = this._tail = record;
  50258. record._nextDup = null;
  50259. record._prevDup = null;
  50260. }
  50261. else {
  50262. /** @type {?} */ ((
  50263. // todo(vicb)
  50264. // assert(record.item == _head.item ||
  50265. // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
  50266. this._tail))._nextDup = record;
  50267. record._prevDup = this._tail;
  50268. record._nextDup = null;
  50269. this._tail = record;
  50270. }
  50271. };
  50272. // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
  50273. // IterableChangeRecord_.currentIndex >= atOrAfterIndex
  50274. /**
  50275. * @param {?} trackById
  50276. * @param {?} atOrAfterIndex
  50277. * @return {?}
  50278. */
  50279. _DuplicateItemRecordList.prototype.get = /**
  50280. * @param {?} trackById
  50281. * @param {?} atOrAfterIndex
  50282. * @return {?}
  50283. */
  50284. function (trackById, atOrAfterIndex) {
  50285. var /** @type {?} */ record;
  50286. for (record = this._head; record !== null; record = record._nextDup) {
  50287. if ((atOrAfterIndex === null || atOrAfterIndex <= /** @type {?} */ ((record.currentIndex))) &&
  50288. looseIdentical(record.trackById, trackById)) {
  50289. return record;
  50290. }
  50291. }
  50292. return null;
  50293. };
  50294. /**
  50295. * Remove one {@link IterableChangeRecord_} from the list of duplicates.
  50296. *
  50297. * Returns whether the list of duplicates is empty.
  50298. */
  50299. /**
  50300. * Remove one {\@link IterableChangeRecord_} from the list of duplicates.
  50301. *
  50302. * Returns whether the list of duplicates is empty.
  50303. * @param {?} record
  50304. * @return {?}
  50305. */
  50306. _DuplicateItemRecordList.prototype.remove = /**
  50307. * Remove one {\@link IterableChangeRecord_} from the list of duplicates.
  50308. *
  50309. * Returns whether the list of duplicates is empty.
  50310. * @param {?} record
  50311. * @return {?}
  50312. */
  50313. function (record) {
  50314. // todo(vicb)
  50315. // assert(() {
  50316. // // verify that the record being removed is in the list.
  50317. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
  50318. // if (identical(cursor, record)) return true;
  50319. // }
  50320. // return false;
  50321. //});
  50322. var /** @type {?} */ prev = record._prevDup;
  50323. var /** @type {?} */ next = record._nextDup;
  50324. if (prev === null) {
  50325. this._head = next;
  50326. }
  50327. else {
  50328. prev._nextDup = next;
  50329. }
  50330. if (next === null) {
  50331. this._tail = prev;
  50332. }
  50333. else {
  50334. next._prevDup = prev;
  50335. }
  50336. return this._head === null;
  50337. };
  50338. return _DuplicateItemRecordList;
  50339. }());
  50340. var _DuplicateMap = /** @class */ (function () {
  50341. function _DuplicateMap() {
  50342. this.map = new Map();
  50343. }
  50344. /**
  50345. * @param {?} record
  50346. * @return {?}
  50347. */
  50348. _DuplicateMap.prototype.put = /**
  50349. * @param {?} record
  50350. * @return {?}
  50351. */
  50352. function (record) {
  50353. var /** @type {?} */ key = record.trackById;
  50354. var /** @type {?} */ duplicates = this.map.get(key);
  50355. if (!duplicates) {
  50356. duplicates = new _DuplicateItemRecordList();
  50357. this.map.set(key, duplicates);
  50358. }
  50359. duplicates.add(record);
  50360. };
  50361. /**
  50362. * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
  50363. * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
  50364. *
  50365. * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
  50366. * have any more `a`s needs to return the second `a`.
  50367. */
  50368. /**
  50369. * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
  50370. * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
  50371. *
  50372. * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
  50373. * have any more `a`s needs to return the second `a`.
  50374. * @param {?} trackById
  50375. * @param {?} atOrAfterIndex
  50376. * @return {?}
  50377. */
  50378. _DuplicateMap.prototype.get = /**
  50379. * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
  50380. * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
  50381. *
  50382. * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
  50383. * have any more `a`s needs to return the second `a`.
  50384. * @param {?} trackById
  50385. * @param {?} atOrAfterIndex
  50386. * @return {?}
  50387. */
  50388. function (trackById, atOrAfterIndex) {
  50389. var /** @type {?} */ key = trackById;
  50390. var /** @type {?} */ recordList = this.map.get(key);
  50391. return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
  50392. };
  50393. /**
  50394. * Removes a {@link IterableChangeRecord_} from the list of duplicates.
  50395. *
  50396. * The list of duplicates also is removed from the map if it gets empty.
  50397. */
  50398. /**
  50399. * Removes a {\@link IterableChangeRecord_} from the list of duplicates.
  50400. *
  50401. * The list of duplicates also is removed from the map if it gets empty.
  50402. * @param {?} record
  50403. * @return {?}
  50404. */
  50405. _DuplicateMap.prototype.remove = /**
  50406. * Removes a {\@link IterableChangeRecord_} from the list of duplicates.
  50407. *
  50408. * The list of duplicates also is removed from the map if it gets empty.
  50409. * @param {?} record
  50410. * @return {?}
  50411. */
  50412. function (record) {
  50413. var /** @type {?} */ key = record.trackById;
  50414. var /** @type {?} */ recordList = /** @type {?} */ ((this.map.get(key)));
  50415. // Remove the list of duplicates when it gets empty
  50416. if (recordList.remove(record)) {
  50417. this.map.delete(key);
  50418. }
  50419. return record;
  50420. };
  50421. Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
  50422. get: /**
  50423. * @return {?}
  50424. */
  50425. function () { return this.map.size === 0; },
  50426. enumerable: true,
  50427. configurable: true
  50428. });
  50429. /**
  50430. * @return {?}
  50431. */
  50432. _DuplicateMap.prototype.clear = /**
  50433. * @return {?}
  50434. */
  50435. function () { this.map.clear(); };
  50436. return _DuplicateMap;
  50437. }());
  50438. /**
  50439. * @param {?} item
  50440. * @param {?} addRemoveOffset
  50441. * @param {?} moveOffsets
  50442. * @return {?}
  50443. */
  50444. function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
  50445. var /** @type {?} */ previousIndex = item.previousIndex;
  50446. if (previousIndex === null)
  50447. return previousIndex;
  50448. var /** @type {?} */ moveOffset = 0;
  50449. if (moveOffsets && previousIndex < moveOffsets.length) {
  50450. moveOffset = moveOffsets[previousIndex];
  50451. }
  50452. return previousIndex + addRemoveOffset + moveOffset;
  50453. }
  50454. /**
  50455. * @fileoverview added by tsickle
  50456. * @suppress {checkTypes} checked by tsc
  50457. */
  50458. /**
  50459. * @license
  50460. * Copyright Google Inc. All Rights Reserved.
  50461. *
  50462. * Use of this source code is governed by an MIT-style license that can be
  50463. * found in the LICENSE file at https://angular.io/license
  50464. */
  50465. var DefaultKeyValueDifferFactory = /** @class */ (function () {
  50466. function DefaultKeyValueDifferFactory() {
  50467. }
  50468. /**
  50469. * @param {?} obj
  50470. * @return {?}
  50471. */
  50472. DefaultKeyValueDifferFactory.prototype.supports = /**
  50473. * @param {?} obj
  50474. * @return {?}
  50475. */
  50476. function (obj) { return obj instanceof Map || isJsObject(obj); };
  50477. /**
  50478. * @template K, V
  50479. * @return {?}
  50480. */
  50481. DefaultKeyValueDifferFactory.prototype.create = /**
  50482. * @template K, V
  50483. * @return {?}
  50484. */
  50485. function () { return new DefaultKeyValueDiffer(); };
  50486. return DefaultKeyValueDifferFactory;
  50487. }());
  50488. var DefaultKeyValueDiffer = /** @class */ (function () {
  50489. function DefaultKeyValueDiffer() {
  50490. this._records = new Map();
  50491. this._mapHead = null;
  50492. this._appendAfter = null;
  50493. this._previousMapHead = null;
  50494. this._changesHead = null;
  50495. this._changesTail = null;
  50496. this._additionsHead = null;
  50497. this._additionsTail = null;
  50498. this._removalsHead = null;
  50499. this._removalsTail = null;
  50500. }
  50501. Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
  50502. get: /**
  50503. * @return {?}
  50504. */
  50505. function () {
  50506. return this._additionsHead !== null || this._changesHead !== null ||
  50507. this._removalsHead !== null;
  50508. },
  50509. enumerable: true,
  50510. configurable: true
  50511. });
  50512. /**
  50513. * @param {?} fn
  50514. * @return {?}
  50515. */
  50516. DefaultKeyValueDiffer.prototype.forEachItem = /**
  50517. * @param {?} fn
  50518. * @return {?}
  50519. */
  50520. function (fn) {
  50521. var /** @type {?} */ record;
  50522. for (record = this._mapHead; record !== null; record = record._next) {
  50523. fn(record);
  50524. }
  50525. };
  50526. /**
  50527. * @param {?} fn
  50528. * @return {?}
  50529. */
  50530. DefaultKeyValueDiffer.prototype.forEachPreviousItem = /**
  50531. * @param {?} fn
  50532. * @return {?}
  50533. */
  50534. function (fn) {
  50535. var /** @type {?} */ record;
  50536. for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
  50537. fn(record);
  50538. }
  50539. };
  50540. /**
  50541. * @param {?} fn
  50542. * @return {?}
  50543. */
  50544. DefaultKeyValueDiffer.prototype.forEachChangedItem = /**
  50545. * @param {?} fn
  50546. * @return {?}
  50547. */
  50548. function (fn) {
  50549. var /** @type {?} */ record;
  50550. for (record = this._changesHead; record !== null; record = record._nextChanged) {
  50551. fn(record);
  50552. }
  50553. };
  50554. /**
  50555. * @param {?} fn
  50556. * @return {?}
  50557. */
  50558. DefaultKeyValueDiffer.prototype.forEachAddedItem = /**
  50559. * @param {?} fn
  50560. * @return {?}
  50561. */
  50562. function (fn) {
  50563. var /** @type {?} */ record;
  50564. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  50565. fn(record);
  50566. }
  50567. };
  50568. /**
  50569. * @param {?} fn
  50570. * @return {?}
  50571. */
  50572. DefaultKeyValueDiffer.prototype.forEachRemovedItem = /**
  50573. * @param {?} fn
  50574. * @return {?}
  50575. */
  50576. function (fn) {
  50577. var /** @type {?} */ record;
  50578. for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
  50579. fn(record);
  50580. }
  50581. };
  50582. /**
  50583. * @param {?=} map
  50584. * @return {?}
  50585. */
  50586. DefaultKeyValueDiffer.prototype.diff = /**
  50587. * @param {?=} map
  50588. * @return {?}
  50589. */
  50590. function (map) {
  50591. if (!map) {
  50592. map = new Map();
  50593. }
  50594. else if (!(map instanceof Map || isJsObject(map))) {
  50595. throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
  50596. }
  50597. return this.check(map) ? this : null;
  50598. };
  50599. /**
  50600. * @return {?}
  50601. */
  50602. DefaultKeyValueDiffer.prototype.onDestroy = /**
  50603. * @return {?}
  50604. */
  50605. function () { };
  50606. /**
  50607. * Check the current state of the map vs the previous.
  50608. * The algorithm is optimised for when the keys do no change.
  50609. */
  50610. /**
  50611. * Check the current state of the map vs the previous.
  50612. * The algorithm is optimised for when the keys do no change.
  50613. * @param {?} map
  50614. * @return {?}
  50615. */
  50616. DefaultKeyValueDiffer.prototype.check = /**
  50617. * Check the current state of the map vs the previous.
  50618. * The algorithm is optimised for when the keys do no change.
  50619. * @param {?} map
  50620. * @return {?}
  50621. */
  50622. function (map) {
  50623. var _this = this;
  50624. this._reset();
  50625. var /** @type {?} */ insertBefore = this._mapHead;
  50626. this._appendAfter = null;
  50627. this._forEach(map, function (value, key) {
  50628. if (insertBefore && insertBefore.key === key) {
  50629. _this._maybeAddToChanges(insertBefore, value);
  50630. _this._appendAfter = insertBefore;
  50631. insertBefore = insertBefore._next;
  50632. }
  50633. else {
  50634. var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value);
  50635. insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
  50636. }
  50637. });
  50638. // Items remaining at the end of the list have been deleted
  50639. if (insertBefore) {
  50640. if (insertBefore._prev) {
  50641. insertBefore._prev._next = null;
  50642. }
  50643. this._removalsHead = insertBefore;
  50644. for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) {
  50645. if (record === this._mapHead) {
  50646. this._mapHead = null;
  50647. }
  50648. this._records.delete(record.key);
  50649. record._nextRemoved = record._next;
  50650. record.previousValue = record.currentValue;
  50651. record.currentValue = null;
  50652. record._prev = null;
  50653. record._next = null;
  50654. }
  50655. }
  50656. // Make sure tails have no next records from previous runs
  50657. if (this._changesTail)
  50658. this._changesTail._nextChanged = null;
  50659. if (this._additionsTail)
  50660. this._additionsTail._nextAdded = null;
  50661. return this.isDirty;
  50662. };
  50663. /**
  50664. * Inserts a record before `before` or append at the end of the list when `before` is null.
  50665. *
  50666. * Notes:
  50667. * - This method appends at `this._appendAfter`,
  50668. * - This method updates `this._appendAfter`,
  50669. * - The return value is the new value for the insertion pointer.
  50670. * @param {?} before
  50671. * @param {?} record
  50672. * @return {?}
  50673. */
  50674. DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = /**
  50675. * Inserts a record before `before` or append at the end of the list when `before` is null.
  50676. *
  50677. * Notes:
  50678. * - This method appends at `this._appendAfter`,
  50679. * - This method updates `this._appendAfter`,
  50680. * - The return value is the new value for the insertion pointer.
  50681. * @param {?} before
  50682. * @param {?} record
  50683. * @return {?}
  50684. */
  50685. function (before, record) {
  50686. if (before) {
  50687. var /** @type {?} */ prev = before._prev;
  50688. record._next = before;
  50689. record._prev = prev;
  50690. before._prev = record;
  50691. if (prev) {
  50692. prev._next = record;
  50693. }
  50694. if (before === this._mapHead) {
  50695. this._mapHead = record;
  50696. }
  50697. this._appendAfter = before;
  50698. return before;
  50699. }
  50700. if (this._appendAfter) {
  50701. this._appendAfter._next = record;
  50702. record._prev = this._appendAfter;
  50703. }
  50704. else {
  50705. this._mapHead = record;
  50706. }
  50707. this._appendAfter = record;
  50708. return null;
  50709. };
  50710. /**
  50711. * @param {?} key
  50712. * @param {?} value
  50713. * @return {?}
  50714. */
  50715. DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = /**
  50716. * @param {?} key
  50717. * @param {?} value
  50718. * @return {?}
  50719. */
  50720. function (key, value) {
  50721. if (this._records.has(key)) {
  50722. var /** @type {?} */ record_1 = /** @type {?} */ ((this._records.get(key)));
  50723. this._maybeAddToChanges(record_1, value);
  50724. var /** @type {?} */ prev = record_1._prev;
  50725. var /** @type {?} */ next = record_1._next;
  50726. if (prev) {
  50727. prev._next = next;
  50728. }
  50729. if (next) {
  50730. next._prev = prev;
  50731. }
  50732. record_1._next = null;
  50733. record_1._prev = null;
  50734. return record_1;
  50735. }
  50736. var /** @type {?} */ record = new KeyValueChangeRecord_(key);
  50737. this._records.set(key, record);
  50738. record.currentValue = value;
  50739. this._addToAdditions(record);
  50740. return record;
  50741. };
  50742. /** @internal */
  50743. /**
  50744. * \@internal
  50745. * @return {?}
  50746. */
  50747. DefaultKeyValueDiffer.prototype._reset = /**
  50748. * \@internal
  50749. * @return {?}
  50750. */
  50751. function () {
  50752. if (this.isDirty) {
  50753. var /** @type {?} */ record = void 0;
  50754. // let `_previousMapHead` contain the state of the map before the changes
  50755. this._previousMapHead = this._mapHead;
  50756. for (record = this._previousMapHead; record !== null; record = record._next) {
  50757. record._nextPrevious = record._next;
  50758. }
  50759. // Update `record.previousValue` with the value of the item before the changes
  50760. // We need to update all changed items (that's those which have been added and changed)
  50761. for (record = this._changesHead; record !== null; record = record._nextChanged) {
  50762. record.previousValue = record.currentValue;
  50763. }
  50764. for (record = this._additionsHead; record != null; record = record._nextAdded) {
  50765. record.previousValue = record.currentValue;
  50766. }
  50767. this._changesHead = this._changesTail = null;
  50768. this._additionsHead = this._additionsTail = null;
  50769. this._removalsHead = null;
  50770. }
  50771. };
  50772. /**
  50773. * @param {?} record
  50774. * @param {?} newValue
  50775. * @return {?}
  50776. */
  50777. DefaultKeyValueDiffer.prototype._maybeAddToChanges = /**
  50778. * @param {?} record
  50779. * @param {?} newValue
  50780. * @return {?}
  50781. */
  50782. function (record, newValue) {
  50783. if (!looseIdentical(newValue, record.currentValue)) {
  50784. record.previousValue = record.currentValue;
  50785. record.currentValue = newValue;
  50786. this._addToChanges(record);
  50787. }
  50788. };
  50789. /**
  50790. * @param {?} record
  50791. * @return {?}
  50792. */
  50793. DefaultKeyValueDiffer.prototype._addToAdditions = /**
  50794. * @param {?} record
  50795. * @return {?}
  50796. */
  50797. function (record) {
  50798. if (this._additionsHead === null) {
  50799. this._additionsHead = this._additionsTail = record;
  50800. }
  50801. else {
  50802. /** @type {?} */ ((this._additionsTail))._nextAdded = record;
  50803. this._additionsTail = record;
  50804. }
  50805. };
  50806. /**
  50807. * @param {?} record
  50808. * @return {?}
  50809. */
  50810. DefaultKeyValueDiffer.prototype._addToChanges = /**
  50811. * @param {?} record
  50812. * @return {?}
  50813. */
  50814. function (record) {
  50815. if (this._changesHead === null) {
  50816. this._changesHead = this._changesTail = record;
  50817. }
  50818. else {
  50819. /** @type {?} */ ((this._changesTail))._nextChanged = record;
  50820. this._changesTail = record;
  50821. }
  50822. };
  50823. /**
  50824. * \@internal
  50825. * @template K, V
  50826. * @param {?} obj
  50827. * @param {?} fn
  50828. * @return {?}
  50829. */
  50830. DefaultKeyValueDiffer.prototype._forEach = /**
  50831. * \@internal
  50832. * @template K, V
  50833. * @param {?} obj
  50834. * @param {?} fn
  50835. * @return {?}
  50836. */
  50837. function (obj, fn) {
  50838. if (obj instanceof Map) {
  50839. obj.forEach(fn);
  50840. }
  50841. else {
  50842. Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
  50843. }
  50844. };
  50845. return DefaultKeyValueDiffer;
  50846. }());
  50847. /**
  50848. * \@stable
  50849. */
  50850. var KeyValueChangeRecord_ = /** @class */ (function () {
  50851. function KeyValueChangeRecord_(key) {
  50852. this.key = key;
  50853. this.previousValue = null;
  50854. this.currentValue = null;
  50855. /**
  50856. * \@internal
  50857. */
  50858. this._nextPrevious = null;
  50859. /**
  50860. * \@internal
  50861. */
  50862. this._next = null;
  50863. /**
  50864. * \@internal
  50865. */
  50866. this._prev = null;
  50867. /**
  50868. * \@internal
  50869. */
  50870. this._nextAdded = null;
  50871. /**
  50872. * \@internal
  50873. */
  50874. this._nextRemoved = null;
  50875. /**
  50876. * \@internal
  50877. */
  50878. this._nextChanged = null;
  50879. }
  50880. return KeyValueChangeRecord_;
  50881. }());
  50882. /**
  50883. * @fileoverview added by tsickle
  50884. * @suppress {checkTypes} checked by tsc
  50885. */
  50886. /**
  50887. * @license
  50888. * Copyright Google Inc. All Rights Reserved.
  50889. *
  50890. * Use of this source code is governed by an MIT-style license that can be
  50891. * found in the LICENSE file at https://angular.io/license
  50892. */
  50893. /**
  50894. * A strategy for tracking changes over time to an iterable. Used by {\@link NgForOf} to
  50895. * respond to changes in an iterable by effecting equivalent changes in the DOM.
  50896. *
  50897. * \@stable
  50898. * @record
  50899. */
  50900. /**
  50901. * An object describing the changes in the `Iterable` collection since last time
  50902. * `IterableDiffer#diff()` was invoked.
  50903. *
  50904. * \@stable
  50905. * @record
  50906. */
  50907. /**
  50908. * Record representing the item change information.
  50909. *
  50910. * \@stable
  50911. * @record
  50912. */
  50913. /**
  50914. * @deprecated v4.0.0 - Use IterableChangeRecord instead.
  50915. * @record
  50916. */
  50917. /**
  50918. * An optional function passed into {\@link NgForOf} that defines how to track
  50919. * items in an iterable (e.g. fby index or id)
  50920. *
  50921. * \@stable
  50922. * @record
  50923. */
  50924. /**
  50925. * Provides a factory for {\@link IterableDiffer}.
  50926. *
  50927. * \@stable
  50928. * @record
  50929. */
  50930. /**
  50931. * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
  50932. * \@stable
  50933. */
  50934. var IterableDiffers = /** @class */ (function () {
  50935. function IterableDiffers(factories) {
  50936. this.factories = factories;
  50937. }
  50938. /**
  50939. * @param {?} factories
  50940. * @param {?=} parent
  50941. * @return {?}
  50942. */
  50943. IterableDiffers.create = /**
  50944. * @param {?} factories
  50945. * @param {?=} parent
  50946. * @return {?}
  50947. */
  50948. function (factories, parent) {
  50949. if (parent != null) {
  50950. var /** @type {?} */ copied = parent.factories.slice();
  50951. factories = factories.concat(copied);
  50952. return new IterableDiffers(factories);
  50953. }
  50954. else {
  50955. return new IterableDiffers(factories);
  50956. }
  50957. };
  50958. /**
  50959. * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
  50960. * inherited {@link IterableDiffers} instance with the provided factories and return a new
  50961. * {@link IterableDiffers} instance.
  50962. *
  50963. * The following example shows how to extend an existing list of factories,
  50964. * which will only be applied to the injector for this component and its children.
  50965. * This step is all that's required to make a new {@link IterableDiffer} available.
  50966. *
  50967. * ### Example
  50968. *
  50969. * ```
  50970. * @Component({
  50971. * viewProviders: [
  50972. * IterableDiffers.extend([new ImmutableListDiffer()])
  50973. * ]
  50974. * })
  50975. * ```
  50976. */
  50977. /**
  50978. * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
  50979. * inherited {\@link IterableDiffers} instance with the provided factories and return a new
  50980. * {\@link IterableDiffers} instance.
  50981. *
  50982. * The following example shows how to extend an existing list of factories,
  50983. * which will only be applied to the injector for this component and its children.
  50984. * This step is all that's required to make a new {\@link IterableDiffer} available.
  50985. *
  50986. * ### Example
  50987. *
  50988. * ```
  50989. * \@Component({
  50990. * viewProviders: [
  50991. * IterableDiffers.extend([new ImmutableListDiffer()])
  50992. * ]
  50993. * })
  50994. * ```
  50995. * @param {?} factories
  50996. * @return {?}
  50997. */
  50998. IterableDiffers.extend = /**
  50999. * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
  51000. * inherited {\@link IterableDiffers} instance with the provided factories and return a new
  51001. * {\@link IterableDiffers} instance.
  51002. *
  51003. * The following example shows how to extend an existing list of factories,
  51004. * which will only be applied to the injector for this component and its children.
  51005. * This step is all that's required to make a new {\@link IterableDiffer} available.
  51006. *
  51007. * ### Example
  51008. *
  51009. * ```
  51010. * \@Component({
  51011. * viewProviders: [
  51012. * IterableDiffers.extend([new ImmutableListDiffer()])
  51013. * ]
  51014. * })
  51015. * ```
  51016. * @param {?} factories
  51017. * @return {?}
  51018. */
  51019. function (factories) {
  51020. return {
  51021. provide: IterableDiffers,
  51022. useFactory: function (parent) {
  51023. if (!parent) {
  51024. // Typically would occur when calling IterableDiffers.extend inside of dependencies passed
  51025. // to
  51026. // bootstrap(), which would override default pipes instead of extending them.
  51027. throw new Error('Cannot extend IterableDiffers without a parent injector');
  51028. }
  51029. return IterableDiffers.create(factories, parent);
  51030. },
  51031. // Dependency technically isn't optional, but we can provide a better error message this way.
  51032. deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
  51033. };
  51034. };
  51035. /**
  51036. * @param {?} iterable
  51037. * @return {?}
  51038. */
  51039. IterableDiffers.prototype.find = /**
  51040. * @param {?} iterable
  51041. * @return {?}
  51042. */
  51043. function (iterable) {
  51044. var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); });
  51045. if (factory != null) {
  51046. return factory;
  51047. }
  51048. else {
  51049. throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
  51050. }
  51051. };
  51052. return IterableDiffers;
  51053. }());
  51054. /**
  51055. * @param {?} type
  51056. * @return {?}
  51057. */
  51058. function getTypeNameForDebugging(type) {
  51059. return type['name'] || typeof type;
  51060. }
  51061. /**
  51062. * @fileoverview added by tsickle
  51063. * @suppress {checkTypes} checked by tsc
  51064. */
  51065. /**
  51066. * @license
  51067. * Copyright Google Inc. All Rights Reserved.
  51068. *
  51069. * Use of this source code is governed by an MIT-style license that can be
  51070. * found in the LICENSE file at https://angular.io/license
  51071. */
  51072. /**
  51073. * A differ that tracks changes made to an object over time.
  51074. *
  51075. * \@stable
  51076. * @record
  51077. */
  51078. /**
  51079. * An object describing the changes in the `Map` or `{[k:string]: string}` since last time
  51080. * `KeyValueDiffer#diff()` was invoked.
  51081. *
  51082. * \@stable
  51083. * @record
  51084. */
  51085. /**
  51086. * Record representing the item change information.
  51087. *
  51088. * \@stable
  51089. * @record
  51090. */
  51091. /**
  51092. * Provides a factory for {\@link KeyValueDiffer}.
  51093. *
  51094. * \@stable
  51095. * @record
  51096. */
  51097. /**
  51098. * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
  51099. * \@stable
  51100. */
  51101. var KeyValueDiffers = /** @class */ (function () {
  51102. function KeyValueDiffers(factories) {
  51103. this.factories = factories;
  51104. }
  51105. /**
  51106. * @template S
  51107. * @param {?} factories
  51108. * @param {?=} parent
  51109. * @return {?}
  51110. */
  51111. KeyValueDiffers.create = /**
  51112. * @template S
  51113. * @param {?} factories
  51114. * @param {?=} parent
  51115. * @return {?}
  51116. */
  51117. function (factories, parent) {
  51118. if (parent) {
  51119. var /** @type {?} */ copied = parent.factories.slice();
  51120. factories = factories.concat(copied);
  51121. }
  51122. return new KeyValueDiffers(factories);
  51123. };
  51124. /**
  51125. * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
  51126. * inherited {@link KeyValueDiffers} instance with the provided factories and return a new
  51127. * {@link KeyValueDiffers} instance.
  51128. *
  51129. * The following example shows how to extend an existing list of factories,
  51130. * which will only be applied to the injector for this component and its children.
  51131. * This step is all that's required to make a new {@link KeyValueDiffer} available.
  51132. *
  51133. * ### Example
  51134. *
  51135. * ```
  51136. * @Component({
  51137. * viewProviders: [
  51138. * KeyValueDiffers.extend([new ImmutableMapDiffer()])
  51139. * ]
  51140. * })
  51141. * ```
  51142. */
  51143. /**
  51144. * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
  51145. * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
  51146. * {\@link KeyValueDiffers} instance.
  51147. *
  51148. * The following example shows how to extend an existing list of factories,
  51149. * which will only be applied to the injector for this component and its children.
  51150. * This step is all that's required to make a new {\@link KeyValueDiffer} available.
  51151. *
  51152. * ### Example
  51153. *
  51154. * ```
  51155. * \@Component({
  51156. * viewProviders: [
  51157. * KeyValueDiffers.extend([new ImmutableMapDiffer()])
  51158. * ]
  51159. * })
  51160. * ```
  51161. * @template S
  51162. * @param {?} factories
  51163. * @return {?}
  51164. */
  51165. KeyValueDiffers.extend = /**
  51166. * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
  51167. * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
  51168. * {\@link KeyValueDiffers} instance.
  51169. *
  51170. * The following example shows how to extend an existing list of factories,
  51171. * which will only be applied to the injector for this component and its children.
  51172. * This step is all that's required to make a new {\@link KeyValueDiffer} available.
  51173. *
  51174. * ### Example
  51175. *
  51176. * ```
  51177. * \@Component({
  51178. * viewProviders: [
  51179. * KeyValueDiffers.extend([new ImmutableMapDiffer()])
  51180. * ]
  51181. * })
  51182. * ```
  51183. * @template S
  51184. * @param {?} factories
  51185. * @return {?}
  51186. */
  51187. function (factories) {
  51188. return {
  51189. provide: KeyValueDiffers,
  51190. useFactory: function (parent) {
  51191. if (!parent) {
  51192. // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
  51193. // to bootstrap(), which would override default pipes instead of extending them.
  51194. throw new Error('Cannot extend KeyValueDiffers without a parent injector');
  51195. }
  51196. return KeyValueDiffers.create(factories, parent);
  51197. },
  51198. // Dependency technically isn't optional, but we can provide a better error message this way.
  51199. deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
  51200. };
  51201. };
  51202. /**
  51203. * @param {?} kv
  51204. * @return {?}
  51205. */
  51206. KeyValueDiffers.prototype.find = /**
  51207. * @param {?} kv
  51208. * @return {?}
  51209. */
  51210. function (kv) {
  51211. var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); });
  51212. if (factory) {
  51213. return factory;
  51214. }
  51215. throw new Error("Cannot find a differ supporting object '" + kv + "'");
  51216. };
  51217. return KeyValueDiffers;
  51218. }());
  51219. /**
  51220. * @fileoverview added by tsickle
  51221. * @suppress {checkTypes} checked by tsc
  51222. */
  51223. /**
  51224. * @license
  51225. * Copyright Google Inc. All Rights Reserved.
  51226. *
  51227. * Use of this source code is governed by an MIT-style license that can be
  51228. * found in the LICENSE file at https://angular.io/license
  51229. */
  51230. /**
  51231. * Structural diffing for `Object`s and `Map`s.
  51232. */
  51233. var keyValDiff = [new DefaultKeyValueDifferFactory()];
  51234. /**
  51235. * Structural diffing for `Iterable` types such as `Array`s.
  51236. */
  51237. var iterableDiff = [new DefaultIterableDifferFactory()];
  51238. var defaultIterableDiffers = new IterableDiffers(iterableDiff);
  51239. var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
  51240. /**
  51241. * @fileoverview added by tsickle
  51242. * @suppress {checkTypes} checked by tsc
  51243. */
  51244. /**
  51245. * @license
  51246. * Copyright Google Inc. All Rights Reserved.
  51247. *
  51248. * Use of this source code is governed by an MIT-style license that can be
  51249. * found in the LICENSE file at https://angular.io/license
  51250. */
  51251. /**
  51252. * @fileoverview added by tsickle
  51253. * @suppress {checkTypes} checked by tsc
  51254. */
  51255. /**
  51256. * @license
  51257. * Copyright Google Inc. All Rights Reserved.
  51258. *
  51259. * Use of this source code is governed by an MIT-style license that can be
  51260. * found in the LICENSE file at https://angular.io/license
  51261. */
  51262. var _CORE_PLATFORM_PROVIDERS = [
  51263. // Set a default platform name for platforms that don't set it explicitly.
  51264. { provide: PLATFORM_ID, useValue: 'unknown' },
  51265. { provide: PlatformRef, deps: [Injector] },
  51266. { provide: TestabilityRegistry, deps: [] },
  51267. { provide: Console, deps: [] },
  51268. ];
  51269. /**
  51270. * This platform has to be included in any other platform
  51271. *
  51272. * \@experimental
  51273. */
  51274. var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
  51275. /**
  51276. * @fileoverview added by tsickle
  51277. * @suppress {checkTypes} checked by tsc
  51278. */
  51279. /**
  51280. * @license
  51281. * Copyright Google Inc. All Rights Reserved.
  51282. *
  51283. * Use of this source code is governed by an MIT-style license that can be
  51284. * found in the LICENSE file at https://angular.io/license
  51285. */
  51286. /**
  51287. * Provide this token to set the locale of your application.
  51288. * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe,
  51289. * DecimalPipe and PercentPipe) and by ICU expressions.
  51290. *
  51291. * See the {\@linkDocs guide/i18n#setting-up-locale i18n guide} for more information.
  51292. *
  51293. * ### Example
  51294. *
  51295. * ```typescript
  51296. * import { LOCALE_ID } from '\@angular/core';
  51297. * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic';
  51298. * import { AppModule } from './app/app.module';
  51299. *
  51300. * platformBrowserDynamic().bootstrapModule(AppModule, {
  51301. * providers: [{provide: LOCALE_ID, useValue: 'en-US' }]
  51302. * });
  51303. * ```
  51304. *
  51305. * \@experimental i18n support is experimental.
  51306. */
  51307. var LOCALE_ID = new InjectionToken('LocaleId');
  51308. /**
  51309. * Use this token at bootstrap to provide the content of your translation file (`xtb`,
  51310. * `xlf` or `xlf2`) when you want to translate your application in another language.
  51311. *
  51312. * See the {\@linkDocs guide/i18n#merge i18n guide} for more information.
  51313. *
  51314. * ### Example
  51315. *
  51316. * ```typescript
  51317. * import { TRANSLATIONS } from '\@angular/core';
  51318. * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic';
  51319. * import { AppModule } from './app/app.module';
  51320. *
  51321. * // content of your translation file
  51322. * const translations = '....';
  51323. *
  51324. * platformBrowserDynamic().bootstrapModule(AppModule, {
  51325. * providers: [{provide: TRANSLATIONS, useValue: translations }]
  51326. * });
  51327. * ```
  51328. *
  51329. * \@experimental i18n support is experimental.
  51330. */
  51331. var TRANSLATIONS = new InjectionToken('Translations');
  51332. /**
  51333. * Provide this token at bootstrap to set the format of your {\@link TRANSLATIONS}: `xtb`,
  51334. * `xlf` or `xlf2`.
  51335. *
  51336. * See the {\@linkDocs guide/i18n#merge i18n guide} for more information.
  51337. *
  51338. * ### Example
  51339. *
  51340. * ```typescript
  51341. * import { TRANSLATIONS_FORMAT } from '\@angular/core';
  51342. * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic';
  51343. * import { AppModule } from './app/app.module';
  51344. *
  51345. * platformBrowserDynamic().bootstrapModule(AppModule, {
  51346. * providers: [{provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }]
  51347. * });
  51348. * ```
  51349. *
  51350. * \@experimental i18n support is experimental.
  51351. */
  51352. var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
  51353. /** @enum {number} */
  51354. var MissingTranslationStrategy = {
  51355. Error: 0,
  51356. Warning: 1,
  51357. Ignore: 2,
  51358. };
  51359. MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
  51360. MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
  51361. MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
  51362. /**
  51363. * @fileoverview added by tsickle
  51364. * @suppress {checkTypes} checked by tsc
  51365. */
  51366. /**
  51367. * @license
  51368. * Copyright Google Inc. All Rights Reserved.
  51369. *
  51370. * Use of this source code is governed by an MIT-style license that can be
  51371. * found in the LICENSE file at https://angular.io/license
  51372. */
  51373. /**
  51374. * @return {?}
  51375. */
  51376. function _iterableDiffersFactory() {
  51377. return defaultIterableDiffers;
  51378. }
  51379. /**
  51380. * @return {?}
  51381. */
  51382. function _keyValueDiffersFactory() {
  51383. return defaultKeyValueDiffers;
  51384. }
  51385. /**
  51386. * @param {?=} locale
  51387. * @return {?}
  51388. */
  51389. function _localeFactory(locale) {
  51390. return locale || 'en-US';
  51391. }
  51392. /**
  51393. * This module includes the providers of \@angular/core that are needed
  51394. * to bootstrap components via `ApplicationRef`.
  51395. *
  51396. * \@experimental
  51397. */
  51398. var ApplicationModule = /** @class */ (function () {
  51399. // Inject ApplicationRef to make it eager...
  51400. function ApplicationModule(appRef) {
  51401. }
  51402. ApplicationModule.decorators = [
  51403. { type: NgModule, args: [{
  51404. providers: [
  51405. ApplicationRef,
  51406. ApplicationInitStatus,
  51407. Compiler,
  51408. APP_ID_RANDOM_PROVIDER,
  51409. { provide: IterableDiffers, useFactory: _iterableDiffersFactory },
  51410. { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
  51411. {
  51412. provide: LOCALE_ID,
  51413. useFactory: _localeFactory,
  51414. deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
  51415. },
  51416. ]
  51417. },] },
  51418. ];
  51419. /** @nocollapse */
  51420. ApplicationModule.ctorParameters = function () { return [
  51421. { type: ApplicationRef, },
  51422. ]; };
  51423. return ApplicationModule;
  51424. }());
  51425. /**
  51426. * @fileoverview added by tsickle
  51427. * @suppress {checkTypes} checked by tsc
  51428. */
  51429. /**
  51430. * @license
  51431. * Copyright Google Inc. All Rights Reserved.
  51432. *
  51433. * Use of this source code is governed by an MIT-style license that can be
  51434. * found in the LICENSE file at https://angular.io/license
  51435. */
  51436. /** @enum {number} */
  51437. var SecurityContext = {
  51438. NONE: 0,
  51439. HTML: 1,
  51440. STYLE: 2,
  51441. SCRIPT: 3,
  51442. URL: 4,
  51443. RESOURCE_URL: 5,
  51444. };
  51445. SecurityContext[SecurityContext.NONE] = "NONE";
  51446. SecurityContext[SecurityContext.HTML] = "HTML";
  51447. SecurityContext[SecurityContext.STYLE] = "STYLE";
  51448. SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
  51449. SecurityContext[SecurityContext.URL] = "URL";
  51450. SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
  51451. /**
  51452. * Sanitizer is used by the views to sanitize potentially dangerous values.
  51453. *
  51454. * \@stable
  51455. * @abstract
  51456. */
  51457. var Sanitizer = /** @class */ (function () {
  51458. function Sanitizer() {
  51459. }
  51460. return Sanitizer;
  51461. }());
  51462. /**
  51463. * @fileoverview added by tsickle
  51464. * @suppress {checkTypes} checked by tsc
  51465. */
  51466. /**
  51467. * @license
  51468. * Copyright Google Inc. All Rights Reserved.
  51469. *
  51470. * Use of this source code is governed by an MIT-style license that can be
  51471. * found in the LICENSE file at https://angular.io/license
  51472. */
  51473. /**
  51474. * Factory for ViewDefinitions/NgModuleDefinitions.
  51475. * We use a function so we can reexeute it in case an error happens and use the given logger
  51476. * function to log the error from the definition of the node, which is shown in all browser
  51477. * logs.
  51478. * @record
  51479. */
  51480. /**
  51481. * Function to call console.error at the right source location. This is an indirection
  51482. * via another function as browser will log the location that actually called
  51483. * `console.error`.
  51484. * @record
  51485. */
  51486. /**
  51487. * @record
  51488. */
  51489. /**
  51490. * @record
  51491. */
  51492. /**
  51493. * @record
  51494. */
  51495. /**
  51496. * @record
  51497. */
  51498. /**
  51499. * @record
  51500. */
  51501. /**
  51502. * @record
  51503. */
  51504. /**
  51505. * @record
  51506. */
  51507. /**
  51508. * @record
  51509. */
  51510. /**
  51511. * A node definition in the view.
  51512. *
  51513. * Note: We use one type for all nodes so that loops that loop over all nodes
  51514. * of a ViewDefinition stay monomorphic!
  51515. * @record
  51516. */
  51517. /**
  51518. * @record
  51519. */
  51520. /**
  51521. * @record
  51522. */
  51523. /**
  51524. * @record
  51525. */
  51526. /**
  51527. * @record
  51528. */
  51529. /**
  51530. * @record
  51531. */
  51532. /**
  51533. * @record
  51534. */
  51535. /**
  51536. * @record
  51537. */
  51538. /**
  51539. * @record
  51540. */
  51541. /**
  51542. * @record
  51543. */
  51544. /**
  51545. * @record
  51546. */
  51547. /**
  51548. * @record
  51549. */
  51550. /**
  51551. * @record
  51552. */
  51553. /**
  51554. * View instance data.
  51555. * Attention: Adding fields to this is performance sensitive!
  51556. * @record
  51557. */
  51558. /**
  51559. * @param {?} view
  51560. * @param {?} priorInitState
  51561. * @param {?} newInitState
  51562. * @return {?}
  51563. */
  51564. function shiftInitState(view, priorInitState, newInitState) {
  51565. // Only update the InitState if we are currently in the prior state.
  51566. // For example, only move into CallingInit if we are in BeforeInit. Only
  51567. // move into CallingContentInit if we are in CallingInit. Normally this will
  51568. // always be true because of how checkCycle is called in checkAndUpdateView.
  51569. // However, if checkAndUpdateView is called recursively or if an exception is
  51570. // thrown while checkAndUpdateView is running, checkAndUpdateView starts over
  51571. // from the beginning. This ensures the state is monotonically increasing,
  51572. // terminating in the AfterInit state, which ensures the Init methods are called
  51573. // at least once and only once.
  51574. var /** @type {?} */ state = view.state;
  51575. var /** @type {?} */ initState = state & 1792;
  51576. if (initState === priorInitState) {
  51577. view.state = (state & ~1792 /* InitState_Mask */) | newInitState;
  51578. view.initIndex = -1;
  51579. return true;
  51580. }
  51581. return initState === newInitState;
  51582. }
  51583. /**
  51584. * @param {?} view
  51585. * @param {?} initState
  51586. * @param {?} index
  51587. * @return {?}
  51588. */
  51589. function shouldCallLifecycleInitHook(view, initState, index) {
  51590. if ((view.state & 1792 /* InitState_Mask */) === initState && view.initIndex <= index) {
  51591. view.initIndex = index + 1;
  51592. return true;
  51593. }
  51594. return false;
  51595. }
  51596. /**
  51597. * @record
  51598. */
  51599. /**
  51600. * Data for an instantiated NodeType.Text.
  51601. *
  51602. * Attention: Adding fields to this is performance sensitive!
  51603. * @record
  51604. */
  51605. /**
  51606. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  51607. * @param {?} view
  51608. * @param {?} index
  51609. * @return {?}
  51610. */
  51611. function asTextData(view, index) {
  51612. return /** @type {?} */ (view.nodes[index]);
  51613. }
  51614. /**
  51615. * Data for an instantiated NodeType.Element.
  51616. *
  51617. * Attention: Adding fields to this is performance sensitive!
  51618. * @record
  51619. */
  51620. /**
  51621. * @record
  51622. */
  51623. /**
  51624. * @record
  51625. */
  51626. /**
  51627. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  51628. * @param {?} view
  51629. * @param {?} index
  51630. * @return {?}
  51631. */
  51632. function asElementData(view, index) {
  51633. return /** @type {?} */ (view.nodes[index]);
  51634. }
  51635. /**
  51636. * Data for an instantiated NodeType.Provider.
  51637. *
  51638. * Attention: Adding fields to this is performance sensitive!
  51639. * @record
  51640. */
  51641. /**
  51642. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  51643. * @param {?} view
  51644. * @param {?} index
  51645. * @return {?}
  51646. */
  51647. function asProviderData(view, index) {
  51648. return /** @type {?} */ (view.nodes[index]);
  51649. }
  51650. /**
  51651. * Data for an instantiated NodeType.PureExpression.
  51652. *
  51653. * Attention: Adding fields to this is performance sensitive!
  51654. * @record
  51655. */
  51656. /**
  51657. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  51658. * @param {?} view
  51659. * @param {?} index
  51660. * @return {?}
  51661. */
  51662. function asPureExpressionData(view, index) {
  51663. return /** @type {?} */ (view.nodes[index]);
  51664. }
  51665. /**
  51666. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  51667. * @param {?} view
  51668. * @param {?} index
  51669. * @return {?}
  51670. */
  51671. function asQueryList(view, index) {
  51672. return /** @type {?} */ (view.nodes[index]);
  51673. }
  51674. /**
  51675. * @record
  51676. */
  51677. /**
  51678. * @abstract
  51679. */
  51680. var DebugContext = /** @class */ (function () {
  51681. function DebugContext() {
  51682. }
  51683. return DebugContext;
  51684. }());
  51685. /**
  51686. * @record
  51687. */
  51688. /**
  51689. * This object is used to prevent cycles in the source files and to have a place where
  51690. * debug mode can hook it. It is lazily filled when `isDevMode` is known.
  51691. */
  51692. var Services = {
  51693. setCurrentNode: /** @type {?} */ ((undefined)),
  51694. createRootView: /** @type {?} */ ((undefined)),
  51695. createEmbeddedView: /** @type {?} */ ((undefined)),
  51696. createComponentView: /** @type {?} */ ((undefined)),
  51697. createNgModuleRef: /** @type {?} */ ((undefined)),
  51698. overrideProvider: /** @type {?} */ ((undefined)),
  51699. overrideComponentView: /** @type {?} */ ((undefined)),
  51700. clearOverrides: /** @type {?} */ ((undefined)),
  51701. checkAndUpdateView: /** @type {?} */ ((undefined)),
  51702. checkNoChangesView: /** @type {?} */ ((undefined)),
  51703. destroyView: /** @type {?} */ ((undefined)),
  51704. resolveDep: /** @type {?} */ ((undefined)),
  51705. createDebugContext: /** @type {?} */ ((undefined)),
  51706. handleEvent: /** @type {?} */ ((undefined)),
  51707. updateDirectives: /** @type {?} */ ((undefined)),
  51708. updateRenderer: /** @type {?} */ ((undefined)),
  51709. dirtyParentQueries: /** @type {?} */ ((undefined)),
  51710. };
  51711. /**
  51712. * @fileoverview added by tsickle
  51713. * @suppress {checkTypes} checked by tsc
  51714. */
  51715. /**
  51716. * @license
  51717. * Copyright Google Inc. All Rights Reserved.
  51718. *
  51719. * Use of this source code is governed by an MIT-style license that can be
  51720. * found in the LICENSE file at https://angular.io/license
  51721. */
  51722. /**
  51723. * @param {?} context
  51724. * @param {?} oldValue
  51725. * @param {?} currValue
  51726. * @param {?} isFirstCheck
  51727. * @return {?}
  51728. */
  51729. function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
  51730. var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
  51731. if (isFirstCheck) {
  51732. msg +=
  51733. " It seems like the view has been created after its parent and its children have been dirty checked." +
  51734. " Has it been created in a change detection hook ?";
  51735. }
  51736. return viewDebugError(msg, context);
  51737. }
  51738. /**
  51739. * @param {?} err
  51740. * @param {?} context
  51741. * @return {?}
  51742. */
  51743. function viewWrappedDebugError(err, context) {
  51744. if (!(err instanceof Error)) {
  51745. // errors that are not Error instances don't have a stack,
  51746. // so it is ok to wrap them into a new Error object...
  51747. err = new Error(err.toString());
  51748. }
  51749. _addDebugContext(err, context);
  51750. return err;
  51751. }
  51752. /**
  51753. * @param {?} msg
  51754. * @param {?} context
  51755. * @return {?}
  51756. */
  51757. function viewDebugError(msg, context) {
  51758. var /** @type {?} */ err = new Error(msg);
  51759. _addDebugContext(err, context);
  51760. return err;
  51761. }
  51762. /**
  51763. * @param {?} err
  51764. * @param {?} context
  51765. * @return {?}
  51766. */
  51767. function _addDebugContext(err, context) {
  51768. (/** @type {?} */ (err))[ERROR_DEBUG_CONTEXT] = context;
  51769. (/** @type {?} */ (err))[ERROR_LOGGER] = context.logError.bind(context);
  51770. }
  51771. /**
  51772. * @param {?} err
  51773. * @return {?}
  51774. */
  51775. function isViewDebugError(err) {
  51776. return !!getDebugContext(err);
  51777. }
  51778. /**
  51779. * @param {?} action
  51780. * @return {?}
  51781. */
  51782. function viewDestroyedError(action) {
  51783. return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
  51784. }
  51785. /**
  51786. * @fileoverview added by tsickle
  51787. * @suppress {checkTypes} checked by tsc
  51788. */
  51789. /**
  51790. * @license
  51791. * Copyright Google Inc. All Rights Reserved.
  51792. *
  51793. * Use of this source code is governed by an MIT-style license that can be
  51794. * found in the LICENSE file at https://angular.io/license
  51795. */
  51796. var NOOP = function () { };
  51797. var _tokenKeyCache = new Map();
  51798. /**
  51799. * @param {?} token
  51800. * @return {?}
  51801. */
  51802. function tokenKey(token) {
  51803. var /** @type {?} */ key = _tokenKeyCache.get(token);
  51804. if (!key) {
  51805. key = stringify(token) + '_' + _tokenKeyCache.size;
  51806. _tokenKeyCache.set(token, key);
  51807. }
  51808. return key;
  51809. }
  51810. /**
  51811. * @param {?} view
  51812. * @param {?} nodeIdx
  51813. * @param {?} bindingIdx
  51814. * @param {?} value
  51815. * @return {?}
  51816. */
  51817. function unwrapValue(view, nodeIdx, bindingIdx, value) {
  51818. if (WrappedValue.isWrapped(value)) {
  51819. value = WrappedValue.unwrap(value);
  51820. var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
  51821. var /** @type {?} */ oldValue = WrappedValue.unwrap(view.oldValues[globalBindingIdx]);
  51822. view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
  51823. }
  51824. return value;
  51825. }
  51826. var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
  51827. var EMPTY_RENDERER_TYPE_ID = '$$empty';
  51828. /**
  51829. * @param {?} values
  51830. * @return {?}
  51831. */
  51832. function createRendererType2(values) {
  51833. return {
  51834. id: UNDEFINED_RENDERER_TYPE_ID,
  51835. styles: values.styles,
  51836. encapsulation: values.encapsulation,
  51837. data: values.data
  51838. };
  51839. }
  51840. var _renderCompCount = 0;
  51841. /**
  51842. * @param {?=} type
  51843. * @return {?}
  51844. */
  51845. function resolveRendererType2(type) {
  51846. if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
  51847. // first time we see this RendererType2. Initialize it...
  51848. var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
  51849. type.styles.length || Object.keys(type.data).length);
  51850. if (isFilled) {
  51851. type.id = "c" + _renderCompCount++;
  51852. }
  51853. else {
  51854. type.id = EMPTY_RENDERER_TYPE_ID;
  51855. }
  51856. }
  51857. if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
  51858. type = null;
  51859. }
  51860. return type || null;
  51861. }
  51862. /**
  51863. * @param {?} view
  51864. * @param {?} def
  51865. * @param {?} bindingIdx
  51866. * @param {?} value
  51867. * @return {?}
  51868. */
  51869. function checkBinding(view, def, bindingIdx, value) {
  51870. var /** @type {?} */ oldValues = view.oldValues;
  51871. if ((view.state & 2 /* FirstCheck */) ||
  51872. !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
  51873. return true;
  51874. }
  51875. return false;
  51876. }
  51877. /**
  51878. * @param {?} view
  51879. * @param {?} def
  51880. * @param {?} bindingIdx
  51881. * @param {?} value
  51882. * @return {?}
  51883. */
  51884. function checkAndUpdateBinding(view, def, bindingIdx, value) {
  51885. if (checkBinding(view, def, bindingIdx, value)) {
  51886. view.oldValues[def.bindingIndex + bindingIdx] = value;
  51887. return true;
  51888. }
  51889. return false;
  51890. }
  51891. /**
  51892. * @param {?} view
  51893. * @param {?} def
  51894. * @param {?} bindingIdx
  51895. * @param {?} value
  51896. * @return {?}
  51897. */
  51898. function checkBindingNoChanges(view, def, bindingIdx, value) {
  51899. var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
  51900. if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) {
  51901. var /** @type {?} */ bindingName = def.bindings[bindingIdx].name;
  51902. throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), bindingName + ": " + oldValue, bindingName + ": " + value, (view.state & 1 /* BeforeFirstCheck */) !== 0);
  51903. }
  51904. }
  51905. /**
  51906. * @param {?} view
  51907. * @return {?}
  51908. */
  51909. function markParentViewsForCheck(view) {
  51910. var /** @type {?} */ currView = view;
  51911. while (currView) {
  51912. if (currView.def.flags & 2 /* OnPush */) {
  51913. currView.state |= 8 /* ChecksEnabled */;
  51914. }
  51915. currView = currView.viewContainerParent || currView.parent;
  51916. }
  51917. }
  51918. /**
  51919. * @param {?} view
  51920. * @param {?} endView
  51921. * @return {?}
  51922. */
  51923. function markParentViewsForCheckProjectedViews(view, endView) {
  51924. var /** @type {?} */ currView = view;
  51925. while (currView && currView !== endView) {
  51926. currView.state |= 64 /* CheckProjectedViews */;
  51927. currView = currView.viewContainerParent || currView.parent;
  51928. }
  51929. }
  51930. /**
  51931. * @param {?} view
  51932. * @param {?} nodeIndex
  51933. * @param {?} eventName
  51934. * @param {?} event
  51935. * @return {?}
  51936. */
  51937. function dispatchEvent(view, nodeIndex, eventName, event) {
  51938. try {
  51939. var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
  51940. var /** @type {?} */ startView = nodeDef.flags & 33554432 /* ComponentView */ ?
  51941. asElementData(view, nodeIndex).componentView :
  51942. view;
  51943. markParentViewsForCheck(startView);
  51944. return Services.handleEvent(view, nodeIndex, eventName, event);
  51945. }
  51946. catch (/** @type {?} */ e) {
  51947. // Attention: Don't rethrow, as it would cancel Observable subscriptions!
  51948. view.root.errorHandler.handleError(e);
  51949. }
  51950. }
  51951. /**
  51952. * @param {?} view
  51953. * @return {?}
  51954. */
  51955. function declaredViewContainer(view) {
  51956. if (view.parent) {
  51957. var /** @type {?} */ parentView = view.parent;
  51958. return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).nodeIndex);
  51959. }
  51960. return null;
  51961. }
  51962. /**
  51963. * for component views, this is the host element.
  51964. * for embedded views, this is the index of the parent node
  51965. * that contains the view container.
  51966. * @param {?} view
  51967. * @return {?}
  51968. */
  51969. function viewParentEl(view) {
  51970. var /** @type {?} */ parentView = view.parent;
  51971. if (parentView) {
  51972. return /** @type {?} */ ((view.parentNodeDef)).parent;
  51973. }
  51974. else {
  51975. return null;
  51976. }
  51977. }
  51978. /**
  51979. * @param {?} view
  51980. * @param {?} def
  51981. * @return {?}
  51982. */
  51983. function renderNode(view, def) {
  51984. switch (def.flags & 201347067 /* Types */) {
  51985. case 1 /* TypeElement */:
  51986. return asElementData(view, def.nodeIndex).renderElement;
  51987. case 2 /* TypeText */:
  51988. return asTextData(view, def.nodeIndex).renderText;
  51989. }
  51990. }
  51991. /**
  51992. * @param {?} target
  51993. * @param {?} name
  51994. * @return {?}
  51995. */
  51996. function elementEventFullName(target, name) {
  51997. return target ? target + ":" + name : name;
  51998. }
  51999. /**
  52000. * @param {?} view
  52001. * @return {?}
  52002. */
  52003. function isComponentView(view) {
  52004. return !!view.parent && !!(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */);
  52005. }
  52006. /**
  52007. * @param {?} view
  52008. * @return {?}
  52009. */
  52010. function isEmbeddedView(view) {
  52011. return !!view.parent && !(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */);
  52012. }
  52013. /**
  52014. * @param {?} queryId
  52015. * @return {?}
  52016. */
  52017. function filterQueryId(queryId) {
  52018. return 1 << (queryId % 32);
  52019. }
  52020. /**
  52021. * @param {?} matchedQueriesDsl
  52022. * @return {?}
  52023. */
  52024. function splitMatchedQueriesDsl(matchedQueriesDsl) {
  52025. var /** @type {?} */ matchedQueries = {};
  52026. var /** @type {?} */ matchedQueryIds = 0;
  52027. var /** @type {?} */ references = {};
  52028. if (matchedQueriesDsl) {
  52029. matchedQueriesDsl.forEach(function (_a) {
  52030. var queryId = _a[0], valueType = _a[1];
  52031. if (typeof queryId === 'number') {
  52032. matchedQueries[queryId] = valueType;
  52033. matchedQueryIds |= filterQueryId(queryId);
  52034. }
  52035. else {
  52036. references[queryId] = valueType;
  52037. }
  52038. });
  52039. }
  52040. return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
  52041. }
  52042. /**
  52043. * @param {?} deps
  52044. * @param {?=} sourceName
  52045. * @return {?}
  52046. */
  52047. function splitDepsDsl(deps, sourceName) {
  52048. return deps.map(function (value) {
  52049. var /** @type {?} */ token;
  52050. var /** @type {?} */ flags;
  52051. if (Array.isArray(value)) {
  52052. flags = value[0], token = value[1];
  52053. }
  52054. else {
  52055. flags = 0 /* None */;
  52056. token = value;
  52057. }
  52058. if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) {
  52059. Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true });
  52060. }
  52061. return { flags: flags, token: token, tokenKey: tokenKey(token) };
  52062. });
  52063. }
  52064. /**
  52065. * @param {?} view
  52066. * @param {?} renderHost
  52067. * @param {?} def
  52068. * @return {?}
  52069. */
  52070. function getParentRenderElement(view, renderHost, def) {
  52071. var /** @type {?} */ renderParent = def.renderParent;
  52072. if (renderParent) {
  52073. if ((renderParent.flags & 1 /* TypeElement */) === 0 ||
  52074. (renderParent.flags & 33554432 /* ComponentView */) === 0 ||
  52075. (/** @type {?} */ ((renderParent.element)).componentRendererType && /** @type {?} */ ((/** @type {?} */ ((renderParent.element)).componentRendererType)).encapsulation === ViewEncapsulation.Native)) {
  52076. // only children of non components, or children of components with native encapsulation should
  52077. // be attached.
  52078. return asElementData(view, /** @type {?} */ ((def.renderParent)).nodeIndex).renderElement;
  52079. }
  52080. }
  52081. else {
  52082. return renderHost;
  52083. }
  52084. }
  52085. var DEFINITION_CACHE = new WeakMap();
  52086. /**
  52087. * @template D
  52088. * @param {?} factory
  52089. * @return {?}
  52090. */
  52091. function resolveDefinition(factory) {
  52092. var /** @type {?} */ value = /** @type {?} */ (((DEFINITION_CACHE.get(factory))));
  52093. if (!value) {
  52094. value = factory(function () { return NOOP; });
  52095. value.factory = factory;
  52096. DEFINITION_CACHE.set(factory, value);
  52097. }
  52098. return value;
  52099. }
  52100. /**
  52101. * @param {?} view
  52102. * @return {?}
  52103. */
  52104. function rootRenderNodes(view) {
  52105. var /** @type {?} */ renderNodes = [];
  52106. visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes);
  52107. return renderNodes;
  52108. }
  52109. /**
  52110. * @param {?} view
  52111. * @param {?} action
  52112. * @param {?} parentNode
  52113. * @param {?} nextSibling
  52114. * @param {?=} target
  52115. * @return {?}
  52116. */
  52117. function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
  52118. // We need to re-compute the parent node in case the nodes have been moved around manually
  52119. if (action === 3 /* RemoveChild */) {
  52120. parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode))));
  52121. }
  52122. visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
  52123. }
  52124. /**
  52125. * @param {?} view
  52126. * @param {?} action
  52127. * @param {?} startIndex
  52128. * @param {?} endIndex
  52129. * @param {?} parentNode
  52130. * @param {?} nextSibling
  52131. * @param {?=} target
  52132. * @return {?}
  52133. */
  52134. function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
  52135. for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
  52136. var /** @type {?} */ nodeDef = view.def.nodes[i];
  52137. if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) {
  52138. visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
  52139. }
  52140. // jump to next sibling
  52141. i += nodeDef.childCount;
  52142. }
  52143. }
  52144. /**
  52145. * @param {?} view
  52146. * @param {?} ngContentIndex
  52147. * @param {?} action
  52148. * @param {?} parentNode
  52149. * @param {?} nextSibling
  52150. * @param {?=} target
  52151. * @return {?}
  52152. */
  52153. function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
  52154. var /** @type {?} */ compView = view;
  52155. while (compView && !isComponentView(compView)) {
  52156. compView = compView.parent;
  52157. }
  52158. var /** @type {?} */ hostView = /** @type {?} */ ((compView)).parent;
  52159. var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView)));
  52160. var /** @type {?} */ startIndex = /** @type {?} */ ((hostElDef)).nodeIndex + 1;
  52161. var /** @type {?} */ endIndex = /** @type {?} */ ((hostElDef)).nodeIndex + /** @type {?} */ ((hostElDef)).childCount;
  52162. for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
  52163. var /** @type {?} */ nodeDef = /** @type {?} */ ((hostView)).def.nodes[i];
  52164. if (nodeDef.ngContentIndex === ngContentIndex) {
  52165. visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target);
  52166. }
  52167. // jump to next sibling
  52168. i += nodeDef.childCount;
  52169. }
  52170. if (!/** @type {?} */ ((hostView)).parent) {
  52171. // a root view
  52172. var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex];
  52173. if (projectedNodes) {
  52174. for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) {
  52175. execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
  52176. }
  52177. }
  52178. }
  52179. }
  52180. /**
  52181. * @param {?} view
  52182. * @param {?} nodeDef
  52183. * @param {?} action
  52184. * @param {?} parentNode
  52185. * @param {?} nextSibling
  52186. * @param {?=} target
  52187. * @return {?}
  52188. */
  52189. function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
  52190. if (nodeDef.flags & 8 /* TypeNgContent */) {
  52191. visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
  52192. }
  52193. else {
  52194. var /** @type {?} */ rn = renderNode(view, nodeDef);
  52195. if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) &&
  52196. (nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) {
  52197. // Note: we might need to do both actions.
  52198. if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) {
  52199. execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
  52200. }
  52201. if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) {
  52202. var /** @type {?} */ compView = asElementData(view, nodeDef.nodeIndex).componentView;
  52203. execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
  52204. }
  52205. }
  52206. else {
  52207. execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
  52208. }
  52209. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  52210. var /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, nodeDef.nodeIndex).viewContainer))._embeddedViews;
  52211. for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
  52212. visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
  52213. }
  52214. }
  52215. if (nodeDef.flags & 1 /* TypeElement */ && !/** @type {?} */ ((nodeDef.element)).name) {
  52216. visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
  52217. }
  52218. }
  52219. }
  52220. /**
  52221. * @param {?} view
  52222. * @param {?} renderNode
  52223. * @param {?} action
  52224. * @param {?} parentNode
  52225. * @param {?} nextSibling
  52226. * @param {?=} target
  52227. * @return {?}
  52228. */
  52229. function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
  52230. var /** @type {?} */ renderer = view.renderer;
  52231. switch (action) {
  52232. case 1 /* AppendChild */:
  52233. renderer.appendChild(parentNode, renderNode);
  52234. break;
  52235. case 2 /* InsertBefore */:
  52236. renderer.insertBefore(parentNode, renderNode, nextSibling);
  52237. break;
  52238. case 3 /* RemoveChild */:
  52239. renderer.removeChild(parentNode, renderNode);
  52240. break;
  52241. case 0 /* Collect */:
  52242. /** @type {?} */ ((target)).push(renderNode);
  52243. break;
  52244. }
  52245. }
  52246. var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
  52247. /**
  52248. * @param {?} name
  52249. * @return {?}
  52250. */
  52251. function splitNamespace(name) {
  52252. if (name[0] === ':') {
  52253. var /** @type {?} */ match = /** @type {?} */ ((name.match(NS_PREFIX_RE)));
  52254. return [match[1], match[2]];
  52255. }
  52256. return ['', name];
  52257. }
  52258. /**
  52259. * @param {?} bindings
  52260. * @return {?}
  52261. */
  52262. function calcBindingFlags(bindings) {
  52263. var /** @type {?} */ flags = 0;
  52264. for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
  52265. flags |= bindings[i].flags;
  52266. }
  52267. return flags;
  52268. }
  52269. /**
  52270. * @param {?} valueCount
  52271. * @param {?} constAndInterp
  52272. * @return {?}
  52273. */
  52274. function interpolate(valueCount, constAndInterp) {
  52275. var /** @type {?} */ result = '';
  52276. for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) {
  52277. result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
  52278. }
  52279. return result + constAndInterp[valueCount * 2];
  52280. }
  52281. /**
  52282. * @param {?} valueCount
  52283. * @param {?} c0
  52284. * @param {?} a1
  52285. * @param {?} c1
  52286. * @param {?=} a2
  52287. * @param {?=} c2
  52288. * @param {?=} a3
  52289. * @param {?=} c3
  52290. * @param {?=} a4
  52291. * @param {?=} c4
  52292. * @param {?=} a5
  52293. * @param {?=} c5
  52294. * @param {?=} a6
  52295. * @param {?=} c6
  52296. * @param {?=} a7
  52297. * @param {?=} c7
  52298. * @param {?=} a8
  52299. * @param {?=} c8
  52300. * @param {?=} a9
  52301. * @param {?=} c9
  52302. * @return {?}
  52303. */
  52304. function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
  52305. switch (valueCount) {
  52306. case 1:
  52307. return c0 + _toStringWithNull(a1) + c1;
  52308. case 2:
  52309. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
  52310. case 3:
  52311. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52312. c3;
  52313. case 4:
  52314. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52315. c3 + _toStringWithNull(a4) + c4;
  52316. case 5:
  52317. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52318. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
  52319. case 6:
  52320. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52321. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
  52322. case 7:
  52323. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52324. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
  52325. c6 + _toStringWithNull(a7) + c7;
  52326. case 8:
  52327. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52328. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
  52329. c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
  52330. case 9:
  52331. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  52332. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
  52333. c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
  52334. default:
  52335. throw new Error("Does not support more than 9 expressions");
  52336. }
  52337. }
  52338. /**
  52339. * @param {?} v
  52340. * @return {?}
  52341. */
  52342. function _toStringWithNull(v) {
  52343. return v != null ? v.toString() : '';
  52344. }
  52345. var EMPTY_ARRAY = [];
  52346. var EMPTY_MAP = {};
  52347. /**
  52348. * @fileoverview added by tsickle
  52349. * @suppress {checkTypes} checked by tsc
  52350. */
  52351. /**
  52352. * @license
  52353. * Copyright Google Inc. All Rights Reserved.
  52354. *
  52355. * Use of this source code is governed by an MIT-style license that can be
  52356. * found in the LICENSE file at https://angular.io/license
  52357. */
  52358. /**
  52359. * @param {?} flags
  52360. * @param {?} matchedQueriesDsl
  52361. * @param {?} ngContentIndex
  52362. * @param {?} childCount
  52363. * @param {?=} handleEvent
  52364. * @param {?=} templateFactory
  52365. * @return {?}
  52366. */
  52367. function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
  52368. flags |= 1 /* TypeElement */;
  52369. var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
  52370. var /** @type {?} */ template = templateFactory ? resolveDefinition(templateFactory) : null;
  52371. return {
  52372. // will bet set by the view definition
  52373. nodeIndex: -1,
  52374. parent: null,
  52375. renderParent: null,
  52376. bindingIndex: -1,
  52377. outputIndex: -1,
  52378. // regular values
  52379. flags: flags,
  52380. checkIndex: -1,
  52381. childFlags: 0,
  52382. directChildFlags: 0,
  52383. childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
  52384. bindings: [],
  52385. bindingFlags: 0,
  52386. outputs: [],
  52387. element: {
  52388. ns: null,
  52389. name: null,
  52390. attrs: null, template: template,
  52391. componentProvider: null,
  52392. componentView: null,
  52393. componentRendererType: null,
  52394. publicProviders: null,
  52395. allProviders: null,
  52396. handleEvent: handleEvent || NOOP
  52397. },
  52398. provider: null,
  52399. text: null,
  52400. query: null,
  52401. ngContent: null
  52402. };
  52403. }
  52404. /**
  52405. * @param {?} checkIndex
  52406. * @param {?} flags
  52407. * @param {?} matchedQueriesDsl
  52408. * @param {?} ngContentIndex
  52409. * @param {?} childCount
  52410. * @param {?} namespaceAndName
  52411. * @param {?=} fixedAttrs
  52412. * @param {?=} bindings
  52413. * @param {?=} outputs
  52414. * @param {?=} handleEvent
  52415. * @param {?=} componentView
  52416. * @param {?=} componentRendererType
  52417. * @return {?}
  52418. */
  52419. function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
  52420. if (fixedAttrs === void 0) { fixedAttrs = []; }
  52421. if (!handleEvent) {
  52422. handleEvent = NOOP;
  52423. }
  52424. var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
  52425. var /** @type {?} */ ns = /** @type {?} */ ((null));
  52426. var /** @type {?} */ name = /** @type {?} */ ((null));
  52427. if (namespaceAndName) {
  52428. _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
  52429. }
  52430. bindings = bindings || [];
  52431. var /** @type {?} */ bindingDefs = new Array(bindings.length);
  52432. for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
  52433. var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
  52434. var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
  52435. var /** @type {?} */ securityContext = /** @type {?} */ ((undefined));
  52436. var /** @type {?} */ suffix = /** @type {?} */ ((undefined));
  52437. switch (bindingFlags & 15 /* Types */) {
  52438. case 4 /* TypeElementStyle */:
  52439. suffix = /** @type {?} */ (suffixOrSecurityContext);
  52440. break;
  52441. case 1 /* TypeElementAttribute */:
  52442. case 8 /* TypeProperty */:
  52443. securityContext = /** @type {?} */ (suffixOrSecurityContext);
  52444. break;
  52445. }
  52446. bindingDefs[i] =
  52447. { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
  52448. }
  52449. outputs = outputs || [];
  52450. var /** @type {?} */ outputDefs = new Array(outputs.length);
  52451. for (var /** @type {?} */ i = 0; i < outputs.length; i++) {
  52452. var _e = outputs[i], target = _e[0], eventName = _e[1];
  52453. outputDefs[i] = {
  52454. type: 0 /* ElementOutput */,
  52455. target: /** @type {?} */ (target), eventName: eventName,
  52456. propName: null
  52457. };
  52458. }
  52459. fixedAttrs = fixedAttrs || [];
  52460. var /** @type {?} */ attrs = /** @type {?} */ (fixedAttrs.map(function (_a) {
  52461. var namespaceAndName = _a[0], value = _a[1];
  52462. var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
  52463. return [ns, name, value];
  52464. }));
  52465. componentRendererType = resolveRendererType2(componentRendererType);
  52466. if (componentView) {
  52467. flags |= 33554432 /* ComponentView */;
  52468. }
  52469. flags |= 1 /* TypeElement */;
  52470. return {
  52471. // will bet set by the view definition
  52472. nodeIndex: -1,
  52473. parent: null,
  52474. renderParent: null,
  52475. bindingIndex: -1,
  52476. outputIndex: -1,
  52477. // regular values
  52478. checkIndex: checkIndex,
  52479. flags: flags,
  52480. childFlags: 0,
  52481. directChildFlags: 0,
  52482. childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
  52483. bindings: bindingDefs,
  52484. bindingFlags: calcBindingFlags(bindingDefs),
  52485. outputs: outputDefs,
  52486. element: {
  52487. ns: ns,
  52488. name: name,
  52489. attrs: attrs,
  52490. template: null,
  52491. // will bet set by the view definition
  52492. componentProvider: null,
  52493. componentView: componentView || null,
  52494. componentRendererType: componentRendererType,
  52495. publicProviders: null,
  52496. allProviders: null,
  52497. handleEvent: handleEvent || NOOP,
  52498. },
  52499. provider: null,
  52500. text: null,
  52501. query: null,
  52502. ngContent: null
  52503. };
  52504. var _b;
  52505. }
  52506. /**
  52507. * @param {?} view
  52508. * @param {?} renderHost
  52509. * @param {?} def
  52510. * @return {?}
  52511. */
  52512. function createElement(view, renderHost, def) {
  52513. var /** @type {?} */ elDef = /** @type {?} */ ((def.element));
  52514. var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode;
  52515. var /** @type {?} */ renderer = view.renderer;
  52516. var /** @type {?} */ el;
  52517. if (view.parent || !rootSelectorOrNode) {
  52518. if (elDef.name) {
  52519. el = renderer.createElement(elDef.name, elDef.ns);
  52520. }
  52521. else {
  52522. el = renderer.createComment('');
  52523. }
  52524. var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
  52525. if (parentEl) {
  52526. renderer.appendChild(parentEl, el);
  52527. }
  52528. }
  52529. else {
  52530. el = renderer.selectRootElement(rootSelectorOrNode);
  52531. }
  52532. if (elDef.attrs) {
  52533. for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) {
  52534. var _a = elDef.attrs[i], ns = _a[0], name_2 = _a[1], value = _a[2];
  52535. renderer.setAttribute(el, name_2, value, ns);
  52536. }
  52537. }
  52538. return el;
  52539. }
  52540. /**
  52541. * @param {?} view
  52542. * @param {?} compView
  52543. * @param {?} def
  52544. * @param {?} el
  52545. * @return {?}
  52546. */
  52547. function listenToElementOutputs(view, compView, def, el) {
  52548. for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
  52549. var /** @type {?} */ output = def.outputs[i];
  52550. var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
  52551. var /** @type {?} */ listenTarget = output.target;
  52552. var /** @type {?} */ listenerView = view;
  52553. if (output.target === 'component') {
  52554. listenTarget = null;
  52555. listenerView = compView;
  52556. }
  52557. var /** @type {?} */ disposable = /** @type {?} */ (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */
  52558. ((view.disposables))[def.outputIndex + i] = disposable;
  52559. }
  52560. }
  52561. /**
  52562. * @param {?} view
  52563. * @param {?} index
  52564. * @param {?} eventName
  52565. * @return {?}
  52566. */
  52567. function renderEventHandlerClosure(view, index, eventName) {
  52568. return function (event) { return dispatchEvent(view, index, eventName, event); };
  52569. }
  52570. /**
  52571. * @param {?} view
  52572. * @param {?} def
  52573. * @param {?} v0
  52574. * @param {?} v1
  52575. * @param {?} v2
  52576. * @param {?} v3
  52577. * @param {?} v4
  52578. * @param {?} v5
  52579. * @param {?} v6
  52580. * @param {?} v7
  52581. * @param {?} v8
  52582. * @param {?} v9
  52583. * @return {?}
  52584. */
  52585. function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  52586. var /** @type {?} */ bindLen = def.bindings.length;
  52587. var /** @type {?} */ changed = false;
  52588. if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
  52589. changed = true;
  52590. if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
  52591. changed = true;
  52592. if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
  52593. changed = true;
  52594. if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
  52595. changed = true;
  52596. if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
  52597. changed = true;
  52598. if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
  52599. changed = true;
  52600. if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
  52601. changed = true;
  52602. if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
  52603. changed = true;
  52604. if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
  52605. changed = true;
  52606. if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
  52607. changed = true;
  52608. return changed;
  52609. }
  52610. /**
  52611. * @param {?} view
  52612. * @param {?} def
  52613. * @param {?} values
  52614. * @return {?}
  52615. */
  52616. function checkAndUpdateElementDynamic(view, def, values) {
  52617. var /** @type {?} */ changed = false;
  52618. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  52619. if (checkAndUpdateElementValue(view, def, i, values[i]))
  52620. changed = true;
  52621. }
  52622. return changed;
  52623. }
  52624. /**
  52625. * @param {?} view
  52626. * @param {?} def
  52627. * @param {?} bindingIdx
  52628. * @param {?} value
  52629. * @return {?}
  52630. */
  52631. function checkAndUpdateElementValue(view, def, bindingIdx, value) {
  52632. if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
  52633. return false;
  52634. }
  52635. var /** @type {?} */ binding = def.bindings[bindingIdx];
  52636. var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
  52637. var /** @type {?} */ renderNode$$1 = elData.renderElement;
  52638. var /** @type {?} */ name = /** @type {?} */ ((binding.name));
  52639. switch (binding.flags & 15 /* Types */) {
  52640. case 1 /* TypeElementAttribute */:
  52641. setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
  52642. break;
  52643. case 2 /* TypeElementClass */:
  52644. setElementClass(view, renderNode$$1, name, value);
  52645. break;
  52646. case 4 /* TypeElementStyle */:
  52647. setElementStyle(view, binding, renderNode$$1, name, value);
  52648. break;
  52649. case 8 /* TypeProperty */:
  52650. var /** @type {?} */ bindView = (def.flags & 33554432 /* ComponentView */ &&
  52651. binding.flags & 32 /* SyntheticHostProperty */) ?
  52652. elData.componentView :
  52653. view;
  52654. setElementProperty(bindView, binding, renderNode$$1, name, value);
  52655. break;
  52656. }
  52657. return true;
  52658. }
  52659. /**
  52660. * @param {?} view
  52661. * @param {?} binding
  52662. * @param {?} renderNode
  52663. * @param {?} ns
  52664. * @param {?} name
  52665. * @param {?} value
  52666. * @return {?}
  52667. */
  52668. function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
  52669. var /** @type {?} */ securityContext = binding.securityContext;
  52670. var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
  52671. renderValue = renderValue != null ? renderValue.toString() : null;
  52672. var /** @type {?} */ renderer = view.renderer;
  52673. if (value != null) {
  52674. renderer.setAttribute(renderNode$$1, name, renderValue, ns);
  52675. }
  52676. else {
  52677. renderer.removeAttribute(renderNode$$1, name, ns);
  52678. }
  52679. }
  52680. /**
  52681. * @param {?} view
  52682. * @param {?} renderNode
  52683. * @param {?} name
  52684. * @param {?} value
  52685. * @return {?}
  52686. */
  52687. function setElementClass(view, renderNode$$1, name, value) {
  52688. var /** @type {?} */ renderer = view.renderer;
  52689. if (value) {
  52690. renderer.addClass(renderNode$$1, name);
  52691. }
  52692. else {
  52693. renderer.removeClass(renderNode$$1, name);
  52694. }
  52695. }
  52696. /**
  52697. * @param {?} view
  52698. * @param {?} binding
  52699. * @param {?} renderNode
  52700. * @param {?} name
  52701. * @param {?} value
  52702. * @return {?}
  52703. */
  52704. function setElementStyle(view, binding, renderNode$$1, name, value) {
  52705. var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value));
  52706. if (renderValue != null) {
  52707. renderValue = renderValue.toString();
  52708. var /** @type {?} */ unit = binding.suffix;
  52709. if (unit != null) {
  52710. renderValue = renderValue + unit;
  52711. }
  52712. }
  52713. else {
  52714. renderValue = null;
  52715. }
  52716. var /** @type {?} */ renderer = view.renderer;
  52717. if (renderValue != null) {
  52718. renderer.setStyle(renderNode$$1, name, renderValue);
  52719. }
  52720. else {
  52721. renderer.removeStyle(renderNode$$1, name);
  52722. }
  52723. }
  52724. /**
  52725. * @param {?} view
  52726. * @param {?} binding
  52727. * @param {?} renderNode
  52728. * @param {?} name
  52729. * @param {?} value
  52730. * @return {?}
  52731. */
  52732. function setElementProperty(view, binding, renderNode$$1, name, value) {
  52733. var /** @type {?} */ securityContext = binding.securityContext;
  52734. var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
  52735. view.renderer.setProperty(renderNode$$1, name, renderValue);
  52736. }
  52737. /**
  52738. * @fileoverview added by tsickle
  52739. * @suppress {checkTypes} checked by tsc
  52740. */
  52741. /**
  52742. * @license
  52743. * Copyright Google Inc. All Rights Reserved.
  52744. *
  52745. * Use of this source code is governed by an MIT-style license that can be
  52746. * found in the LICENSE file at https://angular.io/license
  52747. */
  52748. var UNDEFINED_VALUE = new Object();
  52749. var InjectorRefTokenKey$1 = tokenKey(Injector);
  52750. var NgModuleRefTokenKey = tokenKey(NgModuleRef);
  52751. /**
  52752. * @param {?} flags
  52753. * @param {?} token
  52754. * @param {?} value
  52755. * @param {?} deps
  52756. * @return {?}
  52757. */
  52758. function moduleProvideDef(flags, token, value, deps) {
  52759. // Need to resolve forwardRefs as e.g. for `useValue` we
  52760. // lowered the expression and then stopped evaluating it,
  52761. // i.e. also didn't unwrap it.
  52762. value = resolveForwardRef(value);
  52763. var /** @type {?} */ depDefs = splitDepsDsl(deps, stringify(token));
  52764. return {
  52765. // will bet set by the module definition
  52766. index: -1,
  52767. deps: depDefs, flags: flags, token: token, value: value
  52768. };
  52769. }
  52770. /**
  52771. * @param {?} providers
  52772. * @return {?}
  52773. */
  52774. function moduleDef(providers) {
  52775. var /** @type {?} */ providersByKey = {};
  52776. for (var /** @type {?} */ i = 0; i < providers.length; i++) {
  52777. var /** @type {?} */ provider = providers[i];
  52778. provider.index = i;
  52779. providersByKey[tokenKey(provider.token)] = provider;
  52780. }
  52781. return {
  52782. // Will be filled later...
  52783. factory: null,
  52784. providersByKey: providersByKey,
  52785. providers: providers
  52786. };
  52787. }
  52788. /**
  52789. * @param {?} data
  52790. * @return {?}
  52791. */
  52792. function initNgModule(data) {
  52793. var /** @type {?} */ def = data._def;
  52794. var /** @type {?} */ providers = data._providers = new Array(def.providers.length);
  52795. for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
  52796. var /** @type {?} */ provDef = def.providers[i];
  52797. if (!(provDef.flags & 4096 /* LazyProvider */)) {
  52798. providers[i] = _createProviderInstance$1(data, provDef);
  52799. }
  52800. }
  52801. }
  52802. /**
  52803. * @param {?} data
  52804. * @param {?} depDef
  52805. * @param {?=} notFoundValue
  52806. * @return {?}
  52807. */
  52808. function resolveNgModuleDep(data, depDef, notFoundValue) {
  52809. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  52810. if (depDef.flags & 8 /* Value */) {
  52811. return depDef.token;
  52812. }
  52813. if (depDef.flags & 2 /* Optional */) {
  52814. notFoundValue = null;
  52815. }
  52816. if (depDef.flags & 1 /* SkipSelf */) {
  52817. return data._parent.get(depDef.token, notFoundValue);
  52818. }
  52819. var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
  52820. switch (tokenKey$$1) {
  52821. case InjectorRefTokenKey$1:
  52822. case NgModuleRefTokenKey:
  52823. return data;
  52824. }
  52825. var /** @type {?} */ providerDef = data._def.providersByKey[tokenKey$$1];
  52826. if (providerDef) {
  52827. var /** @type {?} */ providerInstance = data._providers[providerDef.index];
  52828. if (providerInstance === undefined) {
  52829. providerInstance = data._providers[providerDef.index] =
  52830. _createProviderInstance$1(data, providerDef);
  52831. }
  52832. return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
  52833. }
  52834. return data._parent.get(depDef.token, notFoundValue);
  52835. }
  52836. /**
  52837. * @param {?} ngModule
  52838. * @param {?} providerDef
  52839. * @return {?}
  52840. */
  52841. function _createProviderInstance$1(ngModule, providerDef) {
  52842. var /** @type {?} */ injectable;
  52843. switch (providerDef.flags & 201347067 /* Types */) {
  52844. case 512 /* TypeClassProvider */:
  52845. injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
  52846. break;
  52847. case 1024 /* TypeFactoryProvider */:
  52848. injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
  52849. break;
  52850. case 2048 /* TypeUseExistingProvider */:
  52851. injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
  52852. break;
  52853. case 256 /* TypeValueProvider */:
  52854. injectable = providerDef.value;
  52855. break;
  52856. }
  52857. return injectable === undefined ? UNDEFINED_VALUE : injectable;
  52858. }
  52859. /**
  52860. * @param {?} ngModule
  52861. * @param {?} ctor
  52862. * @param {?} deps
  52863. * @return {?}
  52864. */
  52865. function _createClass(ngModule, ctor, deps) {
  52866. var /** @type {?} */ len = deps.length;
  52867. switch (len) {
  52868. case 0:
  52869. return new ctor();
  52870. case 1:
  52871. return new ctor(resolveNgModuleDep(ngModule, deps[0]));
  52872. case 2:
  52873. return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
  52874. case 3:
  52875. return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
  52876. default:
  52877. var /** @type {?} */ depValues = new Array(len);
  52878. for (var /** @type {?} */ i = 0; i < len; i++) {
  52879. depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
  52880. }
  52881. return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
  52882. }
  52883. }
  52884. /**
  52885. * @param {?} ngModule
  52886. * @param {?} factory
  52887. * @param {?} deps
  52888. * @return {?}
  52889. */
  52890. function _callFactory(ngModule, factory, deps) {
  52891. var /** @type {?} */ len = deps.length;
  52892. switch (len) {
  52893. case 0:
  52894. return factory();
  52895. case 1:
  52896. return factory(resolveNgModuleDep(ngModule, deps[0]));
  52897. case 2:
  52898. return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
  52899. case 3:
  52900. return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
  52901. default:
  52902. var /** @type {?} */ depValues = Array(len);
  52903. for (var /** @type {?} */ i = 0; i < len; i++) {
  52904. depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
  52905. }
  52906. return factory.apply(void 0, depValues);
  52907. }
  52908. }
  52909. /**
  52910. * @param {?} ngModule
  52911. * @param {?} lifecycles
  52912. * @return {?}
  52913. */
  52914. function callNgModuleLifecycle(ngModule, lifecycles) {
  52915. var /** @type {?} */ def = ngModule._def;
  52916. for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
  52917. var /** @type {?} */ provDef = def.providers[i];
  52918. if (provDef.flags & 131072 /* OnDestroy */) {
  52919. var /** @type {?} */ instance = ngModule._providers[i];
  52920. if (instance && instance !== UNDEFINED_VALUE) {
  52921. instance.ngOnDestroy();
  52922. }
  52923. }
  52924. }
  52925. }
  52926. /**
  52927. * @fileoverview added by tsickle
  52928. * @suppress {checkTypes} checked by tsc
  52929. */
  52930. /**
  52931. * @license
  52932. * Copyright Google Inc. All Rights Reserved.
  52933. *
  52934. * Use of this source code is governed by an MIT-style license that can be
  52935. * found in the LICENSE file at https://angular.io/license
  52936. */
  52937. /**
  52938. * @param {?} parentView
  52939. * @param {?} elementData
  52940. * @param {?} viewIndex
  52941. * @param {?} view
  52942. * @return {?}
  52943. */
  52944. function attachEmbeddedView(parentView, elementData, viewIndex, view) {
  52945. var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
  52946. if (viewIndex === null || viewIndex === undefined) {
  52947. viewIndex = embeddedViews.length;
  52948. }
  52949. view.viewContainerParent = parentView;
  52950. addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view);
  52951. attachProjectedView(elementData, view);
  52952. Services.dirtyParentQueries(view);
  52953. var /** @type {?} */ prevView = /** @type {?} */ ((viewIndex)) > 0 ? embeddedViews[/** @type {?} */ ((viewIndex)) - 1] : null;
  52954. renderAttachEmbeddedView(elementData, prevView, view);
  52955. }
  52956. /**
  52957. * @param {?} vcElementData
  52958. * @param {?} view
  52959. * @return {?}
  52960. */
  52961. function attachProjectedView(vcElementData, view) {
  52962. var /** @type {?} */ dvcElementData = declaredViewContainer(view);
  52963. if (!dvcElementData || dvcElementData === vcElementData ||
  52964. view.state & 16 /* IsProjectedView */) {
  52965. return;
  52966. }
  52967. // Note: For performance reasons, we
  52968. // - add a view to template._projectedViews only 1x throughout its lifetime,
  52969. // and remove it not until the view is destroyed.
  52970. // (hard, as when a parent view is attached/detached we would need to attach/detach all
  52971. // nested projected views as well, even accross component boundaries).
  52972. // - don't track the insertion order of views in the projected views array
  52973. // (hard, as when the views of the same template are inserted different view containers)
  52974. view.state |= 16 /* IsProjectedView */;
  52975. var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
  52976. if (!projectedViews) {
  52977. projectedViews = dvcElementData.template._projectedViews = [];
  52978. }
  52979. projectedViews.push(view);
  52980. // Note: we are changing the NodeDef here as we cannot calculate
  52981. // the fact whether a template is used for projection during compilation.
  52982. markNodeAsProjectedTemplate(/** @type {?} */ ((view.parent)).def, /** @type {?} */ ((view.parentNodeDef)));
  52983. }
  52984. /**
  52985. * @param {?} viewDef
  52986. * @param {?} nodeDef
  52987. * @return {?}
  52988. */
  52989. function markNodeAsProjectedTemplate(viewDef, nodeDef) {
  52990. if (nodeDef.flags & 4 /* ProjectedTemplate */) {
  52991. return;
  52992. }
  52993. viewDef.nodeFlags |= 4 /* ProjectedTemplate */;
  52994. nodeDef.flags |= 4 /* ProjectedTemplate */;
  52995. var /** @type {?} */ parentNodeDef = nodeDef.parent;
  52996. while (parentNodeDef) {
  52997. parentNodeDef.childFlags |= 4 /* ProjectedTemplate */;
  52998. parentNodeDef = parentNodeDef.parent;
  52999. }
  53000. }
  53001. /**
  53002. * @param {?} elementData
  53003. * @param {?=} viewIndex
  53004. * @return {?}
  53005. */
  53006. function detachEmbeddedView(elementData, viewIndex) {
  53007. var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
  53008. if (viewIndex == null || viewIndex >= embeddedViews.length) {
  53009. viewIndex = embeddedViews.length - 1;
  53010. }
  53011. if (viewIndex < 0) {
  53012. return null;
  53013. }
  53014. var /** @type {?} */ view = embeddedViews[viewIndex];
  53015. view.viewContainerParent = null;
  53016. removeFromArray(embeddedViews, viewIndex);
  53017. // See attachProjectedView for why we don't update projectedViews here.
  53018. Services.dirtyParentQueries(view);
  53019. renderDetachView(view);
  53020. return view;
  53021. }
  53022. /**
  53023. * @param {?} view
  53024. * @return {?}
  53025. */
  53026. function detachProjectedView(view) {
  53027. if (!(view.state & 16 /* IsProjectedView */)) {
  53028. return;
  53029. }
  53030. var /** @type {?} */ dvcElementData = declaredViewContainer(view);
  53031. if (dvcElementData) {
  53032. var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
  53033. if (projectedViews) {
  53034. removeFromArray(projectedViews, projectedViews.indexOf(view));
  53035. Services.dirtyParentQueries(view);
  53036. }
  53037. }
  53038. }
  53039. /**
  53040. * @param {?} elementData
  53041. * @param {?} oldViewIndex
  53042. * @param {?} newViewIndex
  53043. * @return {?}
  53044. */
  53045. function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
  53046. var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
  53047. var /** @type {?} */ view = embeddedViews[oldViewIndex];
  53048. removeFromArray(embeddedViews, oldViewIndex);
  53049. if (newViewIndex == null) {
  53050. newViewIndex = embeddedViews.length;
  53051. }
  53052. addToArray(embeddedViews, newViewIndex, view);
  53053. // Note: Don't need to change projectedViews as the order in there
  53054. // as always invalid...
  53055. Services.dirtyParentQueries(view);
  53056. renderDetachView(view);
  53057. var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
  53058. renderAttachEmbeddedView(elementData, prevView, view);
  53059. return view;
  53060. }
  53061. /**
  53062. * @param {?} elementData
  53063. * @param {?} prevView
  53064. * @param {?} view
  53065. * @return {?}
  53066. */
  53067. function renderAttachEmbeddedView(elementData, prevView, view) {
  53068. var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) :
  53069. elementData.renderElement;
  53070. var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode);
  53071. var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode);
  53072. // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be!
  53073. // However, browsers automatically do `appendChild` when there is no `nextSibling`.
  53074. visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined);
  53075. }
  53076. /**
  53077. * @param {?} view
  53078. * @return {?}
  53079. */
  53080. function renderDetachView(view) {
  53081. visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined);
  53082. }
  53083. /**
  53084. * @param {?} arr
  53085. * @param {?} index
  53086. * @param {?} value
  53087. * @return {?}
  53088. */
  53089. function addToArray(arr, index, value) {
  53090. // perf: array.push is faster than array.splice!
  53091. if (index >= arr.length) {
  53092. arr.push(value);
  53093. }
  53094. else {
  53095. arr.splice(index, 0, value);
  53096. }
  53097. }
  53098. /**
  53099. * @param {?} arr
  53100. * @param {?} index
  53101. * @return {?}
  53102. */
  53103. function removeFromArray(arr, index) {
  53104. // perf: array.pop is faster than array.splice!
  53105. if (index >= arr.length - 1) {
  53106. arr.pop();
  53107. }
  53108. else {
  53109. arr.splice(index, 1);
  53110. }
  53111. }
  53112. /**
  53113. * @fileoverview added by tsickle
  53114. * @suppress {checkTypes} checked by tsc
  53115. */
  53116. /**
  53117. * @license
  53118. * Copyright Google Inc. All Rights Reserved.
  53119. *
  53120. * Use of this source code is governed by an MIT-style license that can be
  53121. * found in the LICENSE file at https://angular.io/license
  53122. */
  53123. var EMPTY_CONTEXT = new Object();
  53124. /**
  53125. * @param {?} selector
  53126. * @param {?} componentType
  53127. * @param {?} viewDefFactory
  53128. * @param {?} inputs
  53129. * @param {?} outputs
  53130. * @param {?} ngContentSelectors
  53131. * @return {?}
  53132. */
  53133. function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
  53134. return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
  53135. }
  53136. /**
  53137. * @param {?} componentFactory
  53138. * @return {?}
  53139. */
  53140. function getComponentViewDefinitionFactory(componentFactory) {
  53141. return (/** @type {?} */ (componentFactory)).viewDefFactory;
  53142. }
  53143. var ComponentFactory_ = /** @class */ (function (_super) {
  53144. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentFactory_, _super);
  53145. function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
  53146. var _this =
  53147. // Attention: this ctor is called as top level function.
  53148. // Putting any logic in here will destroy closure tree shaking!
  53149. _super.call(this) || this;
  53150. _this.selector = selector;
  53151. _this.componentType = componentType;
  53152. _this._inputs = _inputs;
  53153. _this._outputs = _outputs;
  53154. _this.ngContentSelectors = ngContentSelectors;
  53155. _this.viewDefFactory = viewDefFactory;
  53156. return _this;
  53157. }
  53158. Object.defineProperty(ComponentFactory_.prototype, "inputs", {
  53159. get: /**
  53160. * @return {?}
  53161. */
  53162. function () {
  53163. var /** @type {?} */ inputsArr = [];
  53164. var /** @type {?} */ inputs = /** @type {?} */ ((this._inputs));
  53165. for (var /** @type {?} */ propName in inputs) {
  53166. var /** @type {?} */ templateName = inputs[propName];
  53167. inputsArr.push({ propName: propName, templateName: templateName });
  53168. }
  53169. return inputsArr;
  53170. },
  53171. enumerable: true,
  53172. configurable: true
  53173. });
  53174. Object.defineProperty(ComponentFactory_.prototype, "outputs", {
  53175. get: /**
  53176. * @return {?}
  53177. */
  53178. function () {
  53179. var /** @type {?} */ outputsArr = [];
  53180. for (var /** @type {?} */ propName in this._outputs) {
  53181. var /** @type {?} */ templateName = this._outputs[propName];
  53182. outputsArr.push({ propName: propName, templateName: templateName });
  53183. }
  53184. return outputsArr;
  53185. },
  53186. enumerable: true,
  53187. configurable: true
  53188. });
  53189. /**
  53190. * Creates a new component.
  53191. */
  53192. /**
  53193. * Creates a new component.
  53194. * @param {?} injector
  53195. * @param {?=} projectableNodes
  53196. * @param {?=} rootSelectorOrNode
  53197. * @param {?=} ngModule
  53198. * @return {?}
  53199. */
  53200. ComponentFactory_.prototype.create = /**
  53201. * Creates a new component.
  53202. * @param {?} injector
  53203. * @param {?=} projectableNodes
  53204. * @param {?=} rootSelectorOrNode
  53205. * @param {?=} ngModule
  53206. * @return {?}
  53207. */
  53208. function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
  53209. if (!ngModule) {
  53210. throw new Error('ngModule should be provided');
  53211. }
  53212. var /** @type {?} */ viewDef = resolveDefinition(this.viewDefFactory);
  53213. var /** @type {?} */ componentNodeIndex = /** @type {?} */ ((/** @type {?} */ ((viewDef.nodes[0].element)).componentProvider)).nodeIndex;
  53214. var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
  53215. var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance;
  53216. if (rootSelectorOrNode) {
  53217. view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
  53218. }
  53219. return new ComponentRef_(view, new ViewRef_(view), component);
  53220. };
  53221. return ComponentFactory_;
  53222. }(ComponentFactory));
  53223. var ComponentRef_ = /** @class */ (function (_super) {
  53224. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentRef_, _super);
  53225. function ComponentRef_(_view, _viewRef, _component) {
  53226. var _this = _super.call(this) || this;
  53227. _this._view = _view;
  53228. _this._viewRef = _viewRef;
  53229. _this._component = _component;
  53230. _this._elDef = _this._view.def.nodes[0];
  53231. _this.hostView = _viewRef;
  53232. _this.changeDetectorRef = _viewRef;
  53233. _this.instance = _component;
  53234. return _this;
  53235. }
  53236. Object.defineProperty(ComponentRef_.prototype, "location", {
  53237. get: /**
  53238. * @return {?}
  53239. */
  53240. function () {
  53241. return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
  53242. },
  53243. enumerable: true,
  53244. configurable: true
  53245. });
  53246. Object.defineProperty(ComponentRef_.prototype, "injector", {
  53247. get: /**
  53248. * @return {?}
  53249. */
  53250. function () { return new Injector_(this._view, this._elDef); },
  53251. enumerable: true,
  53252. configurable: true
  53253. });
  53254. Object.defineProperty(ComponentRef_.prototype, "componentType", {
  53255. get: /**
  53256. * @return {?}
  53257. */
  53258. function () { return /** @type {?} */ (this._component.constructor); },
  53259. enumerable: true,
  53260. configurable: true
  53261. });
  53262. /**
  53263. * @return {?}
  53264. */
  53265. ComponentRef_.prototype.destroy = /**
  53266. * @return {?}
  53267. */
  53268. function () { this._viewRef.destroy(); };
  53269. /**
  53270. * @param {?} callback
  53271. * @return {?}
  53272. */
  53273. ComponentRef_.prototype.onDestroy = /**
  53274. * @param {?} callback
  53275. * @return {?}
  53276. */
  53277. function (callback) { this._viewRef.onDestroy(callback); };
  53278. return ComponentRef_;
  53279. }(ComponentRef));
  53280. /**
  53281. * @param {?} view
  53282. * @param {?} elDef
  53283. * @param {?} elData
  53284. * @return {?}
  53285. */
  53286. function createViewContainerData(view, elDef, elData) {
  53287. return new ViewContainerRef_(view, elDef, elData);
  53288. }
  53289. var ViewContainerRef_ = /** @class */ (function () {
  53290. function ViewContainerRef_(_view, _elDef, _data) {
  53291. this._view = _view;
  53292. this._elDef = _elDef;
  53293. this._data = _data;
  53294. /**
  53295. * \@internal
  53296. */
  53297. this._embeddedViews = [];
  53298. }
  53299. Object.defineProperty(ViewContainerRef_.prototype, "element", {
  53300. get: /**
  53301. * @return {?}
  53302. */
  53303. function () { return new ElementRef(this._data.renderElement); },
  53304. enumerable: true,
  53305. configurable: true
  53306. });
  53307. Object.defineProperty(ViewContainerRef_.prototype, "injector", {
  53308. get: /**
  53309. * @return {?}
  53310. */
  53311. function () { return new Injector_(this._view, this._elDef); },
  53312. enumerable: true,
  53313. configurable: true
  53314. });
  53315. Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
  53316. get: /**
  53317. * @return {?}
  53318. */
  53319. function () {
  53320. var /** @type {?} */ view = this._view;
  53321. var /** @type {?} */ elDef = this._elDef.parent;
  53322. while (!elDef && view) {
  53323. elDef = viewParentEl(view);
  53324. view = /** @type {?} */ ((view.parent));
  53325. }
  53326. return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
  53327. },
  53328. enumerable: true,
  53329. configurable: true
  53330. });
  53331. /**
  53332. * @return {?}
  53333. */
  53334. ViewContainerRef_.prototype.clear = /**
  53335. * @return {?}
  53336. */
  53337. function () {
  53338. var /** @type {?} */ len = this._embeddedViews.length;
  53339. for (var /** @type {?} */ i = len - 1; i >= 0; i--) {
  53340. var /** @type {?} */ view = /** @type {?} */ ((detachEmbeddedView(this._data, i)));
  53341. Services.destroyView(view);
  53342. }
  53343. };
  53344. /**
  53345. * @param {?} index
  53346. * @return {?}
  53347. */
  53348. ViewContainerRef_.prototype.get = /**
  53349. * @param {?} index
  53350. * @return {?}
  53351. */
  53352. function (index) {
  53353. var /** @type {?} */ view = this._embeddedViews[index];
  53354. if (view) {
  53355. var /** @type {?} */ ref = new ViewRef_(view);
  53356. ref.attachToViewContainerRef(this);
  53357. return ref;
  53358. }
  53359. return null;
  53360. };
  53361. Object.defineProperty(ViewContainerRef_.prototype, "length", {
  53362. get: /**
  53363. * @return {?}
  53364. */
  53365. function () { return this._embeddedViews.length; },
  53366. enumerable: true,
  53367. configurable: true
  53368. });
  53369. /**
  53370. * @template C
  53371. * @param {?} templateRef
  53372. * @param {?=} context
  53373. * @param {?=} index
  53374. * @return {?}
  53375. */
  53376. ViewContainerRef_.prototype.createEmbeddedView = /**
  53377. * @template C
  53378. * @param {?} templateRef
  53379. * @param {?=} context
  53380. * @param {?=} index
  53381. * @return {?}
  53382. */
  53383. function (templateRef, context, index) {
  53384. var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || /** @type {?} */ ({}));
  53385. this.insert(viewRef, index);
  53386. return viewRef;
  53387. };
  53388. /**
  53389. * @template C
  53390. * @param {?} componentFactory
  53391. * @param {?=} index
  53392. * @param {?=} injector
  53393. * @param {?=} projectableNodes
  53394. * @param {?=} ngModuleRef
  53395. * @return {?}
  53396. */
  53397. ViewContainerRef_.prototype.createComponent = /**
  53398. * @template C
  53399. * @param {?} componentFactory
  53400. * @param {?=} index
  53401. * @param {?=} injector
  53402. * @param {?=} projectableNodes
  53403. * @param {?=} ngModuleRef
  53404. * @return {?}
  53405. */
  53406. function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
  53407. var /** @type {?} */ contextInjector = injector || this.parentInjector;
  53408. if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
  53409. ngModuleRef = contextInjector.get(NgModuleRef);
  53410. }
  53411. var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
  53412. this.insert(componentRef.hostView, index);
  53413. return componentRef;
  53414. };
  53415. /**
  53416. * @param {?} viewRef
  53417. * @param {?=} index
  53418. * @return {?}
  53419. */
  53420. ViewContainerRef_.prototype.insert = /**
  53421. * @param {?} viewRef
  53422. * @param {?=} index
  53423. * @return {?}
  53424. */
  53425. function (viewRef, index) {
  53426. if (viewRef.destroyed) {
  53427. throw new Error('Cannot insert a destroyed View in a ViewContainer!');
  53428. }
  53429. var /** @type {?} */ viewRef_ = /** @type {?} */ (viewRef);
  53430. var /** @type {?} */ viewData = viewRef_._view;
  53431. attachEmbeddedView(this._view, this._data, index, viewData);
  53432. viewRef_.attachToViewContainerRef(this);
  53433. return viewRef;
  53434. };
  53435. /**
  53436. * @param {?} viewRef
  53437. * @param {?} currentIndex
  53438. * @return {?}
  53439. */
  53440. ViewContainerRef_.prototype.move = /**
  53441. * @param {?} viewRef
  53442. * @param {?} currentIndex
  53443. * @return {?}
  53444. */
  53445. function (viewRef, currentIndex) {
  53446. if (viewRef.destroyed) {
  53447. throw new Error('Cannot move a destroyed View in a ViewContainer!');
  53448. }
  53449. var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view);
  53450. moveEmbeddedView(this._data, previousIndex, currentIndex);
  53451. return viewRef;
  53452. };
  53453. /**
  53454. * @param {?} viewRef
  53455. * @return {?}
  53456. */
  53457. ViewContainerRef_.prototype.indexOf = /**
  53458. * @param {?} viewRef
  53459. * @return {?}
  53460. */
  53461. function (viewRef) {
  53462. return this._embeddedViews.indexOf((/** @type {?} */ (viewRef))._view);
  53463. };
  53464. /**
  53465. * @param {?=} index
  53466. * @return {?}
  53467. */
  53468. ViewContainerRef_.prototype.remove = /**
  53469. * @param {?=} index
  53470. * @return {?}
  53471. */
  53472. function (index) {
  53473. var /** @type {?} */ viewData = detachEmbeddedView(this._data, index);
  53474. if (viewData) {
  53475. Services.destroyView(viewData);
  53476. }
  53477. };
  53478. /**
  53479. * @param {?=} index
  53480. * @return {?}
  53481. */
  53482. ViewContainerRef_.prototype.detach = /**
  53483. * @param {?=} index
  53484. * @return {?}
  53485. */
  53486. function (index) {
  53487. var /** @type {?} */ view = detachEmbeddedView(this._data, index);
  53488. return view ? new ViewRef_(view) : null;
  53489. };
  53490. return ViewContainerRef_;
  53491. }());
  53492. /**
  53493. * @param {?} view
  53494. * @return {?}
  53495. */
  53496. function createChangeDetectorRef(view) {
  53497. return new ViewRef_(view);
  53498. }
  53499. var ViewRef_ = /** @class */ (function () {
  53500. function ViewRef_(_view) {
  53501. this._view = _view;
  53502. this._viewContainerRef = null;
  53503. this._appRef = null;
  53504. }
  53505. Object.defineProperty(ViewRef_.prototype, "rootNodes", {
  53506. get: /**
  53507. * @return {?}
  53508. */
  53509. function () { return rootRenderNodes(this._view); },
  53510. enumerable: true,
  53511. configurable: true
  53512. });
  53513. Object.defineProperty(ViewRef_.prototype, "context", {
  53514. get: /**
  53515. * @return {?}
  53516. */
  53517. function () { return this._view.context; },
  53518. enumerable: true,
  53519. configurable: true
  53520. });
  53521. Object.defineProperty(ViewRef_.prototype, "destroyed", {
  53522. get: /**
  53523. * @return {?}
  53524. */
  53525. function () { return (this._view.state & 128 /* Destroyed */) !== 0; },
  53526. enumerable: true,
  53527. configurable: true
  53528. });
  53529. /**
  53530. * @return {?}
  53531. */
  53532. ViewRef_.prototype.markForCheck = /**
  53533. * @return {?}
  53534. */
  53535. function () { markParentViewsForCheck(this._view); };
  53536. /**
  53537. * @return {?}
  53538. */
  53539. ViewRef_.prototype.detach = /**
  53540. * @return {?}
  53541. */
  53542. function () { this._view.state &= ~4 /* Attached */; };
  53543. /**
  53544. * @return {?}
  53545. */
  53546. ViewRef_.prototype.detectChanges = /**
  53547. * @return {?}
  53548. */
  53549. function () {
  53550. var /** @type {?} */ fs = this._view.root.rendererFactory;
  53551. if (fs.begin) {
  53552. fs.begin();
  53553. }
  53554. try {
  53555. Services.checkAndUpdateView(this._view);
  53556. }
  53557. finally {
  53558. if (fs.end) {
  53559. fs.end();
  53560. }
  53561. }
  53562. };
  53563. /**
  53564. * @return {?}
  53565. */
  53566. ViewRef_.prototype.checkNoChanges = /**
  53567. * @return {?}
  53568. */
  53569. function () { Services.checkNoChangesView(this._view); };
  53570. /**
  53571. * @return {?}
  53572. */
  53573. ViewRef_.prototype.reattach = /**
  53574. * @return {?}
  53575. */
  53576. function () { this._view.state |= 4 /* Attached */; };
  53577. /**
  53578. * @param {?} callback
  53579. * @return {?}
  53580. */
  53581. ViewRef_.prototype.onDestroy = /**
  53582. * @param {?} callback
  53583. * @return {?}
  53584. */
  53585. function (callback) {
  53586. if (!this._view.disposables) {
  53587. this._view.disposables = [];
  53588. }
  53589. this._view.disposables.push(/** @type {?} */ (callback));
  53590. };
  53591. /**
  53592. * @return {?}
  53593. */
  53594. ViewRef_.prototype.destroy = /**
  53595. * @return {?}
  53596. */
  53597. function () {
  53598. if (this._appRef) {
  53599. this._appRef.detachView(this);
  53600. }
  53601. else if (this._viewContainerRef) {
  53602. this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
  53603. }
  53604. Services.destroyView(this._view);
  53605. };
  53606. /**
  53607. * @return {?}
  53608. */
  53609. ViewRef_.prototype.detachFromAppRef = /**
  53610. * @return {?}
  53611. */
  53612. function () {
  53613. this._appRef = null;
  53614. renderDetachView(this._view);
  53615. Services.dirtyParentQueries(this._view);
  53616. };
  53617. /**
  53618. * @param {?} appRef
  53619. * @return {?}
  53620. */
  53621. ViewRef_.prototype.attachToAppRef = /**
  53622. * @param {?} appRef
  53623. * @return {?}
  53624. */
  53625. function (appRef) {
  53626. if (this._viewContainerRef) {
  53627. throw new Error('This view is already attached to a ViewContainer!');
  53628. }
  53629. this._appRef = appRef;
  53630. };
  53631. /**
  53632. * @param {?} vcRef
  53633. * @return {?}
  53634. */
  53635. ViewRef_.prototype.attachToViewContainerRef = /**
  53636. * @param {?} vcRef
  53637. * @return {?}
  53638. */
  53639. function (vcRef) {
  53640. if (this._appRef) {
  53641. throw new Error('This view is already attached directly to the ApplicationRef!');
  53642. }
  53643. this._viewContainerRef = vcRef;
  53644. };
  53645. return ViewRef_;
  53646. }());
  53647. /**
  53648. * @param {?} view
  53649. * @param {?} def
  53650. * @return {?}
  53651. */
  53652. function createTemplateData(view, def) {
  53653. return new TemplateRef_(view, def);
  53654. }
  53655. var TemplateRef_ = /** @class */ (function (_super) {
  53656. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TemplateRef_, _super);
  53657. function TemplateRef_(_parentView, _def) {
  53658. var _this = _super.call(this) || this;
  53659. _this._parentView = _parentView;
  53660. _this._def = _def;
  53661. return _this;
  53662. }
  53663. /**
  53664. * @param {?} context
  53665. * @return {?}
  53666. */
  53667. TemplateRef_.prototype.createEmbeddedView = /**
  53668. * @param {?} context
  53669. * @return {?}
  53670. */
  53671. function (context) {
  53672. return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ ((/** @type {?} */ ((this._def.element)).template)), context));
  53673. };
  53674. Object.defineProperty(TemplateRef_.prototype, "elementRef", {
  53675. get: /**
  53676. * @return {?}
  53677. */
  53678. function () {
  53679. return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
  53680. },
  53681. enumerable: true,
  53682. configurable: true
  53683. });
  53684. return TemplateRef_;
  53685. }(TemplateRef));
  53686. /**
  53687. * @param {?} view
  53688. * @param {?} elDef
  53689. * @return {?}
  53690. */
  53691. function createInjector(view, elDef) {
  53692. return new Injector_(view, elDef);
  53693. }
  53694. var Injector_ = /** @class */ (function () {
  53695. function Injector_(view, elDef) {
  53696. this.view = view;
  53697. this.elDef = elDef;
  53698. }
  53699. /**
  53700. * @param {?} token
  53701. * @param {?=} notFoundValue
  53702. * @return {?}
  53703. */
  53704. Injector_.prototype.get = /**
  53705. * @param {?} token
  53706. * @param {?=} notFoundValue
  53707. * @return {?}
  53708. */
  53709. function (token, notFoundValue) {
  53710. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  53711. var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false;
  53712. return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue);
  53713. };
  53714. return Injector_;
  53715. }());
  53716. /**
  53717. * @param {?} view
  53718. * @param {?} index
  53719. * @return {?}
  53720. */
  53721. function nodeValue(view, index) {
  53722. var /** @type {?} */ def = view.def.nodes[index];
  53723. if (def.flags & 1 /* TypeElement */) {
  53724. var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
  53725. return /** @type {?} */ ((def.element)).template ? elData.template : elData.renderElement;
  53726. }
  53727. else if (def.flags & 2 /* TypeText */) {
  53728. return asTextData(view, def.nodeIndex).renderText;
  53729. }
  53730. else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) {
  53731. return asProviderData(view, def.nodeIndex).instance;
  53732. }
  53733. throw new Error("Illegal state: read nodeValue for node index " + index);
  53734. }
  53735. /**
  53736. * @param {?} view
  53737. * @return {?}
  53738. */
  53739. function createRendererV1(view) {
  53740. return new RendererAdapter(view.renderer);
  53741. }
  53742. var RendererAdapter = /** @class */ (function () {
  53743. function RendererAdapter(delegate) {
  53744. this.delegate = delegate;
  53745. }
  53746. /**
  53747. * @param {?} selectorOrNode
  53748. * @return {?}
  53749. */
  53750. RendererAdapter.prototype.selectRootElement = /**
  53751. * @param {?} selectorOrNode
  53752. * @return {?}
  53753. */
  53754. function (selectorOrNode) {
  53755. return this.delegate.selectRootElement(selectorOrNode);
  53756. };
  53757. /**
  53758. * @param {?} parent
  53759. * @param {?} namespaceAndName
  53760. * @return {?}
  53761. */
  53762. RendererAdapter.prototype.createElement = /**
  53763. * @param {?} parent
  53764. * @param {?} namespaceAndName
  53765. * @return {?}
  53766. */
  53767. function (parent, namespaceAndName) {
  53768. var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
  53769. var /** @type {?} */ el = this.delegate.createElement(name, ns);
  53770. if (parent) {
  53771. this.delegate.appendChild(parent, el);
  53772. }
  53773. return el;
  53774. };
  53775. /**
  53776. * @param {?} hostElement
  53777. * @return {?}
  53778. */
  53779. RendererAdapter.prototype.createViewRoot = /**
  53780. * @param {?} hostElement
  53781. * @return {?}
  53782. */
  53783. function (hostElement) { return hostElement; };
  53784. /**
  53785. * @param {?} parentElement
  53786. * @return {?}
  53787. */
  53788. RendererAdapter.prototype.createTemplateAnchor = /**
  53789. * @param {?} parentElement
  53790. * @return {?}
  53791. */
  53792. function (parentElement) {
  53793. var /** @type {?} */ comment = this.delegate.createComment('');
  53794. if (parentElement) {
  53795. this.delegate.appendChild(parentElement, comment);
  53796. }
  53797. return comment;
  53798. };
  53799. /**
  53800. * @param {?} parentElement
  53801. * @param {?} value
  53802. * @return {?}
  53803. */
  53804. RendererAdapter.prototype.createText = /**
  53805. * @param {?} parentElement
  53806. * @param {?} value
  53807. * @return {?}
  53808. */
  53809. function (parentElement, value) {
  53810. var /** @type {?} */ node = this.delegate.createText(value);
  53811. if (parentElement) {
  53812. this.delegate.appendChild(parentElement, node);
  53813. }
  53814. return node;
  53815. };
  53816. /**
  53817. * @param {?} parentElement
  53818. * @param {?} nodes
  53819. * @return {?}
  53820. */
  53821. RendererAdapter.prototype.projectNodes = /**
  53822. * @param {?} parentElement
  53823. * @param {?} nodes
  53824. * @return {?}
  53825. */
  53826. function (parentElement, nodes) {
  53827. for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
  53828. this.delegate.appendChild(parentElement, nodes[i]);
  53829. }
  53830. };
  53831. /**
  53832. * @param {?} node
  53833. * @param {?} viewRootNodes
  53834. * @return {?}
  53835. */
  53836. RendererAdapter.prototype.attachViewAfter = /**
  53837. * @param {?} node
  53838. * @param {?} viewRootNodes
  53839. * @return {?}
  53840. */
  53841. function (node, viewRootNodes) {
  53842. var /** @type {?} */ parentElement = this.delegate.parentNode(node);
  53843. var /** @type {?} */ nextSibling = this.delegate.nextSibling(node);
  53844. for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
  53845. this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
  53846. }
  53847. };
  53848. /**
  53849. * @param {?} viewRootNodes
  53850. * @return {?}
  53851. */
  53852. RendererAdapter.prototype.detachView = /**
  53853. * @param {?} viewRootNodes
  53854. * @return {?}
  53855. */
  53856. function (viewRootNodes) {
  53857. for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
  53858. var /** @type {?} */ node = viewRootNodes[i];
  53859. var /** @type {?} */ parentElement = this.delegate.parentNode(node);
  53860. this.delegate.removeChild(parentElement, node);
  53861. }
  53862. };
  53863. /**
  53864. * @param {?} hostElement
  53865. * @param {?} viewAllNodes
  53866. * @return {?}
  53867. */
  53868. RendererAdapter.prototype.destroyView = /**
  53869. * @param {?} hostElement
  53870. * @param {?} viewAllNodes
  53871. * @return {?}
  53872. */
  53873. function (hostElement, viewAllNodes) {
  53874. for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) {
  53875. /** @type {?} */ ((this.delegate.destroyNode))(viewAllNodes[i]);
  53876. }
  53877. };
  53878. /**
  53879. * @param {?} renderElement
  53880. * @param {?} name
  53881. * @param {?} callback
  53882. * @return {?}
  53883. */
  53884. RendererAdapter.prototype.listen = /**
  53885. * @param {?} renderElement
  53886. * @param {?} name
  53887. * @param {?} callback
  53888. * @return {?}
  53889. */
  53890. function (renderElement, name, callback) {
  53891. return this.delegate.listen(renderElement, name, /** @type {?} */ (callback));
  53892. };
  53893. /**
  53894. * @param {?} target
  53895. * @param {?} name
  53896. * @param {?} callback
  53897. * @return {?}
  53898. */
  53899. RendererAdapter.prototype.listenGlobal = /**
  53900. * @param {?} target
  53901. * @param {?} name
  53902. * @param {?} callback
  53903. * @return {?}
  53904. */
  53905. function (target, name, callback) {
  53906. return this.delegate.listen(target, name, /** @type {?} */ (callback));
  53907. };
  53908. /**
  53909. * @param {?} renderElement
  53910. * @param {?} propertyName
  53911. * @param {?} propertyValue
  53912. * @return {?}
  53913. */
  53914. RendererAdapter.prototype.setElementProperty = /**
  53915. * @param {?} renderElement
  53916. * @param {?} propertyName
  53917. * @param {?} propertyValue
  53918. * @return {?}
  53919. */
  53920. function (renderElement, propertyName, propertyValue) {
  53921. this.delegate.setProperty(renderElement, propertyName, propertyValue);
  53922. };
  53923. /**
  53924. * @param {?} renderElement
  53925. * @param {?} namespaceAndName
  53926. * @param {?} attributeValue
  53927. * @return {?}
  53928. */
  53929. RendererAdapter.prototype.setElementAttribute = /**
  53930. * @param {?} renderElement
  53931. * @param {?} namespaceAndName
  53932. * @param {?} attributeValue
  53933. * @return {?}
  53934. */
  53935. function (renderElement, namespaceAndName, attributeValue) {
  53936. var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
  53937. if (attributeValue != null) {
  53938. this.delegate.setAttribute(renderElement, name, attributeValue, ns);
  53939. }
  53940. else {
  53941. this.delegate.removeAttribute(renderElement, name, ns);
  53942. }
  53943. };
  53944. /**
  53945. * @param {?} renderElement
  53946. * @param {?} propertyName
  53947. * @param {?} propertyValue
  53948. * @return {?}
  53949. */
  53950. RendererAdapter.prototype.setBindingDebugInfo = /**
  53951. * @param {?} renderElement
  53952. * @param {?} propertyName
  53953. * @param {?} propertyValue
  53954. * @return {?}
  53955. */
  53956. function (renderElement, propertyName, propertyValue) { };
  53957. /**
  53958. * @param {?} renderElement
  53959. * @param {?} className
  53960. * @param {?} isAdd
  53961. * @return {?}
  53962. */
  53963. RendererAdapter.prototype.setElementClass = /**
  53964. * @param {?} renderElement
  53965. * @param {?} className
  53966. * @param {?} isAdd
  53967. * @return {?}
  53968. */
  53969. function (renderElement, className, isAdd) {
  53970. if (isAdd) {
  53971. this.delegate.addClass(renderElement, className);
  53972. }
  53973. else {
  53974. this.delegate.removeClass(renderElement, className);
  53975. }
  53976. };
  53977. /**
  53978. * @param {?} renderElement
  53979. * @param {?} styleName
  53980. * @param {?} styleValue
  53981. * @return {?}
  53982. */
  53983. RendererAdapter.prototype.setElementStyle = /**
  53984. * @param {?} renderElement
  53985. * @param {?} styleName
  53986. * @param {?} styleValue
  53987. * @return {?}
  53988. */
  53989. function (renderElement, styleName, styleValue) {
  53990. if (styleValue != null) {
  53991. this.delegate.setStyle(renderElement, styleName, styleValue);
  53992. }
  53993. else {
  53994. this.delegate.removeStyle(renderElement, styleName);
  53995. }
  53996. };
  53997. /**
  53998. * @param {?} renderElement
  53999. * @param {?} methodName
  54000. * @param {?} args
  54001. * @return {?}
  54002. */
  54003. RendererAdapter.prototype.invokeElementMethod = /**
  54004. * @param {?} renderElement
  54005. * @param {?} methodName
  54006. * @param {?} args
  54007. * @return {?}
  54008. */
  54009. function (renderElement, methodName, args) {
  54010. (/** @type {?} */ (renderElement))[methodName].apply(renderElement, args);
  54011. };
  54012. /**
  54013. * @param {?} renderNode
  54014. * @param {?} text
  54015. * @return {?}
  54016. */
  54017. RendererAdapter.prototype.setText = /**
  54018. * @param {?} renderNode
  54019. * @param {?} text
  54020. * @return {?}
  54021. */
  54022. function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
  54023. /**
  54024. * @return {?}
  54025. */
  54026. RendererAdapter.prototype.animate = /**
  54027. * @return {?}
  54028. */
  54029. function () { throw new Error('Renderer.animate is no longer supported!'); };
  54030. return RendererAdapter;
  54031. }());
  54032. /**
  54033. * @param {?} moduleType
  54034. * @param {?} parent
  54035. * @param {?} bootstrapComponents
  54036. * @param {?} def
  54037. * @return {?}
  54038. */
  54039. function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
  54040. return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
  54041. }
  54042. var NgModuleRef_ = /** @class */ (function () {
  54043. function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
  54044. this._moduleType = _moduleType;
  54045. this._parent = _parent;
  54046. this._bootstrapComponents = _bootstrapComponents;
  54047. this._def = _def;
  54048. this._destroyListeners = [];
  54049. this._destroyed = false;
  54050. this.injector = this;
  54051. initNgModule(this);
  54052. }
  54053. /**
  54054. * @param {?} token
  54055. * @param {?=} notFoundValue
  54056. * @return {?}
  54057. */
  54058. NgModuleRef_.prototype.get = /**
  54059. * @param {?} token
  54060. * @param {?=} notFoundValue
  54061. * @return {?}
  54062. */
  54063. function (token, notFoundValue) {
  54064. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  54065. return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 /* None */ }, notFoundValue);
  54066. };
  54067. Object.defineProperty(NgModuleRef_.prototype, "instance", {
  54068. get: /**
  54069. * @return {?}
  54070. */
  54071. function () { return this.get(this._moduleType); },
  54072. enumerable: true,
  54073. configurable: true
  54074. });
  54075. Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
  54076. get: /**
  54077. * @return {?}
  54078. */
  54079. function () { return this.get(ComponentFactoryResolver); },
  54080. enumerable: true,
  54081. configurable: true
  54082. });
  54083. /**
  54084. * @return {?}
  54085. */
  54086. NgModuleRef_.prototype.destroy = /**
  54087. * @return {?}
  54088. */
  54089. function () {
  54090. if (this._destroyed) {
  54091. throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
  54092. }
  54093. this._destroyed = true;
  54094. callNgModuleLifecycle(this, 131072 /* OnDestroy */);
  54095. this._destroyListeners.forEach(function (listener) { return listener(); });
  54096. };
  54097. /**
  54098. * @param {?} callback
  54099. * @return {?}
  54100. */
  54101. NgModuleRef_.prototype.onDestroy = /**
  54102. * @param {?} callback
  54103. * @return {?}
  54104. */
  54105. function (callback) { this._destroyListeners.push(callback); };
  54106. return NgModuleRef_;
  54107. }());
  54108. /**
  54109. * @fileoverview added by tsickle
  54110. * @suppress {checkTypes} checked by tsc
  54111. */
  54112. /**
  54113. * @license
  54114. * Copyright Google Inc. All Rights Reserved.
  54115. *
  54116. * Use of this source code is governed by an MIT-style license that can be
  54117. * found in the LICENSE file at https://angular.io/license
  54118. */
  54119. var RendererV1TokenKey = tokenKey(Renderer);
  54120. var Renderer2TokenKey = tokenKey(Renderer2);
  54121. var ElementRefTokenKey = tokenKey(ElementRef);
  54122. var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
  54123. var TemplateRefTokenKey = tokenKey(TemplateRef);
  54124. var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
  54125. var InjectorRefTokenKey = tokenKey(Injector);
  54126. /**
  54127. * @param {?} checkIndex
  54128. * @param {?} flags
  54129. * @param {?} matchedQueries
  54130. * @param {?} childCount
  54131. * @param {?} ctor
  54132. * @param {?} deps
  54133. * @param {?=} props
  54134. * @param {?=} outputs
  54135. * @return {?}
  54136. */
  54137. function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
  54138. var /** @type {?} */ bindings = [];
  54139. if (props) {
  54140. for (var /** @type {?} */ prop in props) {
  54141. var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
  54142. bindings[bindingIndex] = {
  54143. flags: 8 /* TypeProperty */,
  54144. name: prop, nonMinifiedName: nonMinifiedName,
  54145. ns: null,
  54146. securityContext: null,
  54147. suffix: null
  54148. };
  54149. }
  54150. }
  54151. var /** @type {?} */ outputDefs = [];
  54152. if (outputs) {
  54153. for (var /** @type {?} */ propName in outputs) {
  54154. outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] });
  54155. }
  54156. }
  54157. flags |= 16384 /* TypeDirective */;
  54158. return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
  54159. }
  54160. /**
  54161. * @param {?} flags
  54162. * @param {?} ctor
  54163. * @param {?} deps
  54164. * @return {?}
  54165. */
  54166. function pipeDef(flags, ctor, deps) {
  54167. flags |= 16 /* TypePipe */;
  54168. return _def(-1, flags, null, 0, ctor, ctor, deps);
  54169. }
  54170. /**
  54171. * @param {?} flags
  54172. * @param {?} matchedQueries
  54173. * @param {?} token
  54174. * @param {?} value
  54175. * @param {?} deps
  54176. * @return {?}
  54177. */
  54178. function providerDef(flags, matchedQueries, token, value, deps) {
  54179. return _def(-1, flags, matchedQueries, 0, token, value, deps);
  54180. }
  54181. /**
  54182. * @param {?} checkIndex
  54183. * @param {?} flags
  54184. * @param {?} matchedQueriesDsl
  54185. * @param {?} childCount
  54186. * @param {?} token
  54187. * @param {?} value
  54188. * @param {?} deps
  54189. * @param {?=} bindings
  54190. * @param {?=} outputs
  54191. * @return {?}
  54192. */
  54193. function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
  54194. var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
  54195. if (!outputs) {
  54196. outputs = [];
  54197. }
  54198. if (!bindings) {
  54199. bindings = [];
  54200. }
  54201. // Need to resolve forwardRefs as e.g. for `useValue` we
  54202. // lowered the expression and then stopped evaluating it,
  54203. // i.e. also didn't unwrap it.
  54204. value = resolveForwardRef(value);
  54205. var /** @type {?} */ depDefs = splitDepsDsl(deps, stringify(token));
  54206. return {
  54207. // will bet set by the view definition
  54208. nodeIndex: -1,
  54209. parent: null,
  54210. renderParent: null,
  54211. bindingIndex: -1,
  54212. outputIndex: -1,
  54213. // regular values
  54214. checkIndex: checkIndex,
  54215. flags: flags,
  54216. childFlags: 0,
  54217. directChildFlags: 0,
  54218. childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
  54219. ngContentIndex: -1, childCount: childCount, bindings: bindings,
  54220. bindingFlags: calcBindingFlags(bindings), outputs: outputs,
  54221. element: null,
  54222. provider: { token: token, value: value, deps: depDefs },
  54223. text: null,
  54224. query: null,
  54225. ngContent: null
  54226. };
  54227. }
  54228. /**
  54229. * @param {?} view
  54230. * @param {?} def
  54231. * @return {?}
  54232. */
  54233. function createProviderInstance(view, def) {
  54234. return _createProviderInstance(view, def);
  54235. }
  54236. /**
  54237. * @param {?} view
  54238. * @param {?} def
  54239. * @return {?}
  54240. */
  54241. function createPipeInstance(view, def) {
  54242. // deps are looked up from component.
  54243. var /** @type {?} */ compView = view;
  54244. while (compView.parent && !isComponentView(compView)) {
  54245. compView = compView.parent;
  54246. }
  54247. // pipes can see the private services of the component
  54248. var /** @type {?} */ allowPrivateServices = true;
  54249. // pipes are always eager and classes!
  54250. return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
  54251. }
  54252. /**
  54253. * @param {?} view
  54254. * @param {?} def
  54255. * @return {?}
  54256. */
  54257. function createDirectiveInstance(view, def) {
  54258. // components can see other private services, other directives can't.
  54259. var /** @type {?} */ allowPrivateServices = (def.flags & 32768 /* Component */) > 0;
  54260. // directives are always eager and classes!
  54261. var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
  54262. if (def.outputs.length) {
  54263. for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
  54264. var /** @type {?} */ output = def.outputs[i];
  54265. var /** @type {?} */ subscription = instance[/** @type {?} */ ((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).nodeIndex, output.eventName)); /** @type {?} */
  54266. ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
  54267. }
  54268. }
  54269. return instance;
  54270. }
  54271. /**
  54272. * @param {?} view
  54273. * @param {?} index
  54274. * @param {?} eventName
  54275. * @return {?}
  54276. */
  54277. function eventHandlerClosure(view, index, eventName) {
  54278. return function (event) { return dispatchEvent(view, index, eventName, event); };
  54279. }
  54280. /**
  54281. * @param {?} view
  54282. * @param {?} def
  54283. * @param {?} v0
  54284. * @param {?} v1
  54285. * @param {?} v2
  54286. * @param {?} v3
  54287. * @param {?} v4
  54288. * @param {?} v5
  54289. * @param {?} v6
  54290. * @param {?} v7
  54291. * @param {?} v8
  54292. * @param {?} v9
  54293. * @return {?}
  54294. */
  54295. function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  54296. var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
  54297. var /** @type {?} */ directive = providerData.instance;
  54298. var /** @type {?} */ changed = false;
  54299. var /** @type {?} */ changes = /** @type {?} */ ((undefined));
  54300. var /** @type {?} */ bindLen = def.bindings.length;
  54301. if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
  54302. changed = true;
  54303. changes = updateProp(view, providerData, def, 0, v0, changes);
  54304. }
  54305. if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
  54306. changed = true;
  54307. changes = updateProp(view, providerData, def, 1, v1, changes);
  54308. }
  54309. if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
  54310. changed = true;
  54311. changes = updateProp(view, providerData, def, 2, v2, changes);
  54312. }
  54313. if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
  54314. changed = true;
  54315. changes = updateProp(view, providerData, def, 3, v3, changes);
  54316. }
  54317. if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
  54318. changed = true;
  54319. changes = updateProp(view, providerData, def, 4, v4, changes);
  54320. }
  54321. if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
  54322. changed = true;
  54323. changes = updateProp(view, providerData, def, 5, v5, changes);
  54324. }
  54325. if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
  54326. changed = true;
  54327. changes = updateProp(view, providerData, def, 6, v6, changes);
  54328. }
  54329. if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
  54330. changed = true;
  54331. changes = updateProp(view, providerData, def, 7, v7, changes);
  54332. }
  54333. if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
  54334. changed = true;
  54335. changes = updateProp(view, providerData, def, 8, v8, changes);
  54336. }
  54337. if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
  54338. changed = true;
  54339. changes = updateProp(view, providerData, def, 9, v9, changes);
  54340. }
  54341. if (changes) {
  54342. directive.ngOnChanges(changes);
  54343. }
  54344. if ((def.flags & 65536 /* OnInit */) &&
  54345. shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
  54346. directive.ngOnInit();
  54347. }
  54348. if (def.flags & 262144 /* DoCheck */) {
  54349. directive.ngDoCheck();
  54350. }
  54351. return changed;
  54352. }
  54353. /**
  54354. * @param {?} view
  54355. * @param {?} def
  54356. * @param {?} values
  54357. * @return {?}
  54358. */
  54359. function checkAndUpdateDirectiveDynamic(view, def, values) {
  54360. var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
  54361. var /** @type {?} */ directive = providerData.instance;
  54362. var /** @type {?} */ changed = false;
  54363. var /** @type {?} */ changes = /** @type {?} */ ((undefined));
  54364. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  54365. if (checkBinding(view, def, i, values[i])) {
  54366. changed = true;
  54367. changes = updateProp(view, providerData, def, i, values[i], changes);
  54368. }
  54369. }
  54370. if (changes) {
  54371. directive.ngOnChanges(changes);
  54372. }
  54373. if ((def.flags & 65536 /* OnInit */) &&
  54374. shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
  54375. directive.ngOnInit();
  54376. }
  54377. if (def.flags & 262144 /* DoCheck */) {
  54378. directive.ngDoCheck();
  54379. }
  54380. return changed;
  54381. }
  54382. /**
  54383. * @param {?} view
  54384. * @param {?} def
  54385. * @return {?}
  54386. */
  54387. function _createProviderInstance(view, def) {
  54388. // private services can see other private services
  54389. var /** @type {?} */ allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0;
  54390. var /** @type {?} */ providerDef = def.provider;
  54391. switch (def.flags & 201347067 /* Types */) {
  54392. case 512 /* TypeClassProvider */:
  54393. return createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
  54394. case 1024 /* TypeFactoryProvider */:
  54395. return callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
  54396. case 2048 /* TypeUseExistingProvider */:
  54397. return resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]);
  54398. case 256 /* TypeValueProvider */:
  54399. return /** @type {?} */ ((providerDef)).value;
  54400. }
  54401. }
  54402. /**
  54403. * @param {?} view
  54404. * @param {?} elDef
  54405. * @param {?} allowPrivateServices
  54406. * @param {?} ctor
  54407. * @param {?} deps
  54408. * @return {?}
  54409. */
  54410. function createClass(view, elDef, allowPrivateServices, ctor, deps) {
  54411. var /** @type {?} */ len = deps.length;
  54412. switch (len) {
  54413. case 0:
  54414. return new ctor();
  54415. case 1:
  54416. return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
  54417. case 2:
  54418. return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
  54419. case 3:
  54420. return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
  54421. default:
  54422. var /** @type {?} */ depValues = new Array(len);
  54423. for (var /** @type {?} */ i = 0; i < len; i++) {
  54424. depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
  54425. }
  54426. return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
  54427. }
  54428. }
  54429. /**
  54430. * @param {?} view
  54431. * @param {?} elDef
  54432. * @param {?} allowPrivateServices
  54433. * @param {?} factory
  54434. * @param {?} deps
  54435. * @return {?}
  54436. */
  54437. function callFactory(view, elDef, allowPrivateServices, factory, deps) {
  54438. var /** @type {?} */ len = deps.length;
  54439. switch (len) {
  54440. case 0:
  54441. return factory();
  54442. case 1:
  54443. return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
  54444. case 2:
  54445. return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
  54446. case 3:
  54447. return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
  54448. default:
  54449. var /** @type {?} */ depValues = Array(len);
  54450. for (var /** @type {?} */ i = 0; i < len; i++) {
  54451. depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
  54452. }
  54453. return factory.apply(void 0, depValues);
  54454. }
  54455. }
  54456. // This default value is when checking the hierarchy for a token.
  54457. //
  54458. // It means both:
  54459. // - the token is not provided by the current injector,
  54460. // - only the element injectors should be checked (ie do not check module injectors
  54461. //
  54462. // mod1
  54463. // /
  54464. // el1 mod2
  54465. // \ /
  54466. // el2
  54467. //
  54468. // When requesting el2.injector.get(token), we should check in the following order and return the
  54469. // first found value:
  54470. // - el2.injector.get(token, default)
  54471. // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
  54472. // - mod2.injector.get(token, default)
  54473. var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
  54474. /**
  54475. * @param {?} view
  54476. * @param {?} elDef
  54477. * @param {?} allowPrivateServices
  54478. * @param {?} depDef
  54479. * @param {?=} notFoundValue
  54480. * @return {?}
  54481. */
  54482. function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
  54483. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  54484. if (depDef.flags & 8 /* Value */) {
  54485. return depDef.token;
  54486. }
  54487. var /** @type {?} */ startView = view;
  54488. if (depDef.flags & 2 /* Optional */) {
  54489. notFoundValue = null;
  54490. }
  54491. var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
  54492. if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
  54493. // directives on the same element as a component should be able to control the change detector
  54494. // of that component as well.
  54495. allowPrivateServices = !!(elDef && /** @type {?} */ ((elDef.element)).componentView);
  54496. }
  54497. if (elDef && (depDef.flags & 1 /* SkipSelf */)) {
  54498. allowPrivateServices = false;
  54499. elDef = /** @type {?} */ ((elDef.parent));
  54500. }
  54501. while (view) {
  54502. if (elDef) {
  54503. switch (tokenKey$$1) {
  54504. case RendererV1TokenKey: {
  54505. var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
  54506. return createRendererV1(compView);
  54507. }
  54508. case Renderer2TokenKey: {
  54509. var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
  54510. return compView.renderer;
  54511. }
  54512. case ElementRefTokenKey:
  54513. return new ElementRef(asElementData(view, elDef.nodeIndex).renderElement);
  54514. case ViewContainerRefTokenKey:
  54515. return asElementData(view, elDef.nodeIndex).viewContainer;
  54516. case TemplateRefTokenKey: {
  54517. if (/** @type {?} */ ((elDef.element)).template) {
  54518. return asElementData(view, elDef.nodeIndex).template;
  54519. }
  54520. break;
  54521. }
  54522. case ChangeDetectorRefTokenKey: {
  54523. var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices);
  54524. return createChangeDetectorRef(cdView);
  54525. }
  54526. case InjectorRefTokenKey:
  54527. return createInjector(view, elDef);
  54528. default:
  54529. var /** @type {?} */ providerDef_1 = /** @type {?} */ (((allowPrivateServices ? /** @type {?} */ ((elDef.element)).allProviders : /** @type {?} */ ((elDef.element)).publicProviders)))[tokenKey$$1];
  54530. if (providerDef_1) {
  54531. var /** @type {?} */ providerData = asProviderData(view, providerDef_1.nodeIndex);
  54532. if (!providerData) {
  54533. providerData = { instance: _createProviderInstance(view, providerDef_1) };
  54534. view.nodes[providerDef_1.nodeIndex] = /** @type {?} */ (providerData);
  54535. }
  54536. return providerData.instance;
  54537. }
  54538. }
  54539. }
  54540. allowPrivateServices = isComponentView(view);
  54541. elDef = /** @type {?} */ ((viewParentEl(view)));
  54542. view = /** @type {?} */ ((view.parent));
  54543. }
  54544. var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
  54545. if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
  54546. notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
  54547. // Return the value from the root element injector when
  54548. // - it provides it
  54549. // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
  54550. // - the module injector should not be checked
  54551. // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
  54552. return value;
  54553. }
  54554. return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
  54555. }
  54556. /**
  54557. * @param {?} view
  54558. * @param {?} elDef
  54559. * @param {?} allowPrivateServices
  54560. * @return {?}
  54561. */
  54562. function findCompView(view, elDef, allowPrivateServices) {
  54563. var /** @type {?} */ compView;
  54564. if (allowPrivateServices) {
  54565. compView = asElementData(view, elDef.nodeIndex).componentView;
  54566. }
  54567. else {
  54568. compView = view;
  54569. while (compView.parent && !isComponentView(compView)) {
  54570. compView = compView.parent;
  54571. }
  54572. }
  54573. return compView;
  54574. }
  54575. /**
  54576. * @param {?} view
  54577. * @param {?} providerData
  54578. * @param {?} def
  54579. * @param {?} bindingIdx
  54580. * @param {?} value
  54581. * @param {?} changes
  54582. * @return {?}
  54583. */
  54584. function updateProp(view, providerData, def, bindingIdx, value, changes) {
  54585. if (def.flags & 32768 /* Component */) {
  54586. var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).nodeIndex).componentView;
  54587. if (compView.def.flags & 2 /* OnPush */) {
  54588. compView.state |= 8 /* ChecksEnabled */;
  54589. }
  54590. }
  54591. var /** @type {?} */ binding = def.bindings[bindingIdx];
  54592. var /** @type {?} */ propName = /** @type {?} */ ((binding.name));
  54593. // Note: This is still safe with Closure Compiler as
  54594. // the user passed in the property name as an object has to `providerDef`,
  54595. // so Closure Compiler will have renamed the property correctly already.
  54596. providerData.instance[propName] = value;
  54597. if (def.flags & 524288 /* OnChanges */) {
  54598. changes = changes || {};
  54599. var /** @type {?} */ oldValue = WrappedValue.unwrap(view.oldValues[def.bindingIndex + bindingIdx]);
  54600. var /** @type {?} */ binding_1 = def.bindings[bindingIdx];
  54601. changes[/** @type {?} */ ((binding_1.nonMinifiedName))] =
  54602. new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0);
  54603. }
  54604. view.oldValues[def.bindingIndex + bindingIdx] = value;
  54605. return changes;
  54606. }
  54607. /**
  54608. * @param {?} view
  54609. * @param {?} lifecycles
  54610. * @return {?}
  54611. */
  54612. function callLifecycleHooksChildrenFirst(view, lifecycles) {
  54613. if (!(view.def.nodeFlags & lifecycles)) {
  54614. return;
  54615. }
  54616. var /** @type {?} */ nodes = view.def.nodes;
  54617. var /** @type {?} */ initIndex = 0;
  54618. for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
  54619. var /** @type {?} */ nodeDef = nodes[i];
  54620. var /** @type {?} */ parent_1 = nodeDef.parent;
  54621. if (!parent_1 && nodeDef.flags & lifecycles) {
  54622. // matching root node (e.g. a pipe)
  54623. callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
  54624. }
  54625. if ((nodeDef.childFlags & lifecycles) === 0) {
  54626. // no child matches one of the lifecycles
  54627. i += nodeDef.childCount;
  54628. }
  54629. while (parent_1 && (parent_1.flags & 1 /* TypeElement */) &&
  54630. i === parent_1.nodeIndex + parent_1.childCount) {
  54631. // last child of an element
  54632. if (parent_1.directChildFlags & lifecycles) {
  54633. initIndex = callElementProvidersLifecycles(view, parent_1, lifecycles, initIndex);
  54634. }
  54635. parent_1 = parent_1.parent;
  54636. }
  54637. }
  54638. }
  54639. /**
  54640. * @param {?} view
  54641. * @param {?} elDef
  54642. * @param {?} lifecycles
  54643. * @param {?} initIndex
  54644. * @return {?}
  54645. */
  54646. function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) {
  54647. for (var /** @type {?} */ i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
  54648. var /** @type {?} */ nodeDef = view.def.nodes[i];
  54649. if (nodeDef.flags & lifecycles) {
  54650. callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
  54651. }
  54652. // only visit direct children
  54653. i += nodeDef.childCount;
  54654. }
  54655. return initIndex;
  54656. }
  54657. /**
  54658. * @param {?} view
  54659. * @param {?} index
  54660. * @param {?} lifecycles
  54661. * @param {?} initIndex
  54662. * @return {?}
  54663. */
  54664. function callProviderLifecycles(view, index, lifecycles, initIndex) {
  54665. var /** @type {?} */ providerData = asProviderData(view, index);
  54666. if (!providerData) {
  54667. return;
  54668. }
  54669. var /** @type {?} */ provider = providerData.instance;
  54670. if (!provider) {
  54671. return;
  54672. }
  54673. Services.setCurrentNode(view, index);
  54674. if (lifecycles & 1048576 /* AfterContentInit */ &&
  54675. shouldCallLifecycleInitHook(view, 512 /* InitState_CallingAfterContentInit */, initIndex)) {
  54676. provider.ngAfterContentInit();
  54677. }
  54678. if (lifecycles & 2097152 /* AfterContentChecked */) {
  54679. provider.ngAfterContentChecked();
  54680. }
  54681. if (lifecycles & 4194304 /* AfterViewInit */ &&
  54682. shouldCallLifecycleInitHook(view, 768 /* InitState_CallingAfterViewInit */, initIndex)) {
  54683. provider.ngAfterViewInit();
  54684. }
  54685. if (lifecycles & 8388608 /* AfterViewChecked */) {
  54686. provider.ngAfterViewChecked();
  54687. }
  54688. if (lifecycles & 131072 /* OnDestroy */) {
  54689. provider.ngOnDestroy();
  54690. }
  54691. }
  54692. /**
  54693. * @fileoverview added by tsickle
  54694. * @suppress {checkTypes} checked by tsc
  54695. */
  54696. /**
  54697. * @license
  54698. * Copyright Google Inc. All Rights Reserved.
  54699. *
  54700. * Use of this source code is governed by an MIT-style license that can be
  54701. * found in the LICENSE file at https://angular.io/license
  54702. */
  54703. /**
  54704. * @param {?} flags
  54705. * @param {?} id
  54706. * @param {?} bindings
  54707. * @return {?}
  54708. */
  54709. function queryDef(flags, id, bindings) {
  54710. var /** @type {?} */ bindingDefs = [];
  54711. for (var /** @type {?} */ propName in bindings) {
  54712. var /** @type {?} */ bindingType = bindings[propName];
  54713. bindingDefs.push({ propName: propName, bindingType: bindingType });
  54714. }
  54715. return {
  54716. // will bet set by the view definition
  54717. nodeIndex: -1,
  54718. parent: null,
  54719. renderParent: null,
  54720. bindingIndex: -1,
  54721. outputIndex: -1,
  54722. // regular values
  54723. // TODO(vicb): check
  54724. checkIndex: -1, flags: flags,
  54725. childFlags: 0,
  54726. directChildFlags: 0,
  54727. childMatchedQueries: 0,
  54728. ngContentIndex: -1,
  54729. matchedQueries: {},
  54730. matchedQueryIds: 0,
  54731. references: {},
  54732. childCount: 0,
  54733. bindings: [],
  54734. bindingFlags: 0,
  54735. outputs: [],
  54736. element: null,
  54737. provider: null,
  54738. text: null,
  54739. query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
  54740. ngContent: null
  54741. };
  54742. }
  54743. /**
  54744. * @return {?}
  54745. */
  54746. function createQuery() {
  54747. return new QueryList();
  54748. }
  54749. /**
  54750. * @param {?} view
  54751. * @return {?}
  54752. */
  54753. function dirtyParentQueries(view) {
  54754. var /** @type {?} */ queryIds = view.def.nodeMatchedQueries;
  54755. while (view.parent && isEmbeddedView(view)) {
  54756. var /** @type {?} */ tplDef = /** @type {?} */ ((view.parentNodeDef));
  54757. view = view.parent;
  54758. // content queries
  54759. var /** @type {?} */ end = tplDef.nodeIndex + tplDef.childCount;
  54760. for (var /** @type {?} */ i = 0; i <= end; i++) {
  54761. var /** @type {?} */ nodeDef = view.def.nodes[i];
  54762. if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
  54763. (nodeDef.flags & 536870912 /* DynamicQuery */) &&
  54764. (/** @type {?} */ ((nodeDef.query)).filterId & queryIds) === /** @type {?} */ ((nodeDef.query)).filterId) {
  54765. asQueryList(view, i).setDirty();
  54766. }
  54767. if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) ||
  54768. !(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
  54769. !(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
  54770. // skip elements that don't contain the template element or no query.
  54771. i += nodeDef.childCount;
  54772. }
  54773. }
  54774. }
  54775. // view queries
  54776. if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
  54777. for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) {
  54778. var /** @type {?} */ nodeDef = view.def.nodes[i];
  54779. if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
  54780. asQueryList(view, i).setDirty();
  54781. }
  54782. // only visit the root nodes
  54783. i += nodeDef.childCount;
  54784. }
  54785. }
  54786. }
  54787. /**
  54788. * @param {?} view
  54789. * @param {?} nodeDef
  54790. * @return {?}
  54791. */
  54792. function checkAndUpdateQuery(view, nodeDef) {
  54793. var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
  54794. if (!queryList.dirty) {
  54795. return;
  54796. }
  54797. var /** @type {?} */ directiveInstance;
  54798. var /** @type {?} */ newValues = /** @type {?} */ ((undefined));
  54799. if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
  54800. var /** @type {?} */ elementDef = /** @type {?} */ ((/** @type {?} */ ((nodeDef.parent)).parent));
  54801. newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, /** @type {?} */ ((nodeDef.query)), []);
  54802. directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).instance;
  54803. }
  54804. else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
  54805. newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []);
  54806. directiveInstance = view.component;
  54807. }
  54808. queryList.reset(newValues);
  54809. var /** @type {?} */ bindings = /** @type {?} */ ((nodeDef.query)).bindings;
  54810. var /** @type {?} */ notify = false;
  54811. for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
  54812. var /** @type {?} */ binding = bindings[i];
  54813. var /** @type {?} */ boundValue = void 0;
  54814. switch (binding.bindingType) {
  54815. case 0 /* First */:
  54816. boundValue = queryList.first;
  54817. break;
  54818. case 1 /* All */:
  54819. boundValue = queryList;
  54820. notify = true;
  54821. break;
  54822. }
  54823. directiveInstance[binding.propName] = boundValue;
  54824. }
  54825. if (notify) {
  54826. queryList.notifyOnChanges();
  54827. }
  54828. }
  54829. /**
  54830. * @param {?} view
  54831. * @param {?} startIndex
  54832. * @param {?} endIndex
  54833. * @param {?} queryDef
  54834. * @param {?} values
  54835. * @return {?}
  54836. */
  54837. function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
  54838. for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
  54839. var /** @type {?} */ nodeDef = view.def.nodes[i];
  54840. var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id];
  54841. if (valueType != null) {
  54842. values.push(getQueryValue(view, nodeDef, valueType));
  54843. }
  54844. if (nodeDef.flags & 1 /* TypeElement */ && /** @type {?} */ ((nodeDef.element)).template &&
  54845. (/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
  54846. queryDef.filterId) {
  54847. var /** @type {?} */ elementData = asElementData(view, i);
  54848. // check embedded views that were attached at the place of their template,
  54849. // but process child nodes first if some match the query (see issue #16568)
  54850. if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
  54851. calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
  54852. i += nodeDef.childCount;
  54853. }
  54854. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  54855. var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
  54856. for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
  54857. var /** @type {?} */ embeddedView = embeddedViews[k];
  54858. var /** @type {?} */ dvc = declaredViewContainer(embeddedView);
  54859. if (dvc && dvc === elementData) {
  54860. calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
  54861. }
  54862. }
  54863. }
  54864. var /** @type {?} */ projectedViews = elementData.template._projectedViews;
  54865. if (projectedViews) {
  54866. for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) {
  54867. var /** @type {?} */ projectedView = projectedViews[k];
  54868. calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
  54869. }
  54870. }
  54871. }
  54872. if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
  54873. // if no child matches the query, skip the children.
  54874. i += nodeDef.childCount;
  54875. }
  54876. }
  54877. return values;
  54878. }
  54879. /**
  54880. * @param {?} view
  54881. * @param {?} nodeDef
  54882. * @param {?} queryValueType
  54883. * @return {?}
  54884. */
  54885. function getQueryValue(view, nodeDef, queryValueType) {
  54886. if (queryValueType != null) {
  54887. // a match
  54888. switch (queryValueType) {
  54889. case 1 /* RenderElement */:
  54890. return asElementData(view, nodeDef.nodeIndex).renderElement;
  54891. case 0 /* ElementRef */:
  54892. return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
  54893. case 2 /* TemplateRef */:
  54894. return asElementData(view, nodeDef.nodeIndex).template;
  54895. case 3 /* ViewContainerRef */:
  54896. return asElementData(view, nodeDef.nodeIndex).viewContainer;
  54897. case 4 /* Provider */:
  54898. return asProviderData(view, nodeDef.nodeIndex).instance;
  54899. }
  54900. }
  54901. }
  54902. /**
  54903. * @fileoverview added by tsickle
  54904. * @suppress {checkTypes} checked by tsc
  54905. */
  54906. /**
  54907. * @license
  54908. * Copyright Google Inc. All Rights Reserved.
  54909. *
  54910. * Use of this source code is governed by an MIT-style license that can be
  54911. * found in the LICENSE file at https://angular.io/license
  54912. */
  54913. /**
  54914. * @param {?} ngContentIndex
  54915. * @param {?} index
  54916. * @return {?}
  54917. */
  54918. function ngContentDef(ngContentIndex, index) {
  54919. return {
  54920. // will bet set by the view definition
  54921. nodeIndex: -1,
  54922. parent: null,
  54923. renderParent: null,
  54924. bindingIndex: -1,
  54925. outputIndex: -1,
  54926. // regular values
  54927. checkIndex: -1,
  54928. flags: 8 /* TypeNgContent */,
  54929. childFlags: 0,
  54930. directChildFlags: 0,
  54931. childMatchedQueries: 0,
  54932. matchedQueries: {},
  54933. matchedQueryIds: 0,
  54934. references: {}, ngContentIndex: ngContentIndex,
  54935. childCount: 0,
  54936. bindings: [],
  54937. bindingFlags: 0,
  54938. outputs: [],
  54939. element: null,
  54940. provider: null,
  54941. text: null,
  54942. query: null,
  54943. ngContent: { index: index }
  54944. };
  54945. }
  54946. /**
  54947. * @param {?} view
  54948. * @param {?} renderHost
  54949. * @param {?} def
  54950. * @return {?}
  54951. */
  54952. function appendNgContent(view, renderHost, def) {
  54953. var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
  54954. if (!parentEl) {
  54955. // Nothing to do if there is no parent element.
  54956. return;
  54957. }
  54958. var /** @type {?} */ ngContentIndex = /** @type {?} */ ((def.ngContent)).index;
  54959. visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined);
  54960. }
  54961. /**
  54962. * @fileoverview added by tsickle
  54963. * @suppress {checkTypes} checked by tsc
  54964. */
  54965. /**
  54966. * @license
  54967. * Copyright Google Inc. All Rights Reserved.
  54968. *
  54969. * Use of this source code is governed by an MIT-style license that can be
  54970. * found in the LICENSE file at https://angular.io/license
  54971. */
  54972. /**
  54973. * @param {?} checkIndex
  54974. * @param {?} argCount
  54975. * @return {?}
  54976. */
  54977. function purePipeDef(checkIndex, argCount) {
  54978. // argCount + 1 to include the pipe as first arg
  54979. return _pureExpressionDef(128 /* TypePurePipe */, checkIndex, new Array(argCount + 1));
  54980. }
  54981. /**
  54982. * @param {?} checkIndex
  54983. * @param {?} argCount
  54984. * @return {?}
  54985. */
  54986. function pureArrayDef(checkIndex, argCount) {
  54987. return _pureExpressionDef(32 /* TypePureArray */, checkIndex, new Array(argCount));
  54988. }
  54989. /**
  54990. * @param {?} checkIndex
  54991. * @param {?} propToIndex
  54992. * @return {?}
  54993. */
  54994. function pureObjectDef(checkIndex, propToIndex) {
  54995. var /** @type {?} */ keys = Object.keys(propToIndex);
  54996. var /** @type {?} */ nbKeys = keys.length;
  54997. var /** @type {?} */ propertyNames = new Array(nbKeys);
  54998. for (var /** @type {?} */ i = 0; i < nbKeys; i++) {
  54999. var /** @type {?} */ key = keys[i];
  55000. var /** @type {?} */ index = propToIndex[key];
  55001. propertyNames[index] = key;
  55002. }
  55003. return _pureExpressionDef(64 /* TypePureObject */, checkIndex, propertyNames);
  55004. }
  55005. /**
  55006. * @param {?} flags
  55007. * @param {?} checkIndex
  55008. * @param {?} propertyNames
  55009. * @return {?}
  55010. */
  55011. function _pureExpressionDef(flags, checkIndex, propertyNames) {
  55012. var /** @type {?} */ bindings = new Array(propertyNames.length);
  55013. for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) {
  55014. var /** @type {?} */ prop = propertyNames[i];
  55015. bindings[i] = {
  55016. flags: 8 /* TypeProperty */,
  55017. name: prop,
  55018. ns: null,
  55019. nonMinifiedName: prop,
  55020. securityContext: null,
  55021. suffix: null
  55022. };
  55023. }
  55024. return {
  55025. // will bet set by the view definition
  55026. nodeIndex: -1,
  55027. parent: null,
  55028. renderParent: null,
  55029. bindingIndex: -1,
  55030. outputIndex: -1,
  55031. // regular values
  55032. checkIndex: checkIndex,
  55033. flags: flags,
  55034. childFlags: 0,
  55035. directChildFlags: 0,
  55036. childMatchedQueries: 0,
  55037. matchedQueries: {},
  55038. matchedQueryIds: 0,
  55039. references: {},
  55040. ngContentIndex: -1,
  55041. childCount: 0, bindings: bindings,
  55042. bindingFlags: calcBindingFlags(bindings),
  55043. outputs: [],
  55044. element: null,
  55045. provider: null,
  55046. text: null,
  55047. query: null,
  55048. ngContent: null
  55049. };
  55050. }
  55051. /**
  55052. * @param {?} view
  55053. * @param {?} def
  55054. * @return {?}
  55055. */
  55056. function createPureExpression(view, def) {
  55057. return { value: undefined };
  55058. }
  55059. /**
  55060. * @param {?} view
  55061. * @param {?} def
  55062. * @param {?} v0
  55063. * @param {?} v1
  55064. * @param {?} v2
  55065. * @param {?} v3
  55066. * @param {?} v4
  55067. * @param {?} v5
  55068. * @param {?} v6
  55069. * @param {?} v7
  55070. * @param {?} v8
  55071. * @param {?} v9
  55072. * @return {?}
  55073. */
  55074. function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  55075. var /** @type {?} */ bindings = def.bindings;
  55076. var /** @type {?} */ changed = false;
  55077. var /** @type {?} */ bindLen = bindings.length;
  55078. if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
  55079. changed = true;
  55080. if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
  55081. changed = true;
  55082. if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
  55083. changed = true;
  55084. if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
  55085. changed = true;
  55086. if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
  55087. changed = true;
  55088. if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
  55089. changed = true;
  55090. if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
  55091. changed = true;
  55092. if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
  55093. changed = true;
  55094. if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
  55095. changed = true;
  55096. if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
  55097. changed = true;
  55098. if (changed) {
  55099. var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
  55100. var /** @type {?} */ value = void 0;
  55101. switch (def.flags & 201347067 /* Types */) {
  55102. case 32 /* TypePureArray */:
  55103. value = new Array(bindings.length);
  55104. if (bindLen > 0)
  55105. value[0] = v0;
  55106. if (bindLen > 1)
  55107. value[1] = v1;
  55108. if (bindLen > 2)
  55109. value[2] = v2;
  55110. if (bindLen > 3)
  55111. value[3] = v3;
  55112. if (bindLen > 4)
  55113. value[4] = v4;
  55114. if (bindLen > 5)
  55115. value[5] = v5;
  55116. if (bindLen > 6)
  55117. value[6] = v6;
  55118. if (bindLen > 7)
  55119. value[7] = v7;
  55120. if (bindLen > 8)
  55121. value[8] = v8;
  55122. if (bindLen > 9)
  55123. value[9] = v9;
  55124. break;
  55125. case 64 /* TypePureObject */:
  55126. value = {};
  55127. if (bindLen > 0)
  55128. value[/** @type {?} */ ((bindings[0].name))] = v0;
  55129. if (bindLen > 1)
  55130. value[/** @type {?} */ ((bindings[1].name))] = v1;
  55131. if (bindLen > 2)
  55132. value[/** @type {?} */ ((bindings[2].name))] = v2;
  55133. if (bindLen > 3)
  55134. value[/** @type {?} */ ((bindings[3].name))] = v3;
  55135. if (bindLen > 4)
  55136. value[/** @type {?} */ ((bindings[4].name))] = v4;
  55137. if (bindLen > 5)
  55138. value[/** @type {?} */ ((bindings[5].name))] = v5;
  55139. if (bindLen > 6)
  55140. value[/** @type {?} */ ((bindings[6].name))] = v6;
  55141. if (bindLen > 7)
  55142. value[/** @type {?} */ ((bindings[7].name))] = v7;
  55143. if (bindLen > 8)
  55144. value[/** @type {?} */ ((bindings[8].name))] = v8;
  55145. if (bindLen > 9)
  55146. value[/** @type {?} */ ((bindings[9].name))] = v9;
  55147. break;
  55148. case 128 /* TypePurePipe */:
  55149. var /** @type {?} */ pipe = v0;
  55150. switch (bindLen) {
  55151. case 1:
  55152. value = pipe.transform(v0);
  55153. break;
  55154. case 2:
  55155. value = pipe.transform(v1);
  55156. break;
  55157. case 3:
  55158. value = pipe.transform(v1, v2);
  55159. break;
  55160. case 4:
  55161. value = pipe.transform(v1, v2, v3);
  55162. break;
  55163. case 5:
  55164. value = pipe.transform(v1, v2, v3, v4);
  55165. break;
  55166. case 6:
  55167. value = pipe.transform(v1, v2, v3, v4, v5);
  55168. break;
  55169. case 7:
  55170. value = pipe.transform(v1, v2, v3, v4, v5, v6);
  55171. break;
  55172. case 8:
  55173. value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
  55174. break;
  55175. case 9:
  55176. value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
  55177. break;
  55178. case 10:
  55179. value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55180. break;
  55181. }
  55182. break;
  55183. }
  55184. data.value = value;
  55185. }
  55186. return changed;
  55187. }
  55188. /**
  55189. * @param {?} view
  55190. * @param {?} def
  55191. * @param {?} values
  55192. * @return {?}
  55193. */
  55194. function checkAndUpdatePureExpressionDynamic(view, def, values) {
  55195. var /** @type {?} */ bindings = def.bindings;
  55196. var /** @type {?} */ changed = false;
  55197. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  55198. // Note: We need to loop over all values, so that
  55199. // the old values are updates as well!
  55200. if (checkAndUpdateBinding(view, def, i, values[i])) {
  55201. changed = true;
  55202. }
  55203. }
  55204. if (changed) {
  55205. var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
  55206. var /** @type {?} */ value = void 0;
  55207. switch (def.flags & 201347067 /* Types */) {
  55208. case 32 /* TypePureArray */:
  55209. value = values;
  55210. break;
  55211. case 64 /* TypePureObject */:
  55212. value = {};
  55213. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  55214. value[/** @type {?} */ ((bindings[i].name))] = values[i];
  55215. }
  55216. break;
  55217. case 128 /* TypePurePipe */:
  55218. var /** @type {?} */ pipe = values[0];
  55219. var /** @type {?} */ params = values.slice(1);
  55220. value = pipe.transform.apply(pipe, params);
  55221. break;
  55222. }
  55223. data.value = value;
  55224. }
  55225. return changed;
  55226. }
  55227. /**
  55228. * @fileoverview added by tsickle
  55229. * @suppress {checkTypes} checked by tsc
  55230. */
  55231. /**
  55232. * @license
  55233. * Copyright Google Inc. All Rights Reserved.
  55234. *
  55235. * Use of this source code is governed by an MIT-style license that can be
  55236. * found in the LICENSE file at https://angular.io/license
  55237. */
  55238. /**
  55239. * @param {?} checkIndex
  55240. * @param {?} ngContentIndex
  55241. * @param {?} staticText
  55242. * @return {?}
  55243. */
  55244. function textDef(checkIndex, ngContentIndex, staticText) {
  55245. var /** @type {?} */ bindings = new Array(staticText.length - 1);
  55246. for (var /** @type {?} */ i = 1; i < staticText.length; i++) {
  55247. bindings[i - 1] = {
  55248. flags: 8 /* TypeProperty */,
  55249. name: null,
  55250. ns: null,
  55251. nonMinifiedName: null,
  55252. securityContext: null,
  55253. suffix: staticText[i],
  55254. };
  55255. }
  55256. return {
  55257. // will bet set by the view definition
  55258. nodeIndex: -1,
  55259. parent: null,
  55260. renderParent: null,
  55261. bindingIndex: -1,
  55262. outputIndex: -1,
  55263. // regular values
  55264. checkIndex: checkIndex,
  55265. flags: 2 /* TypeText */,
  55266. childFlags: 0,
  55267. directChildFlags: 0,
  55268. childMatchedQueries: 0,
  55269. matchedQueries: {},
  55270. matchedQueryIds: 0,
  55271. references: {}, ngContentIndex: ngContentIndex,
  55272. childCount: 0, bindings: bindings,
  55273. bindingFlags: 8 /* TypeProperty */,
  55274. outputs: [],
  55275. element: null,
  55276. provider: null,
  55277. text: { prefix: staticText[0] },
  55278. query: null,
  55279. ngContent: null,
  55280. };
  55281. }
  55282. /**
  55283. * @param {?} view
  55284. * @param {?} renderHost
  55285. * @param {?} def
  55286. * @return {?}
  55287. */
  55288. function createText(view, renderHost, def) {
  55289. var /** @type {?} */ renderNode$$1;
  55290. var /** @type {?} */ renderer = view.renderer;
  55291. renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix);
  55292. var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
  55293. if (parentEl) {
  55294. renderer.appendChild(parentEl, renderNode$$1);
  55295. }
  55296. return { renderText: renderNode$$1 };
  55297. }
  55298. /**
  55299. * @param {?} view
  55300. * @param {?} def
  55301. * @param {?} v0
  55302. * @param {?} v1
  55303. * @param {?} v2
  55304. * @param {?} v3
  55305. * @param {?} v4
  55306. * @param {?} v5
  55307. * @param {?} v6
  55308. * @param {?} v7
  55309. * @param {?} v8
  55310. * @param {?} v9
  55311. * @return {?}
  55312. */
  55313. function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  55314. var /** @type {?} */ changed = false;
  55315. var /** @type {?} */ bindings = def.bindings;
  55316. var /** @type {?} */ bindLen = bindings.length;
  55317. if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
  55318. changed = true;
  55319. if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
  55320. changed = true;
  55321. if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
  55322. changed = true;
  55323. if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
  55324. changed = true;
  55325. if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
  55326. changed = true;
  55327. if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
  55328. changed = true;
  55329. if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
  55330. changed = true;
  55331. if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
  55332. changed = true;
  55333. if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
  55334. changed = true;
  55335. if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
  55336. changed = true;
  55337. if (changed) {
  55338. var /** @type {?} */ value = /** @type {?} */ ((def.text)).prefix;
  55339. if (bindLen > 0)
  55340. value += _addInterpolationPart(v0, bindings[0]);
  55341. if (bindLen > 1)
  55342. value += _addInterpolationPart(v1, bindings[1]);
  55343. if (bindLen > 2)
  55344. value += _addInterpolationPart(v2, bindings[2]);
  55345. if (bindLen > 3)
  55346. value += _addInterpolationPart(v3, bindings[3]);
  55347. if (bindLen > 4)
  55348. value += _addInterpolationPart(v4, bindings[4]);
  55349. if (bindLen > 5)
  55350. value += _addInterpolationPart(v5, bindings[5]);
  55351. if (bindLen > 6)
  55352. value += _addInterpolationPart(v6, bindings[6]);
  55353. if (bindLen > 7)
  55354. value += _addInterpolationPart(v7, bindings[7]);
  55355. if (bindLen > 8)
  55356. value += _addInterpolationPart(v8, bindings[8]);
  55357. if (bindLen > 9)
  55358. value += _addInterpolationPart(v9, bindings[9]);
  55359. var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
  55360. view.renderer.setValue(renderNode$$1, value);
  55361. }
  55362. return changed;
  55363. }
  55364. /**
  55365. * @param {?} view
  55366. * @param {?} def
  55367. * @param {?} values
  55368. * @return {?}
  55369. */
  55370. function checkAndUpdateTextDynamic(view, def, values) {
  55371. var /** @type {?} */ bindings = def.bindings;
  55372. var /** @type {?} */ changed = false;
  55373. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  55374. // Note: We need to loop over all values, so that
  55375. // the old values are updates as well!
  55376. if (checkAndUpdateBinding(view, def, i, values[i])) {
  55377. changed = true;
  55378. }
  55379. }
  55380. if (changed) {
  55381. var /** @type {?} */ value = '';
  55382. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  55383. value = value + _addInterpolationPart(values[i], bindings[i]);
  55384. }
  55385. value = /** @type {?} */ ((def.text)).prefix + value;
  55386. var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
  55387. view.renderer.setValue(renderNode$$1, value);
  55388. }
  55389. return changed;
  55390. }
  55391. /**
  55392. * @param {?} value
  55393. * @param {?} binding
  55394. * @return {?}
  55395. */
  55396. function _addInterpolationPart(value, binding) {
  55397. var /** @type {?} */ valueStr = value != null ? value.toString() : '';
  55398. return valueStr + binding.suffix;
  55399. }
  55400. /**
  55401. * @fileoverview added by tsickle
  55402. * @suppress {checkTypes} checked by tsc
  55403. */
  55404. /**
  55405. * @license
  55406. * Copyright Google Inc. All Rights Reserved.
  55407. *
  55408. * Use of this source code is governed by an MIT-style license that can be
  55409. * found in the LICENSE file at https://angular.io/license
  55410. */
  55411. /**
  55412. * @param {?} flags
  55413. * @param {?} nodes
  55414. * @param {?=} updateDirectives
  55415. * @param {?=} updateRenderer
  55416. * @return {?}
  55417. */
  55418. function viewDef(flags, nodes, updateDirectives, updateRenderer) {
  55419. // clone nodes and set auto calculated values
  55420. var /** @type {?} */ viewBindingCount = 0;
  55421. var /** @type {?} */ viewDisposableCount = 0;
  55422. var /** @type {?} */ viewNodeFlags = 0;
  55423. var /** @type {?} */ viewRootNodeFlags = 0;
  55424. var /** @type {?} */ viewMatchedQueries = 0;
  55425. var /** @type {?} */ currentParent = null;
  55426. var /** @type {?} */ currentRenderParent = null;
  55427. var /** @type {?} */ currentElementHasPublicProviders = false;
  55428. var /** @type {?} */ currentElementHasPrivateProviders = false;
  55429. var /** @type {?} */ lastRenderRootNode = null;
  55430. for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
  55431. var /** @type {?} */ node = nodes[i];
  55432. node.nodeIndex = i;
  55433. node.parent = currentParent;
  55434. node.bindingIndex = viewBindingCount;
  55435. node.outputIndex = viewDisposableCount;
  55436. node.renderParent = currentRenderParent;
  55437. viewNodeFlags |= node.flags;
  55438. viewMatchedQueries |= node.matchedQueryIds;
  55439. if (node.element) {
  55440. var /** @type {?} */ elDef = node.element;
  55441. elDef.publicProviders =
  55442. currentParent ? /** @type {?} */ ((currentParent.element)).publicProviders : Object.create(null);
  55443. elDef.allProviders = elDef.publicProviders;
  55444. // Note: We assume that all providers of an element are before any child element!
  55445. currentElementHasPublicProviders = false;
  55446. currentElementHasPrivateProviders = false;
  55447. if (node.element.template) {
  55448. viewMatchedQueries |= node.element.template.nodeMatchedQueries;
  55449. }
  55450. }
  55451. validateNode(currentParent, node, nodes.length);
  55452. viewBindingCount += node.bindings.length;
  55453. viewDisposableCount += node.outputs.length;
  55454. if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) {
  55455. lastRenderRootNode = node;
  55456. }
  55457. if (node.flags & 20224 /* CatProvider */) {
  55458. if (!currentElementHasPublicProviders) {
  55459. currentElementHasPublicProviders = true; /** @type {?} */
  55460. ((/** @type {?} */ ((currentParent)).element)).publicProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders); /** @type {?} */
  55461. ((/** @type {?} */ ((currentParent)).element)).allProviders = /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders;
  55462. }
  55463. var /** @type {?} */ isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0;
  55464. var /** @type {?} */ isComponent = (node.flags & 32768 /* Component */) !== 0;
  55465. if (!isPrivateService || isComponent) {
  55466. /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
  55467. }
  55468. else {
  55469. if (!currentElementHasPrivateProviders) {
  55470. currentElementHasPrivateProviders = true; /** @type {?} */
  55471. ((/** @type {?} */ ((currentParent)).element)).allProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders);
  55472. } /** @type {?} */
  55473. ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).allProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
  55474. }
  55475. if (isComponent) {
  55476. /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).componentProvider = node;
  55477. }
  55478. }
  55479. if (currentParent) {
  55480. currentParent.childFlags |= node.flags;
  55481. currentParent.directChildFlags |= node.flags;
  55482. currentParent.childMatchedQueries |= node.matchedQueryIds;
  55483. if (node.element && node.element.template) {
  55484. currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
  55485. }
  55486. }
  55487. else {
  55488. viewRootNodeFlags |= node.flags;
  55489. }
  55490. if (node.childCount > 0) {
  55491. currentParent = node;
  55492. if (!isNgContainer(node)) {
  55493. currentRenderParent = node;
  55494. }
  55495. }
  55496. else {
  55497. // When the current node has no children, check if it is the last children of its parent.
  55498. // When it is, propagate the flags up.
  55499. // The loop is required because an element could be the last transitive children of several
  55500. // elements. We loop to either the root or the highest opened element (= with remaining
  55501. // children)
  55502. while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
  55503. var /** @type {?} */ newParent = currentParent.parent;
  55504. if (newParent) {
  55505. newParent.childFlags |= currentParent.childFlags;
  55506. newParent.childMatchedQueries |= currentParent.childMatchedQueries;
  55507. }
  55508. currentParent = newParent;
  55509. // We also need to update the render parent & account for ng-container
  55510. if (currentParent && isNgContainer(currentParent)) {
  55511. currentRenderParent = currentParent.renderParent;
  55512. }
  55513. else {
  55514. currentRenderParent = currentParent;
  55515. }
  55516. }
  55517. }
  55518. }
  55519. var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return ((/** @type {?} */ ((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
  55520. return {
  55521. // Will be filled later...
  55522. factory: null,
  55523. nodeFlags: viewNodeFlags,
  55524. rootNodeFlags: viewRootNodeFlags,
  55525. nodeMatchedQueries: viewMatchedQueries, flags: flags,
  55526. nodes: nodes,
  55527. updateDirectives: updateDirectives || NOOP,
  55528. updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent,
  55529. bindingCount: viewBindingCount,
  55530. outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
  55531. };
  55532. }
  55533. /**
  55534. * @param {?} node
  55535. * @return {?}
  55536. */
  55537. function isNgContainer(node) {
  55538. return (node.flags & 1 /* TypeElement */) !== 0 && /** @type {?} */ ((node.element)).name === null;
  55539. }
  55540. /**
  55541. * @param {?} parent
  55542. * @param {?} node
  55543. * @param {?} nodeCount
  55544. * @return {?}
  55545. */
  55546. function validateNode(parent, node, nodeCount) {
  55547. var /** @type {?} */ template = node.element && node.element.template;
  55548. if (template) {
  55549. if (!template.lastRenderRootNode) {
  55550. throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
  55551. }
  55552. if (template.lastRenderRootNode &&
  55553. template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) {
  55554. throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.nodeIndex + "!");
  55555. }
  55556. }
  55557. if (node.flags & 20224 /* CatProvider */) {
  55558. var /** @type {?} */ parentFlags = parent ? parent.flags : 0;
  55559. if ((parentFlags & 1 /* TypeElement */) === 0) {
  55560. throw new Error("Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index " + node.nodeIndex + "!");
  55561. }
  55562. }
  55563. if (node.query) {
  55564. if (node.flags & 67108864 /* TypeContentQuery */ &&
  55565. (!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) {
  55566. throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.nodeIndex + "!");
  55567. }
  55568. if (node.flags & 134217728 /* TypeViewQuery */ && parent) {
  55569. throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.nodeIndex + "!");
  55570. }
  55571. }
  55572. if (node.childCount) {
  55573. var /** @type {?} */ parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
  55574. if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
  55575. throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.nodeIndex + "!");
  55576. }
  55577. }
  55578. }
  55579. /**
  55580. * @param {?} parent
  55581. * @param {?} anchorDef
  55582. * @param {?} viewDef
  55583. * @param {?=} context
  55584. * @return {?}
  55585. */
  55586. function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
  55587. // embedded views are seen as siblings to the anchor, so we need
  55588. // to get the parent of the anchor and use it as parentIndex.
  55589. var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
  55590. initView(view, parent.component, context);
  55591. createViewNodes(view);
  55592. return view;
  55593. }
  55594. /**
  55595. * @param {?} root
  55596. * @param {?} def
  55597. * @param {?=} context
  55598. * @return {?}
  55599. */
  55600. function createRootView(root, def, context) {
  55601. var /** @type {?} */ view = createView(root, root.renderer, null, null, def);
  55602. initView(view, context, context);
  55603. createViewNodes(view);
  55604. return view;
  55605. }
  55606. /**
  55607. * @param {?} parentView
  55608. * @param {?} nodeDef
  55609. * @param {?} viewDef
  55610. * @param {?} hostElement
  55611. * @return {?}
  55612. */
  55613. function createComponentView(parentView, nodeDef, viewDef, hostElement) {
  55614. var /** @type {?} */ rendererType = /** @type {?} */ ((nodeDef.element)).componentRendererType;
  55615. var /** @type {?} */ compRenderer;
  55616. if (!rendererType) {
  55617. compRenderer = parentView.root.renderer;
  55618. }
  55619. else {
  55620. compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
  55621. }
  55622. return createView(parentView.root, compRenderer, parentView, /** @type {?} */ ((nodeDef.element)).componentProvider, viewDef);
  55623. }
  55624. /**
  55625. * @param {?} root
  55626. * @param {?} renderer
  55627. * @param {?} parent
  55628. * @param {?} parentNodeDef
  55629. * @param {?} def
  55630. * @return {?}
  55631. */
  55632. function createView(root, renderer, parent, parentNodeDef, def) {
  55633. var /** @type {?} */ nodes = new Array(def.nodes.length);
  55634. var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null;
  55635. var /** @type {?} */ view = {
  55636. def: def,
  55637. parent: parent,
  55638. viewContainerParent: null, parentNodeDef: parentNodeDef,
  55639. context: null,
  55640. component: null, nodes: nodes,
  55641. state: 13 /* CatInit */, root: root, renderer: renderer,
  55642. oldValues: new Array(def.bindingCount), disposables: disposables,
  55643. initIndex: -1
  55644. };
  55645. return view;
  55646. }
  55647. /**
  55648. * @param {?} view
  55649. * @param {?} component
  55650. * @param {?} context
  55651. * @return {?}
  55652. */
  55653. function initView(view, component, context) {
  55654. view.component = component;
  55655. view.context = context;
  55656. }
  55657. /**
  55658. * @param {?} view
  55659. * @return {?}
  55660. */
  55661. function createViewNodes(view) {
  55662. var /** @type {?} */ renderHost;
  55663. if (isComponentView(view)) {
  55664. var /** @type {?} */ hostDef = view.parentNodeDef;
  55665. renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((/** @type {?} */ ((hostDef)).parent)).nodeIndex).renderElement;
  55666. }
  55667. var /** @type {?} */ def = view.def;
  55668. var /** @type {?} */ nodes = view.nodes;
  55669. for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
  55670. var /** @type {?} */ nodeDef = def.nodes[i];
  55671. Services.setCurrentNode(view, i);
  55672. var /** @type {?} */ nodeData = void 0;
  55673. switch (nodeDef.flags & 201347067 /* Types */) {
  55674. case 1 /* TypeElement */:
  55675. var /** @type {?} */ el = /** @type {?} */ (createElement(view, renderHost, nodeDef));
  55676. var /** @type {?} */ componentView = /** @type {?} */ ((undefined));
  55677. if (nodeDef.flags & 33554432 /* ComponentView */) {
  55678. var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentView)));
  55679. componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
  55680. }
  55681. listenToElementOutputs(view, componentView, nodeDef, el);
  55682. nodeData = /** @type {?} */ ({
  55683. renderElement: el,
  55684. componentView: componentView,
  55685. viewContainer: null,
  55686. template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
  55687. });
  55688. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  55689. nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
  55690. }
  55691. break;
  55692. case 2 /* TypeText */:
  55693. nodeData = /** @type {?} */ (createText(view, renderHost, nodeDef));
  55694. break;
  55695. case 512 /* TypeClassProvider */:
  55696. case 1024 /* TypeFactoryProvider */:
  55697. case 2048 /* TypeUseExistingProvider */:
  55698. case 256 /* TypeValueProvider */: {
  55699. nodeData = nodes[i];
  55700. if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */)) {
  55701. var /** @type {?} */ instance = createProviderInstance(view, nodeDef);
  55702. nodeData = /** @type {?} */ ({ instance: instance });
  55703. }
  55704. break;
  55705. }
  55706. case 16 /* TypePipe */: {
  55707. var /** @type {?} */ instance = createPipeInstance(view, nodeDef);
  55708. nodeData = /** @type {?} */ ({ instance: instance });
  55709. break;
  55710. }
  55711. case 16384 /* TypeDirective */: {
  55712. nodeData = nodes[i];
  55713. if (!nodeData) {
  55714. var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef);
  55715. nodeData = /** @type {?} */ ({ instance: instance });
  55716. }
  55717. if (nodeDef.flags & 32768 /* Component */) {
  55718. var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).componentView;
  55719. initView(compView, nodeData.instance, nodeData.instance);
  55720. }
  55721. break;
  55722. }
  55723. case 32 /* TypePureArray */:
  55724. case 64 /* TypePureObject */:
  55725. case 128 /* TypePurePipe */:
  55726. nodeData = /** @type {?} */ (createPureExpression(view, nodeDef));
  55727. break;
  55728. case 67108864 /* TypeContentQuery */:
  55729. case 134217728 /* TypeViewQuery */:
  55730. nodeData = /** @type {?} */ (createQuery());
  55731. break;
  55732. case 8 /* TypeNgContent */:
  55733. appendNgContent(view, renderHost, nodeDef);
  55734. // no runtime data needed for NgContent...
  55735. nodeData = undefined;
  55736. break;
  55737. }
  55738. nodes[i] = nodeData;
  55739. }
  55740. // Create the ViewData.nodes of component views after we created everything else,
  55741. // so that e.g. ng-content works
  55742. execComponentViewsAction(view, ViewAction.CreateViewNodes);
  55743. // fill static content and view queries
  55744. execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */);
  55745. }
  55746. /**
  55747. * @param {?} view
  55748. * @return {?}
  55749. */
  55750. function checkNoChangesView(view) {
  55751. markProjectedViewsForCheck(view);
  55752. Services.updateDirectives(view, 1 /* CheckNoChanges */);
  55753. execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
  55754. Services.updateRenderer(view, 1 /* CheckNoChanges */);
  55755. execComponentViewsAction(view, ViewAction.CheckNoChanges);
  55756. // Note: We don't check queries for changes as we didn't do this in v2.x.
  55757. // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message.
  55758. view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
  55759. }
  55760. /**
  55761. * @param {?} view
  55762. * @return {?}
  55763. */
  55764. function checkAndUpdateView(view) {
  55765. if (view.state & 1 /* BeforeFirstCheck */) {
  55766. view.state &= ~1 /* BeforeFirstCheck */;
  55767. view.state |= 2 /* FirstCheck */;
  55768. }
  55769. else {
  55770. view.state &= ~2 /* FirstCheck */;
  55771. }
  55772. shiftInitState(view, 0 /* InitState_BeforeInit */, 256 /* InitState_CallingOnInit */);
  55773. markProjectedViewsForCheck(view);
  55774. Services.updateDirectives(view, 0 /* CheckAndUpdate */);
  55775. execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
  55776. execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
  55777. var /** @type {?} */ callInit = shiftInitState(view, 256 /* InitState_CallingOnInit */, 512 /* InitState_CallingAfterContentInit */);
  55778. callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ | (callInit ? 1048576 /* AfterContentInit */ : 0));
  55779. Services.updateRenderer(view, 0 /* CheckAndUpdate */);
  55780. execComponentViewsAction(view, ViewAction.CheckAndUpdate);
  55781. execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
  55782. callInit = shiftInitState(view, 512 /* InitState_CallingAfterContentInit */, 768 /* InitState_CallingAfterViewInit */);
  55783. callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ | (callInit ? 4194304 /* AfterViewInit */ : 0));
  55784. if (view.def.flags & 2 /* OnPush */) {
  55785. view.state &= ~8 /* ChecksEnabled */;
  55786. }
  55787. view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
  55788. shiftInitState(view, 768 /* InitState_CallingAfterViewInit */, 1024 /* InitState_AfterInit */);
  55789. }
  55790. /**
  55791. * @param {?} view
  55792. * @param {?} nodeDef
  55793. * @param {?} argStyle
  55794. * @param {?=} v0
  55795. * @param {?=} v1
  55796. * @param {?=} v2
  55797. * @param {?=} v3
  55798. * @param {?=} v4
  55799. * @param {?=} v5
  55800. * @param {?=} v6
  55801. * @param {?=} v7
  55802. * @param {?=} v8
  55803. * @param {?=} v9
  55804. * @return {?}
  55805. */
  55806. function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  55807. if (argStyle === 0 /* Inline */) {
  55808. return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55809. }
  55810. else {
  55811. return checkAndUpdateNodeDynamic(view, nodeDef, v0);
  55812. }
  55813. }
  55814. /**
  55815. * @param {?} view
  55816. * @return {?}
  55817. */
  55818. function markProjectedViewsForCheck(view) {
  55819. var /** @type {?} */ def = view.def;
  55820. if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) {
  55821. return;
  55822. }
  55823. for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
  55824. var /** @type {?} */ nodeDef = def.nodes[i];
  55825. if (nodeDef.flags & 4 /* ProjectedTemplate */) {
  55826. var /** @type {?} */ projectedViews = asElementData(view, i).template._projectedViews;
  55827. if (projectedViews) {
  55828. for (var /** @type {?} */ i_1 = 0; i_1 < projectedViews.length; i_1++) {
  55829. var /** @type {?} */ projectedView = projectedViews[i_1];
  55830. projectedView.state |= 32 /* CheckProjectedView */;
  55831. markParentViewsForCheckProjectedViews(projectedView, view);
  55832. }
  55833. }
  55834. }
  55835. else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) {
  55836. // a parent with leafs
  55837. // no child is a component,
  55838. // then skip the children
  55839. i += nodeDef.childCount;
  55840. }
  55841. }
  55842. }
  55843. /**
  55844. * @param {?} view
  55845. * @param {?} nodeDef
  55846. * @param {?=} v0
  55847. * @param {?=} v1
  55848. * @param {?=} v2
  55849. * @param {?=} v3
  55850. * @param {?=} v4
  55851. * @param {?=} v5
  55852. * @param {?=} v6
  55853. * @param {?=} v7
  55854. * @param {?=} v8
  55855. * @param {?=} v9
  55856. * @return {?}
  55857. */
  55858. function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  55859. switch (nodeDef.flags & 201347067 /* Types */) {
  55860. case 1 /* TypeElement */:
  55861. return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55862. case 2 /* TypeText */:
  55863. return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55864. case 16384 /* TypeDirective */:
  55865. return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55866. case 32 /* TypePureArray */:
  55867. case 64 /* TypePureObject */:
  55868. case 128 /* TypePurePipe */:
  55869. return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55870. default:
  55871. throw 'unreachable';
  55872. }
  55873. }
  55874. /**
  55875. * @param {?} view
  55876. * @param {?} nodeDef
  55877. * @param {?} values
  55878. * @return {?}
  55879. */
  55880. function checkAndUpdateNodeDynamic(view, nodeDef, values) {
  55881. switch (nodeDef.flags & 201347067 /* Types */) {
  55882. case 1 /* TypeElement */:
  55883. return checkAndUpdateElementDynamic(view, nodeDef, values);
  55884. case 2 /* TypeText */:
  55885. return checkAndUpdateTextDynamic(view, nodeDef, values);
  55886. case 16384 /* TypeDirective */:
  55887. return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
  55888. case 32 /* TypePureArray */:
  55889. case 64 /* TypePureObject */:
  55890. case 128 /* TypePurePipe */:
  55891. return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
  55892. default:
  55893. throw 'unreachable';
  55894. }
  55895. }
  55896. /**
  55897. * @param {?} view
  55898. * @param {?} nodeDef
  55899. * @param {?} argStyle
  55900. * @param {?=} v0
  55901. * @param {?=} v1
  55902. * @param {?=} v2
  55903. * @param {?=} v3
  55904. * @param {?=} v4
  55905. * @param {?=} v5
  55906. * @param {?=} v6
  55907. * @param {?=} v7
  55908. * @param {?=} v8
  55909. * @param {?=} v9
  55910. * @return {?}
  55911. */
  55912. function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  55913. if (argStyle === 0 /* Inline */) {
  55914. checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  55915. }
  55916. else {
  55917. checkNoChangesNodeDynamic(view, nodeDef, v0);
  55918. }
  55919. // Returning false is ok here as we would have thrown in case of a change.
  55920. return false;
  55921. }
  55922. /**
  55923. * @param {?} view
  55924. * @param {?} nodeDef
  55925. * @param {?} v0
  55926. * @param {?} v1
  55927. * @param {?} v2
  55928. * @param {?} v3
  55929. * @param {?} v4
  55930. * @param {?} v5
  55931. * @param {?} v6
  55932. * @param {?} v7
  55933. * @param {?} v8
  55934. * @param {?} v9
  55935. * @return {?}
  55936. */
  55937. function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  55938. var /** @type {?} */ bindLen = nodeDef.bindings.length;
  55939. if (bindLen > 0)
  55940. checkBindingNoChanges(view, nodeDef, 0, v0);
  55941. if (bindLen > 1)
  55942. checkBindingNoChanges(view, nodeDef, 1, v1);
  55943. if (bindLen > 2)
  55944. checkBindingNoChanges(view, nodeDef, 2, v2);
  55945. if (bindLen > 3)
  55946. checkBindingNoChanges(view, nodeDef, 3, v3);
  55947. if (bindLen > 4)
  55948. checkBindingNoChanges(view, nodeDef, 4, v4);
  55949. if (bindLen > 5)
  55950. checkBindingNoChanges(view, nodeDef, 5, v5);
  55951. if (bindLen > 6)
  55952. checkBindingNoChanges(view, nodeDef, 6, v6);
  55953. if (bindLen > 7)
  55954. checkBindingNoChanges(view, nodeDef, 7, v7);
  55955. if (bindLen > 8)
  55956. checkBindingNoChanges(view, nodeDef, 8, v8);
  55957. if (bindLen > 9)
  55958. checkBindingNoChanges(view, nodeDef, 9, v9);
  55959. }
  55960. /**
  55961. * @param {?} view
  55962. * @param {?} nodeDef
  55963. * @param {?} values
  55964. * @return {?}
  55965. */
  55966. function checkNoChangesNodeDynamic(view, nodeDef, values) {
  55967. for (var /** @type {?} */ i = 0; i < values.length; i++) {
  55968. checkBindingNoChanges(view, nodeDef, i, values[i]);
  55969. }
  55970. }
  55971. /**
  55972. * Workaround https://github.com/angular/tsickle/issues/497
  55973. * @suppress {misplacedTypeAnnotation}
  55974. * @param {?} view
  55975. * @param {?} nodeDef
  55976. * @return {?}
  55977. */
  55978. function checkNoChangesQuery(view, nodeDef) {
  55979. var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
  55980. if (queryList.dirty) {
  55981. throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), "Query " + (/** @type {?} */ ((nodeDef.query))).id + " not dirty", "Query " + (/** @type {?} */ ((nodeDef.query))).id + " dirty", (view.state & 1 /* BeforeFirstCheck */) !== 0);
  55982. }
  55983. }
  55984. /**
  55985. * @param {?} view
  55986. * @return {?}
  55987. */
  55988. function destroyView(view) {
  55989. if (view.state & 128 /* Destroyed */) {
  55990. return;
  55991. }
  55992. execEmbeddedViewsAction(view, ViewAction.Destroy);
  55993. execComponentViewsAction(view, ViewAction.Destroy);
  55994. callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */);
  55995. if (view.disposables) {
  55996. for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) {
  55997. view.disposables[i]();
  55998. }
  55999. }
  56000. detachProjectedView(view);
  56001. if (view.renderer.destroyNode) {
  56002. destroyViewNodes(view);
  56003. }
  56004. if (isComponentView(view)) {
  56005. view.renderer.destroy();
  56006. }
  56007. view.state |= 128 /* Destroyed */;
  56008. }
  56009. /**
  56010. * @param {?} view
  56011. * @return {?}
  56012. */
  56013. function destroyViewNodes(view) {
  56014. var /** @type {?} */ len = view.def.nodes.length;
  56015. for (var /** @type {?} */ i = 0; i < len; i++) {
  56016. var /** @type {?} */ def = view.def.nodes[i];
  56017. if (def.flags & 1 /* TypeElement */) {
  56018. /** @type {?} */ ((view.renderer.destroyNode))(asElementData(view, i).renderElement);
  56019. }
  56020. else if (def.flags & 2 /* TypeText */) {
  56021. /** @type {?} */ ((view.renderer.destroyNode))(asTextData(view, i).renderText);
  56022. }
  56023. else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */) {
  56024. asQueryList(view, i).destroy();
  56025. }
  56026. }
  56027. }
  56028. /** @enum {number} */
  56029. var ViewAction = {
  56030. CreateViewNodes: 0,
  56031. CheckNoChanges: 1,
  56032. CheckNoChangesProjectedViews: 2,
  56033. CheckAndUpdate: 3,
  56034. CheckAndUpdateProjectedViews: 4,
  56035. Destroy: 5,
  56036. };
  56037. ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
  56038. ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
  56039. ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews";
  56040. ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
  56041. ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews";
  56042. ViewAction[ViewAction.Destroy] = "Destroy";
  56043. /**
  56044. * @param {?} view
  56045. * @param {?} action
  56046. * @return {?}
  56047. */
  56048. function execComponentViewsAction(view, action) {
  56049. var /** @type {?} */ def = view.def;
  56050. if (!(def.nodeFlags & 33554432 /* ComponentView */)) {
  56051. return;
  56052. }
  56053. for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
  56054. var /** @type {?} */ nodeDef = def.nodes[i];
  56055. if (nodeDef.flags & 33554432 /* ComponentView */) {
  56056. // a leaf
  56057. callViewAction(asElementData(view, i).componentView, action);
  56058. }
  56059. else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) {
  56060. // a parent with leafs
  56061. // no child is a component,
  56062. // then skip the children
  56063. i += nodeDef.childCount;
  56064. }
  56065. }
  56066. }
  56067. /**
  56068. * @param {?} view
  56069. * @param {?} action
  56070. * @return {?}
  56071. */
  56072. function execEmbeddedViewsAction(view, action) {
  56073. var /** @type {?} */ def = view.def;
  56074. if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) {
  56075. return;
  56076. }
  56077. for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
  56078. var /** @type {?} */ nodeDef = def.nodes[i];
  56079. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  56080. // a leaf
  56081. var /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, i).viewContainer))._embeddedViews;
  56082. for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
  56083. callViewAction(embeddedViews[k], action);
  56084. }
  56085. }
  56086. else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) {
  56087. // a parent with leafs
  56088. // no child is a component,
  56089. // then skip the children
  56090. i += nodeDef.childCount;
  56091. }
  56092. }
  56093. }
  56094. /**
  56095. * @param {?} view
  56096. * @param {?} action
  56097. * @return {?}
  56098. */
  56099. function callViewAction(view, action) {
  56100. var /** @type {?} */ viewState = view.state;
  56101. switch (action) {
  56102. case ViewAction.CheckNoChanges:
  56103. if ((viewState & 128 /* Destroyed */) === 0) {
  56104. if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
  56105. checkNoChangesView(view);
  56106. }
  56107. else if (viewState & 64 /* CheckProjectedViews */) {
  56108. execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
  56109. }
  56110. }
  56111. break;
  56112. case ViewAction.CheckNoChangesProjectedViews:
  56113. if ((viewState & 128 /* Destroyed */) === 0) {
  56114. if (viewState & 32 /* CheckProjectedView */) {
  56115. checkNoChangesView(view);
  56116. }
  56117. else if (viewState & 64 /* CheckProjectedViews */) {
  56118. execProjectedViewsAction(view, action);
  56119. }
  56120. }
  56121. break;
  56122. case ViewAction.CheckAndUpdate:
  56123. if ((viewState & 128 /* Destroyed */) === 0) {
  56124. if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
  56125. checkAndUpdateView(view);
  56126. }
  56127. else if (viewState & 64 /* CheckProjectedViews */) {
  56128. execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
  56129. }
  56130. }
  56131. break;
  56132. case ViewAction.CheckAndUpdateProjectedViews:
  56133. if ((viewState & 128 /* Destroyed */) === 0) {
  56134. if (viewState & 32 /* CheckProjectedView */) {
  56135. checkAndUpdateView(view);
  56136. }
  56137. else if (viewState & 64 /* CheckProjectedViews */) {
  56138. execProjectedViewsAction(view, action);
  56139. }
  56140. }
  56141. break;
  56142. case ViewAction.Destroy:
  56143. // Note: destroyView recurses over all views,
  56144. // so we don't need to special case projected views here.
  56145. destroyView(view);
  56146. break;
  56147. case ViewAction.CreateViewNodes:
  56148. createViewNodes(view);
  56149. break;
  56150. }
  56151. }
  56152. /**
  56153. * @param {?} view
  56154. * @param {?} action
  56155. * @return {?}
  56156. */
  56157. function execProjectedViewsAction(view, action) {
  56158. execEmbeddedViewsAction(view, action);
  56159. execComponentViewsAction(view, action);
  56160. }
  56161. /**
  56162. * @param {?} view
  56163. * @param {?} queryFlags
  56164. * @param {?} staticDynamicQueryFlag
  56165. * @param {?} checkType
  56166. * @return {?}
  56167. */
  56168. function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
  56169. if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
  56170. return;
  56171. }
  56172. var /** @type {?} */ nodeCount = view.def.nodes.length;
  56173. for (var /** @type {?} */ i = 0; i < nodeCount; i++) {
  56174. var /** @type {?} */ nodeDef = view.def.nodes[i];
  56175. if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
  56176. Services.setCurrentNode(view, nodeDef.nodeIndex);
  56177. switch (checkType) {
  56178. case 0 /* CheckAndUpdate */:
  56179. checkAndUpdateQuery(view, nodeDef);
  56180. break;
  56181. case 1 /* CheckNoChanges */:
  56182. checkNoChangesQuery(view, nodeDef);
  56183. break;
  56184. }
  56185. }
  56186. if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
  56187. // no child has a matching query
  56188. // then skip the children
  56189. i += nodeDef.childCount;
  56190. }
  56191. }
  56192. }
  56193. /**
  56194. * @fileoverview added by tsickle
  56195. * @suppress {checkTypes} checked by tsc
  56196. */
  56197. /**
  56198. * @license
  56199. * Copyright Google Inc. All Rights Reserved.
  56200. *
  56201. * Use of this source code is governed by an MIT-style license that can be
  56202. * found in the LICENSE file at https://angular.io/license
  56203. */
  56204. var initialized = false;
  56205. /**
  56206. * @return {?}
  56207. */
  56208. function initServicesIfNeeded() {
  56209. if (initialized) {
  56210. return;
  56211. }
  56212. initialized = true;
  56213. var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices();
  56214. Services.setCurrentNode = services.setCurrentNode;
  56215. Services.createRootView = services.createRootView;
  56216. Services.createEmbeddedView = services.createEmbeddedView;
  56217. Services.createComponentView = services.createComponentView;
  56218. Services.createNgModuleRef = services.createNgModuleRef;
  56219. Services.overrideProvider = services.overrideProvider;
  56220. Services.overrideComponentView = services.overrideComponentView;
  56221. Services.clearOverrides = services.clearOverrides;
  56222. Services.checkAndUpdateView = services.checkAndUpdateView;
  56223. Services.checkNoChangesView = services.checkNoChangesView;
  56224. Services.destroyView = services.destroyView;
  56225. Services.resolveDep = resolveDep;
  56226. Services.createDebugContext = services.createDebugContext;
  56227. Services.handleEvent = services.handleEvent;
  56228. Services.updateDirectives = services.updateDirectives;
  56229. Services.updateRenderer = services.updateRenderer;
  56230. Services.dirtyParentQueries = dirtyParentQueries;
  56231. }
  56232. /**
  56233. * @return {?}
  56234. */
  56235. function createProdServices() {
  56236. return {
  56237. setCurrentNode: function () { },
  56238. createRootView: createProdRootView,
  56239. createEmbeddedView: createEmbeddedView,
  56240. createComponentView: createComponentView,
  56241. createNgModuleRef: createNgModuleRef,
  56242. overrideProvider: NOOP,
  56243. overrideComponentView: NOOP,
  56244. clearOverrides: NOOP,
  56245. checkAndUpdateView: checkAndUpdateView,
  56246. checkNoChangesView: checkNoChangesView,
  56247. destroyView: destroyView,
  56248. createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
  56249. handleEvent: function (view, nodeIndex, eventName, event) {
  56250. return view.def.handleEvent(view, nodeIndex, eventName, event);
  56251. },
  56252. updateDirectives: function (view, checkType) {
  56253. return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
  56254. prodCheckNoChangesNode, view);
  56255. },
  56256. updateRenderer: function (view, checkType) {
  56257. return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
  56258. prodCheckNoChangesNode, view);
  56259. },
  56260. };
  56261. }
  56262. /**
  56263. * @return {?}
  56264. */
  56265. function createDebugServices() {
  56266. return {
  56267. setCurrentNode: debugSetCurrentNode,
  56268. createRootView: debugCreateRootView,
  56269. createEmbeddedView: debugCreateEmbeddedView,
  56270. createComponentView: debugCreateComponentView,
  56271. createNgModuleRef: debugCreateNgModuleRef,
  56272. overrideProvider: debugOverrideProvider,
  56273. overrideComponentView: debugOverrideComponentView,
  56274. clearOverrides: debugClearOverrides,
  56275. checkAndUpdateView: debugCheckAndUpdateView,
  56276. checkNoChangesView: debugCheckNoChangesView,
  56277. destroyView: debugDestroyView,
  56278. createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
  56279. handleEvent: debugHandleEvent,
  56280. updateDirectives: debugUpdateDirectives,
  56281. updateRenderer: debugUpdateRenderer,
  56282. };
  56283. }
  56284. /**
  56285. * @param {?} elInjector
  56286. * @param {?} projectableNodes
  56287. * @param {?} rootSelectorOrNode
  56288. * @param {?} def
  56289. * @param {?} ngModule
  56290. * @param {?=} context
  56291. * @return {?}
  56292. */
  56293. function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
  56294. var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
  56295. return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
  56296. }
  56297. /**
  56298. * @param {?} elInjector
  56299. * @param {?} projectableNodes
  56300. * @param {?} rootSelectorOrNode
  56301. * @param {?} def
  56302. * @param {?} ngModule
  56303. * @param {?=} context
  56304. * @return {?}
  56305. */
  56306. function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
  56307. var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
  56308. var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
  56309. var /** @type {?} */ defWithOverride = applyProviderOverridesToView(def);
  56310. return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
  56311. }
  56312. /**
  56313. * @param {?} elInjector
  56314. * @param {?} ngModule
  56315. * @param {?} rendererFactory
  56316. * @param {?} projectableNodes
  56317. * @param {?} rootSelectorOrNode
  56318. * @return {?}
  56319. */
  56320. function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
  56321. var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer);
  56322. var /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler);
  56323. var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null);
  56324. return {
  56325. ngModule: ngModule,
  56326. injector: elInjector, projectableNodes: projectableNodes,
  56327. selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
  56328. };
  56329. }
  56330. /**
  56331. * @param {?} parentView
  56332. * @param {?} anchorDef
  56333. * @param {?} viewDef
  56334. * @param {?=} context
  56335. * @return {?}
  56336. */
  56337. function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
  56338. var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
  56339. return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
  56340. }
  56341. /**
  56342. * @param {?} parentView
  56343. * @param {?} nodeDef
  56344. * @param {?} viewDef
  56345. * @param {?} hostElement
  56346. * @return {?}
  56347. */
  56348. function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
  56349. var /** @type {?} */ overrideComponentView = viewDefOverrides.get(/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentProvider)).provider)).token);
  56350. if (overrideComponentView) {
  56351. viewDef$$1 = overrideComponentView;
  56352. }
  56353. else {
  56354. viewDef$$1 = applyProviderOverridesToView(viewDef$$1);
  56355. }
  56356. return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef$$1, hostElement]);
  56357. }
  56358. /**
  56359. * @param {?} moduleType
  56360. * @param {?} parentInjector
  56361. * @param {?} bootstrapComponents
  56362. * @param {?} def
  56363. * @return {?}
  56364. */
  56365. function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
  56366. var /** @type {?} */ defWithOverride = applyProviderOverridesToNgModule(def);
  56367. return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
  56368. }
  56369. var providerOverrides = new Map();
  56370. var viewDefOverrides = new Map();
  56371. /**
  56372. * @param {?} override
  56373. * @return {?}
  56374. */
  56375. function debugOverrideProvider(override) {
  56376. providerOverrides.set(override.token, override);
  56377. }
  56378. /**
  56379. * @param {?} comp
  56380. * @param {?} compFactory
  56381. * @return {?}
  56382. */
  56383. function debugOverrideComponentView(comp, compFactory) {
  56384. var /** @type {?} */ hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory));
  56385. var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((hostViewDef.nodes[0].element)).componentView)));
  56386. viewDefOverrides.set(comp, compViewDef);
  56387. }
  56388. /**
  56389. * @return {?}
  56390. */
  56391. function debugClearOverrides() {
  56392. providerOverrides.clear();
  56393. viewDefOverrides.clear();
  56394. }
  56395. /**
  56396. * @param {?} def
  56397. * @return {?}
  56398. */
  56399. function applyProviderOverridesToView(def) {
  56400. if (providerOverrides.size === 0) {
  56401. return def;
  56402. }
  56403. var /** @type {?} */ elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
  56404. if (elementIndicesWithOverwrittenProviders.length === 0) {
  56405. return def;
  56406. }
  56407. // clone the whole view definition,
  56408. // as it maintains references between the nodes that are hard to update.
  56409. def = /** @type {?} */ ((def.factory))(function () { return NOOP; });
  56410. for (var /** @type {?} */ i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
  56411. applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
  56412. }
  56413. return def;
  56414. /**
  56415. * @param {?} def
  56416. * @return {?}
  56417. */
  56418. function findElementIndicesWithOverwrittenProviders(def) {
  56419. var /** @type {?} */ elIndicesWithOverwrittenProviders = [];
  56420. var /** @type {?} */ lastElementDef = null;
  56421. for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
  56422. var /** @type {?} */ nodeDef = def.nodes[i];
  56423. if (nodeDef.flags & 1 /* TypeElement */) {
  56424. lastElementDef = nodeDef;
  56425. }
  56426. if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ &&
  56427. providerOverrides.has(/** @type {?} */ ((nodeDef.provider)).token)) {
  56428. elIndicesWithOverwrittenProviders.push(/** @type {?} */ ((lastElementDef)).nodeIndex);
  56429. lastElementDef = null;
  56430. }
  56431. }
  56432. return elIndicesWithOverwrittenProviders;
  56433. }
  56434. /**
  56435. * @param {?} viewDef
  56436. * @param {?} elIndex
  56437. * @return {?}
  56438. */
  56439. function applyProviderOverridesToElement(viewDef$$1, elIndex) {
  56440. for (var /** @type {?} */ i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
  56441. var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
  56442. if (nodeDef.flags & 1 /* TypeElement */) {
  56443. // stop at the next element
  56444. return;
  56445. }
  56446. if (nodeDef.flags & 3840 /* CatProviderNoDirective */) {
  56447. var /** @type {?} */ provider = /** @type {?} */ ((nodeDef.provider));
  56448. var /** @type {?} */ override = providerOverrides.get(provider.token);
  56449. if (override) {
  56450. nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
  56451. provider.deps = splitDepsDsl(override.deps);
  56452. provider.value = override.value;
  56453. }
  56454. }
  56455. }
  56456. }
  56457. }
  56458. /**
  56459. * @param {?} def
  56460. * @return {?}
  56461. */
  56462. function applyProviderOverridesToNgModule(def) {
  56463. var _a = calcHasOverrides(def), hasOverrides = _a.hasOverrides, hasDeprecatedOverrides = _a.hasDeprecatedOverrides;
  56464. if (!hasOverrides) {
  56465. return def;
  56466. }
  56467. // clone the whole view definition,
  56468. // as it maintains references between the nodes that are hard to update.
  56469. def = /** @type {?} */ ((def.factory))(function () { return NOOP; });
  56470. applyProviderOverrides(def);
  56471. return def;
  56472. /**
  56473. * @param {?} def
  56474. * @return {?}
  56475. */
  56476. function calcHasOverrides(def) {
  56477. var /** @type {?} */ hasOverrides = false;
  56478. var /** @type {?} */ hasDeprecatedOverrides = false;
  56479. if (providerOverrides.size === 0) {
  56480. return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
  56481. }
  56482. def.providers.forEach(function (node) {
  56483. var /** @type {?} */ override = providerOverrides.get(node.token);
  56484. if ((node.flags & 3840 /* CatProviderNoDirective */) && override) {
  56485. hasOverrides = true;
  56486. hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
  56487. }
  56488. });
  56489. return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
  56490. }
  56491. /**
  56492. * @param {?} def
  56493. * @return {?}
  56494. */
  56495. function applyProviderOverrides(def) {
  56496. for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
  56497. var /** @type {?} */ provider = def.providers[i];
  56498. if (hasDeprecatedOverrides) {
  56499. // We had a bug where me made
  56500. // all providers lazy. Keep this logic behind a flag
  56501. // for migrating existing users.
  56502. provider.flags |= 4096 /* LazyProvider */;
  56503. }
  56504. var /** @type {?} */ override = providerOverrides.get(provider.token);
  56505. if (override) {
  56506. provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
  56507. provider.deps = splitDepsDsl(override.deps);
  56508. provider.value = override.value;
  56509. }
  56510. }
  56511. }
  56512. }
  56513. /**
  56514. * @param {?} view
  56515. * @param {?} checkIndex
  56516. * @param {?} argStyle
  56517. * @param {?=} v0
  56518. * @param {?=} v1
  56519. * @param {?=} v2
  56520. * @param {?=} v3
  56521. * @param {?=} v4
  56522. * @param {?=} v5
  56523. * @param {?=} v6
  56524. * @param {?=} v7
  56525. * @param {?=} v8
  56526. * @param {?=} v9
  56527. * @return {?}
  56528. */
  56529. function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  56530. var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
  56531. checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  56532. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  56533. asPureExpressionData(view, checkIndex).value :
  56534. undefined;
  56535. }
  56536. /**
  56537. * @param {?} view
  56538. * @param {?} checkIndex
  56539. * @param {?} argStyle
  56540. * @param {?=} v0
  56541. * @param {?=} v1
  56542. * @param {?=} v2
  56543. * @param {?=} v3
  56544. * @param {?=} v4
  56545. * @param {?=} v5
  56546. * @param {?=} v6
  56547. * @param {?=} v7
  56548. * @param {?=} v8
  56549. * @param {?=} v9
  56550. * @return {?}
  56551. */
  56552. function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  56553. var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
  56554. checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  56555. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  56556. asPureExpressionData(view, checkIndex).value :
  56557. undefined;
  56558. }
  56559. /**
  56560. * @param {?} view
  56561. * @return {?}
  56562. */
  56563. function debugCheckAndUpdateView(view) {
  56564. return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
  56565. }
  56566. /**
  56567. * @param {?} view
  56568. * @return {?}
  56569. */
  56570. function debugCheckNoChangesView(view) {
  56571. return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
  56572. }
  56573. /**
  56574. * @param {?} view
  56575. * @return {?}
  56576. */
  56577. function debugDestroyView(view) {
  56578. return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
  56579. }
  56580. /** @enum {number} */
  56581. var DebugAction = {
  56582. create: 0,
  56583. detectChanges: 1,
  56584. checkNoChanges: 2,
  56585. destroy: 3,
  56586. handleEvent: 4,
  56587. };
  56588. DebugAction[DebugAction.create] = "create";
  56589. DebugAction[DebugAction.detectChanges] = "detectChanges";
  56590. DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
  56591. DebugAction[DebugAction.destroy] = "destroy";
  56592. DebugAction[DebugAction.handleEvent] = "handleEvent";
  56593. var _currentAction;
  56594. var _currentView;
  56595. var _currentNodeIndex;
  56596. /**
  56597. * @param {?} view
  56598. * @param {?} nodeIndex
  56599. * @return {?}
  56600. */
  56601. function debugSetCurrentNode(view, nodeIndex) {
  56602. _currentView = view;
  56603. _currentNodeIndex = nodeIndex;
  56604. }
  56605. /**
  56606. * @param {?} view
  56607. * @param {?} nodeIndex
  56608. * @param {?} eventName
  56609. * @param {?} event
  56610. * @return {?}
  56611. */
  56612. function debugHandleEvent(view, nodeIndex, eventName, event) {
  56613. debugSetCurrentNode(view, nodeIndex);
  56614. return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
  56615. }
  56616. /**
  56617. * @param {?} view
  56618. * @param {?} checkType
  56619. * @return {?}
  56620. */
  56621. function debugUpdateDirectives(view, checkType) {
  56622. if (view.state & 128 /* Destroyed */) {
  56623. throw viewDestroyedError(DebugAction[_currentAction]);
  56624. }
  56625. debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
  56626. return view.def.updateDirectives(debugCheckDirectivesFn, view);
  56627. /**
  56628. * @param {?} view
  56629. * @param {?} nodeIndex
  56630. * @param {?} argStyle
  56631. * @param {...?} values
  56632. * @return {?}
  56633. */
  56634. function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
  56635. var values = [];
  56636. for (var _i = 3; _i < arguments.length; _i++) {
  56637. values[_i - 3] = arguments[_i];
  56638. }
  56639. var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
  56640. if (checkType === 0 /* CheckAndUpdate */) {
  56641. debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
  56642. }
  56643. else {
  56644. debugCheckNoChangesNode(view, nodeDef, argStyle, values);
  56645. }
  56646. if (nodeDef.flags & 16384 /* TypeDirective */) {
  56647. debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
  56648. }
  56649. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  56650. asPureExpressionData(view, nodeDef.nodeIndex).value :
  56651. undefined;
  56652. }
  56653. }
  56654. /**
  56655. * @param {?} view
  56656. * @param {?} checkType
  56657. * @return {?}
  56658. */
  56659. function debugUpdateRenderer(view, checkType) {
  56660. if (view.state & 128 /* Destroyed */) {
  56661. throw viewDestroyedError(DebugAction[_currentAction]);
  56662. }
  56663. debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
  56664. return view.def.updateRenderer(debugCheckRenderNodeFn, view);
  56665. /**
  56666. * @param {?} view
  56667. * @param {?} nodeIndex
  56668. * @param {?} argStyle
  56669. * @param {...?} values
  56670. * @return {?}
  56671. */
  56672. function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
  56673. var values = [];
  56674. for (var _i = 3; _i < arguments.length; _i++) {
  56675. values[_i - 3] = arguments[_i];
  56676. }
  56677. var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
  56678. if (checkType === 0 /* CheckAndUpdate */) {
  56679. debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
  56680. }
  56681. else {
  56682. debugCheckNoChangesNode(view, nodeDef, argStyle, values);
  56683. }
  56684. if (nodeDef.flags & 3 /* CatRenderNode */) {
  56685. debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
  56686. }
  56687. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  56688. asPureExpressionData(view, nodeDef.nodeIndex).value :
  56689. undefined;
  56690. }
  56691. }
  56692. /**
  56693. * @param {?} view
  56694. * @param {?} nodeDef
  56695. * @param {?} argStyle
  56696. * @param {?} givenValues
  56697. * @return {?}
  56698. */
  56699. function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
  56700. var /** @type {?} */ changed = (/** @type {?} */ (checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
  56701. if (changed) {
  56702. var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
  56703. if (nodeDef.flags & 16384 /* TypeDirective */) {
  56704. var /** @type {?} */ bindingValues = {};
  56705. for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) {
  56706. var /** @type {?} */ binding = nodeDef.bindings[i];
  56707. var /** @type {?} */ value = values[i];
  56708. if (binding.flags & 8 /* TypeProperty */) {
  56709. bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] =
  56710. normalizeDebugBindingValue(value);
  56711. }
  56712. }
  56713. var /** @type {?} */ elDef = /** @type {?} */ ((nodeDef.parent));
  56714. var /** @type {?} */ el = asElementData(view, elDef.nodeIndex).renderElement;
  56715. if (!/** @type {?} */ ((elDef.element)).name) {
  56716. // a comment.
  56717. view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
  56718. }
  56719. else {
  56720. // a regular element.
  56721. for (var /** @type {?} */ attr in bindingValues) {
  56722. var /** @type {?} */ value = bindingValues[attr];
  56723. if (value != null) {
  56724. view.renderer.setAttribute(el, attr, value);
  56725. }
  56726. else {
  56727. view.renderer.removeAttribute(el, attr);
  56728. }
  56729. }
  56730. }
  56731. }
  56732. }
  56733. }
  56734. /**
  56735. * @param {?} view
  56736. * @param {?} nodeDef
  56737. * @param {?} argStyle
  56738. * @param {?} values
  56739. * @return {?}
  56740. */
  56741. function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
  56742. (/** @type {?} */ (checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
  56743. }
  56744. /**
  56745. * @param {?} name
  56746. * @return {?}
  56747. */
  56748. function normalizeDebugBindingName(name) {
  56749. // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
  56750. name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
  56751. return "ng-reflect-" + name;
  56752. }
  56753. var CAMEL_CASE_REGEXP = /([A-Z])/g;
  56754. /**
  56755. * @param {?} input
  56756. * @return {?}
  56757. */
  56758. function camelCaseToDashCase(input) {
  56759. return input.replace(CAMEL_CASE_REGEXP, function () {
  56760. var m = [];
  56761. for (var _i = 0; _i < arguments.length; _i++) {
  56762. m[_i] = arguments[_i];
  56763. }
  56764. return '-' + m[1].toLowerCase();
  56765. });
  56766. }
  56767. /**
  56768. * @param {?} value
  56769. * @return {?}
  56770. */
  56771. function normalizeDebugBindingValue(value) {
  56772. try {
  56773. // Limit the size of the value as otherwise the DOM just gets polluted.
  56774. return value != null ? value.toString().slice(0, 30) : value;
  56775. }
  56776. catch (/** @type {?} */ e) {
  56777. return '[ERROR] Exception while trying to serialize the value';
  56778. }
  56779. }
  56780. /**
  56781. * @param {?} view
  56782. * @param {?} nodeIndex
  56783. * @return {?}
  56784. */
  56785. function nextDirectiveWithBinding(view, nodeIndex) {
  56786. for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
  56787. var /** @type {?} */ nodeDef = view.def.nodes[i];
  56788. if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) {
  56789. return i;
  56790. }
  56791. }
  56792. return null;
  56793. }
  56794. /**
  56795. * @param {?} view
  56796. * @param {?} nodeIndex
  56797. * @return {?}
  56798. */
  56799. function nextRenderNodeWithBinding(view, nodeIndex) {
  56800. for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
  56801. var /** @type {?} */ nodeDef = view.def.nodes[i];
  56802. if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) {
  56803. return i;
  56804. }
  56805. }
  56806. return null;
  56807. }
  56808. var DebugContext_ = /** @class */ (function () {
  56809. function DebugContext_(view, nodeIndex) {
  56810. this.view = view;
  56811. this.nodeIndex = nodeIndex;
  56812. if (nodeIndex == null) {
  56813. this.nodeIndex = nodeIndex = 0;
  56814. }
  56815. this.nodeDef = view.def.nodes[nodeIndex];
  56816. var /** @type {?} */ elDef = this.nodeDef;
  56817. var /** @type {?} */ elView = view;
  56818. while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) {
  56819. elDef = /** @type {?} */ ((elDef.parent));
  56820. }
  56821. if (!elDef) {
  56822. while (!elDef && elView) {
  56823. elDef = /** @type {?} */ ((viewParentEl(elView)));
  56824. elView = /** @type {?} */ ((elView.parent));
  56825. }
  56826. }
  56827. this.elDef = elDef;
  56828. this.elView = elView;
  56829. }
  56830. Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
  56831. get: /**
  56832. * @return {?}
  56833. */
  56834. function () {
  56835. // Has to be done lazily as we use the DebugContext also during creation of elements...
  56836. return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
  56837. },
  56838. enumerable: true,
  56839. configurable: true
  56840. });
  56841. Object.defineProperty(DebugContext_.prototype, "injector", {
  56842. get: /**
  56843. * @return {?}
  56844. */
  56845. function () { return createInjector(this.elView, this.elDef); },
  56846. enumerable: true,
  56847. configurable: true
  56848. });
  56849. Object.defineProperty(DebugContext_.prototype, "component", {
  56850. get: /**
  56851. * @return {?}
  56852. */
  56853. function () { return this.elOrCompView.component; },
  56854. enumerable: true,
  56855. configurable: true
  56856. });
  56857. Object.defineProperty(DebugContext_.prototype, "context", {
  56858. get: /**
  56859. * @return {?}
  56860. */
  56861. function () { return this.elOrCompView.context; },
  56862. enumerable: true,
  56863. configurable: true
  56864. });
  56865. Object.defineProperty(DebugContext_.prototype, "providerTokens", {
  56866. get: /**
  56867. * @return {?}
  56868. */
  56869. function () {
  56870. var /** @type {?} */ tokens = [];
  56871. if (this.elDef) {
  56872. for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
  56873. var /** @type {?} */ childDef = this.elView.def.nodes[i];
  56874. if (childDef.flags & 20224 /* CatProvider */) {
  56875. tokens.push(/** @type {?} */ ((childDef.provider)).token);
  56876. }
  56877. i += childDef.childCount;
  56878. }
  56879. }
  56880. return tokens;
  56881. },
  56882. enumerable: true,
  56883. configurable: true
  56884. });
  56885. Object.defineProperty(DebugContext_.prototype, "references", {
  56886. get: /**
  56887. * @return {?}
  56888. */
  56889. function () {
  56890. var /** @type {?} */ references = {};
  56891. if (this.elDef) {
  56892. collectReferences(this.elView, this.elDef, references);
  56893. for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
  56894. var /** @type {?} */ childDef = this.elView.def.nodes[i];
  56895. if (childDef.flags & 20224 /* CatProvider */) {
  56896. collectReferences(this.elView, childDef, references);
  56897. }
  56898. i += childDef.childCount;
  56899. }
  56900. }
  56901. return references;
  56902. },
  56903. enumerable: true,
  56904. configurable: true
  56905. });
  56906. Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
  56907. get: /**
  56908. * @return {?}
  56909. */
  56910. function () {
  56911. var /** @type {?} */ elData = findHostElement(this.elOrCompView);
  56912. return elData ? elData.renderElement : undefined;
  56913. },
  56914. enumerable: true,
  56915. configurable: true
  56916. });
  56917. Object.defineProperty(DebugContext_.prototype, "renderNode", {
  56918. get: /**
  56919. * @return {?}
  56920. */
  56921. function () {
  56922. return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) :
  56923. renderNode(this.elView, this.elDef);
  56924. },
  56925. enumerable: true,
  56926. configurable: true
  56927. });
  56928. /**
  56929. * @param {?} console
  56930. * @param {...?} values
  56931. * @return {?}
  56932. */
  56933. DebugContext_.prototype.logError = /**
  56934. * @param {?} console
  56935. * @param {...?} values
  56936. * @return {?}
  56937. */
  56938. function (console) {
  56939. var values = [];
  56940. for (var _i = 1; _i < arguments.length; _i++) {
  56941. values[_i - 1] = arguments[_i];
  56942. }
  56943. var /** @type {?} */ logViewDef;
  56944. var /** @type {?} */ logNodeIndex;
  56945. if (this.nodeDef.flags & 2 /* TypeText */) {
  56946. logViewDef = this.view.def;
  56947. logNodeIndex = this.nodeDef.nodeIndex;
  56948. }
  56949. else {
  56950. logViewDef = this.elView.def;
  56951. logNodeIndex = this.elDef.nodeIndex;
  56952. }
  56953. // Note: we only generate a log function for text and element nodes
  56954. // to make the generated code as small as possible.
  56955. var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
  56956. var /** @type {?} */ currRenderNodeIndex = -1;
  56957. var /** @type {?} */ nodeLogger = function () {
  56958. currRenderNodeIndex++;
  56959. if (currRenderNodeIndex === renderNodeIndex) {
  56960. return (_a = console.error).bind.apply(_a, [console].concat(values));
  56961. }
  56962. else {
  56963. return NOOP;
  56964. }
  56965. var _a;
  56966. }; /** @type {?} */
  56967. ((logViewDef.factory))(nodeLogger);
  56968. if (currRenderNodeIndex < renderNodeIndex) {
  56969. console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
  56970. console.error.apply(console, values);
  56971. }
  56972. };
  56973. return DebugContext_;
  56974. }());
  56975. /**
  56976. * @param {?} viewDef
  56977. * @param {?} nodeIndex
  56978. * @return {?}
  56979. */
  56980. function getRenderNodeIndex(viewDef$$1, nodeIndex) {
  56981. var /** @type {?} */ renderNodeIndex = -1;
  56982. for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) {
  56983. var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
  56984. if (nodeDef.flags & 3 /* CatRenderNode */) {
  56985. renderNodeIndex++;
  56986. }
  56987. }
  56988. return renderNodeIndex;
  56989. }
  56990. /**
  56991. * @param {?} view
  56992. * @return {?}
  56993. */
  56994. function findHostElement(view) {
  56995. while (view && !isComponentView(view)) {
  56996. view = /** @type {?} */ ((view.parent));
  56997. }
  56998. if (view.parent) {
  56999. return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).nodeIndex);
  57000. }
  57001. return null;
  57002. }
  57003. /**
  57004. * @param {?} view
  57005. * @param {?} nodeDef
  57006. * @param {?} references
  57007. * @return {?}
  57008. */
  57009. function collectReferences(view, nodeDef, references) {
  57010. for (var /** @type {?} */ refName in nodeDef.references) {
  57011. references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
  57012. }
  57013. }
  57014. /**
  57015. * @param {?} action
  57016. * @param {?} fn
  57017. * @param {?} self
  57018. * @param {?} args
  57019. * @return {?}
  57020. */
  57021. function callWithDebugContext(action, fn, self, args) {
  57022. var /** @type {?} */ oldAction = _currentAction;
  57023. var /** @type {?} */ oldView = _currentView;
  57024. var /** @type {?} */ oldNodeIndex = _currentNodeIndex;
  57025. try {
  57026. _currentAction = action;
  57027. var /** @type {?} */ result = fn.apply(self, args);
  57028. _currentView = oldView;
  57029. _currentNodeIndex = oldNodeIndex;
  57030. _currentAction = oldAction;
  57031. return result;
  57032. }
  57033. catch (/** @type {?} */ e) {
  57034. if (isViewDebugError(e) || !_currentView) {
  57035. throw e;
  57036. }
  57037. throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext())));
  57038. }
  57039. }
  57040. /**
  57041. * @return {?}
  57042. */
  57043. function getCurrentDebugContext() {
  57044. return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
  57045. }
  57046. var DebugRendererFactory2 = /** @class */ (function () {
  57047. function DebugRendererFactory2(delegate) {
  57048. this.delegate = delegate;
  57049. }
  57050. /**
  57051. * @param {?} element
  57052. * @param {?} renderData
  57053. * @return {?}
  57054. */
  57055. DebugRendererFactory2.prototype.createRenderer = /**
  57056. * @param {?} element
  57057. * @param {?} renderData
  57058. * @return {?}
  57059. */
  57060. function (element, renderData) {
  57061. return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
  57062. };
  57063. /**
  57064. * @return {?}
  57065. */
  57066. DebugRendererFactory2.prototype.begin = /**
  57067. * @return {?}
  57068. */
  57069. function () {
  57070. if (this.delegate.begin) {
  57071. this.delegate.begin();
  57072. }
  57073. };
  57074. /**
  57075. * @return {?}
  57076. */
  57077. DebugRendererFactory2.prototype.end = /**
  57078. * @return {?}
  57079. */
  57080. function () {
  57081. if (this.delegate.end) {
  57082. this.delegate.end();
  57083. }
  57084. };
  57085. /**
  57086. * @return {?}
  57087. */
  57088. DebugRendererFactory2.prototype.whenRenderingDone = /**
  57089. * @return {?}
  57090. */
  57091. function () {
  57092. if (this.delegate.whenRenderingDone) {
  57093. return this.delegate.whenRenderingDone();
  57094. }
  57095. return Promise.resolve(null);
  57096. };
  57097. return DebugRendererFactory2;
  57098. }());
  57099. var DebugRenderer2 = /** @class */ (function () {
  57100. function DebugRenderer2(delegate) {
  57101. this.delegate = delegate;
  57102. this.data = this.delegate.data;
  57103. }
  57104. /**
  57105. * @param {?} node
  57106. * @return {?}
  57107. */
  57108. DebugRenderer2.prototype.destroyNode = /**
  57109. * @param {?} node
  57110. * @return {?}
  57111. */
  57112. function (node) {
  57113. removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node))));
  57114. if (this.delegate.destroyNode) {
  57115. this.delegate.destroyNode(node);
  57116. }
  57117. };
  57118. /**
  57119. * @return {?}
  57120. */
  57121. DebugRenderer2.prototype.destroy = /**
  57122. * @return {?}
  57123. */
  57124. function () { this.delegate.destroy(); };
  57125. /**
  57126. * @param {?} name
  57127. * @param {?=} namespace
  57128. * @return {?}
  57129. */
  57130. DebugRenderer2.prototype.createElement = /**
  57131. * @param {?} name
  57132. * @param {?=} namespace
  57133. * @return {?}
  57134. */
  57135. function (name, namespace) {
  57136. var /** @type {?} */ el = this.delegate.createElement(name, namespace);
  57137. var /** @type {?} */ debugCtx = getCurrentDebugContext();
  57138. if (debugCtx) {
  57139. var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx);
  57140. debugEl.name = name;
  57141. indexDebugNode(debugEl);
  57142. }
  57143. return el;
  57144. };
  57145. /**
  57146. * @param {?} value
  57147. * @return {?}
  57148. */
  57149. DebugRenderer2.prototype.createComment = /**
  57150. * @param {?} value
  57151. * @return {?}
  57152. */
  57153. function (value) {
  57154. var /** @type {?} */ comment = this.delegate.createComment(value);
  57155. var /** @type {?} */ debugCtx = getCurrentDebugContext();
  57156. if (debugCtx) {
  57157. indexDebugNode(new DebugNode(comment, null, debugCtx));
  57158. }
  57159. return comment;
  57160. };
  57161. /**
  57162. * @param {?} value
  57163. * @return {?}
  57164. */
  57165. DebugRenderer2.prototype.createText = /**
  57166. * @param {?} value
  57167. * @return {?}
  57168. */
  57169. function (value) {
  57170. var /** @type {?} */ text = this.delegate.createText(value);
  57171. var /** @type {?} */ debugCtx = getCurrentDebugContext();
  57172. if (debugCtx) {
  57173. indexDebugNode(new DebugNode(text, null, debugCtx));
  57174. }
  57175. return text;
  57176. };
  57177. /**
  57178. * @param {?} parent
  57179. * @param {?} newChild
  57180. * @return {?}
  57181. */
  57182. DebugRenderer2.prototype.appendChild = /**
  57183. * @param {?} parent
  57184. * @param {?} newChild
  57185. * @return {?}
  57186. */
  57187. function (parent, newChild) {
  57188. var /** @type {?} */ debugEl = getDebugNode(parent);
  57189. var /** @type {?} */ debugChildEl = getDebugNode(newChild);
  57190. if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
  57191. debugEl.addChild(debugChildEl);
  57192. }
  57193. this.delegate.appendChild(parent, newChild);
  57194. };
  57195. /**
  57196. * @param {?} parent
  57197. * @param {?} newChild
  57198. * @param {?} refChild
  57199. * @return {?}
  57200. */
  57201. DebugRenderer2.prototype.insertBefore = /**
  57202. * @param {?} parent
  57203. * @param {?} newChild
  57204. * @param {?} refChild
  57205. * @return {?}
  57206. */
  57207. function (parent, newChild, refChild) {
  57208. var /** @type {?} */ debugEl = getDebugNode(parent);
  57209. var /** @type {?} */ debugChildEl = getDebugNode(newChild);
  57210. var /** @type {?} */ debugRefEl = /** @type {?} */ ((getDebugNode(refChild)));
  57211. if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
  57212. debugEl.insertBefore(debugRefEl, debugChildEl);
  57213. }
  57214. this.delegate.insertBefore(parent, newChild, refChild);
  57215. };
  57216. /**
  57217. * @param {?} parent
  57218. * @param {?} oldChild
  57219. * @return {?}
  57220. */
  57221. DebugRenderer2.prototype.removeChild = /**
  57222. * @param {?} parent
  57223. * @param {?} oldChild
  57224. * @return {?}
  57225. */
  57226. function (parent, oldChild) {
  57227. var /** @type {?} */ debugEl = getDebugNode(parent);
  57228. var /** @type {?} */ debugChildEl = getDebugNode(oldChild);
  57229. if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
  57230. debugEl.removeChild(debugChildEl);
  57231. }
  57232. this.delegate.removeChild(parent, oldChild);
  57233. };
  57234. /**
  57235. * @param {?} selectorOrNode
  57236. * @return {?}
  57237. */
  57238. DebugRenderer2.prototype.selectRootElement = /**
  57239. * @param {?} selectorOrNode
  57240. * @return {?}
  57241. */
  57242. function (selectorOrNode) {
  57243. var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode);
  57244. var /** @type {?} */ debugCtx = getCurrentDebugContext();
  57245. if (debugCtx) {
  57246. indexDebugNode(new DebugElement(el, null, debugCtx));
  57247. }
  57248. return el;
  57249. };
  57250. /**
  57251. * @param {?} el
  57252. * @param {?} name
  57253. * @param {?} value
  57254. * @param {?=} namespace
  57255. * @return {?}
  57256. */
  57257. DebugRenderer2.prototype.setAttribute = /**
  57258. * @param {?} el
  57259. * @param {?} name
  57260. * @param {?} value
  57261. * @param {?=} namespace
  57262. * @return {?}
  57263. */
  57264. function (el, name, value, namespace) {
  57265. var /** @type {?} */ debugEl = getDebugNode(el);
  57266. if (debugEl && debugEl instanceof DebugElement) {
  57267. var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
  57268. debugEl.attributes[fullName] = value;
  57269. }
  57270. this.delegate.setAttribute(el, name, value, namespace);
  57271. };
  57272. /**
  57273. * @param {?} el
  57274. * @param {?} name
  57275. * @param {?=} namespace
  57276. * @return {?}
  57277. */
  57278. DebugRenderer2.prototype.removeAttribute = /**
  57279. * @param {?} el
  57280. * @param {?} name
  57281. * @param {?=} namespace
  57282. * @return {?}
  57283. */
  57284. function (el, name, namespace) {
  57285. var /** @type {?} */ debugEl = getDebugNode(el);
  57286. if (debugEl && debugEl instanceof DebugElement) {
  57287. var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
  57288. debugEl.attributes[fullName] = null;
  57289. }
  57290. this.delegate.removeAttribute(el, name, namespace);
  57291. };
  57292. /**
  57293. * @param {?} el
  57294. * @param {?} name
  57295. * @return {?}
  57296. */
  57297. DebugRenderer2.prototype.addClass = /**
  57298. * @param {?} el
  57299. * @param {?} name
  57300. * @return {?}
  57301. */
  57302. function (el, name) {
  57303. var /** @type {?} */ debugEl = getDebugNode(el);
  57304. if (debugEl && debugEl instanceof DebugElement) {
  57305. debugEl.classes[name] = true;
  57306. }
  57307. this.delegate.addClass(el, name);
  57308. };
  57309. /**
  57310. * @param {?} el
  57311. * @param {?} name
  57312. * @return {?}
  57313. */
  57314. DebugRenderer2.prototype.removeClass = /**
  57315. * @param {?} el
  57316. * @param {?} name
  57317. * @return {?}
  57318. */
  57319. function (el, name) {
  57320. var /** @type {?} */ debugEl = getDebugNode(el);
  57321. if (debugEl && debugEl instanceof DebugElement) {
  57322. debugEl.classes[name] = false;
  57323. }
  57324. this.delegate.removeClass(el, name);
  57325. };
  57326. /**
  57327. * @param {?} el
  57328. * @param {?} style
  57329. * @param {?} value
  57330. * @param {?} flags
  57331. * @return {?}
  57332. */
  57333. DebugRenderer2.prototype.setStyle = /**
  57334. * @param {?} el
  57335. * @param {?} style
  57336. * @param {?} value
  57337. * @param {?} flags
  57338. * @return {?}
  57339. */
  57340. function (el, style, value, flags) {
  57341. var /** @type {?} */ debugEl = getDebugNode(el);
  57342. if (debugEl && debugEl instanceof DebugElement) {
  57343. debugEl.styles[style] = value;
  57344. }
  57345. this.delegate.setStyle(el, style, value, flags);
  57346. };
  57347. /**
  57348. * @param {?} el
  57349. * @param {?} style
  57350. * @param {?} flags
  57351. * @return {?}
  57352. */
  57353. DebugRenderer2.prototype.removeStyle = /**
  57354. * @param {?} el
  57355. * @param {?} style
  57356. * @param {?} flags
  57357. * @return {?}
  57358. */
  57359. function (el, style, flags) {
  57360. var /** @type {?} */ debugEl = getDebugNode(el);
  57361. if (debugEl && debugEl instanceof DebugElement) {
  57362. debugEl.styles[style] = null;
  57363. }
  57364. this.delegate.removeStyle(el, style, flags);
  57365. };
  57366. /**
  57367. * @param {?} el
  57368. * @param {?} name
  57369. * @param {?} value
  57370. * @return {?}
  57371. */
  57372. DebugRenderer2.prototype.setProperty = /**
  57373. * @param {?} el
  57374. * @param {?} name
  57375. * @param {?} value
  57376. * @return {?}
  57377. */
  57378. function (el, name, value) {
  57379. var /** @type {?} */ debugEl = getDebugNode(el);
  57380. if (debugEl && debugEl instanceof DebugElement) {
  57381. debugEl.properties[name] = value;
  57382. }
  57383. this.delegate.setProperty(el, name, value);
  57384. };
  57385. /**
  57386. * @param {?} target
  57387. * @param {?} eventName
  57388. * @param {?} callback
  57389. * @return {?}
  57390. */
  57391. DebugRenderer2.prototype.listen = /**
  57392. * @param {?} target
  57393. * @param {?} eventName
  57394. * @param {?} callback
  57395. * @return {?}
  57396. */
  57397. function (target, eventName, callback) {
  57398. if (typeof target !== 'string') {
  57399. var /** @type {?} */ debugEl = getDebugNode(target);
  57400. if (debugEl) {
  57401. debugEl.listeners.push(new EventListener(eventName, callback));
  57402. }
  57403. }
  57404. return this.delegate.listen(target, eventName, callback);
  57405. };
  57406. /**
  57407. * @param {?} node
  57408. * @return {?}
  57409. */
  57410. DebugRenderer2.prototype.parentNode = /**
  57411. * @param {?} node
  57412. * @return {?}
  57413. */
  57414. function (node) { return this.delegate.parentNode(node); };
  57415. /**
  57416. * @param {?} node
  57417. * @return {?}
  57418. */
  57419. DebugRenderer2.prototype.nextSibling = /**
  57420. * @param {?} node
  57421. * @return {?}
  57422. */
  57423. function (node) { return this.delegate.nextSibling(node); };
  57424. /**
  57425. * @param {?} node
  57426. * @param {?} value
  57427. * @return {?}
  57428. */
  57429. DebugRenderer2.prototype.setValue = /**
  57430. * @param {?} node
  57431. * @param {?} value
  57432. * @return {?}
  57433. */
  57434. function (node, value) { return this.delegate.setValue(node, value); };
  57435. return DebugRenderer2;
  57436. }());
  57437. /**
  57438. * @fileoverview added by tsickle
  57439. * @suppress {checkTypes} checked by tsc
  57440. */
  57441. /**
  57442. * @license
  57443. * Copyright Google Inc. All Rights Reserved.
  57444. *
  57445. * Use of this source code is governed by an MIT-style license that can be
  57446. * found in the LICENSE file at https://angular.io/license
  57447. */
  57448. /**
  57449. * @param {?} override
  57450. * @return {?}
  57451. */
  57452. function overrideProvider(override) {
  57453. initServicesIfNeeded();
  57454. return Services.overrideProvider(override);
  57455. }
  57456. /**
  57457. * @param {?} comp
  57458. * @param {?} componentFactory
  57459. * @return {?}
  57460. */
  57461. function overrideComponentView(comp, componentFactory) {
  57462. initServicesIfNeeded();
  57463. return Services.overrideComponentView(comp, componentFactory);
  57464. }
  57465. /**
  57466. * @return {?}
  57467. */
  57468. function clearOverrides() {
  57469. initServicesIfNeeded();
  57470. return Services.clearOverrides();
  57471. }
  57472. /**
  57473. * @param {?} ngModuleType
  57474. * @param {?} bootstrapComponents
  57475. * @param {?} defFactory
  57476. * @return {?}
  57477. */
  57478. function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
  57479. return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
  57480. }
  57481. var NgModuleFactory_ = /** @class */ (function (_super) {
  57482. Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgModuleFactory_, _super);
  57483. function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
  57484. var _this =
  57485. // Attention: this ctor is called as top level function.
  57486. // Putting any logic in here will destroy closure tree shaking!
  57487. _super.call(this) || this;
  57488. _this.moduleType = moduleType;
  57489. _this._bootstrapComponents = _bootstrapComponents;
  57490. _this._ngModuleDefFactory = _ngModuleDefFactory;
  57491. return _this;
  57492. }
  57493. /**
  57494. * @param {?} parentInjector
  57495. * @return {?}
  57496. */
  57497. NgModuleFactory_.prototype.create = /**
  57498. * @param {?} parentInjector
  57499. * @return {?}
  57500. */
  57501. function (parentInjector) {
  57502. initServicesIfNeeded();
  57503. var /** @type {?} */ def = resolveDefinition(this._ngModuleDefFactory);
  57504. return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
  57505. };
  57506. return NgModuleFactory_;
  57507. }(NgModuleFactory));
  57508. /**
  57509. * @fileoverview added by tsickle
  57510. * @suppress {checkTypes} checked by tsc
  57511. */
  57512. /**
  57513. * @license
  57514. * Copyright Google Inc. All Rights Reserved.
  57515. *
  57516. * Use of this source code is governed by an MIT-style license that can be
  57517. * found in the LICENSE file at https://angular.io/license
  57518. */
  57519. /**
  57520. * @fileoverview added by tsickle
  57521. * @suppress {checkTypes} checked by tsc
  57522. */
  57523. /**
  57524. * @license
  57525. * Copyright Google Inc. All Rights Reserved.
  57526. *
  57527. * Use of this source code is governed by an MIT-style license that can be
  57528. * found in the LICENSE file at https://angular.io/license
  57529. */
  57530. /**
  57531. * @fileoverview added by tsickle
  57532. * @suppress {checkTypes} checked by tsc
  57533. */
  57534. /**
  57535. * @license
  57536. * Copyright Google Inc. All Rights Reserved.
  57537. *
  57538. * Use of this source code is governed by an MIT-style license that can be
  57539. * found in the LICENSE file at https://angular.io/license
  57540. */
  57541. // The functions in this file verify that the assumptions we are making
  57542. // about state in an instruction are correct before implementing any logic.
  57543. // They are meant only to be called in dev mode as sanity checks.
  57544. /**
  57545. * Stringifies values such that strings are wrapped in explicit quotation marks and
  57546. * other types are stringified normally. Used in error messages (e.g. assertThrow)
  57547. * to make it clear that certain values are of the string type when comparing.
  57548. *
  57549. * e.g. `expected "3" to be 3` is easier to understand than `expected 3 to be 3`.
  57550. *
  57551. * @param {?} value The value to be stringified
  57552. * @return {?} The stringified value
  57553. */
  57554. function stringifyValueForError(value) {
  57555. return typeof value === 'string' ? "\"" + value + "\"" : '' + value;
  57556. }
  57557. /**
  57558. * @param {?} actual
  57559. * @param {?} name
  57560. * @return {?}
  57561. */
  57562. /**
  57563. * @template T
  57564. * @param {?} actual
  57565. * @param {?} expected
  57566. * @param {?} name
  57567. * @param {?=} serializer
  57568. * @return {?}
  57569. */
  57570. function assertEqual(actual, expected, name, serializer) {
  57571. (actual != expected) && assertThrow(actual, expected, name, '==', serializer);
  57572. }
  57573. /**
  57574. * @template T
  57575. * @param {?} actual
  57576. * @param {?} expected
  57577. * @param {?} name
  57578. * @return {?}
  57579. */
  57580. function assertLessThan(actual, expected, name) {
  57581. (actual < expected) && assertThrow(actual, expected, name, '>');
  57582. }
  57583. /**
  57584. * @template T
  57585. * @param {?} actual
  57586. * @param {?} name
  57587. * @return {?}
  57588. */
  57589. function assertNotNull(actual, name) {
  57590. assertNotEqual(actual, null, name);
  57591. }
  57592. /**
  57593. * @template T
  57594. * @param {?} actual
  57595. * @param {?} expected
  57596. * @param {?} name
  57597. * @return {?}
  57598. */
  57599. function assertNotEqual(actual, expected, name) {
  57600. (actual == expected) && assertThrow(actual, expected, name, '!=');
  57601. }
  57602. /**
  57603. * Throws an error with a message constructed from the arguments.
  57604. *
  57605. * @template T
  57606. * @param {?} actual The actual value (e.g. 3)
  57607. * @param {?} expected The expected value (e.g. 5)
  57608. * @param {?} name The name of the value being checked (e.g. attrs.length)
  57609. * @param {?} operator The comparison operator (e.g. <, >, ==)
  57610. * @param {?=} serializer Function that maps a value to its display value
  57611. * @return {?}
  57612. */
  57613. function assertThrow(actual, expected, name, operator, serializer) {
  57614. if (serializer === void 0) { serializer = stringifyValueForError; }
  57615. throw new Error("ASSERT: expected " + name + " " + operator + " " + serializer(expected) + " but was " + serializer(actual) + "!");
  57616. }
  57617. /**
  57618. * @fileoverview added by tsickle
  57619. * @suppress {checkTypes} checked by tsc
  57620. */
  57621. /**
  57622. * @license
  57623. * Copyright Google Inc. All Rights Reserved.
  57624. *
  57625. * Use of this source code is governed by an MIT-style license that can be
  57626. * found in the LICENSE file at https://angular.io/license
  57627. */
  57628. if (typeof ngDevMode == 'undefined') {
  57629. if (typeof window != 'undefined')
  57630. (/** @type {?} */ (window)).ngDevMode = true;
  57631. if (typeof self != 'undefined')
  57632. (/** @type {?} */ (self)).ngDevMode = true;
  57633. if (typeof global != 'undefined')
  57634. (/** @type {?} */ (global)).ngDevMode = true;
  57635. }
  57636. /**
  57637. * @fileoverview added by tsickle
  57638. * @suppress {checkTypes} checked by tsc
  57639. */
  57640. /**
  57641. * @license
  57642. * Copyright Google Inc. All Rights Reserved.
  57643. *
  57644. * Use of this source code is governed by an MIT-style license that can be
  57645. * found in the LICENSE file at https://angular.io/license
  57646. */
  57647. /**
  57648. * @param {?} node
  57649. * @param {?} type
  57650. * @return {?}
  57651. */
  57652. function assertNodeType(node, type) {
  57653. assertNotEqual(node, null, 'node');
  57654. assertEqual(node.flags & 3 /* TYPE_MASK */, type, 'Node.type', typeSerializer);
  57655. }
  57656. /**
  57657. * @param {?} node
  57658. * @param {...?} types
  57659. * @return {?}
  57660. */
  57661. /**
  57662. * @param {?} type
  57663. * @return {?}
  57664. */
  57665. function typeSerializer(type) {
  57666. if (type == 1 /* Projection */)
  57667. return 'Projection';
  57668. if (type == 0 /* Container */)
  57669. return 'Container';
  57670. if (type == 2 /* View */)
  57671. return 'View';
  57672. if (type == 3 /* Element */)
  57673. return 'Element';
  57674. return '??? ' + type + ' ???';
  57675. }
  57676. /**
  57677. * @fileoverview added by tsickle
  57678. * @suppress {checkTypes} checked by tsc
  57679. */
  57680. /**
  57681. * @license
  57682. * Copyright Google Inc. All Rights Reserved.
  57683. *
  57684. * Use of this source code is governed by an MIT-style license that can be
  57685. * found in the LICENSE file at https://angular.io/license
  57686. */
  57687. /**
  57688. * Finds the closest DOM node above a given container in the hierarchy.
  57689. *
  57690. * This is necessary to add or remove elements from the DOM when a view
  57691. * is added or removed from the container. e.g. parent.removeChild(...)
  57692. *
  57693. * @param {?} containerNode The container node whose parent must be found
  57694. * @return {?} Closest DOM node above the container
  57695. */
  57696. function findNativeParent(containerNode) {
  57697. var /** @type {?} */ container = containerNode;
  57698. while (container) {
  57699. ngDevMode && assertNodeType(container, 0 /* Container */);
  57700. var /** @type {?} */ renderParent = container.data.renderParent;
  57701. if (renderParent !== null) {
  57702. return renderParent.native;
  57703. }
  57704. var /** @type {?} */ viewOrElement = /** @type {?} */ ((container.parent));
  57705. ngDevMode && assertNotNull(viewOrElement, 'container.parent');
  57706. if ((viewOrElement.flags & 3 /* TYPE_MASK */) === 3 /* Element */) {
  57707. // we are an LElement, which means we are past the last LContainer.
  57708. // This means than we have not been projected so just ignore.
  57709. return null;
  57710. }
  57711. ngDevMode && assertNodeType(viewOrElement, 2 /* View */);
  57712. container = (/** @type {?} */ (viewOrElement)).parent;
  57713. }
  57714. return null;
  57715. }
  57716. /**
  57717. * Finds the DOM element before which a certain view should be inserting its
  57718. * child elements.
  57719. *
  57720. * If the view has a next (e.g. for loop), elements should be inserted before
  57721. * the next view's first child element. Otherwise, the container's comment
  57722. * anchor is the marker.
  57723. *
  57724. * @param {?} index The index of the view to check
  57725. * @param {?} state ContainerState of the parent container
  57726. * @param {?} native Comment anchor for container
  57727. * @return {?} The DOM element for which the view should insert elements
  57728. */
  57729. function findBeforeNode(index, state, native) {
  57730. var /** @type {?} */ views = state.views;
  57731. // Find the node to insert in front of
  57732. return index + 1 < views.length ?
  57733. (/** @type {?} */ (views[index + 1].child)).native :
  57734. native;
  57735. }
  57736. /**
  57737. * @param {?} container
  57738. * @param {?} rootNode
  57739. * @param {?} insertMode
  57740. * @param {?=} beforeNode
  57741. * @return {?}
  57742. */
  57743. function addRemoveViewFromContainer(container, rootNode, insertMode, beforeNode) {
  57744. ngDevMode && assertNodeType(container, 0 /* Container */);
  57745. ngDevMode && assertNodeType(rootNode, 2 /* View */);
  57746. var /** @type {?} */ parent = findNativeParent(container);
  57747. var /** @type {?} */ node = rootNode.child;
  57748. if (parent) {
  57749. while (node) {
  57750. var /** @type {?} */ type = node.flags & 3;
  57751. var /** @type {?} */ nextNode = null;
  57752. var /** @type {?} */ renderer = container.view.renderer;
  57753. var /** @type {?} */ isFnRenderer = (/** @type {?} */ (renderer)).listen;
  57754. if (type === 3 /* Element */) {
  57755. insertMode ? (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
  57756. .insertBefore))(parent, /** @type {?} */ ((node.native)), /** @type {?} */ (beforeNode)) :
  57757. parent.insertBefore(/** @type {?} */ ((node.native)), /** @type {?} */ (beforeNode), true)) :
  57758. (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
  57759. .removeChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) :
  57760. parent.removeChild(/** @type {?} */ ((node.native))));
  57761. nextNode = node.next;
  57762. }
  57763. else if (type === 0 /* Container */) {
  57764. // if we get to a container, it must be a root node of a view because we are only
  57765. // propagating down into child views / containers and not child elements
  57766. var /** @type {?} */ childContainerData = (/** @type {?} */ (node)).data;
  57767. insertMode ? (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
  57768. .appendChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) :
  57769. parent.appendChild(/** @type {?} */ ((node.native)))) :
  57770. (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
  57771. .removeChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) :
  57772. parent.removeChild(/** @type {?} */ ((node.native))));
  57773. nextNode = childContainerData.views.length ? childContainerData.views[0].child : null;
  57774. }
  57775. else if (type === 1 /* Projection */) {
  57776. nextNode = (/** @type {?} */ (node)).data[0];
  57777. }
  57778. else {
  57779. nextNode = (/** @type {?} */ (node)).child;
  57780. }
  57781. if (nextNode === null) {
  57782. while (node && !node.next) {
  57783. node = node.parent;
  57784. if (node === rootNode)
  57785. node = null;
  57786. }
  57787. node = node && node.next;
  57788. }
  57789. else {
  57790. node = nextNode;
  57791. }
  57792. }
  57793. }
  57794. }
  57795. /**
  57796. * Traverses the tree of component views and containers to remove listeners and
  57797. * call onDestroy callbacks.
  57798. *
  57799. * Notes:
  57800. * - Because it's used for onDestroy calls, it needs to be bottom-up.
  57801. * - Must process containers instead of their views to avoid splicing
  57802. * when views are destroyed and re-added.
  57803. * - Using a while loop because it's faster than recursion
  57804. * - Destroy only called on movement to sibling or movement to parent (laterally or up)
  57805. *
  57806. * \@param rootView The view to destroy
  57807. * @param {?} rootView
  57808. * @return {?}
  57809. */
  57810. function destroyViewTree(rootView) {
  57811. var /** @type {?} */ viewOrContainerState = rootView;
  57812. while (viewOrContainerState) {
  57813. var /** @type {?} */ next = null;
  57814. if (viewOrContainerState.views && viewOrContainerState.views.length) {
  57815. next = viewOrContainerState.views[0].data;
  57816. }
  57817. else if (viewOrContainerState.child) {
  57818. next = viewOrContainerState.child;
  57819. }
  57820. else if (viewOrContainerState.next) {
  57821. cleanUpView(/** @type {?} */ (viewOrContainerState));
  57822. next = viewOrContainerState.next;
  57823. }
  57824. if (next == null) {
  57825. while (viewOrContainerState && !/** @type {?} */ ((viewOrContainerState)).next) {
  57826. cleanUpView(/** @type {?} */ (viewOrContainerState));
  57827. viewOrContainerState = getParentState(viewOrContainerState, rootView);
  57828. }
  57829. cleanUpView(/** @type {?} */ (viewOrContainerState) || rootView);
  57830. next = viewOrContainerState && viewOrContainerState.next;
  57831. }
  57832. viewOrContainerState = next;
  57833. }
  57834. }
  57835. /**
  57836. * Inserts a view into a container.
  57837. *
  57838. * This adds the view to the container's array of active views in the correct
  57839. * position. It also adds the view's elements to the DOM if the container isn't a
  57840. * root node of another view (in that case, the view's elements will be added when
  57841. * the container's parent view is added later).
  57842. *
  57843. * @param {?} container The container into which the view should be inserted
  57844. * @param {?} newView The view to insert
  57845. * @param {?} index The index at which to insert the view
  57846. * @return {?} The inserted view
  57847. */
  57848. function insertView(container, newView, index) {
  57849. var /** @type {?} */ state = container.data;
  57850. var /** @type {?} */ views = state.views;
  57851. if (index > 0) {
  57852. // This is a new view, we need to add it to the children.
  57853. setViewNext(views[index - 1], newView);
  57854. }
  57855. if (index < views.length && views[index].data.id !== newView.data.id) {
  57856. // View ID change replace the view.
  57857. setViewNext(newView, views[index]);
  57858. views.splice(index, 0, newView);
  57859. }
  57860. else if (index >= views.length) {
  57861. views.push(newView);
  57862. }
  57863. if (state.nextIndex <= index) {
  57864. state.nextIndex++;
  57865. }
  57866. // If the container's renderParent is null, we know that it is a root node of its own parent view
  57867. // and we should wait until that parent processes its nodes (otherwise, we will insert this view's
  57868. // nodes twice - once now and once when its parent inserts its views).
  57869. if (container.data.renderParent !== null) {
  57870. addRemoveViewFromContainer(container, newView, true, findBeforeNode(index, state, container.native));
  57871. }
  57872. // Notify query that view has been inserted
  57873. container.query && container.query.insertView(container, newView, index);
  57874. return newView;
  57875. }
  57876. /**
  57877. * Removes a view from a container.
  57878. *
  57879. * This method splices the view from the container's array of active views. It also
  57880. * removes the view's elements from the DOM and conducts cleanup (e.g. removing
  57881. * listeners, calling onDestroys).
  57882. *
  57883. * @param {?} container The container from which to remove a view
  57884. * @param {?} removeIndex The index of the view to remove
  57885. * @return {?} The removed view
  57886. */
  57887. function removeView(container, removeIndex) {
  57888. var /** @type {?} */ views = container.data.views;
  57889. var /** @type {?} */ viewNode = views[removeIndex];
  57890. if (removeIndex > 0) {
  57891. setViewNext(views[removeIndex - 1], viewNode.next);
  57892. }
  57893. views.splice(removeIndex, 1);
  57894. destroyViewTree(viewNode.data);
  57895. addRemoveViewFromContainer(container, viewNode, false);
  57896. // Notify query that view has been removed
  57897. container.query && container.query.removeView(container, viewNode, removeIndex);
  57898. return viewNode;
  57899. }
  57900. /**
  57901. * Sets a next on the view node, so views in for loops can easily jump from
  57902. * one view to the next to add/remove elements. Also adds the ViewState (view.data)
  57903. * to the view tree for easy traversal when cleaning up the view.
  57904. *
  57905. * @param {?} view The view to set up
  57906. * @param {?} next The view's new next
  57907. * @return {?}
  57908. */
  57909. function setViewNext(view, next) {
  57910. view.next = next;
  57911. view.data.next = next ? next.data : null;
  57912. }
  57913. /**
  57914. * Determines which ViewOrContainerState to jump to when traversing back up the
  57915. * tree in destroyViewTree.
  57916. *
  57917. * Normally, the view's parent ViewState should be checked, but in the case of
  57918. * embedded views, the container (which is the view node's parent, but not the
  57919. * ViewState's parent) needs to be checked for a possible next property.
  57920. *
  57921. * @param {?} state The ViewOrContainerState for which we need a parent state
  57922. * @param {?} rootView The rootView, so we don't propagate too far up the view tree
  57923. * @return {?} The correct parent ViewOrContainerState
  57924. */
  57925. function getParentState(state, rootView) {
  57926. var /** @type {?} */ node;
  57927. if ((node = /** @type {?} */ (((/** @type {?} */ (state)))).node) &&
  57928. (node.flags & 3 /* TYPE_MASK */) === 2 /* View */) {
  57929. // if it's an embedded view, the state needs to go up to the container, in case the
  57930. // container has a next
  57931. return /** @type {?} */ (((node.parent)).data);
  57932. }
  57933. else {
  57934. // otherwise, use parent view for containers or component views
  57935. return state.parent === rootView ? null : state.parent;
  57936. }
  57937. }
  57938. /**
  57939. * Removes all listeners and call all onDestroys in a given view.
  57940. *
  57941. * @param {?} viewState The ViewState of the view to clean up
  57942. * @return {?}
  57943. */
  57944. function cleanUpView(viewState) {
  57945. if (!viewState.cleanup)
  57946. return;
  57947. var /** @type {?} */ cleanup = /** @type {?} */ ((viewState.cleanup));
  57948. for (var /** @type {?} */ i = 0; i < cleanup.length - 1; i += 2) {
  57949. if (typeof cleanup[i] === 'string') {
  57950. /** @type {?} */ ((cleanup))[i + 1].removeEventListener(cleanup[i], cleanup[i + 2], cleanup[i + 3]);
  57951. i += 2;
  57952. }
  57953. else {
  57954. cleanup[i].call(cleanup[i + 1]);
  57955. }
  57956. }
  57957. viewState.cleanup = null;
  57958. }
  57959. /**
  57960. * Appends the provided child element to the provided parent, if appropriate.
  57961. *
  57962. * If the parent is a view, the element will be appended as part of viewEnd(), so
  57963. * the element should not be appended now. Similarly, if the child is a content child
  57964. * of a parent component, the child will be appended to the right position later by
  57965. * the content projection system. Otherwise, append normally.
  57966. *
  57967. * @param {?} parent The parent to which to append the child
  57968. * @param {?} child The child that should be appended
  57969. * @param {?} currentView The current view's ViewState
  57970. * @return {?} Whether or not the child was appended
  57971. */
  57972. function appendChild(parent, child, currentView) {
  57973. // Only add native child element to parent element if the parent element is regular Element.
  57974. // If parent is:
  57975. // - Regular element => add child
  57976. // - Component host element =>
  57977. // - Current View, and parent view same => content => don't add -> parent component will
  57978. // re-project if needed.
  57979. // - Current View, and parent view different => view => add Child
  57980. // - View element => View's get added separately.
  57981. if (child !== null && (parent.flags & 3 /* TYPE_MASK */) === 3 /* Element */ &&
  57982. (parent.view !==
  57983. currentView /* Crossing View Boundaries, it is Component, but add Element of View */
  57984. || parent.data === null /* Regular Element. */)) {
  57985. // We only add element if not in View or not projected.
  57986. var /** @type {?} */ renderer = currentView.renderer;
  57987. (/** @type {?} */ (renderer)).listen ? /** @type {?} */ (((/** @type {?} */ (renderer)).appendChild))(/** @type {?} */ (((parent.native))), child) : /** @type {?} */ ((parent.native)).appendChild(child);
  57988. return true;
  57989. }
  57990. return false;
  57991. }
  57992. /**
  57993. * Inserts the provided node before the correct element in the DOM, if appropriate.
  57994. *
  57995. * If the parent is a view, the element will be inserted as part of viewEnd(), so
  57996. * the element should not be inserted now. Similarly, if the child is a content child
  57997. * of a parent component, the child will be inserted to the right position later by
  57998. * the content projection system. Otherwise, insertBefore normally.
  57999. *
  58000. * @param {?} node Node to insert
  58001. * @param {?} currentView The current view's ViewState
  58002. * @return {?}
  58003. */
  58004. function insertChild(node, currentView) {
  58005. var /** @type {?} */ parent = /** @type {?} */ ((node.parent));
  58006. // Only add child element to parent element if the parent element is regular Element.
  58007. // If parent is:
  58008. // - Normal element => add child
  58009. // - Component element =>
  58010. // - Current View, and parent view same => content don't add -> parent component will
  58011. // re-project if needed.
  58012. // - Current View, and parent view different => view => add Child
  58013. // - View element => View's get added separately.
  58014. if ((parent.flags & 3 /* TYPE_MASK */) === 3 /* Element */ &&
  58015. (parent.view !==
  58016. currentView /* Crossing View Boundaries, its Component, but add Element of View */
  58017. || parent.data === null /* Regular Element. */)) {
  58018. // We only add element if not in View or not projected.
  58019. var /** @type {?} */ sibling = node.next;
  58020. var /** @type {?} */ nativeSibling = null;
  58021. while (sibling && (nativeSibling = sibling.native) === null) {
  58022. sibling = sibling.next;
  58023. }
  58024. var /** @type {?} */ renderer = currentView.renderer;
  58025. (/** @type {?} */ (renderer)).listen ? /** @type {?} */ (((/** @type {?} */ (renderer))
  58026. .insertBefore))(/** @type {?} */ ((parent.native)), /** @type {?} */ ((node.native)), nativeSibling) : /** @type {?} */ ((parent.native)).insertBefore(/** @type {?} */ ((node.native)), nativeSibling, false);
  58027. }
  58028. }
  58029. /**
  58030. * Appends a projected node to the DOM, or in the case of a projected container,
  58031. * appends the nodes from all of the container's active views to the DOM. Also stores the
  58032. * node in the given projectedNodes array.
  58033. *
  58034. * @param {?} projectedNodes Array to store the projected node
  58035. * @param {?} node The node to process
  58036. * @param {?} currentParent The last parent element to be processed
  58037. * @param {?} currentView The current view's ViewState
  58038. * @return {?}
  58039. */
  58040. /**
  58041. * @fileoverview added by tsickle
  58042. * @suppress {checkTypes} checked by tsc
  58043. */
  58044. /**
  58045. * @license
  58046. * Copyright Google Inc. All Rights Reserved.
  58047. *
  58048. * Use of this source code is governed by an MIT-style license that can be
  58049. * found in the LICENSE file at https://angular.io/license
  58050. */
  58051. /**
  58052. * A utility function to match an Ivy node static data against a simple CSS selector
  58053. *
  58054. * @param {?} lNodeStaticData
  58055. * @param {?} selector
  58056. * @return {?} true if node matches the selector.
  58057. */
  58058. /**
  58059. * @param {?} lNodeStaticData
  58060. * @param {?} selector
  58061. * @return {?}
  58062. */
  58063. /**
  58064. * @param {?} lNodeStaticData
  58065. * @param {?} selector
  58066. * @return {?}
  58067. */
  58068. /**
  58069. * @fileoverview added by tsickle
  58070. * @suppress {checkTypes} checked by tsc
  58071. */
  58072. /**
  58073. * @license
  58074. * Copyright Google Inc. All Rights Reserved.
  58075. *
  58076. * Use of this source code is governed by an MIT-style license that can be
  58077. * found in the LICENSE file at https://angular.io/license
  58078. */
  58079. /**
  58080. * Must use this method for CD (instead of === ) since NaN !== NaN
  58081. * @param {?} a
  58082. * @param {?} b
  58083. * @return {?}
  58084. */
  58085. function isDifferent(a, b) {
  58086. // NaN is the only value that is not equal to itself so the first
  58087. // test checks if both a and b are not NaN
  58088. return !(a !== a && b !== b) && a !== b;
  58089. }
  58090. /**
  58091. * @param {?} value
  58092. * @return {?}
  58093. */
  58094. function stringify$1(value) {
  58095. if (typeof value == 'function')
  58096. return value.name || value;
  58097. if (typeof value == 'string')
  58098. return value;
  58099. if (value == null)
  58100. return '';
  58101. return '' + value;
  58102. }
  58103. /**
  58104. * Function that throws a "not implemented" error so it's clear certain
  58105. * behaviors/methods aren't yet ready.
  58106. *
  58107. * @return {?} Not implemented error
  58108. */
  58109. /**
  58110. * @fileoverview added by tsickle
  58111. * @suppress {checkTypes} checked by tsc
  58112. */
  58113. /**
  58114. * @license
  58115. * Copyright Google Inc. All Rights Reserved.
  58116. *
  58117. * Use of this source code is governed by an MIT-style license that can be
  58118. * found in the LICENSE file at https://angular.io/license
  58119. */
  58120. /**
  58121. * If a directive is diPublic, bloomAdd sets a property on the instance with this constant as
  58122. * the key and the directive's unique ID as the value. This allows us to map directives to their
  58123. * bloom filter bit for DI.
  58124. */
  58125. var NG_ELEMENT_ID = '__NG_ELEMENT_ID__';
  58126. /**
  58127. * The number of slots in each bloom filter (used by DI). The larger this number, the fewer
  58128. * directives that will share slots, and thus, the fewer false positives when checking for
  58129. * the existence of a directive.
  58130. */
  58131. var BLOOM_SIZE = 128;
  58132. /**
  58133. * Registers this directive as present in its node's injector by flipping the directive's
  58134. * corresponding bit in the injector's bloom filter.
  58135. *
  58136. * @param {?} injector The node injector in which the directive should be registered
  58137. * @param {?} type The directive to register
  58138. * @return {?}
  58139. */
  58140. /**
  58141. * Creates (or gets an existing) injector for a given element or container.
  58142. *
  58143. * @param {?} node for which an injector should be retrieved / created.
  58144. * @return {?} Node injector
  58145. */
  58146. /**
  58147. * Constructs an injection error with the given text and token.
  58148. *
  58149. * @param {?} text The text of the error
  58150. * @param {?} token The token associated with the error
  58151. * @return {?} The error that was created
  58152. */
  58153. function createInjectionError(text, token) {
  58154. return new Error("ElementInjector: " + text + " [" + stringify$1(token) + "]");
  58155. }
  58156. /**
  58157. * Makes a directive public to the DI system by adding it to an injector's bloom filter.
  58158. *
  58159. * @param {?} di The node injector in which a directive will be added
  58160. * @param {?} def The definition of the directive to be made public
  58161. * @return {?}
  58162. */
  58163. /**
  58164. * Searches for an instance of the given directive type up the injector tree and returns
  58165. * that instance if found.
  58166. *
  58167. * Specifically, it gets the bloom filter bit associated with the directive (see bloomHashBit),
  58168. * checks that bit against the bloom filter structure to identify an injector that might have
  58169. * the directive (see bloomFindPossibleInjector), then searches the directives on that injector
  58170. * for a match.
  58171. *
  58172. * If not found, it will propagate up to the next parent injector until the token
  58173. * is found or the top is reached.
  58174. *
  58175. * @template T
  58176. * @param {?} di Node injector where the search should start
  58177. * @param {?} token The directive type to search for
  58178. * @param {?=} flags Injection flags (e.g. CheckParent)
  58179. * @return {?} The instance found
  58180. */
  58181. /**
  58182. * Given a directive type, this function returns the bit in an injector's bloom filter
  58183. * that should be used to determine whether or not the directive is present.
  58184. *
  58185. * When the directive was added to the bloom filter, it was given a unique ID that can be
  58186. * retrieved on the class. Since there are only BLOOM_SIZE slots per bloom filter, the directive's
  58187. * ID must be modulo-ed by BLOOM_SIZE to get the correct bloom bit (directives share slots after
  58188. * BLOOM_SIZE is reached).
  58189. *
  58190. * @param {?} type The directive type
  58191. * @return {?} The bloom bit to check for the directive
  58192. */
  58193. function bloomHashBit(type) {
  58194. var /** @type {?} */ id = (/** @type {?} */ (type))[NG_ELEMENT_ID];
  58195. return typeof id === 'number' ? id % BLOOM_SIZE : null;
  58196. }
  58197. /**
  58198. * Finds the closest injector that might have a certain directive.
  58199. *
  58200. * Each directive corresponds to a bit in an injector's bloom filter. Given the bloom bit to
  58201. * check and a starting injector, this function traverses up injectors until it finds an
  58202. * injector that contains a 1 for that bit in its bloom filter. A 1 indicates that the
  58203. * injector may have that directive. It only *may* have the directive because directives begin
  58204. * to share bloom filter bits after the BLOOM_SIZE is reached, and it could correspond to a
  58205. * different directive sharing the bit.
  58206. *
  58207. * Note: We can skip checking further injectors up the tree if an injector's cbf structure
  58208. * has a 0 for that bloom bit. Since cbf contains the merged value of all the parent
  58209. * injectors, a 0 in the bloom bit indicates that the parents definitely do not contain
  58210. * the directive and do not need to be checked.
  58211. *
  58212. * @param {?} startInjector
  58213. * @param {?} bloomBit The bit to check in each injector's bloom filter
  58214. * @return {?} An injector that might have the directive
  58215. */
  58216. function bloomFindPossibleInjector(startInjector, bloomBit) {
  58217. // Create a mask that targets the specific bit associated with the directive we're looking for.
  58218. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
  58219. // to bit positions 0 - 31 in a 32 bit integer.
  58220. var /** @type {?} */ mask = 1 << bloomBit;
  58221. // Traverse up the injector tree until we find a potential match or until we know there *isn't* a
  58222. // match.
  58223. var /** @type {?} */ injector = startInjector;
  58224. while (injector) {
  58225. // Our bloom filter size is 128 bits, which is four 32-bit bloom filter buckets:
  58226. // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127]
  58227. // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
  58228. var /** @type {?} */ value = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) :
  58229. (bloomBit < 96 ? injector.bf2 : injector.bf3);
  58230. // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
  58231. // this injector is a potential match.
  58232. if ((value & mask) === mask) {
  58233. return injector;
  58234. }
  58235. // If the current injector does not have the directive, check the bloom filters for the ancestor
  58236. // injectors (cbf0 - cbf3). These filters capture *all* ancestor injectors.
  58237. value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) :
  58238. (bloomBit < 96 ? injector.cbf2 : injector.cbf3);
  58239. // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to
  58240. // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort.
  58241. injector = (value & mask) ? injector.parent : null;
  58242. }
  58243. return null;
  58244. }
  58245. /**
  58246. * Creates an ElementRef for a given node injector and stores it on the injector.
  58247. * Or, if the ElementRef already exists, retrieves the existing ElementRef.
  58248. *
  58249. * @param {?} di The node injector where we should store a created ElementRef
  58250. * @return {?} The ElementRef instance to use
  58251. */
  58252. /**
  58253. * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already
  58254. * exists, retrieves the existing TemplateRef.
  58255. *
  58256. * @template T
  58257. * @param {?} di The node injector where we should store a created TemplateRef
  58258. * @return {?} The TemplateRef instance to use
  58259. */
  58260. /**
  58261. * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef
  58262. * already exists, retrieves the existing ViewContainerRef.
  58263. *
  58264. * @param {?} di
  58265. * @return {?} The ViewContainerRef instance to use
  58266. */
  58267. /**
  58268. * @fileoverview added by tsickle
  58269. * @suppress {checkTypes} checked by tsc
  58270. */
  58271. /**
  58272. * @license
  58273. * Copyright Google Inc. All Rights Reserved.
  58274. *
  58275. * Use of this source code is governed by an MIT-style license that can be
  58276. * found in the LICENSE file at https://angular.io/license
  58277. */
  58278. /**
  58279. * A predicate which determines if a given element/directive should be included in the query
  58280. * @record
  58281. */
  58282. var QueryList_ = /** @class */ (function () {
  58283. function QueryList_() {
  58284. this.dirty = false;
  58285. /**
  58286. * \@internal
  58287. */
  58288. this._valuesTree = null;
  58289. /**
  58290. * \@internal
  58291. */
  58292. this._values = null;
  58293. }
  58294. Object.defineProperty(QueryList_.prototype, "length", {
  58295. get: /**
  58296. * @return {?}
  58297. */
  58298. function () {
  58299. ngDevMode && assertNotNull(this._values, 'refreshed');
  58300. return /** @type {?} */ ((this._values)).length;
  58301. },
  58302. enumerable: true,
  58303. configurable: true
  58304. });
  58305. Object.defineProperty(QueryList_.prototype, "first", {
  58306. get: /**
  58307. * @return {?}
  58308. */
  58309. function () {
  58310. ngDevMode && assertNotNull(this._values, 'refreshed');
  58311. var /** @type {?} */ values = /** @type {?} */ ((this._values));
  58312. return values.length ? values[0] : null;
  58313. },
  58314. enumerable: true,
  58315. configurable: true
  58316. });
  58317. Object.defineProperty(QueryList_.prototype, "last", {
  58318. get: /**
  58319. * @return {?}
  58320. */
  58321. function () {
  58322. ngDevMode && assertNotNull(this._values, 'refreshed');
  58323. var /** @type {?} */ values = /** @type {?} */ ((this._values));
  58324. return values.length ? values[values.length - 1] : null;
  58325. },
  58326. enumerable: true,
  58327. configurable: true
  58328. });
  58329. /** @internal */
  58330. /**
  58331. * \@internal
  58332. * @return {?}
  58333. */
  58334. QueryList_.prototype._refresh = /**
  58335. * \@internal
  58336. * @return {?}
  58337. */
  58338. function () {
  58339. // TODO(misko): needs more logic to flatten tree.
  58340. if (this._values === null) {
  58341. this._values = this._valuesTree;
  58342. return true;
  58343. }
  58344. return false;
  58345. };
  58346. /**
  58347. * @template U
  58348. * @param {?} fn
  58349. * @return {?}
  58350. */
  58351. QueryList_.prototype.map = /**
  58352. * @template U
  58353. * @param {?} fn
  58354. * @return {?}
  58355. */
  58356. function (fn) {
  58357. throw new Error('Method not implemented.');
  58358. };
  58359. /**
  58360. * @param {?} fn
  58361. * @return {?}
  58362. */
  58363. QueryList_.prototype.filter = /**
  58364. * @param {?} fn
  58365. * @return {?}
  58366. */
  58367. function (fn) {
  58368. throw new Error('Method not implemented.');
  58369. };
  58370. /**
  58371. * @param {?} fn
  58372. * @return {?}
  58373. */
  58374. QueryList_.prototype.find = /**
  58375. * @param {?} fn
  58376. * @return {?}
  58377. */
  58378. function (fn) {
  58379. throw new Error('Method not implemented.');
  58380. };
  58381. /**
  58382. * @template U
  58383. * @param {?} fn
  58384. * @param {?} init
  58385. * @return {?}
  58386. */
  58387. QueryList_.prototype.reduce = /**
  58388. * @template U
  58389. * @param {?} fn
  58390. * @param {?} init
  58391. * @return {?}
  58392. */
  58393. function (fn, init) {
  58394. throw new Error('Method not implemented.');
  58395. };
  58396. /**
  58397. * @param {?} fn
  58398. * @return {?}
  58399. */
  58400. QueryList_.prototype.forEach = /**
  58401. * @param {?} fn
  58402. * @return {?}
  58403. */
  58404. function (fn) {
  58405. throw new Error('Method not implemented.');
  58406. };
  58407. /**
  58408. * @param {?} fn
  58409. * @return {?}
  58410. */
  58411. QueryList_.prototype.some = /**
  58412. * @param {?} fn
  58413. * @return {?}
  58414. */
  58415. function (fn) {
  58416. throw new Error('Method not implemented.');
  58417. };
  58418. /**
  58419. * @return {?}
  58420. */
  58421. QueryList_.prototype.toArray = /**
  58422. * @return {?}
  58423. */
  58424. function () {
  58425. ngDevMode && assertNotNull(this._values, 'refreshed');
  58426. return /** @type {?} */ ((this._values));
  58427. };
  58428. /**
  58429. * @return {?}
  58430. */
  58431. QueryList_.prototype.toString = /**
  58432. * @return {?}
  58433. */
  58434. function () { throw new Error('Method not implemented.'); };
  58435. /**
  58436. * @param {?} res
  58437. * @return {?}
  58438. */
  58439. QueryList_.prototype.reset = /**
  58440. * @param {?} res
  58441. * @return {?}
  58442. */
  58443. function (res) { throw new Error('Method not implemented.'); };
  58444. /**
  58445. * @return {?}
  58446. */
  58447. QueryList_.prototype.notifyOnChanges = /**
  58448. * @return {?}
  58449. */
  58450. function () { throw new Error('Method not implemented.'); };
  58451. /**
  58452. * @return {?}
  58453. */
  58454. QueryList_.prototype.setDirty = /**
  58455. * @return {?}
  58456. */
  58457. function () { throw new Error('Method not implemented.'); };
  58458. /**
  58459. * @return {?}
  58460. */
  58461. QueryList_.prototype.destroy = /**
  58462. * @return {?}
  58463. */
  58464. function () { throw new Error('Method not implemented.'); };
  58465. return QueryList_;
  58466. }());
  58467. /**
  58468. * @param {?} query
  58469. * @return {?}
  58470. */
  58471. /**
  58472. * @fileoverview added by tsickle
  58473. * @suppress {checkTypes} checked by tsc
  58474. */
  58475. /**
  58476. * @license
  58477. * Copyright Google Inc. All Rights Reserved.
  58478. *
  58479. * Use of this source code is governed by an MIT-style license that can be
  58480. * found in the LICENSE file at https://angular.io/license
  58481. */
  58482. /** @enum {number} */
  58483. var RendererStyleFlags3 = {
  58484. Important: 1,
  58485. DashCase: 2,
  58486. };
  58487. RendererStyleFlags3[RendererStyleFlags3.Important] = "Important";
  58488. RendererStyleFlags3[RendererStyleFlags3.DashCase] = "DashCase";
  58489. /**
  58490. * Object Oriented style of API needed to create elements and text nodes.
  58491. *
  58492. * This is the native browser API style, e.g. operations are methods on individual objects
  58493. * like HTMLElement. With this style, no additional code is needed as a facade
  58494. * (reducing payload size).
  58495. *
  58496. * @record
  58497. */
  58498. /**
  58499. * Procedural style of API needed to create elements and text nodes.
  58500. *
  58501. * In non-native browser environments (e.g. platforms such as web-workers), this is the
  58502. * facade that enables element manipulation. This also facilitates backwards compatibility
  58503. * with Renderer2.
  58504. * @record
  58505. */
  58506. /**
  58507. * @record
  58508. */
  58509. var domRendererFactory3 = {
  58510. createRenderer: function (hostElement, rendererType) { return document; }
  58511. };
  58512. /**
  58513. * Subset of API needed for appending elements and text nodes.
  58514. * @record
  58515. */
  58516. /**
  58517. * Subset of API needed for writing attributes, properties, and setting up
  58518. * listeners on Element.
  58519. * @record
  58520. */
  58521. /**
  58522. * @record
  58523. */
  58524. /**
  58525. * @record
  58526. */
  58527. /**
  58528. * @record
  58529. */
  58530. /**
  58531. * @record
  58532. */
  58533. /**
  58534. * @fileoverview added by tsickle
  58535. * @suppress {checkTypes} checked by tsc
  58536. */
  58537. /**
  58538. * @license
  58539. * Copyright Google Inc. All Rights Reserved.
  58540. *
  58541. * Use of this source code is governed by an MIT-style license that can be
  58542. * found in the LICENSE file at https://angular.io/license
  58543. */
  58544. /**
  58545. * Directive (D) sets a property on all component instances using this constant as a key and the
  58546. * component's host node (LElement) as the value. This is used in methods like detectChanges to
  58547. * facilitate jumping from an instance to the host node.
  58548. */
  58549. var NG_HOST_SYMBOL = '__ngHostLNode__';
  58550. /**
  58551. * This property gets set before entering a template.
  58552. *
  58553. * This renderer can be one of two varieties of Renderer3:
  58554. *
  58555. * - ObjectedOrientedRenderer3
  58556. *
  58557. * This is the native browser API style, e.g. operations are methods on individual objects
  58558. * like HTMLElement. With this style, no additional code is needed as a facade (reducing payload
  58559. * size).
  58560. *
  58561. * - ProceduralRenderer3
  58562. *
  58563. * In non-native browser environments (e.g. platforms such as web-workers), this is the facade
  58564. * that enables element manipulation. This also facilitates backwards compatibility with
  58565. * Renderer2.
  58566. */
  58567. var renderer;
  58568. var rendererFactory;
  58569. /**
  58570. * Used to set the parent property when nodes are created.
  58571. */
  58572. var previousOrParentNode;
  58573. /**
  58574. * If `isParent` is:
  58575. * - `true`: then `previousOrParentNode` points to a parent node.
  58576. * - `false`: then `previousOrParentNode` points to previous node (sibling).
  58577. */
  58578. var isParent;
  58579. /**
  58580. * The current template's static data (shared between all templates of a
  58581. * given type).
  58582. *
  58583. * Each node's static data is stored at the same index that it's stored
  58584. * in the data array. Any nodes that do not have static data store a null
  58585. * value to avoid a sparse array.
  58586. */
  58587. var ngStaticData;
  58588. /**
  58589. * State of the current view being processed.
  58590. */
  58591. var currentView;
  58592. // The initialization has to be after the `let`, otherwise `createViewState` can't see `let`.
  58593. currentView = createViewState(/** @type {?} */ ((null)), /** @type {?} */ ((null)), []);
  58594. var currentQuery;
  58595. /**
  58596. * This property gets set before entering a template.
  58597. */
  58598. var creationMode;
  58599. /**
  58600. * An array of nodes (text, element, container, etc), their bindings, and
  58601. * any local variables that need to be stored between invocations.
  58602. */
  58603. var data;
  58604. /**
  58605. * Points to the next binding index to read or write to.
  58606. */
  58607. var bindingIndex;
  58608. /**
  58609. * When a view is destroyed, listeners need to be released
  58610. * and onDestroy callbacks need to be called. This cleanup array
  58611. * stores both listener data (in chunks of 4) and onDestroy data
  58612. * (in chunks of 2), as they'll be processed at the same time.
  58613. *
  58614. * If it's a listener being stored:
  58615. * 1st index is: event name to remove
  58616. * 2nd index is: native element
  58617. * 3rd index is: listener function
  58618. * 4th index is: useCapture boolean
  58619. *
  58620. * If it's an onDestroy function:
  58621. * 1st index is: onDestroy function
  58622. * 2nd index is: context for function
  58623. */
  58624. var cleanup;
  58625. /**
  58626. * Index in the data array at which view hooks begin to be stored.
  58627. */
  58628. var viewHookStartIndex;
  58629. /**
  58630. * Swap the current state with a new state.
  58631. *
  58632. * For performance reasons we store the state in the top level of the module.
  58633. * This way we minimize the number of properties to read. Whenever a new view
  58634. * is entered we have to store the state for later, and when the view is
  58635. * exited the state has to be restored
  58636. *
  58637. * @param {?} newViewState New state to become active
  58638. * @param {?} host Element to which the View is a child of
  58639. * @return {?} the previous state;
  58640. */
  58641. function enterView(newViewState, host) {
  58642. var /** @type {?} */ oldViewState = currentView;
  58643. data = newViewState.data;
  58644. bindingIndex = newViewState.bindingStartIndex || 0;
  58645. ngStaticData = newViewState.ngStaticData;
  58646. creationMode = newViewState.creationMode;
  58647. viewHookStartIndex = newViewState.viewHookStartIndex;
  58648. cleanup = newViewState.cleanup;
  58649. renderer = newViewState.renderer;
  58650. if (host != null) {
  58651. previousOrParentNode = host;
  58652. isParent = true;
  58653. }
  58654. currentView = newViewState;
  58655. return /** @type {?} */ ((oldViewState));
  58656. }
  58657. /**
  58658. * Used in lieu of enterView to make it clear when we are exiting a child view. This makes
  58659. * the direction of traversal (up or down the view tree) a bit clearer.
  58660. * @param {?} newViewState
  58661. * @return {?}
  58662. */
  58663. function leaveView(newViewState) {
  58664. executeViewHooks();
  58665. enterView(newViewState, null);
  58666. }
  58667. /**
  58668. * @param {?} viewId
  58669. * @param {?} renderer
  58670. * @param {?} ngStaticData
  58671. * @return {?}
  58672. */
  58673. function createViewState(viewId, renderer, ngStaticData) {
  58674. var /** @type {?} */ newView = {
  58675. parent: currentView,
  58676. id: viewId,
  58677. // -1 for component views
  58678. node: /** @type {?} */ ((null)),
  58679. // until we initialize it in createNode.
  58680. data: [],
  58681. ngStaticData: ngStaticData,
  58682. cleanup: null,
  58683. renderer: renderer,
  58684. child: null,
  58685. tail: null,
  58686. next: null,
  58687. bindingStartIndex: null,
  58688. creationMode: true,
  58689. viewHookStartIndex: null
  58690. };
  58691. return newView;
  58692. }
  58693. /**
  58694. * @param {?} index
  58695. * @param {?} type
  58696. * @param {?} native
  58697. * @param {?=} state
  58698. * @return {?}
  58699. */
  58700. function createLNode(index, type, native, state) {
  58701. var /** @type {?} */ parent = isParent ? previousOrParentNode :
  58702. previousOrParentNode && /** @type {?} */ (previousOrParentNode.parent);
  58703. var /** @type {?} */ query = (isParent ? currentQuery : previousOrParentNode && previousOrParentNode.query) ||
  58704. parent && parent.query && parent.query.child();
  58705. var /** @type {?} */ isState = state != null;
  58706. var /** @type {?} */ node = {
  58707. flags: type,
  58708. native: /** @type {?} */ (native),
  58709. view: currentView,
  58710. parent: /** @type {?} */ (parent),
  58711. child: null,
  58712. next: null,
  58713. nodeInjector: parent ? parent.nodeInjector : null,
  58714. data: isState ? /** @type {?} */ (state) : null,
  58715. query: query,
  58716. staticData: null
  58717. };
  58718. if ((type & 2 /* ViewOrElement */) === 2 /* ViewOrElement */ && isState) {
  58719. // Bit of a hack to bust through the readonly because there is a circular dep between
  58720. // ViewState and LNode.
  58721. ngDevMode && assertEqual((/** @type {?} */ (state)).node, null, 'viewState.node');
  58722. (/** @type {?} */ ((state))).node = node;
  58723. }
  58724. if (index != null) {
  58725. // We are Element or Container
  58726. ngDevMode && assertEqual(data.length, index, 'data.length not in sequence');
  58727. data[index] = node;
  58728. // Every node adds a value to the static data array to avoid a sparse array
  58729. if (index >= ngStaticData.length) {
  58730. ngStaticData[index] = null;
  58731. }
  58732. else {
  58733. node.staticData = /** @type {?} */ (ngStaticData[index]);
  58734. }
  58735. // Now link ourselves into the tree.
  58736. if (isParent) {
  58737. currentQuery = null;
  58738. if (previousOrParentNode.view === currentView ||
  58739. (previousOrParentNode.flags & 3 /* TYPE_MASK */) === 2 /* View */) {
  58740. // We are in the same view, which means we are adding content node to the parent View.
  58741. ngDevMode && assertEqual(previousOrParentNode.child, null, 'previousNode.child');
  58742. previousOrParentNode.child = node;
  58743. }
  58744. else {
  58745. // We are adding component view, so we don't link parent node child to this node.
  58746. }
  58747. }
  58748. else if (previousOrParentNode) {
  58749. ngDevMode && assertEqual(previousOrParentNode.next, null, 'previousNode.next');
  58750. previousOrParentNode.next = node;
  58751. }
  58752. }
  58753. previousOrParentNode = node;
  58754. isParent = true;
  58755. return node;
  58756. }
  58757. /**
  58758. * Resets the application state.
  58759. * @return {?}
  58760. */
  58761. function resetApplicationState() {
  58762. isParent = false;
  58763. previousOrParentNode = /** @type {?} */ ((null));
  58764. }
  58765. /**
  58766. *
  58767. * @template T
  58768. * @param {?} hostNode
  58769. * @param {?} template Template function with the instructions.
  58770. * @param {?} context to pass into the template.
  58771. * @param {?} providedRendererFactory
  58772. * @param {?} host Existing node to render into.
  58773. * @return {?}
  58774. */
  58775. /**
  58776. * @template T
  58777. * @param {?} node
  58778. * @param {?} viewState
  58779. * @param {?} componentOrContext
  58780. * @param {?=} template
  58781. * @return {?}
  58782. */
  58783. function renderComponentOrTemplate(node, viewState, componentOrContext, template) {
  58784. var /** @type {?} */ oldView = enterView(viewState, node);
  58785. try {
  58786. if (rendererFactory.begin) {
  58787. rendererFactory.begin();
  58788. }
  58789. if (template) {
  58790. ngStaticData = template.ngStaticData || (template.ngStaticData = /** @type {?} */ ([]));
  58791. template(/** @type {?} */ ((componentOrContext)), creationMode);
  58792. }
  58793. else {
  58794. // Element was stored at 0 and directive was stored at 1 in renderComponent
  58795. // so to refresh the component, r() needs to be called with (1, 0)
  58796. (/** @type {?} */ (componentOrContext.constructor)).ngComponentDef.r(1, 0);
  58797. }
  58798. }
  58799. finally {
  58800. if (rendererFactory.end) {
  58801. rendererFactory.end();
  58802. }
  58803. viewState.creationMode = false;
  58804. leaveView(oldView);
  58805. }
  58806. }
  58807. /**
  58808. * @return {?}
  58809. */
  58810. /**
  58811. * Makes a directive public to the DI system by adding it to an injector's bloom filter.
  58812. *
  58813. * @param {?} def The definition of the directive to be made public
  58814. * @return {?}
  58815. */
  58816. /**
  58817. * Searches for an instance of the given directive type up the injector tree and returns
  58818. * that instance if found.
  58819. *
  58820. * If not found, it will propagate up to the next parent injector until the token
  58821. * is found or the top is reached.
  58822. *
  58823. * Usage example (in factory function):
  58824. *
  58825. * class SomeDirective {
  58826. * constructor(directive: DirectiveA) {}
  58827. *
  58828. * static ngDirectiveDef = defineDirective({
  58829. * type: SomeDirective,
  58830. * factory: () => new SomeDirective(inject(DirectiveA))
  58831. * });
  58832. * }
  58833. *
  58834. * @template T
  58835. * @param {?} token The directive type to search for
  58836. * @param {?=} flags Injection flags (e.g. CheckParent)
  58837. * @return {?} The instance found
  58838. */
  58839. /**
  58840. * Creates an ElementRef and stores it on the injector.
  58841. * Or, if the ElementRef already exists, retrieves the existing ElementRef.
  58842. *
  58843. * @return {?} The ElementRef instance to use
  58844. */
  58845. /**
  58846. * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already
  58847. * exists, retrieves the existing TemplateRef.
  58848. *
  58849. * @template T
  58850. * @return {?} The TemplateRef instance to use
  58851. */
  58852. /**
  58853. * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef
  58854. * already exists, retrieves the existing ViewContainerRef.
  58855. *
  58856. * @return {?} The ViewContainerRef instance to use
  58857. */
  58858. /**
  58859. * Create DOM element. The instruction must later be followed by `elementEnd()` call.
  58860. *
  58861. * @param {?} index Index of the element in the data array
  58862. * @param {?=} nameOrComponentDef Name of the DOM Node or `ComponentDef`.
  58863. * @param {?=} attrs Statically bound set of attributes to be written into the DOM element on creation.
  58864. * @param {?=} localName A name under which a given element is exported.
  58865. *
  58866. * Attributes are passed as an array of strings where elements with an even index hold an attribute
  58867. * name and elements with an odd index hold an attribute value, ex.:
  58868. * ['id', 'warning5', 'class', 'alert']
  58869. * @return {?}
  58870. */
  58871. function elementStart(index, nameOrComponentDef, attrs, localName) {
  58872. var /** @type {?} */ node;
  58873. var /** @type {?} */ native;
  58874. if (nameOrComponentDef == null) {
  58875. // native node retrieval - used for exporting elements as tpl local variables (<div #foo>)
  58876. var /** @type {?} */ node_1 = /** @type {?} */ ((data[index]));
  58877. native = node_1 && (/** @type {?} */ (node_1)).native;
  58878. }
  58879. else {
  58880. ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
  58881. var /** @type {?} */ isHostElement = typeof nameOrComponentDef !== 'string';
  58882. var /** @type {?} */ name_1 = isHostElement ? (/** @type {?} */ (nameOrComponentDef)).tag : /** @type {?} */ (nameOrComponentDef);
  58883. if (name_1 === null) {
  58884. // TODO: future support for nameless components.
  58885. throw 'for now name is required';
  58886. }
  58887. else {
  58888. native = renderer.createElement(name_1);
  58889. var /** @type {?} */ componentView = null;
  58890. if (isHostElement) {
  58891. var /** @type {?} */ ngStaticData_1 = getTemplateStatic((/** @type {?} */ (nameOrComponentDef)).template);
  58892. componentView = addToViewTree(createViewState(-1, rendererFactory.createRenderer(native, (/** @type {?} */ (nameOrComponentDef)).rendererType), ngStaticData_1));
  58893. }
  58894. // Only component views should be added to the view tree directly. Embedded views are
  58895. // accessed through their containers because they may be removed / re-added later.
  58896. node = createLNode(index, 3 /* Element */, native, componentView);
  58897. if (node.staticData == null) {
  58898. ngDevMode && assertDataInRange(index - 1);
  58899. node.staticData = ngStaticData[index] =
  58900. createNodeStatic(name_1, attrs || null, null, localName || null);
  58901. }
  58902. if (attrs)
  58903. setUpAttributes(native, attrs);
  58904. appendChild(/** @type {?} */ ((node.parent)), native, currentView);
  58905. }
  58906. }
  58907. return native;
  58908. }
  58909. /**
  58910. * Gets static data from a template function or creates a new static
  58911. * data array if it doesn't already exist.
  58912. *
  58913. * @param {?} template The template from which to get static data
  58914. * @return {?} NgStaticData
  58915. */
  58916. function getTemplateStatic(template) {
  58917. return template.ngStaticData || (template.ngStaticData = /** @type {?} */ ([]));
  58918. }
  58919. /**
  58920. * @param {?} native
  58921. * @param {?} attrs
  58922. * @return {?}
  58923. */
  58924. function setUpAttributes(native, attrs) {
  58925. ngDevMode && assertEqual(attrs.length % 2, 0, 'attrs.length % 2');
  58926. var /** @type {?} */ isProceduralRenderer = (/** @type {?} */ (renderer)).setAttribute;
  58927. for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
  58928. isProceduralRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)).setAttribute))(native, attrs[i], attrs[i | 1]) :
  58929. native.setAttribute(attrs[i], attrs[i | 1]);
  58930. }
  58931. }
  58932. /**
  58933. * @param {?} text
  58934. * @param {?} token
  58935. * @return {?}
  58936. */
  58937. function createError(text, token) {
  58938. return new Error("Renderer: " + text + " [" + stringify$1(token) + "]");
  58939. }
  58940. /**
  58941. * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
  58942. *
  58943. * @param {?} factory
  58944. * @param {?} elementOrSelector Render element or CSS selector to locate the element.
  58945. * @return {?}
  58946. */
  58947. function locateHostElement(factory, elementOrSelector) {
  58948. ngDevMode && assertDataInRange(-1);
  58949. rendererFactory = factory;
  58950. var /** @type {?} */ defaultRenderer = factory.createRenderer(null, null);
  58951. var /** @type {?} */ rNode = typeof elementOrSelector === 'string' ?
  58952. ((/** @type {?} */ (defaultRenderer)).selectRootElement ?
  58953. (/** @type {?} */ (defaultRenderer)).selectRootElement(elementOrSelector) : /** @type {?} */ (((/** @type {?} */ (defaultRenderer)).querySelector))(elementOrSelector)) :
  58954. elementOrSelector;
  58955. if (ngDevMode && !rNode) {
  58956. if (typeof elementOrSelector === 'string') {
  58957. throw createError('Host node with selector not found:', elementOrSelector);
  58958. }
  58959. else {
  58960. throw createError('Host node is required:', elementOrSelector);
  58961. }
  58962. }
  58963. return rNode;
  58964. }
  58965. /**
  58966. * Creates the host LNode..
  58967. *
  58968. * @param {?} rNode Render host element.
  58969. * @param {?} def
  58970. * @return {?}
  58971. */
  58972. function hostElement(rNode, def) {
  58973. resetApplicationState();
  58974. createLNode(0, 3 /* Element */, rNode, createViewState(-1, renderer, getTemplateStatic(def.template)));
  58975. }
  58976. /**
  58977. * Adds an event listener to the current node.
  58978. *
  58979. * If an output exists on one of the node's directives, it also subscribes to the output
  58980. * and saves the subscription for later cleanup.
  58981. *
  58982. * @param {?} eventName Name of the event
  58983. * @param {?} listener The function to be called when event emits
  58984. * @param {?=} useCapture Whether or not to use capture in event listener.
  58985. * @return {?}
  58986. */
  58987. /**
  58988. * Mark the end of the element.
  58989. * @return {?}
  58990. */
  58991. function elementEnd() {
  58992. if (isParent) {
  58993. isParent = false;
  58994. }
  58995. else {
  58996. ngDevMode && assertHasParent();
  58997. previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent));
  58998. }
  58999. ngDevMode && assertNodeType(previousOrParentNode, 3 /* Element */);
  59000. var /** @type {?} */ query = previousOrParentNode.query;
  59001. query && query.addNode(previousOrParentNode);
  59002. }
  59003. /**
  59004. * Update an attribute on an Element. This is used with a `bind` instruction.
  59005. *
  59006. * @param {?} index The index of the element to update in the data array
  59007. * @param {?} attrName Name of attribute. Because it is going to DOM, this is not subject to
  59008. * renaming as port of minification.
  59009. * @param {?} value Value to write. This value will go through stringification.
  59010. * @return {?}
  59011. */
  59012. /**
  59013. * Update a property on an Element.
  59014. *
  59015. * If the property name also exists as an input property on one of the element's directives,
  59016. * the component property will be set instead of the element property. This check must
  59017. * be conducted at runtime so child components that add new \@Inputs don't have to be re-compiled.
  59018. *
  59019. * @template T
  59020. * @param {?} index The index of the element to update in the data array
  59021. * @param {?} propName Name of property. Because it is going to DOM, this is not subject to
  59022. * renaming as part of minification.
  59023. * @param {?} value New value to write.
  59024. * @return {?}
  59025. */
  59026. function elementProperty(index, propName, value) {
  59027. if (value === NO_CHANGE)
  59028. return;
  59029. var /** @type {?} */ node = /** @type {?} */ (data[index]);
  59030. var /** @type {?} */ staticData = /** @type {?} */ ((node.staticData));
  59031. // if staticData.inputs is undefined, a listener has created output staticData, but inputs haven't
  59032. // yet been checked
  59033. if (staticData.inputs === undefined) {
  59034. // mark inputs as checked
  59035. staticData.inputs = null;
  59036. staticData = generatePropertyAliases(node.flags, staticData, true);
  59037. }
  59038. var /** @type {?} */ inputData = staticData.inputs;
  59039. var /** @type {?} */ dataValue;
  59040. if (inputData && (dataValue = inputData[propName])) {
  59041. setInputsForProperty(dataValue, value);
  59042. }
  59043. else {
  59044. var /** @type {?} */ native = node.native;
  59045. (/** @type {?} */ (renderer)).setProperty ?
  59046. (/** @type {?} */ (renderer)).setProperty(native, propName, value) :
  59047. native.setProperty ? native.setProperty(propName, value) :
  59048. (/** @type {?} */ (native))[propName] = value;
  59049. }
  59050. }
  59051. /**
  59052. * Constructs a LNodeStatic object from the arguments.
  59053. *
  59054. * @param {?} tagName
  59055. * @param {?} attrs
  59056. * @param {?} containerStatic
  59057. * @param {?} localName
  59058. * @return {?} the LNodeStatic object
  59059. */
  59060. function createNodeStatic(tagName, attrs, containerStatic, localName) {
  59061. return {
  59062. tagName: tagName,
  59063. attrs: attrs,
  59064. localNames: localName ? [localName, -1] : null,
  59065. initialInputs: undefined,
  59066. inputs: undefined,
  59067. outputs: undefined,
  59068. containerStatic: containerStatic
  59069. };
  59070. }
  59071. /**
  59072. * Given a list of directive indices and minified input names, sets the
  59073. * input properties on the corresponding directives.
  59074. * @param {?} inputs
  59075. * @param {?} value
  59076. * @return {?}
  59077. */
  59078. function setInputsForProperty(inputs, value) {
  59079. for (var /** @type {?} */ i = 0; i < inputs.length; i += 2) {
  59080. ngDevMode && assertDataInRange(/** @type {?} */ (inputs[i]));
  59081. data[/** @type {?} */ (inputs[i])][inputs[i | 1]] = value;
  59082. }
  59083. }
  59084. /**
  59085. * This function consolidates all the inputs or outputs defined by directives
  59086. * on this node into one object and stores it in ngStaticData so it can
  59087. * be shared between all templates of this type.
  59088. *
  59089. * @param {?} flags
  59090. * @param {?} data
  59091. * @param {?=} isInputData
  59092. * @return {?}
  59093. */
  59094. function generatePropertyAliases(flags, data, isInputData) {
  59095. if (isInputData === void 0) { isInputData = false; }
  59096. var /** @type {?} */ start = flags >> 12;
  59097. var /** @type {?} */ size = (flags & 4092 /* SIZE_MASK */) >> 2;
  59098. for (var /** @type {?} */ i = start, /** @type {?} */ ii = start + size; i < ii; i++) {
  59099. var /** @type {?} */ directiveDef = /** @type {?} */ (((ngStaticData))[i]);
  59100. var /** @type {?} */ propertyAliasMap = isInputData ? directiveDef.inputs : directiveDef.outputs;
  59101. for (var /** @type {?} */ publicName in propertyAliasMap) {
  59102. if (propertyAliasMap.hasOwnProperty(publicName)) {
  59103. var /** @type {?} */ internalName = propertyAliasMap[publicName];
  59104. var /** @type {?} */ staticDirData = isInputData ? (data.inputs || (data.inputs = {})) :
  59105. (data.outputs || (data.outputs = {}));
  59106. var /** @type {?} */ hasProperty = staticDirData.hasOwnProperty(publicName);
  59107. hasProperty ? staticDirData[publicName].push(i, internalName) :
  59108. (staticDirData[publicName] = [i, internalName]);
  59109. }
  59110. }
  59111. }
  59112. return data;
  59113. }
  59114. /**
  59115. * Add or remove a class in a classList.
  59116. *
  59117. * This instruction is meant to handle the [class.foo]="exp" case
  59118. *
  59119. * @template T
  59120. * @param {?} index The index of the element to update in the data array
  59121. * @param {?} className Name of class to toggle. Because it is going to DOM, this is not subject to
  59122. * renaming as part of minification.
  59123. * @param {?} value A value indicating if a given class should be added or removed.
  59124. * @return {?}
  59125. */
  59126. /**
  59127. * Update a given style on an Element.
  59128. *
  59129. * @template T
  59130. * @param {?} index Index of the element to change in the data array
  59131. * @param {?} styleName Name of property. Because it is going to DOM this is not subject to
  59132. * renaming as part of minification.
  59133. * @param {?} value New value to write (null to remove).
  59134. * @param {?=} suffix Suffix to add to style's value (optional).
  59135. * @return {?}
  59136. */
  59137. function elementStyle(index, styleName, value, suffix) {
  59138. if (value !== NO_CHANGE) {
  59139. var /** @type {?} */ lElement = /** @type {?} */ (data[index]);
  59140. if (value == null) {
  59141. (/** @type {?} */ (renderer)).removeStyle ?
  59142. (/** @type {?} */ (renderer))
  59143. .removeStyle(lElement.native, styleName, RendererStyleFlags3.DashCase) :
  59144. lElement.native.style.removeProperty(styleName);
  59145. }
  59146. else {
  59147. (/** @type {?} */ (renderer)).setStyle ?
  59148. (/** @type {?} */ (renderer))
  59149. .setStyle(lElement.native, styleName, suffix ? stringify$1(value) + suffix : stringify$1(value), RendererStyleFlags3.DashCase) :
  59150. lElement.native.style.setProperty(styleName, suffix ? stringify$1(value) + suffix : stringify$1(value));
  59151. }
  59152. }
  59153. }
  59154. /**
  59155. * Create static text node
  59156. *
  59157. * @param {?} index Index of the node in the data array.
  59158. * @param {?=} value Value to write. This value will be stringified.
  59159. * If value is not provided than the actual creation of the text node is delayed.
  59160. * @return {?}
  59161. */
  59162. function text(index, value) {
  59163. ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
  59164. var /** @type {?} */ textNode = value != null ?
  59165. ((/** @type {?} */ (renderer)).createText ?
  59166. (/** @type {?} */ (renderer)).createText(stringify$1(value)) : /** @type {?} */ (((/** @type {?} */ (renderer)).createTextNode))(stringify$1(value))) :
  59167. null;
  59168. var /** @type {?} */ node = createLNode(index, 3 /* Element */, textNode);
  59169. // Text nodes are self closing.
  59170. isParent = false;
  59171. appendChild(/** @type {?} */ ((node.parent)), textNode, currentView);
  59172. }
  59173. /**
  59174. * Create text node with binding
  59175. * Bindings should be handled externally with the proper bind(1-8) method
  59176. *
  59177. * @template T
  59178. * @param {?} index Index of the node in the data array.
  59179. * @param {?} value Stringified value to write.
  59180. * @return {?}
  59181. */
  59182. function textBinding(index, value) {
  59183. // TODO(misko): I don't think index < nodes.length check is needed here.
  59184. var /** @type {?} */ existingNode = index < data.length && /** @type {?} */ (data[index]);
  59185. if (existingNode && existingNode.native) {
  59186. // If DOM node exists and value changed, update textContent
  59187. value !== NO_CHANGE &&
  59188. ((/** @type {?} */ (renderer)).setValue ?
  59189. (/** @type {?} */ (renderer)).setValue(existingNode.native, stringify$1(value)) :
  59190. existingNode.native.textContent = stringify$1(value));
  59191. }
  59192. else if (existingNode) {
  59193. // Node was created but DOM node creation was delayed. Create and append now.
  59194. existingNode.native =
  59195. ((/** @type {?} */ (renderer)).createText ?
  59196. (/** @type {?} */ (renderer)).createText(stringify$1(value)) : /** @type {?} */ (((/** @type {?} */ (renderer)).createTextNode))(stringify$1(value)));
  59197. insertChild(existingNode, currentView);
  59198. }
  59199. else {
  59200. text(index, value);
  59201. }
  59202. }
  59203. /**
  59204. * @template T
  59205. * @param {?} index
  59206. * @param {?=} directive
  59207. * @param {?=} directiveDef
  59208. * @param {?=} localName
  59209. * @return {?}
  59210. */
  59211. function directive(index, directive, directiveDef, localName) {
  59212. var /** @type {?} */ instance;
  59213. if (directive == null) {
  59214. // return existing
  59215. ngDevMode && assertDataInRange(index);
  59216. instance = data[index];
  59217. }
  59218. else {
  59219. ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
  59220. ngDevMode && assertPreviousIsParent();
  59221. var /** @type {?} */ flags = /** @type {?} */ ((previousOrParentNode)).flags;
  59222. var /** @type {?} */ size = flags & 4092;
  59223. if (size === 0) {
  59224. flags =
  59225. (index << 12 /* INDX_SHIFT */) | 4 /* SIZE_SKIP */ | flags & 3 /* TYPE_MASK */;
  59226. }
  59227. else {
  59228. flags += 4 /* SIZE_SKIP */;
  59229. } /** @type {?} */
  59230. ((previousOrParentNode)).flags = flags;
  59231. ngDevMode && assertDataInRange(index - 1);
  59232. Object.defineProperty(directive, NG_HOST_SYMBOL, { enumerable: false, value: previousOrParentNode });
  59233. data[index] = instance = directive;
  59234. if (index >= ngStaticData.length) {
  59235. ngStaticData[index] = /** @type {?} */ ((directiveDef));
  59236. if (localName) {
  59237. ngDevMode &&
  59238. assertNotNull(previousOrParentNode.staticData, 'previousOrParentNode.staticData');
  59239. var /** @type {?} */ nodeStaticData = /** @type {?} */ ((/** @type {?} */ ((previousOrParentNode)).staticData));
  59240. (nodeStaticData.localNames || (nodeStaticData.localNames = [])).push(localName, index);
  59241. }
  59242. }
  59243. var /** @type {?} */ diPublic_1 = /** @type {?} */ ((directiveDef)).diPublic;
  59244. if (diPublic_1) {
  59245. diPublic_1(/** @type {?} */ ((directiveDef)));
  59246. }
  59247. var /** @type {?} */ staticData = /** @type {?} */ ((previousOrParentNode.staticData));
  59248. if (staticData && staticData.attrs) {
  59249. setInputsFromAttrs(instance, /** @type {?} */ ((directiveDef)).inputs, staticData);
  59250. }
  59251. }
  59252. return instance;
  59253. }
  59254. /**
  59255. * Sets initial input properties on directive instances from attribute data
  59256. *
  59257. * @template T
  59258. * @param {?} instance Instance of the directive on which to set the initial inputs
  59259. * @param {?} inputs The list of inputs from the directive def
  59260. * @param {?} staticData The static data for this node
  59261. * @return {?}
  59262. */
  59263. function setInputsFromAttrs(instance, inputs, staticData) {
  59264. var /** @type {?} */ directiveIndex = ((previousOrParentNode.flags & 4092 /* SIZE_MASK */) >> 2 /* SIZE_SHIFT */) - 1;
  59265. var /** @type {?} */ initialInputData = /** @type {?} */ (staticData.initialInputs);
  59266. if (initialInputData === undefined || directiveIndex >= initialInputData.length) {
  59267. initialInputData = generateInitialInputs(directiveIndex, inputs, staticData);
  59268. }
  59269. var /** @type {?} */ initialInputs = initialInputData[directiveIndex];
  59270. if (initialInputs) {
  59271. for (var /** @type {?} */ i = 0; i < initialInputs.length; i += 2) {
  59272. (/** @type {?} */ (instance))[initialInputs[i]] = initialInputs[i | 1];
  59273. }
  59274. }
  59275. }
  59276. /**
  59277. * Generates initialInputData for a node and stores it in the template's static storage
  59278. * so subsequent template invocations don't have to recalculate it.
  59279. *
  59280. * initialInputData is an array containing values that need to be set as input properties
  59281. * for directives on this node, but only once on creation. We need this array to support
  59282. * the case where you set an \@Input property of a directive using attribute-like syntax.
  59283. * e.g. if you have a `name` \@Input, you can set it once like this:
  59284. *
  59285. * <my-component name="Bess"></my-component>
  59286. *
  59287. * @param {?} directiveIndex Index to store the initial input data
  59288. * @param {?} inputs The list of inputs from the directive def
  59289. * @param {?} staticData The static data on this node
  59290. * @return {?}
  59291. */
  59292. function generateInitialInputs(directiveIndex, inputs, staticData) {
  59293. var /** @type {?} */ initialInputData = staticData.initialInputs || (staticData.initialInputs = []);
  59294. initialInputData[directiveIndex] = null;
  59295. var /** @type {?} */ attrs = /** @type {?} */ ((staticData.attrs));
  59296. for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
  59297. var /** @type {?} */ attrName = attrs[i];
  59298. var /** @type {?} */ minifiedInputName = inputs[attrName];
  59299. if (minifiedInputName !== undefined) {
  59300. var /** @type {?} */ inputsToStore = initialInputData[directiveIndex] || (initialInputData[directiveIndex] = []);
  59301. inputsToStore.push(minifiedInputName, attrs[i | 1]);
  59302. }
  59303. }
  59304. return initialInputData;
  59305. }
  59306. /**
  59307. * @param {?} lifecycle
  59308. * @param {?=} self
  59309. * @param {?=} method
  59310. * @return {?}
  59311. */
  59312. /**
  59313. * Iterates over view hook functions and calls them.
  59314. * @return {?}
  59315. */
  59316. function executeViewHooks() {
  59317. if (viewHookStartIndex == null)
  59318. return;
  59319. // Instead of using splice to remove init hooks after their first run (expensive), we
  59320. // shift over the AFTER_CHECKED hooks as we call them and truncate once at the end.
  59321. var /** @type {?} */ checkIndex = /** @type {?} */ (viewHookStartIndex);
  59322. var /** @type {?} */ writeIndex = checkIndex;
  59323. while (checkIndex < data.length) {
  59324. // Call lifecycle hook with its context
  59325. data[checkIndex + 1].call(data[checkIndex + 2]);
  59326. if (data[checkIndex] === 16 /* AFTER_VIEW_CHECKED */) {
  59327. // We know if the writeIndex falls behind that there is an init that needs to
  59328. // be overwritten.
  59329. if (writeIndex < checkIndex) {
  59330. data[writeIndex] = data[checkIndex];
  59331. data[writeIndex + 1] = data[checkIndex + 1];
  59332. data[writeIndex + 2] = data[checkIndex + 2];
  59333. }
  59334. writeIndex += 3;
  59335. }
  59336. checkIndex += 3;
  59337. }
  59338. // Truncate once at the writeIndex
  59339. data.length = writeIndex;
  59340. }
  59341. /**
  59342. * Creates an LContainer.
  59343. *
  59344. * Only `LView`s can go into `LContainer`.
  59345. *
  59346. * @param {?} index The index of the container in the data array
  59347. * @param {?=} template Optional inline template
  59348. * @param {?=} tagName The name of the container element, if applicable
  59349. * @param {?=} attrs The attrs attached to the container, if applicable
  59350. * @param {?=} localName
  59351. * @return {?}
  59352. */
  59353. function containerStart(index, template, tagName, attrs, localName) {
  59354. ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
  59355. // If the direct parent of the container is a view, its views (including its comment)
  59356. // will need to be added through insertView() when its parent view is being inserted.
  59357. // For now, it is marked "headless" so we know to append its views later.
  59358. var /** @type {?} */ comment = renderer.createComment(ngDevMode ? 'container' : '');
  59359. var /** @type {?} */ renderParent = null;
  59360. var /** @type {?} */ currentParent = isParent ? previousOrParentNode : /** @type {?} */ ((previousOrParentNode.parent));
  59361. ngDevMode && assertNotEqual(currentParent, null, 'currentParent');
  59362. if (appendChild(currentParent, comment, currentView)) {
  59363. // we are adding to an Element which is either:
  59364. // - Not a component (will not be re-projected, just added)
  59365. // - View of the Component
  59366. renderParent = /** @type {?} */ (currentParent);
  59367. }
  59368. var /** @type {?} */ node = createLNode(index, 0 /* Container */, comment, /** @type {?} */ ({
  59369. views: [],
  59370. nextIndex: 0, renderParent: renderParent,
  59371. template: template == null ? null : template,
  59372. next: null,
  59373. parent: currentView
  59374. }));
  59375. if (node.staticData == null) {
  59376. node.staticData = ngStaticData[index] =
  59377. createNodeStatic(tagName || null, attrs || null, [], localName || null);
  59378. }
  59379. // Containers are added to the current view tree instead of their embedded views
  59380. // because views can be removed and re-inserted.
  59381. addToViewTree(node.data);
  59382. }
  59383. /**
  59384. * @return {?}
  59385. */
  59386. function containerEnd() {
  59387. if (isParent) {
  59388. isParent = false;
  59389. }
  59390. else {
  59391. ngDevMode && assertHasParent();
  59392. previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent));
  59393. }
  59394. ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
  59395. var /** @type {?} */ query = previousOrParentNode.query;
  59396. query && query.addNode(previousOrParentNode);
  59397. }
  59398. /**
  59399. * Sets a container up to receive views.
  59400. *
  59401. * @param {?} index The index of the container in the data array
  59402. * @return {?}
  59403. */
  59404. function containerRefreshStart(index) {
  59405. ngDevMode && assertDataInRange(index);
  59406. previousOrParentNode = /** @type {?} */ (data[index]);
  59407. ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
  59408. isParent = true;
  59409. (/** @type {?} */ (previousOrParentNode)).data.nextIndex = 0;
  59410. }
  59411. /**
  59412. * Marks the end of the LContainer.
  59413. *
  59414. * Marking the end of ViewContainer is the time when to child Views get inserted or removed.
  59415. * @return {?}
  59416. */
  59417. function containerRefreshEnd() {
  59418. if (isParent) {
  59419. isParent = false;
  59420. }
  59421. else {
  59422. ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
  59423. ngDevMode && assertHasParent();
  59424. previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent));
  59425. }
  59426. ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
  59427. var /** @type {?} */ container = /** @type {?} */ (previousOrParentNode);
  59428. ngDevMode && assertNodeType(container, 0 /* Container */);
  59429. var /** @type {?} */ nextIndex = container.data.nextIndex;
  59430. while (nextIndex < container.data.views.length) {
  59431. // remove extra view.
  59432. removeView(container, nextIndex);
  59433. }
  59434. }
  59435. /**
  59436. * Creates an LView.
  59437. *
  59438. * @param {?} viewBlockId The ID of this view
  59439. * @return {?} Whether or not this view is in creation mode
  59440. */
  59441. function viewStart(viewBlockId) {
  59442. var /** @type {?} */ container = /** @type {?} */ ((isParent ? previousOrParentNode : /** @type {?} */ ((previousOrParentNode.parent))));
  59443. ngDevMode && assertNodeType(container, 0 /* Container */);
  59444. var /** @type {?} */ containerState = container.data;
  59445. var /** @type {?} */ views = containerState.views;
  59446. var /** @type {?} */ existingView = !creationMode && containerState.nextIndex < views.length && views[containerState.nextIndex];
  59447. var /** @type {?} */ viewUpdateMode = existingView && viewBlockId === (/** @type {?} */ (existingView)).data.id;
  59448. if (viewUpdateMode) {
  59449. previousOrParentNode = views[containerState.nextIndex++];
  59450. ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
  59451. isParent = true;
  59452. enterView((/** @type {?} */ (existingView)).data, /** @type {?} */ (previousOrParentNode));
  59453. }
  59454. else {
  59455. // When we create a new View, we always reset the state of the instructions.
  59456. var /** @type {?} */ newViewState = createViewState(viewBlockId, renderer, initViewStaticData(viewBlockId, container));
  59457. enterView(newViewState, createLNode(null, 2 /* View */, null, newViewState));
  59458. containerState.nextIndex++;
  59459. }
  59460. return !viewUpdateMode;
  59461. }
  59462. /**
  59463. * Initialize the static data for the active view.
  59464. *
  59465. * Each embedded view needs to set the global ngStaticData variable to the static data for
  59466. * that view. Otherwise, the view's static data for a particular node would overwrite
  59467. * the staticdata for a node in the view above it with the same index (since it's in the
  59468. * same template).
  59469. *
  59470. * @param {?} viewIndex The index of the view's static data in containerStatic
  59471. * @param {?} parent The parent container in which to look for the view's static data
  59472. * @return {?} NgStaticData
  59473. */
  59474. function initViewStaticData(viewIndex, parent) {
  59475. ngDevMode && assertNodeType(parent, 0 /* Container */);
  59476. var /** @type {?} */ containerStatic = (/** @type {?} */ (((parent)).staticData)).containerStatic;
  59477. if (viewIndex >= containerStatic.length || containerStatic[viewIndex] == null) {
  59478. containerStatic[viewIndex] = [];
  59479. }
  59480. return containerStatic[viewIndex];
  59481. }
  59482. /**
  59483. * Marks the end of the LView.
  59484. * @return {?}
  59485. */
  59486. function viewEnd() {
  59487. isParent = false;
  59488. var /** @type {?} */ viewNode = previousOrParentNode = /** @type {?} */ (currentView.node);
  59489. var /** @type {?} */ container = /** @type {?} */ (previousOrParentNode.parent);
  59490. ngDevMode && assertNodeType(viewNode, 2 /* View */);
  59491. ngDevMode && assertNodeType(container, 0 /* Container */);
  59492. var /** @type {?} */ containerState = container.data;
  59493. var /** @type {?} */ previousView = containerState.nextIndex <= containerState.views.length ? /** @type {?} */ (containerState.views[containerState.nextIndex - 1]) :
  59494. null;
  59495. var /** @type {?} */ viewIdChanged = previousView == null ? true : previousView.data.id !== viewNode.data.id;
  59496. if (viewIdChanged) {
  59497. insertView(container, viewNode, containerState.nextIndex - 1);
  59498. currentView.creationMode = false;
  59499. }
  59500. leaveView(/** @type {?} */ ((/** @type {?} */ ((currentView)).parent)));
  59501. ngDevMode && assertEqual(isParent, false, 'isParent');
  59502. ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
  59503. }
  59504. /**
  59505. * Refreshes the component view.
  59506. *
  59507. * In other words, enters the component's view and processes it to update bindings, queries, etc.
  59508. *
  59509. * @param directiveIndex
  59510. * @param elementIndex
  59511. * @param template
  59512. */
  59513. var componentRefresh = function (directiveIndex, elementIndex, template) {
  59514. ngDevMode && assertDataInRange(elementIndex);
  59515. var /** @type {?} */ element = /** @type {?} */ (((data))[elementIndex]);
  59516. ngDevMode && assertNodeType(element, 3 /* Element */);
  59517. ngDevMode && assertNotEqual(element.data, null, 'isComponent');
  59518. ngDevMode && assertDataInRange(directiveIndex);
  59519. var /** @type {?} */ hostView = /** @type {?} */ ((element.data));
  59520. ngDevMode && assertNotEqual(hostView, null, 'hostView');
  59521. var /** @type {?} */ directive = data[directiveIndex];
  59522. var /** @type {?} */ oldView = enterView(hostView, element);
  59523. try {
  59524. template(directive, creationMode);
  59525. }
  59526. finally {
  59527. hostView.creationMode = false;
  59528. leaveView(oldView);
  59529. }
  59530. };
  59531. /**
  59532. * Instruction to distribute projectable nodes among <ng-content> occurrences in a given template.
  59533. * It takes all the selectors from the entire component's template and decides where
  59534. * each projected node belongs (it re-distributes nodes among "buckets" where each "bucket" is
  59535. * backed by a selector).
  59536. *
  59537. * @param {?=} selectors
  59538. * @return {?}
  59539. */
  59540. /**
  59541. * Inserts previously re-distributed projected nodes. This instruction must be preceded by a call
  59542. * to the projectionDef instruction.
  59543. *
  59544. * @param {?} nodeIndex
  59545. * @param {?} localIndex - index under which distribution of projected nodes was memorized
  59546. * @param {?=} selectorIndex - 0 means <ng-content> without any selector
  59547. * @return {?}
  59548. */
  59549. /**
  59550. * Adds a ViewState or a ContainerState to the end of the current view tree.
  59551. *
  59552. * This structure will be used to traverse through nested views to remove listeners
  59553. * and call onDestroy callbacks.
  59554. *
  59555. * @template T
  59556. * @param {?} state The ViewState or ContainerState to add to the view tree
  59557. * @return {?} The state passed in
  59558. */
  59559. function addToViewTree(state) {
  59560. currentView.tail ? (currentView.tail.next = state) : (currentView.child = state);
  59561. currentView.tail = state;
  59562. return state;
  59563. }
  59564. /**
  59565. * A special value which designates that a value has not changed.
  59566. */
  59567. var NO_CHANGE = /** @type {?} */ ({});
  59568. /**
  59569. * Create interpolation bindings with variable number of arguments.
  59570. *
  59571. * If any of the arguments change, then the interpolation is concatenated
  59572. * and causes an update.
  59573. *
  59574. * @param {?} values an array of values to diff.
  59575. * @return {?}
  59576. */
  59577. /**
  59578. * Create a single value binding without interpolation.
  59579. *
  59580. * @template T
  59581. * @param {?} value Value to diff
  59582. * @return {?}
  59583. */
  59584. function bind(value) {
  59585. var /** @type {?} */ different;
  59586. if (different = creationMode) {
  59587. if (typeof currentView.bindingStartIndex !== 'number') {
  59588. bindingIndex = currentView.bindingStartIndex = data.length;
  59589. }
  59590. data[bindingIndex++] = value;
  59591. }
  59592. else {
  59593. if (different = value !== NO_CHANGE && isDifferent(data[bindingIndex], value)) {
  59594. data[bindingIndex] = value;
  59595. }
  59596. bindingIndex++;
  59597. }
  59598. return different ? value : NO_CHANGE;
  59599. }
  59600. /**
  59601. * Create an interpolation bindings with 1 arguments.
  59602. *
  59603. * @param {?} prefix static value used for concatenation only.
  59604. * @param {?} value value checked for change.
  59605. * @param {?} suffix static value used for concatenation only.
  59606. * @return {?}
  59607. */
  59608. function bind1(prefix, value, suffix) {
  59609. return bind(value) === NO_CHANGE ? NO_CHANGE : prefix + stringify$1(value) + suffix;
  59610. }
  59611. /**
  59612. * Create an interpolation bindings with 2 arguments.
  59613. *
  59614. * @param {?} prefix
  59615. * @param {?} v0 value checked for change
  59616. * @param {?} i0
  59617. * @param {?} v1 value checked for change
  59618. * @param {?} suffix
  59619. * @return {?}
  59620. */
  59621. /**
  59622. * Create an interpolation bindings with 3 arguments.
  59623. *
  59624. * @param {?} prefix
  59625. * @param {?} v0
  59626. * @param {?} i0
  59627. * @param {?} v1
  59628. * @param {?} i1
  59629. * @param {?} v2
  59630. * @param {?} suffix
  59631. * @return {?}
  59632. */
  59633. /**
  59634. * Create an interpolation binding with 4 arguments.
  59635. *
  59636. * @param {?} prefix
  59637. * @param {?} v0
  59638. * @param {?} i0
  59639. * @param {?} v1
  59640. * @param {?} i1
  59641. * @param {?} v2
  59642. * @param {?} i2
  59643. * @param {?} v3
  59644. * @param {?} suffix
  59645. * @return {?}
  59646. */
  59647. /**
  59648. * Create an interpolation binding with 5 arguments.
  59649. *
  59650. * @param {?} prefix
  59651. * @param {?} v0
  59652. * @param {?} i0
  59653. * @param {?} v1
  59654. * @param {?} i1
  59655. * @param {?} v2
  59656. * @param {?} i2
  59657. * @param {?} v3
  59658. * @param {?} i3
  59659. * @param {?} v4
  59660. * @param {?} suffix
  59661. * @return {?}
  59662. */
  59663. /**
  59664. * Create an interpolation binding with 6 arguments.
  59665. *
  59666. * @param {?} prefix
  59667. * @param {?} v0
  59668. * @param {?} i0
  59669. * @param {?} v1
  59670. * @param {?} i1
  59671. * @param {?} v2
  59672. * @param {?} i2
  59673. * @param {?} v3
  59674. * @param {?} i3
  59675. * @param {?} v4
  59676. * @param {?} i4
  59677. * @param {?} v5
  59678. * @param {?} suffix
  59679. * @return {?}
  59680. */
  59681. /**
  59682. * Create an interpolation binding with 7 arguments.
  59683. *
  59684. * @param {?} prefix
  59685. * @param {?} v0
  59686. * @param {?} i0
  59687. * @param {?} v1
  59688. * @param {?} i1
  59689. * @param {?} v2
  59690. * @param {?} i2
  59691. * @param {?} v3
  59692. * @param {?} i3
  59693. * @param {?} v4
  59694. * @param {?} i4
  59695. * @param {?} v5
  59696. * @param {?} i5
  59697. * @param {?} v6
  59698. * @param {?} suffix
  59699. * @return {?}
  59700. */
  59701. /**
  59702. * Create an interpolation binding with 8 arguments.
  59703. *
  59704. * @param {?} prefix
  59705. * @param {?} v0
  59706. * @param {?} i0
  59707. * @param {?} v1
  59708. * @param {?} i1
  59709. * @param {?} v2
  59710. * @param {?} i2
  59711. * @param {?} v3
  59712. * @param {?} i3
  59713. * @param {?} v4
  59714. * @param {?} i4
  59715. * @param {?} v5
  59716. * @param {?} i5
  59717. * @param {?} v6
  59718. * @param {?} i6
  59719. * @param {?} v7
  59720. * @param {?} suffix
  59721. * @return {?}
  59722. */
  59723. /**
  59724. * @template T
  59725. * @param {?} index
  59726. * @param {?=} value
  59727. * @return {?}
  59728. */
  59729. /**
  59730. * @template T
  59731. * @param {?} predicate
  59732. * @param {?=} descend
  59733. * @param {?=} read
  59734. * @return {?}
  59735. */
  59736. /**
  59737. * @return {?}
  59738. */
  59739. function assertPreviousIsParent() {
  59740. assertEqual(isParent, true, 'isParent');
  59741. }
  59742. /**
  59743. * @return {?}
  59744. */
  59745. function assertHasParent() {
  59746. assertNotEqual(previousOrParentNode.parent, null, 'isParent');
  59747. }
  59748. /**
  59749. * @param {?} index
  59750. * @param {?=} arr
  59751. * @return {?}
  59752. */
  59753. function assertDataInRange(index, arr) {
  59754. if (arr == null)
  59755. arr = data;
  59756. assertLessThan(arr ? arr.length : 0, index, 'data.length');
  59757. }
  59758. /**
  59759. * @fileoverview added by tsickle
  59760. * @suppress {checkTypes} checked by tsc
  59761. */
  59762. /**
  59763. * @license
  59764. * Copyright Google Inc. All Rights Reserved.
  59765. *
  59766. * Use of this source code is governed by an MIT-style license that can be
  59767. * found in the LICENSE file at https://angular.io/license
  59768. */
  59769. /**
  59770. * Options that control how the component should be bootstrapped.
  59771. * @record
  59772. */
  59773. /**
  59774. * Bootstraps a component, then creates and returns a `ComponentRef` for that component.
  59775. *
  59776. * @template T
  59777. * @param {?} componentType Component to bootstrap
  59778. * @param {?} opts
  59779. * @return {?}
  59780. */
  59781. // TODO: A hack to not pull in the NullInjector from @angular/core.
  59782. /**
  59783. * Bootstraps a Component into an existing host element and returns an instance
  59784. * of the component.
  59785. *
  59786. * @template T
  59787. * @param {?} componentType Component to bootstrap
  59788. * @param {?=} opts
  59789. * @return {?}
  59790. */
  59791. function renderComponent(componentType, opts) {
  59792. if (opts === void 0) { opts = {}; }
  59793. var /** @type {?} */ rendererFactory = opts.rendererFactory || domRendererFactory3;
  59794. var /** @type {?} */ componentDef = componentType.ngComponentDef;
  59795. var /** @type {?} */ component;
  59796. var /** @type {?} */ hostNode = locateHostElement(rendererFactory, opts.host || componentDef.tag);
  59797. var /** @type {?} */ oldView = enterView(createViewState(-1, rendererFactory.createRenderer(hostNode, componentDef.rendererType), []), /** @type {?} */ ((null)));
  59798. try {
  59799. // Create element node at index 0 in data array
  59800. hostElement(hostNode, componentDef);
  59801. // Create directive instance with n() and store at index 1 in data array (el is 0)
  59802. component = directive(1, componentDef.n(), componentDef);
  59803. }
  59804. finally {
  59805. leaveView(oldView);
  59806. }
  59807. opts.features && opts.features.forEach(function (feature) { return feature(component, componentDef); });
  59808. detectChanges(component);
  59809. return component;
  59810. }
  59811. /**
  59812. * @template T
  59813. * @param {?} component
  59814. * @return {?}
  59815. */
  59816. function detectChanges(component) {
  59817. ngDevMode && assertNotNull(component, 'component');
  59818. var /** @type {?} */ hostNode = /** @type {?} */ ((/** @type {?} */ (component))[NG_HOST_SYMBOL]);
  59819. if (ngDevMode && !hostNode) {
  59820. createError('Not a directive instance', component);
  59821. }
  59822. ngDevMode && assertNotNull(hostNode.data, 'hostNode.data');
  59823. renderComponentOrTemplate(hostNode, hostNode.view, component);
  59824. isDirty = false;
  59825. }
  59826. var isDirty = false;
  59827. /**
  59828. * @template T
  59829. * @param {?} component
  59830. * @param {?=} scheduler
  59831. * @return {?}
  59832. */
  59833. /**
  59834. * @template T
  59835. * @param {?} component
  59836. * @return {?}
  59837. */
  59838. /**
  59839. * @fileoverview added by tsickle
  59840. * @suppress {checkTypes} checked by tsc
  59841. */
  59842. /**
  59843. * @license
  59844. * Copyright Google Inc. All Rights Reserved.
  59845. *
  59846. * Use of this source code is governed by an MIT-style license that can be
  59847. * found in the LICENSE file at https://angular.io/license
  59848. */
  59849. /**
  59850. * Create a component definition object.
  59851. *
  59852. *
  59853. * # Example
  59854. * ```
  59855. * class MyDirective {
  59856. * // Generated by Angular Template Compiler
  59857. * // [Symbol] syntax will not be supported by TypeScript until v2.7
  59858. * static [COMPONENT_DEF_SYMBOL] = defineComponent({
  59859. * ...
  59860. * });
  59861. * }
  59862. * ```
  59863. * @template T
  59864. * @param {?} componentDefinition
  59865. * @return {?}
  59866. */
  59867. function defineComponent(componentDefinition) {
  59868. var /** @type {?} */ def = /** @type {?} */ ({
  59869. type: componentDefinition.type,
  59870. diPublic: null,
  59871. n: componentDefinition.factory,
  59872. tag: (/** @type {?} */ (componentDefinition)).tag || /** @type {?} */ ((null)),
  59873. template: (/** @type {?} */ (componentDefinition)).template || /** @type {?} */ ((null)),
  59874. r: componentDefinition.refresh ||
  59875. function (d, e) { componentRefresh(d, e, componentDefinition.template); },
  59876. h: componentDefinition.hostBindings || noop$1,
  59877. inputs: invertObject(componentDefinition.inputs),
  59878. outputs: invertObject(componentDefinition.outputs),
  59879. methods: invertObject(componentDefinition.methods),
  59880. rendererType: resolveRendererType2(componentDefinition.rendererType) || null,
  59881. });
  59882. var /** @type {?} */ feature = componentDefinition.features;
  59883. feature && feature.forEach(function (fn) { return fn(def); });
  59884. return def;
  59885. }
  59886. /**
  59887. * @template T
  59888. * @param {?} definition
  59889. * @return {?}
  59890. */
  59891. /**
  59892. * @template T
  59893. * @param {?} definition
  59894. * @return {?}
  59895. */
  59896. var EMPTY$1 = {};
  59897. /**
  59898. * @return {?}
  59899. */
  59900. function noop$1() { }
  59901. /**
  59902. * Swaps the keys and values of an object.
  59903. * @param {?} obj
  59904. * @return {?}
  59905. */
  59906. function invertObject(obj) {
  59907. if (obj == null)
  59908. return EMPTY$1;
  59909. var /** @type {?} */ newObj = {};
  59910. for (var /** @type {?} */ minifiedKey in obj) {
  59911. newObj[obj[minifiedKey]] = minifiedKey;
  59912. }
  59913. return newObj;
  59914. }
  59915. /**
  59916. * Create a directive definition object.
  59917. *
  59918. * # Example
  59919. * ```
  59920. * class MyDirective {
  59921. * // Generated by Angular Template Compiler
  59922. * // [Symbol] syntax will not be supported by TypeScript until v2.7
  59923. * static [DIRECTIVE_DEF_SYMBOL] = defineDirective({
  59924. * ...
  59925. * });
  59926. * }
  59927. * ```
  59928. */
  59929. /**
  59930. * @fileoverview added by tsickle
  59931. * @suppress {checkTypes} checked by tsc
  59932. */
  59933. /**
  59934. * @license
  59935. * Copyright Google Inc. All Rights Reserved.
  59936. *
  59937. * Use of this source code is governed by an MIT-style license that can be
  59938. * found in the LICENSE file at https://angular.io/license
  59939. */
  59940. /**
  59941. * @fileoverview added by tsickle
  59942. * @suppress {checkTypes} checked by tsc
  59943. */
  59944. /**
  59945. * @license
  59946. * Copyright Google Inc. All Rights Reserved.
  59947. *
  59948. * Use of this source code is governed by an MIT-style license that can be
  59949. * found in the LICENSE file at https://angular.io/license
  59950. */
  59951. // clang-format on
  59952. /**
  59953. * @fileoverview added by tsickle
  59954. * @suppress {checkTypes} checked by tsc
  59955. */
  59956. /**
  59957. * @license
  59958. * Copyright Google Inc. All Rights Reserved.
  59959. *
  59960. * Use of this source code is governed by an MIT-style license that can be
  59961. * found in the LICENSE file at https://angular.io/license
  59962. */
  59963. /**
  59964. * @fileoverview added by tsickle
  59965. * @suppress {checkTypes} checked by tsc
  59966. */
  59967. /**
  59968. * @license
  59969. * Copyright Google Inc. All Rights Reserved.
  59970. *
  59971. * Use of this source code is governed by an MIT-style license that can be
  59972. * found in the LICENSE file at https://angular.io/license
  59973. * @record
  59974. */
  59975. /**
  59976. * \@experimental Animation support is experimental.
  59977. */
  59978. /**
  59979. * \@experimental Animation support is experimental.
  59980. * @record
  59981. */
  59982. /**
  59983. * Metadata representing the entry of animations. Instances of this interface are provided via the
  59984. * animation DSL when the {\@link trigger trigger animation function} is called.
  59985. *
  59986. * \@experimental Animation support is experimental.
  59987. * @record
  59988. */
  59989. /**
  59990. * Metadata representing the entry of animations. Instances of this interface are provided via the
  59991. * animation DSL when the {\@link state state animation function} is called.
  59992. *
  59993. * \@experimental Animation support is experimental.
  59994. * @record
  59995. */
  59996. /**
  59997. * Metadata representing the entry of animations. Instances of this interface are provided via the
  59998. * animation DSL when the {\@link transition transition animation function} is called.
  59999. *
  60000. * \@experimental Animation support is experimental.
  60001. * @record
  60002. */
  60003. /**
  60004. * \@experimental Animation support is experimental.
  60005. * @record
  60006. */
  60007. /**
  60008. * \@experimental Animation support is experimental.
  60009. * @record
  60010. */
  60011. /**
  60012. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60013. * animation DSL when the {\@link keyframes keyframes animation function} is called.
  60014. *
  60015. * \@experimental Animation support is experimental.
  60016. * @record
  60017. */
  60018. /**
  60019. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60020. * animation DSL when the {\@link style style animation function} is called.
  60021. *
  60022. * \@experimental Animation support is experimental.
  60023. * @record
  60024. */
  60025. /**
  60026. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60027. * animation DSL when the {\@link animate animate animation function} is called.
  60028. *
  60029. * \@experimental Animation support is experimental.
  60030. * @record
  60031. */
  60032. /**
  60033. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60034. * animation DSL when the {\@link animateChild animateChild animation function} is called.
  60035. *
  60036. * \@experimental Animation support is experimental.
  60037. * @record
  60038. */
  60039. /**
  60040. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60041. * animation DSL when the {\@link useAnimation useAnimation animation function} is called.
  60042. *
  60043. * \@experimental Animation support is experimental.
  60044. * @record
  60045. */
  60046. /**
  60047. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60048. * animation DSL when the {\@link sequence sequence animation function} is called.
  60049. *
  60050. * \@experimental Animation support is experimental.
  60051. * @record
  60052. */
  60053. /**
  60054. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60055. * animation DSL when the {\@link group group animation function} is called.
  60056. *
  60057. * \@experimental Animation support is experimental.
  60058. * @record
  60059. */
  60060. /**
  60061. * Metadata representing the entry of animations. Instances of this interface are provided via the
  60062. * animation DSL when the {\@link stagger stagger animation function} is called.
  60063. *
  60064. * \@experimental Animation support is experimental.
  60065. * @record
  60066. */
  60067. /**
  60068. * `trigger` is an animation-specific function that is designed to be used inside of Angular's
  60069. * animation DSL language. If this information is new, please navigate to the
  60070. * {\@link Component#animations component animations metadata page} to gain a better
  60071. * understanding of how animations in Angular are used.
  60072. *
  60073. * `trigger` Creates an animation trigger which will a list of {\@link state state} and
  60074. * {\@link transition transition} entries that will be evaluated when the expression
  60075. * bound to the trigger changes.
  60076. *
  60077. * Triggers are registered within the component annotation data under the
  60078. * {\@link Component#animations animations section}. An animation trigger can be placed on an element
  60079. * within a template by referencing the name of the trigger followed by the expression value that
  60080. * the
  60081. * trigger is bound to (in the form of `[\@triggerName]="expression"`.
  60082. *
  60083. * Animation trigger bindings strigify values and then match the previous and current values against
  60084. * any linked transitions. If a boolean value is provided into the trigger binding then it will both
  60085. * be represented as `1` or `true` and `0` or `false` for a true and false boolean values
  60086. * respectively.
  60087. *
  60088. * ### Usage
  60089. *
  60090. * `trigger` will create an animation trigger reference based on the provided `name` value. The
  60091. * provided `animation` value is expected to be an array consisting of {\@link state state} and
  60092. * {\@link transition transition} declarations.
  60093. *
  60094. * ```typescript
  60095. * \@Component({
  60096. * selector: 'my-component',
  60097. * templateUrl: 'my-component-tpl.html',
  60098. * animations: [
  60099. * trigger("myAnimationTrigger", [
  60100. * state(...),
  60101. * state(...),
  60102. * transition(...),
  60103. * transition(...)
  60104. * ])
  60105. * ]
  60106. * })
  60107. * class MyComponent {
  60108. * myStatusExp = "something";
  60109. * }
  60110. * ```
  60111. *
  60112. * The template associated with this component will make use of the `myAnimationTrigger` animation
  60113. * trigger by binding to an element within its template code.
  60114. *
  60115. * ```html
  60116. * <!-- somewhere inside of my-component-tpl.html -->
  60117. * <div [\@myAnimationTrigger]="myStatusExp">...</div>
  60118. * ```
  60119. *
  60120. * ## Disable Animations
  60121. * A special animation control binding called `\@.disabled` can be placed on an element which will
  60122. * then disable animations for any inner animation triggers situated within the element as well as
  60123. * any animations on the element itself.
  60124. *
  60125. * When true, the `\@.disabled` binding will prevent all animations from rendering. The example
  60126. * below shows how to use this feature:
  60127. *
  60128. * ```ts
  60129. * \@Component({
  60130. * selector: 'my-component',
  60131. * template: `
  60132. * <div [\@.disabled]="isDisabled">
  60133. * <div [\@childAnimation]="exp"></div>
  60134. * </div>
  60135. * `,
  60136. * animations: [
  60137. * trigger("childAnimation", [
  60138. * // ...
  60139. * ])
  60140. * ]
  60141. * })
  60142. * class MyComponent {
  60143. * isDisabled = true;
  60144. * exp = '...';
  60145. * }
  60146. * ```
  60147. *
  60148. * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening
  60149. * (when true).
  60150. *
  60151. * Note that `\@.disabled` will only disable all animations (this means any animations running on
  60152. * the same element will also be disabled).
  60153. *
  60154. * ### Disabling Animations Application-wide
  60155. * When an area of the template is set to have animations disabled, **all** inner components will
  60156. * also have their animations disabled as well. This means that all animations for an angular
  60157. * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular
  60158. * component.
  60159. *
  60160. * ```ts
  60161. * import {Component, HostBinding} from '\@angular/core';
  60162. *
  60163. * \@Component({
  60164. * selector: 'app-component',
  60165. * templateUrl: 'app.component.html',
  60166. * })
  60167. * class AppComponent {
  60168. * \@HostBinding('\@.disabled')
  60169. * public animationsDisabled = true;
  60170. * }
  60171. * ```
  60172. *
  60173. * ### What about animations that us `query()` and `animateChild()`?
  60174. * Despite inner animations being disabled, a parent animation can {\@link query query} for inner
  60175. * elements located in disabled areas of the template and still animate them as it sees fit. This is
  60176. * also the case for when a sub animation is queried by a parent and then later animated using {\@link
  60177. * animateChild animateChild}.
  60178. *
  60179. * \@experimental Animation support is experimental.
  60180. * @param {?} name
  60181. * @param {?} definitions
  60182. * @return {?}
  60183. */
  60184. function trigger$1(name, definitions) {
  60185. return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
  60186. }
  60187. /**
  60188. * `animate` is an animation-specific function that is designed to be used inside of Angular's
  60189. * animation DSL language. If this information is new, please navigate to the {\@link
  60190. * Component#animations component animations metadata page} to gain a better understanding of
  60191. * how animations in Angular are used.
  60192. *
  60193. * `animate` specifies an animation step that will apply the provided `styles` data for a given
  60194. * amount of time based on the provided `timing` expression value. Calls to `animate` are expected
  60195. * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
  60196. * transition transition}.
  60197. *
  60198. * ### Usage
  60199. *
  60200. * The `animate` function accepts two input parameters: `timing` and `styles`:
  60201. *
  60202. * - `timing` is a string based value that can be a combination of a duration with optional delay
  60203. * and easing values. The format for the expression breaks down to `duration delay easing`
  60204. * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
  60205. * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
  60206. * `duration` value in millisecond form.
  60207. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
  60208. * keyframes keyframes}. If left empty then the styles from the destination state will be collected
  60209. * and used (this is useful when describing an animation step that will complete an animation by
  60210. * {\@link transition#the-final-animate-call animating to the final state}).
  60211. *
  60212. * ```typescript
  60213. * // various functions for specifying timing data
  60214. * animate(500, style(...))
  60215. * animate("1s", style(...))
  60216. * animate("100ms 0.5s", style(...))
  60217. * animate("5s ease", style(...))
  60218. * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
  60219. *
  60220. * // either style() of keyframes() can be used
  60221. * animate(500, style({ background: "red" }))
  60222. * animate(500, keyframes([
  60223. * style({ background: "blue" })),
  60224. * style({ background: "red" }))
  60225. * ])
  60226. * ```
  60227. *
  60228. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60229. *
  60230. * \@experimental Animation support is experimental.
  60231. * @param {?} timings
  60232. * @param {?=} styles
  60233. * @return {?}
  60234. */
  60235. function animate$1(timings, styles) {
  60236. if (styles === void 0) { styles = null; }
  60237. return { type: 4 /* Animate */, styles: styles, timings: timings };
  60238. }
  60239. /**
  60240. * `group` is an animation-specific function that is designed to be used inside of Angular's
  60241. * animation DSL language. If this information is new, please navigate to the {\@link
  60242. * Component#animations component animations metadata page} to gain a better understanding of
  60243. * how animations in Angular are used.
  60244. *
  60245. * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
  60246. * useful when a series of styles must be animated/closed off at different starting/ending times.
  60247. *
  60248. * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
  60249. * transition} and it will only continue to the next instruction once all of the inner animation
  60250. * steps have completed.
  60251. *
  60252. * ### Usage
  60253. *
  60254. * The `steps` data that is passed into the `group` animation function can either consist of {\@link
  60255. * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
  60256. * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
  60257. * animate#usage animate() with a delay value} to offset styles to be applied at a later time).
  60258. *
  60259. * ```typescript
  60260. * group([
  60261. * animate("1s", { background: "black" }))
  60262. * animate("2s", { color: "white" }))
  60263. * ])
  60264. * ```
  60265. *
  60266. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60267. *
  60268. * \@experimental Animation support is experimental.
  60269. * @param {?} steps
  60270. * @param {?=} options
  60271. * @return {?}
  60272. */
  60273. function group$1(steps, options) {
  60274. if (options === void 0) { options = null; }
  60275. return { type: 3 /* Group */, steps: steps, options: options };
  60276. }
  60277. /**
  60278. * `sequence` is an animation-specific function that is designed to be used inside of Angular's
  60279. * animation DSL language. If this information is new, please navigate to the {\@link
  60280. * Component#animations component animations metadata page} to gain a better understanding of
  60281. * how animations in Angular are used.
  60282. *
  60283. * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
  60284. * default when an array is passed as animation data into {\@link transition transition}.)
  60285. *
  60286. * The `sequence` function can either be used within a {\@link group group} or a {\@link transition
  60287. * transition} and it will only continue to the next instruction once each of the inner animation
  60288. * steps have completed.
  60289. *
  60290. * To perform animation styling in parallel with other animation steps then have a look at the
  60291. * {\@link group group} animation function.
  60292. *
  60293. * ### Usage
  60294. *
  60295. * The `steps` data that is passed into the `sequence` animation function can either consist of
  60296. * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
  60297. * provided styling data immediately while a call to `animate()` will apply its styling data over a
  60298. * given time depending on its timing data.
  60299. *
  60300. * ```typescript
  60301. * sequence([
  60302. * style({ opacity: 0 })),
  60303. * animate("1s", { opacity: 1 }))
  60304. * ])
  60305. * ```
  60306. *
  60307. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60308. *
  60309. * \@experimental Animation support is experimental.
  60310. * @param {?} steps
  60311. * @param {?=} options
  60312. * @return {?}
  60313. */
  60314. function sequence$1(steps, options) {
  60315. if (options === void 0) { options = null; }
  60316. return { type: 2 /* Sequence */, steps: steps, options: options };
  60317. }
  60318. /**
  60319. * `style` is an animation-specific function that is designed to be used inside of Angular's
  60320. * animation DSL language. If this information is new, please navigate to the {\@link
  60321. * Component#animations component animations metadata page} to gain a better understanding of
  60322. * how animations in Angular are used.
  60323. *
  60324. * `style` declares a key/value object containing CSS properties/styles that can then be used for
  60325. * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
  60326. * for both {\@link animate animate} and {\@link keyframes keyframes}.
  60327. *
  60328. * ### Usage
  60329. *
  60330. * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
  60331. * to be defined.
  60332. *
  60333. * ```typescript
  60334. * // string values are used for css properties
  60335. * style({ background: "red", color: "blue" })
  60336. *
  60337. * // numerical (pixel) values are also supported
  60338. * style({ width: 100, height: 0 })
  60339. * ```
  60340. *
  60341. * #### Auto-styles (using `*`)
  60342. *
  60343. * When an asterix (`*`) character is used as a value then it will be detected from the element
  60344. * being animated and applied as animation data when the animation starts.
  60345. *
  60346. * This feature proves useful for a state depending on layout and/or environment factors; in such
  60347. * cases the styles are calculated just before the animation starts.
  60348. *
  60349. * ```typescript
  60350. * // the steps below will animate from 0 to the
  60351. * // actual height of the element
  60352. * style({ height: 0 }),
  60353. * animate("1s", style({ height: "*" }))
  60354. * ```
  60355. *
  60356. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60357. *
  60358. * \@experimental Animation support is experimental.
  60359. * @param {?} tokens
  60360. * @return {?}
  60361. */
  60362. function style$1(tokens) {
  60363. return { type: 6 /* Style */, styles: tokens, offset: null };
  60364. }
  60365. /**
  60366. * `state` is an animation-specific function that is designed to be used inside of Angular's
  60367. * animation DSL language. If this information is new, please navigate to the {\@link
  60368. * Component#animations component animations metadata page} to gain a better understanding of
  60369. * how animations in Angular are used.
  60370. *
  60371. * `state` declares an animation state within the given trigger. When a state is active within a
  60372. * component then its associated styles will persist on the element that the trigger is attached to
  60373. * (even when the animation ends).
  60374. *
  60375. * To animate between states, have a look at the animation {\@link transition transition} DSL
  60376. * function. To register states to an animation trigger please have a look at the {\@link trigger
  60377. * trigger} function.
  60378. *
  60379. * #### The `void` state
  60380. *
  60381. * The `void` state value is a reserved word that angular uses to determine when the element is not
  60382. * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
  60383. * associated element is void).
  60384. *
  60385. * #### The `*` (default) state
  60386. *
  60387. * The `*` state (when styled) is a fallback state that will be used if the state that is being
  60388. * animated is not declared within the trigger.
  60389. *
  60390. * ### Usage
  60391. *
  60392. * `state` will declare an animation state with its associated styles
  60393. * within the given trigger.
  60394. *
  60395. * - `stateNameExpr` can be one or more state names separated by commas.
  60396. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once
  60397. * the state has been reached.
  60398. *
  60399. * ```typescript
  60400. * // "void" is a reserved name for a state and is used to represent
  60401. * // the state in which an element is detached from from the application.
  60402. * state("void", style({ height: 0 }))
  60403. *
  60404. * // user-defined states
  60405. * state("closed", style({ height: 0 }))
  60406. * state("open, visible", style({ height: "*" }))
  60407. * ```
  60408. *
  60409. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60410. *
  60411. * \@experimental Animation support is experimental.
  60412. * @param {?} name
  60413. * @param {?} styles
  60414. * @param {?=} options
  60415. * @return {?}
  60416. */
  60417. function state$1(name, styles, options) {
  60418. return { type: 0 /* State */, name: name, styles: styles, options: options };
  60419. }
  60420. /**
  60421. * `keyframes` is an animation-specific function that is designed to be used inside of Angular's
  60422. * animation DSL language. If this information is new, please navigate to the {\@link
  60423. * Component#animations component animations metadata page} to gain a better understanding of
  60424. * how animations in Angular are used.
  60425. *
  60426. * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
  60427. * by an `offset` value.
  60428. *
  60429. * ### Usage
  60430. *
  60431. * The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
  60432. * animation function. Instead of applying animations from where they are currently to their
  60433. * destination, keyframes can describe how each style entry is applied and at what point within the
  60434. * animation arc (much like CSS Keyframe Animations do).
  60435. *
  60436. * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
  60437. * percentage of the animate time the styles will be applied.
  60438. *
  60439. * ```typescript
  60440. * // the provided offset values describe when each backgroundColor value is applied.
  60441. * animate("5s", keyframes([
  60442. * style({ backgroundColor: "red", offset: 0 }),
  60443. * style({ backgroundColor: "blue", offset: 0.2 }),
  60444. * style({ backgroundColor: "orange", offset: 0.3 }),
  60445. * style({ backgroundColor: "black", offset: 1 })
  60446. * ]))
  60447. * ```
  60448. *
  60449. * Alternatively, if there are no `offset` values used within the style entries then the offsets
  60450. * will be calculated automatically.
  60451. *
  60452. * ```typescript
  60453. * animate("5s", keyframes([
  60454. * style({ backgroundColor: "red" }) // offset = 0
  60455. * style({ backgroundColor: "blue" }) // offset = 0.33
  60456. * style({ backgroundColor: "orange" }) // offset = 0.66
  60457. * style({ backgroundColor: "black" }) // offset = 1
  60458. * ]))
  60459. * ```
  60460. *
  60461. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60462. *
  60463. * \@experimental Animation support is experimental.
  60464. * @param {?} steps
  60465. * @return {?}
  60466. */
  60467. function keyframes$1(steps) {
  60468. return { type: 5 /* Keyframes */, steps: steps };
  60469. }
  60470. /**
  60471. * `transition` is an animation-specific function that is designed to be used inside of Angular's
  60472. * animation DSL language. If this information is new, please navigate to the {\@link
  60473. * Component#animations component animations metadata page} to gain a better understanding of
  60474. * how animations in Angular are used.
  60475. *
  60476. * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
  60477. * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
  60478. * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
  60479. * and/or ending state).
  60480. *
  60481. * A function can also be provided as the `stateChangeExpr` argument for a transition and this
  60482. * function will be executed each time a state change occurs. If the value returned within the
  60483. * function is true then the associated animation will be run.
  60484. *
  60485. * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
  60486. * to animate to a state value and persist its styles then one or more {\@link state animation
  60487. * states} is expected to be defined.
  60488. *
  60489. * ### Usage
  60490. *
  60491. * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
  60492. * what the previous state is and what the current state has become. In other words, if a transition
  60493. * is defined that matches the old/current state criteria then the associated animation will be
  60494. * triggered.
  60495. *
  60496. * ```typescript
  60497. * // all transition/state changes are defined within an animation trigger
  60498. * trigger("myAnimationTrigger", [
  60499. * // if a state is defined then its styles will be persisted when the
  60500. * // animation has fully completed itself
  60501. * state("on", style({ background: "green" })),
  60502. * state("off", style({ background: "grey" })),
  60503. *
  60504. * // a transition animation that will be kicked off when the state value
  60505. * // bound to "myAnimationTrigger" changes from "on" to "off"
  60506. * transition("on => off", animate(500)),
  60507. *
  60508. * // it is also possible to do run the same animation for both directions
  60509. * transition("on <=> off", animate(500)),
  60510. *
  60511. * // or to define multiple states pairs separated by commas
  60512. * transition("on => off, off => void", animate(500)),
  60513. *
  60514. * // this is a catch-all state change for when an element is inserted into
  60515. * // the page and the destination state is unknown
  60516. * transition("void => *", [
  60517. * style({ opacity: 0 }),
  60518. * animate(500)
  60519. * ]),
  60520. *
  60521. * // this will capture a state change between any states
  60522. * transition("* => *", animate("1s 0s")),
  60523. *
  60524. * // you can also go full out and include a function
  60525. * transition((fromState, toState) => {
  60526. * // when `true` then it will allow the animation below to be invoked
  60527. * return fromState == "off" && toState == "on";
  60528. * }, animate("1s 0s"))
  60529. * ])
  60530. * ```
  60531. *
  60532. * The template associated with this component will make use of the `myAnimationTrigger` animation
  60533. * trigger by binding to an element within its template code.
  60534. *
  60535. * ```html
  60536. * <!-- somewhere inside of my-component-tpl.html -->
  60537. * <div [\@myAnimationTrigger]="myStatusExp">...</div>
  60538. * ```
  60539. *
  60540. * #### The final `animate` call
  60541. *
  60542. * If the final step within the transition steps is a call to `animate()` that **only** uses a
  60543. * timing value with **no style data** then it will be automatically used as the final animation arc
  60544. * for the element to animate itself to the final state. This involves an automatic mix of
  60545. * adding/removing CSS styles so that the element will be in the exact state it should be for the
  60546. * applied state to be presented correctly.
  60547. *
  60548. * ```
  60549. * // start off by hiding the element, but make sure that it animates properly to whatever state
  60550. * // is currently active for "myAnimationTrigger"
  60551. * transition("void => *", [
  60552. * style({ opacity: 0 }),
  60553. * animate(500)
  60554. * ])
  60555. * ```
  60556. *
  60557. * ### Using :enter and :leave
  60558. *
  60559. * Given that enter (insertion) and leave (removal) animations are so common, the `transition`
  60560. * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
  60561. * => void` state changes.
  60562. *
  60563. * ```
  60564. * transition(":enter", [
  60565. * style({ opacity: 0 }),
  60566. * animate(500, style({ opacity: 1 }))
  60567. * ]),
  60568. * transition(":leave", [
  60569. * animate(500, style({ opacity: 0 }))
  60570. * ])
  60571. * ```
  60572. *
  60573. * ### Boolean values
  60574. * if a trigger binding value is a boolean value then it can be matched using a transition
  60575. * expression that compares `true` and `false` or `1` and `0`.
  60576. *
  60577. * ```
  60578. * // in the template
  60579. * <div [\@openClose]="open ? true : false">...</div>
  60580. *
  60581. * // in the component metadata
  60582. * trigger('openClose', [
  60583. * state('true', style({ height: '*' })),
  60584. * state('false', style({ height: '0px' })),
  60585. * transition('false <=> true', animate(500))
  60586. * ])
  60587. * ```
  60588. *
  60589. * ### Using :increment and :decrement
  60590. * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases
  60591. * can be used to kick off a transition when a numeric value has increased or decreased in value.
  60592. *
  60593. * ```
  60594. * import {group, animate, query, transition, style, trigger} from '\@angular/animations';
  60595. * import {Component} from '\@angular/core';
  60596. *
  60597. * \@Component({
  60598. * selector: 'banner-carousel-component',
  60599. * styles: [`
  60600. * .banner-container {
  60601. * position:relative;
  60602. * height:500px;
  60603. * overflow:hidden;
  60604. * }
  60605. * .banner-container > .banner {
  60606. * position:absolute;
  60607. * left:0;
  60608. * top:0;
  60609. * font-size:200px;
  60610. * line-height:500px;
  60611. * font-weight:bold;
  60612. * text-align:center;
  60613. * width:100%;
  60614. * }
  60615. * `],
  60616. * template: `
  60617. * <button (click)="previous()">Previous</button>
  60618. * <button (click)="next()">Next</button>
  60619. * <hr>
  60620. * <div [\@bannerAnimation]="selectedIndex" class="banner-container">
  60621. * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div>
  60622. * </div>
  60623. * `,
  60624. * animations: [
  60625. * trigger('bannerAnimation', [
  60626. * transition(":increment", group([
  60627. * query(':enter', [
  60628. * style({ left: '100%' }),
  60629. * animate('0.5s ease-out', style('*'))
  60630. * ]),
  60631. * query(':leave', [
  60632. * animate('0.5s ease-out', style({ left: '-100%' }))
  60633. * ])
  60634. * ])),
  60635. * transition(":decrement", group([
  60636. * query(':enter', [
  60637. * style({ left: '-100%' }),
  60638. * animate('0.5s ease-out', style('*'))
  60639. * ]),
  60640. * query(':leave', [
  60641. * animate('0.5s ease-out', style({ left: '100%' }))
  60642. * ])
  60643. * ]))
  60644. * ])
  60645. * ]
  60646. * })
  60647. * class BannerCarouselComponent {
  60648. * allBanners: string[] = ['1', '2', '3', '4'];
  60649. * selectedIndex: number = 0;
  60650. *
  60651. * get banners() {
  60652. * return [this.allBanners[this.selectedIndex]];
  60653. * }
  60654. *
  60655. * previous() {
  60656. * this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
  60657. * }
  60658. *
  60659. * next() {
  60660. * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1);
  60661. * }
  60662. * }
  60663. * ```
  60664. *
  60665. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  60666. *
  60667. * \@experimental Animation support is experimental.
  60668. * @param {?} stateChangeExpr
  60669. * @param {?} steps
  60670. * @param {?=} options
  60671. * @return {?}
  60672. */
  60673. function transition$1(stateChangeExpr, steps, options) {
  60674. if (options === void 0) { options = null; }
  60675. return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
  60676. }
  60677. /**
  60678. * `animation` is an animation-specific function that is designed to be used inside of Angular's
  60679. * animation DSL language.
  60680. *
  60681. * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
  60682. * invoked in another animation or sequence. Reusable animations are designed to make use of
  60683. * animation parameters and the produced animation can be used via the `useAnimation` method.
  60684. *
  60685. * ```
  60686. * var fadeAnimation = animation([
  60687. * style({ opacity: '{{ start }}' }),
  60688. * animate('{{ time }}',
  60689. * style({ opacity: '{{ end }}'}))
  60690. * ], { params: { time: '1000ms', start: 0, end: 1 }});
  60691. * ```
  60692. *
  60693. * If parameters are attached to an animation then they act as **default parameter values**. When an
  60694. * animation is invoked via `useAnimation` then parameter values are allowed to be passed in
  60695. * directly. If any of the passed in parameter values are missing then the default values will be
  60696. * used.
  60697. *
  60698. * ```
  60699. * useAnimation(fadeAnimation, {
  60700. * params: {
  60701. * time: '2s',
  60702. * start: 1,
  60703. * end: 0
  60704. * }
  60705. * })
  60706. * ```
  60707. *
  60708. * If one or more parameter values are missing before animated then an error will be thrown.
  60709. *
  60710. * \@experimental Animation support is experimental.
  60711. * @param {?} steps
  60712. * @param {?=} options
  60713. * @return {?}
  60714. */
  60715. /**
  60716. * `animateChild` is an animation-specific function that is designed to be used inside of Angular's
  60717. * animation DSL language. It works by allowing a queried element to execute its own
  60718. * animation within the animation sequence.
  60719. *
  60720. * Each time an animation is triggered in angular, the parent animation
  60721. * will always get priority and any child animations will be blocked. In order
  60722. * for a child animation to run, the parent animation must query each of the elements
  60723. * containing child animations and then allow the animations to run using `animateChild`.
  60724. *
  60725. * The example HTML code below shows both parent and child elements that have animation
  60726. * triggers that will execute at the same time.
  60727. *
  60728. * ```html
  60729. * <!-- parent-child.component.html -->
  60730. * <button (click)="exp =! exp">Toggle</button>
  60731. * <hr>
  60732. *
  60733. * <div [\@parentAnimation]="exp">
  60734. * <header>Hello</header>
  60735. * <div [\@childAnimation]="exp">
  60736. * one
  60737. * </div>
  60738. * <div [\@childAnimation]="exp">
  60739. * two
  60740. * </div>
  60741. * <div [\@childAnimation]="exp">
  60742. * three
  60743. * </div>
  60744. * </div>
  60745. * ```
  60746. *
  60747. * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
  60748. * because it has priority. However, using `query` and `animateChild` each of the inner animations
  60749. * can also fire:
  60750. *
  60751. * ```ts
  60752. * // parent-child.component.ts
  60753. * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
  60754. * \@Component({
  60755. * selector: 'parent-child-component',
  60756. * animations: [
  60757. * trigger('parentAnimation', [
  60758. * transition('false => true', [
  60759. * query('header', [
  60760. * style({ opacity: 0 }),
  60761. * animate(500, style({ opacity: 1 }))
  60762. * ]),
  60763. * query('\@childAnimation', [
  60764. * animateChild()
  60765. * ])
  60766. * ])
  60767. * ]),
  60768. * trigger('childAnimation', [
  60769. * transition('false => true', [
  60770. * style({ opacity: 0 }),
  60771. * animate(500, style({ opacity: 1 }))
  60772. * ])
  60773. * ])
  60774. * ]
  60775. * })
  60776. * class ParentChildCmp {
  60777. * exp: boolean = false;
  60778. * }
  60779. * ```
  60780. *
  60781. * In the animation code above, when the `parentAnimation` transition kicks off it first queries to
  60782. * find the header element and fades it in. It then finds each of the sub elements that contain the
  60783. * `\@childAnimation` trigger and then allows for their animations to fire.
  60784. *
  60785. * This example can be further extended by using stagger:
  60786. *
  60787. * ```ts
  60788. * query('\@childAnimation', stagger(100, [
  60789. * animateChild()
  60790. * ]))
  60791. * ```
  60792. *
  60793. * Now each of the sub animations start off with respect to the `100ms` staggering step.
  60794. *
  60795. * ## The first frame of child animations
  60796. * When sub animations are executed using `animateChild` the animation engine will always apply the
  60797. * first frame of every sub animation immediately at the start of the animation sequence. This way
  60798. * the parent animation does not need to set any initial styling data on the sub elements before the
  60799. * sub animations kick off.
  60800. *
  60801. * In the example above the first frame of the `childAnimation`'s `false => true` transition
  60802. * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
  60803. * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
  60804. * with `animateChild` will it then animate to its destination of `opacity: 1`.
  60805. *
  60806. * Note that this feature designed to be used alongside {\@link query query()} and it will only work
  60807. * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
  60808. * and transitions are not handled by this API).
  60809. *
  60810. * \@experimental Animation support is experimental.
  60811. * @param {?=} options
  60812. * @return {?}
  60813. */
  60814. /**
  60815. * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
  60816. * animation DSL language. It is used to kick off a reusable animation that is created using {\@link
  60817. * animation animation()}.
  60818. *
  60819. * \@experimental Animation support is experimental.
  60820. * @param {?} animation
  60821. * @param {?=} options
  60822. * @return {?}
  60823. */
  60824. /**
  60825. * `query` is an animation-specific function that is designed to be used inside of Angular's
  60826. * animation DSL language.
  60827. *
  60828. * query() is used to find one or more inner elements within the current element that is
  60829. * being animated within the sequence. The provided animation steps are applied
  60830. * to the queried element (by default, an array is provided, then this will be
  60831. * treated as an animation sequence).
  60832. *
  60833. * ### Usage
  60834. *
  60835. * query() is designed to collect mutiple elements and works internally by using
  60836. * `element.querySelectorAll`. An additional options object can be provided which
  60837. * can be used to limit the total amount of items to be collected.
  60838. *
  60839. * ```js
  60840. * query('div', [
  60841. * animate(...),
  60842. * animate(...)
  60843. * ], { limit: 1 })
  60844. * ```
  60845. *
  60846. * query(), by default, will throw an error when zero items are found. If a query
  60847. * has the `optional` flag set to true then this error will be ignored.
  60848. *
  60849. * ```js
  60850. * query('.some-element-that-may-not-be-there', [
  60851. * animate(...),
  60852. * animate(...)
  60853. * ], { optional: true })
  60854. * ```
  60855. *
  60856. * ### Special Selector Values
  60857. *
  60858. * The selector value within a query can collect elements that contain angular-specific
  60859. * characteristics
  60860. * using special pseudo-selectors tokens.
  60861. *
  60862. * These include:
  60863. *
  60864. * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
  60865. * - Querying all currently animating elements using `query(":animating")`
  60866. * - Querying elements that contain an animation trigger using `query("\@triggerName")`
  60867. * - Querying all elements that contain an animation triggers using `query("\@*")`
  60868. * - Including the current element into the animation sequence using `query(":self")`
  60869. *
  60870. *
  60871. * Each of these pseudo-selector tokens can be merged together into a combined query selector
  60872. * string:
  60873. *
  60874. * ```
  60875. * query(':self, .record:enter, .record:leave, \@subTrigger', [...])
  60876. * ```
  60877. *
  60878. * ### Demo
  60879. *
  60880. * ```
  60881. * \@Component({
  60882. * selector: 'inner',
  60883. * template: `
  60884. * <div [\@queryAnimation]="exp">
  60885. * <h1>Title</h1>
  60886. * <div class="content">
  60887. * Blah blah blah
  60888. * </div>
  60889. * </div>
  60890. * `,
  60891. * animations: [
  60892. * trigger('queryAnimation', [
  60893. * transition('* => goAnimate', [
  60894. * // hide the inner elements
  60895. * query('h1', style({ opacity: 0 })),
  60896. * query('.content', style({ opacity: 0 })),
  60897. *
  60898. * // animate the inner elements in, one by one
  60899. * query('h1', animate(1000, style({ opacity: 1 })),
  60900. * query('.content', animate(1000, style({ opacity: 1 })),
  60901. * ])
  60902. * ])
  60903. * ]
  60904. * })
  60905. * class Cmp {
  60906. * exp = '';
  60907. *
  60908. * goAnimate() {
  60909. * this.exp = 'goAnimate';
  60910. * }
  60911. * }
  60912. * ```
  60913. *
  60914. * \@experimental Animation support is experimental.
  60915. * @param {?} selector
  60916. * @param {?} animation
  60917. * @param {?=} options
  60918. * @return {?}
  60919. */
  60920. /**
  60921. * `stagger` is an animation-specific function that is designed to be used inside of Angular's
  60922. * animation DSL language. It is designed to be used inside of an animation {\@link query query()}
  60923. * and works by issuing a timing gap between after each queried item is animated.
  60924. *
  60925. * ### Usage
  60926. *
  60927. * In the example below there is a container element that wraps a list of items stamped out
  60928. * by an ngFor. The container element contains an animation trigger that will later be set
  60929. * to query for each of the inner items.
  60930. *
  60931. * ```html
  60932. * <!-- list.component.html -->
  60933. * <button (click)="toggle()">Show / Hide Items</button>
  60934. * <hr />
  60935. * <div [\@listAnimation]="items.length">
  60936. * <div *ngFor="let item of items">
  60937. * {{ item }}
  60938. * </div>
  60939. * </div>
  60940. * ```
  60941. *
  60942. * The component code for this looks as such:
  60943. *
  60944. * ```ts
  60945. * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
  60946. * \@Component({
  60947. * templateUrl: 'list.component.html',
  60948. * animations: [
  60949. * trigger('listAnimation', [
  60950. * //...
  60951. * ])
  60952. * ]
  60953. * })
  60954. * class ListComponent {
  60955. * items = [];
  60956. *
  60957. * showItems() {
  60958. * this.items = [0,1,2,3,4];
  60959. * }
  60960. *
  60961. * hideItems() {
  60962. * this.items = [];
  60963. * }
  60964. *
  60965. * toggle() {
  60966. * this.items.length ? this.hideItems() : this.showItems();
  60967. * }
  60968. * }
  60969. * ```
  60970. *
  60971. * And now for the animation trigger code:
  60972. *
  60973. * ```ts
  60974. * trigger('listAnimation', [
  60975. * transition('* => *', [ // each time the binding value changes
  60976. * query(':leave', [
  60977. * stagger(100, [
  60978. * animate('0.5s', style({ opacity: 0 }))
  60979. * ])
  60980. * ]),
  60981. * query(':enter', [
  60982. * style({ opacity: 0 }),
  60983. * stagger(100, [
  60984. * animate('0.5s', style({ opacity: 1 }))
  60985. * ])
  60986. * ])
  60987. * ])
  60988. * ])
  60989. * ```
  60990. *
  60991. * Now each time the items are added/removed then either the opacity
  60992. * fade-in animation will run or each removed item will be faded out.
  60993. * When either of these animations occur then a stagger effect will be
  60994. * applied after each item's animation is started.
  60995. *
  60996. * \@experimental Animation support is experimental.
  60997. * @param {?} timings
  60998. * @param {?} animation
  60999. * @return {?}
  61000. */
  61001. /**
  61002. * @fileoverview added by tsickle
  61003. * @suppress {checkTypes} checked by tsc
  61004. */
  61005. /**
  61006. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61007. */
  61008. var AUTO_STYLE = '*';
  61009. /**
  61010. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61011. * @record
  61012. */
  61013. /**
  61014. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61015. * @record
  61016. */
  61017. /**
  61018. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61019. * @record
  61020. */
  61021. /**
  61022. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61023. * @record
  61024. */
  61025. /**
  61026. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61027. * @record
  61028. */
  61029. /**
  61030. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61031. * @record
  61032. */
  61033. /**
  61034. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61035. * @record
  61036. */
  61037. /**
  61038. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61039. * @record
  61040. */
  61041. /**
  61042. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61043. * @record
  61044. */
  61045. /**
  61046. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61047. * @param {?} name
  61048. * @param {?} definitions
  61049. * @return {?}
  61050. */
  61051. function trigger$$1(name, definitions) {
  61052. return trigger$1(name, definitions);
  61053. }
  61054. /**
  61055. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61056. * @param {?} timings
  61057. * @param {?=} styles
  61058. * @return {?}
  61059. */
  61060. function animate$$1(timings, styles) {
  61061. return animate$1(timings, styles);
  61062. }
  61063. /**
  61064. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61065. * @param {?} steps
  61066. * @return {?}
  61067. */
  61068. function group$$1(steps) {
  61069. return group$1(steps);
  61070. }
  61071. /**
  61072. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61073. * @param {?} steps
  61074. * @return {?}
  61075. */
  61076. function sequence$$1(steps) {
  61077. return sequence$1(steps);
  61078. }
  61079. /**
  61080. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61081. * @param {?} tokens
  61082. * @return {?}
  61083. */
  61084. function style$$1(tokens) {
  61085. return style$1(tokens);
  61086. }
  61087. /**
  61088. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61089. * @param {?} name
  61090. * @param {?} styles
  61091. * @return {?}
  61092. */
  61093. function state$$1(name, styles) {
  61094. return state$1(name, styles);
  61095. }
  61096. /**
  61097. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61098. * @param {?} steps
  61099. * @return {?}
  61100. */
  61101. function keyframes$$1(steps) {
  61102. return keyframes$1(steps);
  61103. }
  61104. /**
  61105. * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
  61106. * @param {?} stateChangeExpr
  61107. * @param {?} steps
  61108. * @return {?}
  61109. */
  61110. function transition$$1(stateChangeExpr, steps) {
  61111. return transition$1(stateChangeExpr, steps);
  61112. }
  61113. /**
  61114. * @deprecated This has been renamed to `AnimationEvent`. Please import it from \@angular/animations.
  61115. * @record
  61116. */
  61117. /**
  61118. * @fileoverview added by tsickle
  61119. * @suppress {checkTypes} checked by tsc
  61120. */
  61121. /**
  61122. * @license
  61123. * Copyright Google Inc. All Rights Reserved.
  61124. *
  61125. * Use of this source code is governed by an MIT-style license that can be
  61126. * found in the LICENSE file at https://angular.io/license
  61127. */
  61128. /**
  61129. * @module
  61130. * @description
  61131. * Entry point from which you should import all public core APIs.
  61132. */
  61133. /**
  61134. * @fileoverview added by tsickle
  61135. * @suppress {checkTypes} checked by tsc
  61136. */
  61137. /**
  61138. * @license
  61139. * Copyright Google Inc. All Rights Reserved.
  61140. *
  61141. * Use of this source code is governed by an MIT-style license that can be
  61142. * found in the LICENSE file at https://angular.io/license
  61143. */
  61144. /**
  61145. * @module
  61146. * @description
  61147. * Entry point for all public APIs of this package.
  61148. */
  61149. // This file only reexports content of the `src` folder. Keep it that way.
  61150. /**
  61151. * @fileoverview added by tsickle
  61152. * @suppress {checkTypes} checked by tsc
  61153. */
  61154. /**
  61155. * Generated bundle index. Do not edit.
  61156. */
  61157. //# sourceMappingURL=core.js.map
  61158. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js")))
  61159. /***/ }),
  61160. /***/ "./node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js":
  61161. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61162. "use strict";
  61163. /* unused harmony export VERSION */
  61164. /* unused harmony export JitCompilerFactory */
  61165. /* unused harmony export RESOURCE_CACHE_PROVIDER */
  61166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return platformBrowserDynamic; });
  61167. /* unused harmony export ɵCompilerImpl */
  61168. /* unused harmony export ɵplatformCoreDynamic */
  61169. /* unused harmony export ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS */
  61170. /* unused harmony export ɵResourceLoaderImpl */
  61171. /* unused harmony export ɵa */
  61172. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_compiler__ = __webpack_require__("./node_modules/@angular/compiler/esm5/compiler.js");
  61173. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
  61174. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm5/common.js");
  61175. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__ = __webpack_require__("./node_modules/@angular/platform-browser/esm5/platform-browser.js");
  61176. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
  61177. /**
  61178. * @license Angular v5.2.9
  61179. * (c) 2010-2018 Google, Inc. https://angular.io/
  61180. * License: MIT
  61181. */
  61182. /**
  61183. * @fileoverview added by tsickle
  61184. * @suppress {checkTypes} checked by tsc
  61185. */
  61186. /**
  61187. * @license
  61188. * Copyright Google Inc. All Rights Reserved.
  61189. *
  61190. * Use of this source code is governed by an MIT-style license that can be
  61191. * found in the LICENSE file at https://angular.io/license
  61192. */
  61193. var MODULE_SUFFIX = '';
  61194. var builtinExternalReferences = createBuiltinExternalReferencesMap();
  61195. var JitReflector = /** @class */ (function () {
  61196. function JitReflector() {
  61197. this.builtinExternalReferences = new Map();
  61198. this.reflectionCapabilities = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_15" /* ɵReflectionCapabilities */]();
  61199. }
  61200. /**
  61201. * @param {?} type
  61202. * @param {?} cmpMetadata
  61203. * @return {?}
  61204. */
  61205. JitReflector.prototype.componentModuleUrl = /**
  61206. * @param {?} type
  61207. * @param {?} cmpMetadata
  61208. * @return {?}
  61209. */
  61210. function (type, cmpMetadata) {
  61211. var /** @type {?} */ moduleId = cmpMetadata.moduleId;
  61212. if (typeof moduleId === 'string') {
  61213. var /** @type {?} */ scheme = Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["z" /* getUrlScheme */])(moduleId);
  61214. return scheme ? moduleId : "package:" + moduleId + MODULE_SUFFIX;
  61215. }
  61216. else if (moduleId !== null && moduleId !== void 0) {
  61217. throw Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["A" /* syntaxError */])("moduleId should be a string in \"" + Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_39" /* ɵstringify */])(type) + "\". See https://goo.gl/wIDDiL for more information.\n" +
  61218. "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
  61219. }
  61220. return "./" + Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_39" /* ɵstringify */])(type);
  61221. };
  61222. /**
  61223. * @param {?} typeOrFunc
  61224. * @return {?}
  61225. */
  61226. JitReflector.prototype.parameters = /**
  61227. * @param {?} typeOrFunc
  61228. * @return {?}
  61229. */
  61230. function (typeOrFunc) {
  61231. return this.reflectionCapabilities.parameters(typeOrFunc);
  61232. };
  61233. /**
  61234. * @param {?} typeOrFunc
  61235. * @return {?}
  61236. */
  61237. JitReflector.prototype.annotations = /**
  61238. * @param {?} typeOrFunc
  61239. * @return {?}
  61240. */
  61241. function (typeOrFunc) {
  61242. return this.reflectionCapabilities.annotations(typeOrFunc);
  61243. };
  61244. /**
  61245. * @param {?} typeOrFunc
  61246. * @return {?}
  61247. */
  61248. JitReflector.prototype.propMetadata = /**
  61249. * @param {?} typeOrFunc
  61250. * @return {?}
  61251. */
  61252. function (typeOrFunc) {
  61253. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  61254. };
  61255. /**
  61256. * @param {?} type
  61257. * @param {?} lcProperty
  61258. * @return {?}
  61259. */
  61260. JitReflector.prototype.hasLifecycleHook = /**
  61261. * @param {?} type
  61262. * @param {?} lcProperty
  61263. * @return {?}
  61264. */
  61265. function (type, lcProperty) {
  61266. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  61267. };
  61268. /**
  61269. * @param {?} type
  61270. * @return {?}
  61271. */
  61272. JitReflector.prototype.guards = /**
  61273. * @param {?} type
  61274. * @return {?}
  61275. */
  61276. function (type) { return this.reflectionCapabilities.guards(type); };
  61277. /**
  61278. * @param {?} ref
  61279. * @return {?}
  61280. */
  61281. JitReflector.prototype.resolveExternalReference = /**
  61282. * @param {?} ref
  61283. * @return {?}
  61284. */
  61285. function (ref) {
  61286. return builtinExternalReferences.get(ref) || ref.runtime;
  61287. };
  61288. return JitReflector;
  61289. }());
  61290. /**
  61291. * @return {?}
  61292. */
  61293. function createBuiltinExternalReferencesMap() {
  61294. var /** @type {?} */ map = new Map();
  61295. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ANALYZE_FOR_ENTRY_COMPONENTS, __WEBPACK_IMPORTED_MODULE_1__angular_core__["a" /* ANALYZE_FOR_ENTRY_COMPONENTS */]);
  61296. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ElementRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["r" /* ElementRef */]);
  61297. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["H" /* NgModuleRef */]);
  61298. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewContainerRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* ViewContainerRef */]);
  61299. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectorRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* ChangeDetectorRef */]);
  61300. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].QueryList, __WEBPACK_IMPORTED_MODULE_1__angular_core__["P" /* QueryList */]);
  61301. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TemplateRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Z" /* TemplateRef */]);
  61302. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].CodegenComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* ɵCodegenComponentFactoryResolver */]);
  61303. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["o" /* ComponentFactoryResolver */]);
  61304. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* ComponentFactory */]);
  61305. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["p" /* ComponentRef */]);
  61306. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["G" /* NgModuleFactory */]);
  61307. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_18" /* ɵcmf */]);
  61308. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_28" /* ɵmod */]);
  61309. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleProviderDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_29" /* ɵmpd */]);
  61310. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].RegisterModuleFactoryFn, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_38" /* ɵregisterModuleFactory */]);
  61311. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Injector, __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */]);
  61312. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewEncapsulation, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */]);
  61313. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectionStrategy, __WEBPACK_IMPORTED_MODULE_1__angular_core__["i" /* ChangeDetectionStrategy */]);
  61314. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].SecurityContext, __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */]);
  61315. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].LOCALE_ID, __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* LOCALE_ID */]);
  61316. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TRANSLATIONS_FORMAT, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Y" /* TRANSLATIONS_FORMAT */]);
  61317. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].inlineInterpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_23" /* ɵinlineInterpolate */]);
  61318. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].interpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_24" /* ɵinterpolate */]);
  61319. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_ARRAY, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_13" /* ɵEMPTY_ARRAY */]);
  61320. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_MAP, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* ɵEMPTY_MAP */]);
  61321. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Renderer, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Q" /* Renderer */]);
  61322. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].viewDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_42" /* ɵvid */]);
  61323. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].elementDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_21" /* ɵeld */]);
  61324. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].anchorDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_16" /* ɵand */]);
  61325. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].textDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_40" /* ɵted */]);
  61326. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].directiveDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵdid */]);
  61327. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].providerDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_36" /* ɵprd */]);
  61328. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].queryDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_37" /* ɵqud */]);
  61329. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureArrayDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_32" /* ɵpad */]);
  61330. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureObjectDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_34" /* ɵpod */]);
  61331. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].purePipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_35" /* ɵppd */]);
  61332. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_33" /* ɵpid */]);
  61333. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].nodeValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_31" /* ɵnov */]);
  61334. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ngContentDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵncd */]);
  61335. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].unwrapValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_41" /* ɵunv */]);
  61336. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createRendererType2, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_19" /* ɵcrt */]);
  61337. map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_17" /* ɵccf */]);
  61338. return map;
  61339. }
  61340. /**
  61341. * @fileoverview added by tsickle
  61342. * @suppress {checkTypes} checked by tsc
  61343. */
  61344. /**
  61345. * @license
  61346. * Copyright Google Inc. All Rights Reserved.
  61347. *
  61348. * Use of this source code is governed by an MIT-style license that can be
  61349. * found in the LICENSE file at https://angular.io/license
  61350. */
  61351. var ERROR_COLLECTOR_TOKEN = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('ErrorCollector');
  61352. /**
  61353. * A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'.
  61354. */
  61355. var DEFAULT_PACKAGE_URL_PROVIDER = {
  61356. provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["L" /* PACKAGE_ROOT_URL */],
  61357. useValue: '/'
  61358. };
  61359. var _NO_RESOURCE_LOADER = {
  61360. get: /**
  61361. * @param {?} url
  61362. * @return {?}
  61363. */
  61364. function (url) {
  61365. throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");
  61366. }
  61367. };
  61368. var baseHtmlParser = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('HtmlParser');
  61369. var CompilerImpl = /** @class */ (function () {
  61370. function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) {
  61371. this._metadataResolver = _metadataResolver;
  61372. this._delegate = new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["k" /* JitCompiler */](_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
  61373. this.injector = injector;
  61374. }
  61375. /**
  61376. * @return {?}
  61377. */
  61378. CompilerImpl.prototype.getExtraNgModuleProviders = /**
  61379. * @return {?}
  61380. */
  61381. function () {
  61382. return [this._metadataResolver.getProviderMetadata(new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["r" /* ProviderMeta */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */], { useValue: this }))];
  61383. };
  61384. /**
  61385. * @template T
  61386. * @param {?} moduleType
  61387. * @return {?}
  61388. */
  61389. CompilerImpl.prototype.compileModuleSync = /**
  61390. * @template T
  61391. * @param {?} moduleType
  61392. * @return {?}
  61393. */
  61394. function (moduleType) {
  61395. return /** @type {?} */ (this._delegate.compileModuleSync(moduleType));
  61396. };
  61397. /**
  61398. * @template T
  61399. * @param {?} moduleType
  61400. * @return {?}
  61401. */
  61402. CompilerImpl.prototype.compileModuleAsync = /**
  61403. * @template T
  61404. * @param {?} moduleType
  61405. * @return {?}
  61406. */
  61407. function (moduleType) {
  61408. return /** @type {?} */ (this._delegate.compileModuleAsync(moduleType));
  61409. };
  61410. /**
  61411. * @template T
  61412. * @param {?} moduleType
  61413. * @return {?}
  61414. */
  61415. CompilerImpl.prototype.compileModuleAndAllComponentsSync = /**
  61416. * @template T
  61417. * @param {?} moduleType
  61418. * @return {?}
  61419. */
  61420. function (moduleType) {
  61421. var /** @type {?} */ result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
  61422. return {
  61423. ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
  61424. componentFactories: /** @type {?} */ (result.componentFactories),
  61425. };
  61426. };
  61427. /**
  61428. * @template T
  61429. * @param {?} moduleType
  61430. * @return {?}
  61431. */
  61432. CompilerImpl.prototype.compileModuleAndAllComponentsAsync = /**
  61433. * @template T
  61434. * @param {?} moduleType
  61435. * @return {?}
  61436. */
  61437. function (moduleType) {
  61438. return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
  61439. .then(function (result) {
  61440. return ({
  61441. ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
  61442. componentFactories: /** @type {?} */ (result.componentFactories),
  61443. });
  61444. });
  61445. };
  61446. /**
  61447. * @param {?} summaries
  61448. * @return {?}
  61449. */
  61450. CompilerImpl.prototype.loadAotSummaries = /**
  61451. * @param {?} summaries
  61452. * @return {?}
  61453. */
  61454. function (summaries) { this._delegate.loadAotSummaries(summaries); };
  61455. /**
  61456. * @param {?} ref
  61457. * @return {?}
  61458. */
  61459. CompilerImpl.prototype.hasAotSummary = /**
  61460. * @param {?} ref
  61461. * @return {?}
  61462. */
  61463. function (ref) { return this._delegate.hasAotSummary(ref); };
  61464. /**
  61465. * @template T
  61466. * @param {?} component
  61467. * @return {?}
  61468. */
  61469. CompilerImpl.prototype.getComponentFactory = /**
  61470. * @template T
  61471. * @param {?} component
  61472. * @return {?}
  61473. */
  61474. function (component) {
  61475. return /** @type {?} */ (this._delegate.getComponentFactory(component));
  61476. };
  61477. /**
  61478. * @return {?}
  61479. */
  61480. CompilerImpl.prototype.clearCache = /**
  61481. * @return {?}
  61482. */
  61483. function () { this._delegate.clearCache(); };
  61484. /**
  61485. * @param {?} type
  61486. * @return {?}
  61487. */
  61488. CompilerImpl.prototype.clearCacheFor = /**
  61489. * @param {?} type
  61490. * @return {?}
  61491. */
  61492. function (type) { this._delegate.clearCacheFor(type); };
  61493. return CompilerImpl;
  61494. }());
  61495. /**
  61496. * A set of providers that provide `JitCompiler` and its dependencies to use for
  61497. * template compilation.
  61498. */
  61499. var COMPILER_PROVIDERS = /** @type {?} */ ([
  61500. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], useValue: new JitReflector() },
  61501. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useValue: _NO_RESOURCE_LOADER },
  61502. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */], deps: [] },
  61503. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */] },
  61504. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */], deps: [] },
  61505. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */], deps: [] },
  61506. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */]] },
  61507. {
  61508. provide: baseHtmlParser,
  61509. useClass: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */],
  61510. deps: [],
  61511. },
  61512. {
  61513. provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */],
  61514. useFactory: function (parser, translations, format, config, console) {
  61515. translations = translations || '';
  61516. var /** @type {?} */ missingTranslation = translations ? /** @type {?} */ ((config.missingTranslation)) : __WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* MissingTranslationStrategy */].Ignore;
  61517. return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */](parser, translations, format, missingTranslation, console);
  61518. },
  61519. deps: [
  61520. baseHtmlParser,
  61521. [new __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["X" /* TRANSLATIONS */])],
  61522. [new __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["Y" /* TRANSLATIONS_FORMAT */])],
  61523. [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]],
  61524. [__WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */]],
  61525. ]
  61526. },
  61527. {
  61528. provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */],
  61529. useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */],
  61530. },
  61531. {
  61532. provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */],
  61533. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */],
  61534. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */]]
  61535. },
  61536. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]] },
  61537. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["a" /* CompileMetadataResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */],
  61538. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */],
  61539. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */],
  61540. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */],
  61541. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */],
  61542. [__WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["t" /* StaticSymbolCache */]],
  61543. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */],
  61544. [__WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */], ERROR_COLLECTOR_TOKEN]] },
  61545. DEFAULT_PACKAGE_URL_PROVIDER,
  61546. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */]] },
  61547. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
  61548. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
  61549. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], useValue: new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]() },
  61550. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */], useClass: CompilerImpl, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["a" /* CompileMetadataResolver */],
  61551. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */],
  61552. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */],
  61553. __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */],
  61554. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */]] },
  61555. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */], deps: [] },
  61556. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */] },
  61557. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["L" /* PACKAGE_ROOT_URL */]] },
  61558. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
  61559. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
  61560. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
  61561. ]);
  61562. /**
  61563. * \@experimental
  61564. */
  61565. var JitCompilerFactory = /** @class */ (function () {
  61566. /* @internal */
  61567. function JitCompilerFactory(defaultOptions) {
  61568. var /** @type {?} */ compilerOptions = {
  61569. useJit: true,
  61570. defaultEncapsulation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */].Emulated,
  61571. missingTranslation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* MissingTranslationStrategy */].Warning,
  61572. enableLegacyTemplate: false,
  61573. };
  61574. this._defaultOptions = [compilerOptions].concat(defaultOptions);
  61575. }
  61576. /**
  61577. * @param {?=} options
  61578. * @return {?}
  61579. */
  61580. JitCompilerFactory.prototype.createCompiler = /**
  61581. * @param {?=} options
  61582. * @return {?}
  61583. */
  61584. function (options) {
  61585. if (options === void 0) { options = []; }
  61586. var /** @type {?} */ opts = _mergeOptions(this._defaultOptions.concat(options));
  61587. var /** @type {?} */ injector = __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */].create([
  61588. COMPILER_PROVIDERS, {
  61589. provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */],
  61590. useFactory: function () {
  61591. return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]({
  61592. // let explicit values from the compiler options overwrite options
  61593. // from the app providers
  61594. useJit: opts.useJit,
  61595. jitDevMode: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])(),
  61596. // let explicit values from the compiler options overwrite options
  61597. // from the app providers
  61598. defaultEncapsulation: opts.defaultEncapsulation,
  61599. missingTranslation: opts.missingTranslation,
  61600. enableLegacyTemplate: opts.enableLegacyTemplate,
  61601. preserveWhitespaces: opts.preserveWhitespaces,
  61602. });
  61603. },
  61604. deps: []
  61605. },
  61606. /** @type {?} */ ((opts.providers))
  61607. ]);
  61608. return injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */]);
  61609. };
  61610. return JitCompilerFactory;
  61611. }());
  61612. /**
  61613. * @param {?} optionsArr
  61614. * @return {?}
  61615. */
  61616. function _mergeOptions(optionsArr) {
  61617. return {
  61618. useJit: _lastDefined(optionsArr.map(function (options) { return options.useJit; })),
  61619. defaultEncapsulation: _lastDefined(optionsArr.map(function (options) { return options.defaultEncapsulation; })),
  61620. providers: _mergeArrays(optionsArr.map(function (options) { return ((options.providers)); })),
  61621. missingTranslation: _lastDefined(optionsArr.map(function (options) { return options.missingTranslation; })),
  61622. enableLegacyTemplate: _lastDefined(optionsArr.map(function (options) { return options.enableLegacyTemplate; })),
  61623. preserveWhitespaces: _lastDefined(optionsArr.map(function (options) { return options.preserveWhitespaces; })),
  61624. };
  61625. }
  61626. /**
  61627. * @template T
  61628. * @param {?} args
  61629. * @return {?}
  61630. */
  61631. function _lastDefined(args) {
  61632. for (var /** @type {?} */ i = args.length - 1; i >= 0; i--) {
  61633. if (args[i] !== undefined) {
  61634. return args[i];
  61635. }
  61636. }
  61637. return undefined;
  61638. }
  61639. /**
  61640. * @param {?} parts
  61641. * @return {?}
  61642. */
  61643. function _mergeArrays(parts) {
  61644. var /** @type {?} */ result = [];
  61645. parts.forEach(function (part) { return part && result.push.apply(result, part); });
  61646. return result;
  61647. }
  61648. /**
  61649. * @fileoverview added by tsickle
  61650. * @suppress {checkTypes} checked by tsc
  61651. */
  61652. /**
  61653. * @license
  61654. * Copyright Google Inc. All Rights Reserved.
  61655. *
  61656. * Use of this source code is governed by an MIT-style license that can be
  61657. * found in the LICENSE file at https://angular.io/license
  61658. */
  61659. /**
  61660. * A platform that included corePlatform and the compiler.
  61661. *
  61662. * \@experimental
  61663. */
  61664. var platformCoreDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* createPlatformFactory */])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_9" /* platformCore */], 'coreDynamic', [
  61665. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */], useValue: {}, multi: true },
  61666. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["l" /* CompilerFactory */], useClass: JitCompilerFactory, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */]] },
  61667. ]);
  61668. /**
  61669. * @fileoverview added by tsickle
  61670. * @suppress {checkTypes} checked by tsc
  61671. */
  61672. var ResourceLoaderImpl = /** @class */ (function (_super) {
  61673. Object(__WEBPACK_IMPORTED_MODULE_4_tslib__["b" /* __extends */])(ResourceLoaderImpl, _super);
  61674. function ResourceLoaderImpl() {
  61675. return _super !== null && _super.apply(this, arguments) || this;
  61676. }
  61677. /**
  61678. * @param {?} url
  61679. * @return {?}
  61680. */
  61681. ResourceLoaderImpl.prototype.get = /**
  61682. * @param {?} url
  61683. * @return {?}
  61684. */
  61685. function (url) {
  61686. var /** @type {?} */ resolve;
  61687. var /** @type {?} */ reject;
  61688. var /** @type {?} */ promise = new Promise(function (res, rej) {
  61689. resolve = res;
  61690. reject = rej;
  61691. });
  61692. var /** @type {?} */ xhr = new XMLHttpRequest();
  61693. xhr.open('GET', url, true);
  61694. xhr.responseType = 'text';
  61695. xhr.onload = function () {
  61696. // responseText is the old-school way of retrieving response (supported by IE8 & 9)
  61697. // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
  61698. // by IE10)
  61699. var /** @type {?} */ response = xhr.response || xhr.responseText;
  61700. // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
  61701. var /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status;
  61702. // fix status code when it is 0 (0 status is undocumented).
  61703. // Occurs when accessing file resources or on Android 4.1 stock browser
  61704. // while retrieving files from application cache.
  61705. if (status === 0) {
  61706. status = response ? 200 : 0;
  61707. }
  61708. if (200 <= status && status <= 300) {
  61709. resolve(response);
  61710. }
  61711. else {
  61712. reject("Failed to load " + url);
  61713. }
  61714. };
  61715. xhr.onerror = function () { reject("Failed to load " + url); };
  61716. xhr.send();
  61717. return promise;
  61718. };
  61719. ResourceLoaderImpl.decorators = [
  61720. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  61721. ];
  61722. /** @nocollapse */
  61723. ResourceLoaderImpl.ctorParameters = function () { return []; };
  61724. return ResourceLoaderImpl;
  61725. }(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */]));
  61726. /**
  61727. * @fileoverview added by tsickle
  61728. * @suppress {checkTypes} checked by tsc
  61729. */
  61730. /**
  61731. * @license
  61732. * Copyright Google Inc. All Rights Reserved.
  61733. *
  61734. * Use of this source code is governed by an MIT-style license that can be
  61735. * found in the LICENSE file at https://angular.io/license
  61736. */
  61737. var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
  61738. __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__["b" /* ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS */],
  61739. {
  61740. provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */],
  61741. useValue: { providers: [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: ResourceLoaderImpl, deps: [] }] },
  61742. multi: true
  61743. },
  61744. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* PLATFORM_ID */], useValue: __WEBPACK_IMPORTED_MODULE_2__angular_common__["d" /* ɵPLATFORM_BROWSER_ID */] },
  61745. ];
  61746. /**
  61747. * @fileoverview added by tsickle
  61748. * @suppress {checkTypes} checked by tsc
  61749. */
  61750. /**
  61751. * @license
  61752. * Copyright Google Inc. All Rights Reserved.
  61753. *
  61754. * Use of this source code is governed by an MIT-style license that can be
  61755. * found in the LICENSE file at https://angular.io/license
  61756. */
  61757. /**
  61758. * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
  61759. * ResourceLoader.
  61760. *
  61761. * The template cache needs to be built and loaded into window.$templateCache
  61762. * via a separate mechanism.
  61763. */
  61764. var CachedResourceLoader = /** @class */ (function (_super) {
  61765. Object(__WEBPACK_IMPORTED_MODULE_4_tslib__["b" /* __extends */])(CachedResourceLoader, _super);
  61766. function CachedResourceLoader() {
  61767. var _this = _super.call(this) || this;
  61768. _this._cache = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */])).$templateCache;
  61769. if (_this._cache == null) {
  61770. throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
  61771. }
  61772. return _this;
  61773. }
  61774. /**
  61775. * @param {?} url
  61776. * @return {?}
  61777. */
  61778. CachedResourceLoader.prototype.get = /**
  61779. * @param {?} url
  61780. * @return {?}
  61781. */
  61782. function (url) {
  61783. if (this._cache.hasOwnProperty(url)) {
  61784. return Promise.resolve(this._cache[url]);
  61785. }
  61786. else {
  61787. return /** @type {?} */ (Promise.reject('CachedResourceLoader: Did not find cached template for ' + url));
  61788. }
  61789. };
  61790. return CachedResourceLoader;
  61791. }(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */]));
  61792. /**
  61793. * @fileoverview added by tsickle
  61794. * @suppress {checkTypes} checked by tsc
  61795. */
  61796. /**
  61797. * @license
  61798. * Copyright Google Inc. All Rights Reserved.
  61799. *
  61800. * Use of this source code is governed by an MIT-style license that can be
  61801. * found in the LICENSE file at https://angular.io/license
  61802. */
  61803. /**
  61804. * @fileoverview added by tsickle
  61805. * @suppress {checkTypes} checked by tsc
  61806. */
  61807. /**
  61808. * @license
  61809. * Copyright Google Inc. All Rights Reserved.
  61810. *
  61811. * Use of this source code is governed by an MIT-style license that can be
  61812. * found in the LICENSE file at https://angular.io/license
  61813. */
  61814. /**
  61815. * \@stable
  61816. */
  61817. var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Version */]('5.2.9');
  61818. /**
  61819. * @fileoverview added by tsickle
  61820. * @suppress {checkTypes} checked by tsc
  61821. */
  61822. /**
  61823. * @license
  61824. * Copyright Google Inc. All Rights Reserved.
  61825. *
  61826. * Use of this source code is governed by an MIT-style license that can be
  61827. * found in the LICENSE file at https://angular.io/license
  61828. */
  61829. /**
  61830. * \@experimental
  61831. */
  61832. var RESOURCE_CACHE_PROVIDER = [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: CachedResourceLoader, deps: [] }];
  61833. /**
  61834. * \@stable
  61835. */
  61836. var platformBrowserDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* createPlatformFactory */])(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
  61837. /**
  61838. * @fileoverview added by tsickle
  61839. * @suppress {checkTypes} checked by tsc
  61840. */
  61841. /**
  61842. * @license
  61843. * Copyright Google Inc. All Rights Reserved.
  61844. *
  61845. * Use of this source code is governed by an MIT-style license that can be
  61846. * found in the LICENSE file at https://angular.io/license
  61847. */
  61848. /**
  61849. * @module
  61850. * @description
  61851. * Entry point for all public APIs of this package.
  61852. */
  61853. // This file only reexports content of the `src` folder. Keep it that way.
  61854. /**
  61855. * @fileoverview added by tsickle
  61856. * @suppress {checkTypes} checked by tsc
  61857. */
  61858. /**
  61859. * Generated bundle index. Do not edit.
  61860. */
  61861. //# sourceMappingURL=platform-browser-dynamic.js.map
  61862. /***/ }),
  61863. /***/ "./node_modules/@angular/platform-browser/esm5/platform-browser.js":
  61864. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61865. "use strict";
  61866. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BrowserModule; });
  61867. /* unused harmony export platformBrowser */
  61868. /* unused harmony export Meta */
  61869. /* unused harmony export Title */
  61870. /* unused harmony export disableDebugTools */
  61871. /* unused harmony export enableDebugTools */
  61872. /* unused harmony export BrowserTransferStateModule */
  61873. /* unused harmony export TransferState */
  61874. /* unused harmony export makeStateKey */
  61875. /* unused harmony export By */
  61876. /* unused harmony export DOCUMENT */
  61877. /* unused harmony export EVENT_MANAGER_PLUGINS */
  61878. /* unused harmony export EventManager */
  61879. /* unused harmony export HAMMER_GESTURE_CONFIG */
  61880. /* unused harmony export HammerGestureConfig */
  61881. /* unused harmony export DomSanitizer */
  61882. /* unused harmony export VERSION */
  61883. /* unused harmony export ɵBROWSER_SANITIZATION_PROVIDERS */
  61884. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; });
  61885. /* unused harmony export ɵinitDomAdapter */
  61886. /* unused harmony export ɵBrowserDomAdapter */
  61887. /* unused harmony export ɵBrowserPlatformLocation */
  61888. /* unused harmony export ɵTRANSITION_ID */
  61889. /* unused harmony export ɵBrowserGetTestability */
  61890. /* unused harmony export ɵescapeHtml */
  61891. /* unused harmony export ɵELEMENT_PROBE_PROVIDERS */
  61892. /* unused harmony export ɵDomAdapter */
  61893. /* unused harmony export ɵgetDOM */
  61894. /* unused harmony export ɵsetRootDomAdapter */
  61895. /* unused harmony export ɵDomRendererFactory2 */
  61896. /* unused harmony export ɵNAMESPACE_URIS */
  61897. /* unused harmony export ɵflattenStyles */
  61898. /* unused harmony export ɵshimContentAttribute */
  61899. /* unused harmony export ɵshimHostAttribute */
  61900. /* unused harmony export ɵDomEventsPlugin */
  61901. /* unused harmony export ɵHammerGesturesPlugin */
  61902. /* unused harmony export ɵKeyEventsPlugin */
  61903. /* unused harmony export ɵDomSharedStylesHost */
  61904. /* unused harmony export ɵSharedStylesHost */
  61905. /* unused harmony export ɵb */
  61906. /* unused harmony export ɵa */
  61907. /* unused harmony export ɵi */
  61908. /* unused harmony export ɵg */
  61909. /* unused harmony export ɵf */
  61910. /* unused harmony export ɵc */
  61911. /* unused harmony export ɵh */
  61912. /* unused harmony export ɵd */
  61913. /* unused harmony export ɵe */
  61914. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm5/common.js");
  61915. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
  61916. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
  61917. /**
  61918. * @license Angular v5.2.9
  61919. * (c) 2010-2018 Google, Inc. https://angular.io/
  61920. * License: MIT
  61921. */
  61922. /**
  61923. * @fileoverview added by tsickle
  61924. * @suppress {checkTypes} checked by tsc
  61925. */
  61926. /**
  61927. * @license
  61928. * Copyright Google Inc. All Rights Reserved.
  61929. *
  61930. * Use of this source code is governed by an MIT-style license that can be
  61931. * found in the LICENSE file at https://angular.io/license
  61932. */
  61933. var _DOM = /** @type {?} */ ((null));
  61934. /**
  61935. * @return {?}
  61936. */
  61937. function getDOM() {
  61938. return _DOM;
  61939. }
  61940. /**
  61941. * @param {?} adapter
  61942. * @return {?}
  61943. */
  61944. /**
  61945. * @param {?} adapter
  61946. * @return {?}
  61947. */
  61948. function setRootDomAdapter(adapter) {
  61949. if (!_DOM) {
  61950. _DOM = adapter;
  61951. }
  61952. }
  61953. /**
  61954. * Provides DOM operations in an environment-agnostic way.
  61955. *
  61956. * \@security Tread carefully! Interacting with the DOM directly is dangerous and
  61957. * can introduce XSS risks.
  61958. * @abstract
  61959. */
  61960. var DomAdapter = /** @class */ (function () {
  61961. function DomAdapter() {
  61962. this.resourceLoaderType = /** @type {?} */ ((null));
  61963. }
  61964. Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
  61965. /**
  61966. * Maps attribute names to their corresponding property names for cases
  61967. * where attribute name doesn't match property name.
  61968. */
  61969. get: /**
  61970. * Maps attribute names to their corresponding property names for cases
  61971. * where attribute name doesn't match property name.
  61972. * @return {?}
  61973. */
  61974. function () { return this._attrToPropMap; },
  61975. set: /**
  61976. * @param {?} value
  61977. * @return {?}
  61978. */
  61979. function (value) { this._attrToPropMap = value; },
  61980. enumerable: true,
  61981. configurable: true
  61982. });
  61983. return DomAdapter;
  61984. }());
  61985. /**
  61986. * @fileoverview added by tsickle
  61987. * @suppress {checkTypes} checked by tsc
  61988. */
  61989. /**
  61990. * @license
  61991. * Copyright Google Inc. All Rights Reserved.
  61992. *
  61993. * Use of this source code is governed by an MIT-style license that can be
  61994. * found in the LICENSE file at https://angular.io/license
  61995. */
  61996. /**
  61997. * Provides DOM operations in any browser environment.
  61998. *
  61999. * \@security Tread carefully! Interacting with the DOM directly is dangerous and
  62000. * can introduce XSS risks.
  62001. * @abstract
  62002. */
  62003. var GenericBrowserDomAdapter = /** @class */ (function (_super) {
  62004. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(GenericBrowserDomAdapter, _super);
  62005. function GenericBrowserDomAdapter() {
  62006. var _this = _super.call(this) || this;
  62007. _this._animationPrefix = null;
  62008. _this._transitionEnd = null;
  62009. try {
  62010. var /** @type {?} */ element_1 = _this.createElement('div', document);
  62011. if (_this.getStyle(element_1, 'animationName') != null) {
  62012. _this._animationPrefix = '';
  62013. }
  62014. else {
  62015. var /** @type {?} */ domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
  62016. for (var /** @type {?} */ i = 0; i < domPrefixes.length; i++) {
  62017. if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) {
  62018. _this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
  62019. break;
  62020. }
  62021. }
  62022. }
  62023. var /** @type {?} */ transEndEventNames_1 = {
  62024. WebkitTransition: 'webkitTransitionEnd',
  62025. MozTransition: 'transitionend',
  62026. OTransition: 'oTransitionEnd otransitionend',
  62027. transition: 'transitionend'
  62028. };
  62029. Object.keys(transEndEventNames_1).forEach(function (key) {
  62030. if (_this.getStyle(element_1, key) != null) {
  62031. _this._transitionEnd = transEndEventNames_1[key];
  62032. }
  62033. });
  62034. }
  62035. catch (/** @type {?} */ e) {
  62036. _this._animationPrefix = null;
  62037. _this._transitionEnd = null;
  62038. }
  62039. return _this;
  62040. }
  62041. /**
  62042. * @param {?} el
  62043. * @return {?}
  62044. */
  62045. GenericBrowserDomAdapter.prototype.getDistributedNodes = /**
  62046. * @param {?} el
  62047. * @return {?}
  62048. */
  62049. function (el) { return (/** @type {?} */ (el)).getDistributedNodes(); };
  62050. /**
  62051. * @param {?} el
  62052. * @param {?} baseUrl
  62053. * @param {?} href
  62054. * @return {?}
  62055. */
  62056. GenericBrowserDomAdapter.prototype.resolveAndSetHref = /**
  62057. * @param {?} el
  62058. * @param {?} baseUrl
  62059. * @param {?} href
  62060. * @return {?}
  62061. */
  62062. function (el, baseUrl, href) {
  62063. el.href = href == null ? baseUrl : baseUrl + '/../' + href;
  62064. };
  62065. /**
  62066. * @return {?}
  62067. */
  62068. GenericBrowserDomAdapter.prototype.supportsDOMEvents = /**
  62069. * @return {?}
  62070. */
  62071. function () { return true; };
  62072. /**
  62073. * @return {?}
  62074. */
  62075. GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = /**
  62076. * @return {?}
  62077. */
  62078. function () {
  62079. return typeof (/** @type {?} */ (document.body)).createShadowRoot === 'function';
  62080. };
  62081. /**
  62082. * @return {?}
  62083. */
  62084. GenericBrowserDomAdapter.prototype.getAnimationPrefix = /**
  62085. * @return {?}
  62086. */
  62087. function () { return this._animationPrefix ? this._animationPrefix : ''; };
  62088. /**
  62089. * @return {?}
  62090. */
  62091. GenericBrowserDomAdapter.prototype.getTransitionEnd = /**
  62092. * @return {?}
  62093. */
  62094. function () { return this._transitionEnd ? this._transitionEnd : ''; };
  62095. /**
  62096. * @return {?}
  62097. */
  62098. GenericBrowserDomAdapter.prototype.supportsAnimation = /**
  62099. * @return {?}
  62100. */
  62101. function () {
  62102. return this._animationPrefix != null && this._transitionEnd != null;
  62103. };
  62104. return GenericBrowserDomAdapter;
  62105. }(DomAdapter));
  62106. /**
  62107. * @fileoverview added by tsickle
  62108. * @suppress {checkTypes} checked by tsc
  62109. */
  62110. /**
  62111. * @license
  62112. * Copyright Google Inc. All Rights Reserved.
  62113. *
  62114. * Use of this source code is governed by an MIT-style license that can be
  62115. * found in the LICENSE file at https://angular.io/license
  62116. */
  62117. var _attrToPropMap = {
  62118. 'class': 'className',
  62119. 'innerHtml': 'innerHTML',
  62120. 'readonly': 'readOnly',
  62121. 'tabindex': 'tabIndex',
  62122. };
  62123. var DOM_KEY_LOCATION_NUMPAD = 3;
  62124. // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
  62125. var _keyMap = {
  62126. // The following values are here for cross-browser compatibility and to match the W3C standard
  62127. // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
  62128. '\b': 'Backspace',
  62129. '\t': 'Tab',
  62130. '\x7F': 'Delete',
  62131. '\x1B': 'Escape',
  62132. 'Del': 'Delete',
  62133. 'Esc': 'Escape',
  62134. 'Left': 'ArrowLeft',
  62135. 'Right': 'ArrowRight',
  62136. 'Up': 'ArrowUp',
  62137. 'Down': 'ArrowDown',
  62138. 'Menu': 'ContextMenu',
  62139. 'Scroll': 'ScrollLock',
  62140. 'Win': 'OS'
  62141. };
  62142. // There is a bug in Chrome for numeric keypad keys:
  62143. // https://code.google.com/p/chromium/issues/detail?id=155654
  62144. // 1, 2, 3 ... are reported as A, B, C ...
  62145. var _chromeNumKeyPadMap = {
  62146. 'A': '1',
  62147. 'B': '2',
  62148. 'C': '3',
  62149. 'D': '4',
  62150. 'E': '5',
  62151. 'F': '6',
  62152. 'G': '7',
  62153. 'H': '8',
  62154. 'I': '9',
  62155. 'J': '*',
  62156. 'K': '+',
  62157. 'M': '-',
  62158. 'N': '.',
  62159. 'O': '/',
  62160. '\x60': '0',
  62161. '\x90': 'NumLock'
  62162. };
  62163. var nodeContains;
  62164. if (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['Node']) {
  62165. nodeContains = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['Node'].prototype.contains || function (node) {
  62166. return !!(this.compareDocumentPosition(node) & 16);
  62167. };
  62168. }
  62169. /**
  62170. * A `DomAdapter` powered by full browser DOM APIs.
  62171. *
  62172. * \@security Tread carefully! Interacting with the DOM directly is dangerous and
  62173. * can introduce XSS risks.
  62174. */
  62175. var BrowserDomAdapter = /** @class */ (function (_super) {
  62176. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(BrowserDomAdapter, _super);
  62177. function BrowserDomAdapter() {
  62178. return _super !== null && _super.apply(this, arguments) || this;
  62179. }
  62180. /**
  62181. * @param {?} templateHtml
  62182. * @return {?}
  62183. */
  62184. BrowserDomAdapter.prototype.parse = /**
  62185. * @param {?} templateHtml
  62186. * @return {?}
  62187. */
  62188. function (templateHtml) { throw new Error('parse not implemented'); };
  62189. /**
  62190. * @return {?}
  62191. */
  62192. BrowserDomAdapter.makeCurrent = /**
  62193. * @return {?}
  62194. */
  62195. function () { setRootDomAdapter(new BrowserDomAdapter()); };
  62196. /**
  62197. * @param {?} element
  62198. * @param {?} name
  62199. * @return {?}
  62200. */
  62201. BrowserDomAdapter.prototype.hasProperty = /**
  62202. * @param {?} element
  62203. * @param {?} name
  62204. * @return {?}
  62205. */
  62206. function (element, name) { return name in element; };
  62207. /**
  62208. * @param {?} el
  62209. * @param {?} name
  62210. * @param {?} value
  62211. * @return {?}
  62212. */
  62213. BrowserDomAdapter.prototype.setProperty = /**
  62214. * @param {?} el
  62215. * @param {?} name
  62216. * @param {?} value
  62217. * @return {?}
  62218. */
  62219. function (el, name, value) { (/** @type {?} */ (el))[name] = value; };
  62220. /**
  62221. * @param {?} el
  62222. * @param {?} name
  62223. * @return {?}
  62224. */
  62225. BrowserDomAdapter.prototype.getProperty = /**
  62226. * @param {?} el
  62227. * @param {?} name
  62228. * @return {?}
  62229. */
  62230. function (el, name) { return (/** @type {?} */ (el))[name]; };
  62231. /**
  62232. * @param {?} el
  62233. * @param {?} methodName
  62234. * @param {?} args
  62235. * @return {?}
  62236. */
  62237. BrowserDomAdapter.prototype.invoke = /**
  62238. * @param {?} el
  62239. * @param {?} methodName
  62240. * @param {?} args
  62241. * @return {?}
  62242. */
  62243. function (el, methodName, args) {
  62244. (_a = (/** @type {?} */ (el)))[methodName].apply(_a, args);
  62245. var _a;
  62246. };
  62247. // TODO(tbosch): move this into a separate environment class once we have it
  62248. /**
  62249. * @param {?} error
  62250. * @return {?}
  62251. */
  62252. BrowserDomAdapter.prototype.logError = /**
  62253. * @param {?} error
  62254. * @return {?}
  62255. */
  62256. function (error) {
  62257. if (window.console) {
  62258. if (console.error) {
  62259. console.error(error);
  62260. }
  62261. else {
  62262. console.log(error);
  62263. }
  62264. }
  62265. };
  62266. /**
  62267. * @param {?} error
  62268. * @return {?}
  62269. */
  62270. BrowserDomAdapter.prototype.log = /**
  62271. * @param {?} error
  62272. * @return {?}
  62273. */
  62274. function (error) {
  62275. if (window.console) {
  62276. window.console.log && window.console.log(error);
  62277. }
  62278. };
  62279. /**
  62280. * @param {?} error
  62281. * @return {?}
  62282. */
  62283. BrowserDomAdapter.prototype.logGroup = /**
  62284. * @param {?} error
  62285. * @return {?}
  62286. */
  62287. function (error) {
  62288. if (window.console) {
  62289. window.console.group && window.console.group(error);
  62290. }
  62291. };
  62292. /**
  62293. * @return {?}
  62294. */
  62295. BrowserDomAdapter.prototype.logGroupEnd = /**
  62296. * @return {?}
  62297. */
  62298. function () {
  62299. if (window.console) {
  62300. window.console.groupEnd && window.console.groupEnd();
  62301. }
  62302. };
  62303. Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
  62304. get: /**
  62305. * @return {?}
  62306. */
  62307. function () { return _attrToPropMap; },
  62308. enumerable: true,
  62309. configurable: true
  62310. });
  62311. /**
  62312. * @param {?} nodeA
  62313. * @param {?} nodeB
  62314. * @return {?}
  62315. */
  62316. BrowserDomAdapter.prototype.contains = /**
  62317. * @param {?} nodeA
  62318. * @param {?} nodeB
  62319. * @return {?}
  62320. */
  62321. function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); };
  62322. /**
  62323. * @param {?} el
  62324. * @param {?} selector
  62325. * @return {?}
  62326. */
  62327. BrowserDomAdapter.prototype.querySelector = /**
  62328. * @param {?} el
  62329. * @param {?} selector
  62330. * @return {?}
  62331. */
  62332. function (el, selector) { return el.querySelector(selector); };
  62333. /**
  62334. * @param {?} el
  62335. * @param {?} selector
  62336. * @return {?}
  62337. */
  62338. BrowserDomAdapter.prototype.querySelectorAll = /**
  62339. * @param {?} el
  62340. * @param {?} selector
  62341. * @return {?}
  62342. */
  62343. function (el, selector) { return el.querySelectorAll(selector); };
  62344. /**
  62345. * @param {?} el
  62346. * @param {?} evt
  62347. * @param {?} listener
  62348. * @return {?}
  62349. */
  62350. BrowserDomAdapter.prototype.on = /**
  62351. * @param {?} el
  62352. * @param {?} evt
  62353. * @param {?} listener
  62354. * @return {?}
  62355. */
  62356. function (el, evt, listener) { el.addEventListener(evt, listener, false); };
  62357. /**
  62358. * @param {?} el
  62359. * @param {?} evt
  62360. * @param {?} listener
  62361. * @return {?}
  62362. */
  62363. BrowserDomAdapter.prototype.onAndCancel = /**
  62364. * @param {?} el
  62365. * @param {?} evt
  62366. * @param {?} listener
  62367. * @return {?}
  62368. */
  62369. function (el, evt, listener) {
  62370. el.addEventListener(evt, listener, false);
  62371. // Needed to follow Dart's subscription semantic, until fix of
  62372. // https://code.google.com/p/dart/issues/detail?id=17406
  62373. return function () { el.removeEventListener(evt, listener, false); };
  62374. };
  62375. /**
  62376. * @param {?} el
  62377. * @param {?} evt
  62378. * @return {?}
  62379. */
  62380. BrowserDomAdapter.prototype.dispatchEvent = /**
  62381. * @param {?} el
  62382. * @param {?} evt
  62383. * @return {?}
  62384. */
  62385. function (el, evt) { el.dispatchEvent(evt); };
  62386. /**
  62387. * @param {?} eventType
  62388. * @return {?}
  62389. */
  62390. BrowserDomAdapter.prototype.createMouseEvent = /**
  62391. * @param {?} eventType
  62392. * @return {?}
  62393. */
  62394. function (eventType) {
  62395. var /** @type {?} */ evt = this.getDefaultDocument().createEvent('MouseEvent');
  62396. evt.initEvent(eventType, true, true);
  62397. return evt;
  62398. };
  62399. /**
  62400. * @param {?} eventType
  62401. * @return {?}
  62402. */
  62403. BrowserDomAdapter.prototype.createEvent = /**
  62404. * @param {?} eventType
  62405. * @return {?}
  62406. */
  62407. function (eventType) {
  62408. var /** @type {?} */ evt = this.getDefaultDocument().createEvent('Event');
  62409. evt.initEvent(eventType, true, true);
  62410. return evt;
  62411. };
  62412. /**
  62413. * @param {?} evt
  62414. * @return {?}
  62415. */
  62416. BrowserDomAdapter.prototype.preventDefault = /**
  62417. * @param {?} evt
  62418. * @return {?}
  62419. */
  62420. function (evt) {
  62421. evt.preventDefault();
  62422. evt.returnValue = false;
  62423. };
  62424. /**
  62425. * @param {?} evt
  62426. * @return {?}
  62427. */
  62428. BrowserDomAdapter.prototype.isPrevented = /**
  62429. * @param {?} evt
  62430. * @return {?}
  62431. */
  62432. function (evt) {
  62433. return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
  62434. };
  62435. /**
  62436. * @param {?} el
  62437. * @return {?}
  62438. */
  62439. BrowserDomAdapter.prototype.getInnerHTML = /**
  62440. * @param {?} el
  62441. * @return {?}
  62442. */
  62443. function (el) { return el.innerHTML; };
  62444. /**
  62445. * @param {?} el
  62446. * @return {?}
  62447. */
  62448. BrowserDomAdapter.prototype.getTemplateContent = /**
  62449. * @param {?} el
  62450. * @return {?}
  62451. */
  62452. function (el) {
  62453. return 'content' in el && this.isTemplateElement(el) ? (/** @type {?} */ (el)).content : null;
  62454. };
  62455. /**
  62456. * @param {?} el
  62457. * @return {?}
  62458. */
  62459. BrowserDomAdapter.prototype.getOuterHTML = /**
  62460. * @param {?} el
  62461. * @return {?}
  62462. */
  62463. function (el) { return el.outerHTML; };
  62464. /**
  62465. * @param {?} node
  62466. * @return {?}
  62467. */
  62468. BrowserDomAdapter.prototype.nodeName = /**
  62469. * @param {?} node
  62470. * @return {?}
  62471. */
  62472. function (node) { return node.nodeName; };
  62473. /**
  62474. * @param {?} node
  62475. * @return {?}
  62476. */
  62477. BrowserDomAdapter.prototype.nodeValue = /**
  62478. * @param {?} node
  62479. * @return {?}
  62480. */
  62481. function (node) { return node.nodeValue; };
  62482. /**
  62483. * @param {?} node
  62484. * @return {?}
  62485. */
  62486. BrowserDomAdapter.prototype.type = /**
  62487. * @param {?} node
  62488. * @return {?}
  62489. */
  62490. function (node) { return node.type; };
  62491. /**
  62492. * @param {?} node
  62493. * @return {?}
  62494. */
  62495. BrowserDomAdapter.prototype.content = /**
  62496. * @param {?} node
  62497. * @return {?}
  62498. */
  62499. function (node) {
  62500. if (this.hasProperty(node, 'content')) {
  62501. return (/** @type {?} */ (node)).content;
  62502. }
  62503. else {
  62504. return node;
  62505. }
  62506. };
  62507. /**
  62508. * @param {?} el
  62509. * @return {?}
  62510. */
  62511. BrowserDomAdapter.prototype.firstChild = /**
  62512. * @param {?} el
  62513. * @return {?}
  62514. */
  62515. function (el) { return el.firstChild; };
  62516. /**
  62517. * @param {?} el
  62518. * @return {?}
  62519. */
  62520. BrowserDomAdapter.prototype.nextSibling = /**
  62521. * @param {?} el
  62522. * @return {?}
  62523. */
  62524. function (el) { return el.nextSibling; };
  62525. /**
  62526. * @param {?} el
  62527. * @return {?}
  62528. */
  62529. BrowserDomAdapter.prototype.parentElement = /**
  62530. * @param {?} el
  62531. * @return {?}
  62532. */
  62533. function (el) { return el.parentNode; };
  62534. /**
  62535. * @param {?} el
  62536. * @return {?}
  62537. */
  62538. BrowserDomAdapter.prototype.childNodes = /**
  62539. * @param {?} el
  62540. * @return {?}
  62541. */
  62542. function (el) { return el.childNodes; };
  62543. /**
  62544. * @param {?} el
  62545. * @return {?}
  62546. */
  62547. BrowserDomAdapter.prototype.childNodesAsList = /**
  62548. * @param {?} el
  62549. * @return {?}
  62550. */
  62551. function (el) {
  62552. var /** @type {?} */ childNodes = el.childNodes;
  62553. var /** @type {?} */ res = new Array(childNodes.length);
  62554. for (var /** @type {?} */ i = 0; i < childNodes.length; i++) {
  62555. res[i] = childNodes[i];
  62556. }
  62557. return res;
  62558. };
  62559. /**
  62560. * @param {?} el
  62561. * @return {?}
  62562. */
  62563. BrowserDomAdapter.prototype.clearNodes = /**
  62564. * @param {?} el
  62565. * @return {?}
  62566. */
  62567. function (el) {
  62568. while (el.firstChild) {
  62569. el.removeChild(el.firstChild);
  62570. }
  62571. };
  62572. /**
  62573. * @param {?} el
  62574. * @param {?} node
  62575. * @return {?}
  62576. */
  62577. BrowserDomAdapter.prototype.appendChild = /**
  62578. * @param {?} el
  62579. * @param {?} node
  62580. * @return {?}
  62581. */
  62582. function (el, node) { el.appendChild(node); };
  62583. /**
  62584. * @param {?} el
  62585. * @param {?} node
  62586. * @return {?}
  62587. */
  62588. BrowserDomAdapter.prototype.removeChild = /**
  62589. * @param {?} el
  62590. * @param {?} node
  62591. * @return {?}
  62592. */
  62593. function (el, node) { el.removeChild(node); };
  62594. /**
  62595. * @param {?} el
  62596. * @param {?} newChild
  62597. * @param {?} oldChild
  62598. * @return {?}
  62599. */
  62600. BrowserDomAdapter.prototype.replaceChild = /**
  62601. * @param {?} el
  62602. * @param {?} newChild
  62603. * @param {?} oldChild
  62604. * @return {?}
  62605. */
  62606. function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
  62607. /**
  62608. * @param {?} node
  62609. * @return {?}
  62610. */
  62611. BrowserDomAdapter.prototype.remove = /**
  62612. * @param {?} node
  62613. * @return {?}
  62614. */
  62615. function (node) {
  62616. if (node.parentNode) {
  62617. node.parentNode.removeChild(node);
  62618. }
  62619. return node;
  62620. };
  62621. /**
  62622. * @param {?} parent
  62623. * @param {?} ref
  62624. * @param {?} node
  62625. * @return {?}
  62626. */
  62627. BrowserDomAdapter.prototype.insertBefore = /**
  62628. * @param {?} parent
  62629. * @param {?} ref
  62630. * @param {?} node
  62631. * @return {?}
  62632. */
  62633. function (parent, ref, node) { parent.insertBefore(node, ref); };
  62634. /**
  62635. * @param {?} parent
  62636. * @param {?} ref
  62637. * @param {?} nodes
  62638. * @return {?}
  62639. */
  62640. BrowserDomAdapter.prototype.insertAllBefore = /**
  62641. * @param {?} parent
  62642. * @param {?} ref
  62643. * @param {?} nodes
  62644. * @return {?}
  62645. */
  62646. function (parent, ref, nodes) {
  62647. nodes.forEach(function (n) { return parent.insertBefore(n, ref); });
  62648. };
  62649. /**
  62650. * @param {?} parent
  62651. * @param {?} ref
  62652. * @param {?} node
  62653. * @return {?}
  62654. */
  62655. BrowserDomAdapter.prototype.insertAfter = /**
  62656. * @param {?} parent
  62657. * @param {?} ref
  62658. * @param {?} node
  62659. * @return {?}
  62660. */
  62661. function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); };
  62662. /**
  62663. * @param {?} el
  62664. * @param {?} value
  62665. * @return {?}
  62666. */
  62667. BrowserDomAdapter.prototype.setInnerHTML = /**
  62668. * @param {?} el
  62669. * @param {?} value
  62670. * @return {?}
  62671. */
  62672. function (el, value) { el.innerHTML = value; };
  62673. /**
  62674. * @param {?} el
  62675. * @return {?}
  62676. */
  62677. BrowserDomAdapter.prototype.getText = /**
  62678. * @param {?} el
  62679. * @return {?}
  62680. */
  62681. function (el) { return el.textContent; };
  62682. /**
  62683. * @param {?} el
  62684. * @param {?} value
  62685. * @return {?}
  62686. */
  62687. BrowserDomAdapter.prototype.setText = /**
  62688. * @param {?} el
  62689. * @param {?} value
  62690. * @return {?}
  62691. */
  62692. function (el, value) { el.textContent = value; };
  62693. /**
  62694. * @param {?} el
  62695. * @return {?}
  62696. */
  62697. BrowserDomAdapter.prototype.getValue = /**
  62698. * @param {?} el
  62699. * @return {?}
  62700. */
  62701. function (el) { return el.value; };
  62702. /**
  62703. * @param {?} el
  62704. * @param {?} value
  62705. * @return {?}
  62706. */
  62707. BrowserDomAdapter.prototype.setValue = /**
  62708. * @param {?} el
  62709. * @param {?} value
  62710. * @return {?}
  62711. */
  62712. function (el, value) { el.value = value; };
  62713. /**
  62714. * @param {?} el
  62715. * @return {?}
  62716. */
  62717. BrowserDomAdapter.prototype.getChecked = /**
  62718. * @param {?} el
  62719. * @return {?}
  62720. */
  62721. function (el) { return el.checked; };
  62722. /**
  62723. * @param {?} el
  62724. * @param {?} value
  62725. * @return {?}
  62726. */
  62727. BrowserDomAdapter.prototype.setChecked = /**
  62728. * @param {?} el
  62729. * @param {?} value
  62730. * @return {?}
  62731. */
  62732. function (el, value) { el.checked = value; };
  62733. /**
  62734. * @param {?} text
  62735. * @return {?}
  62736. */
  62737. BrowserDomAdapter.prototype.createComment = /**
  62738. * @param {?} text
  62739. * @return {?}
  62740. */
  62741. function (text) { return this.getDefaultDocument().createComment(text); };
  62742. /**
  62743. * @param {?} html
  62744. * @return {?}
  62745. */
  62746. BrowserDomAdapter.prototype.createTemplate = /**
  62747. * @param {?} html
  62748. * @return {?}
  62749. */
  62750. function (html) {
  62751. var /** @type {?} */ t = this.getDefaultDocument().createElement('template');
  62752. t.innerHTML = html;
  62753. return t;
  62754. };
  62755. /**
  62756. * @param {?} tagName
  62757. * @param {?=} doc
  62758. * @return {?}
  62759. */
  62760. BrowserDomAdapter.prototype.createElement = /**
  62761. * @param {?} tagName
  62762. * @param {?=} doc
  62763. * @return {?}
  62764. */
  62765. function (tagName, doc) {
  62766. doc = doc || this.getDefaultDocument();
  62767. return doc.createElement(tagName);
  62768. };
  62769. /**
  62770. * @param {?} ns
  62771. * @param {?} tagName
  62772. * @param {?=} doc
  62773. * @return {?}
  62774. */
  62775. BrowserDomAdapter.prototype.createElementNS = /**
  62776. * @param {?} ns
  62777. * @param {?} tagName
  62778. * @param {?=} doc
  62779. * @return {?}
  62780. */
  62781. function (ns, tagName, doc) {
  62782. doc = doc || this.getDefaultDocument();
  62783. return doc.createElementNS(ns, tagName);
  62784. };
  62785. /**
  62786. * @param {?} text
  62787. * @param {?=} doc
  62788. * @return {?}
  62789. */
  62790. BrowserDomAdapter.prototype.createTextNode = /**
  62791. * @param {?} text
  62792. * @param {?=} doc
  62793. * @return {?}
  62794. */
  62795. function (text, doc) {
  62796. doc = doc || this.getDefaultDocument();
  62797. return doc.createTextNode(text);
  62798. };
  62799. /**
  62800. * @param {?} attrName
  62801. * @param {?} attrValue
  62802. * @param {?=} doc
  62803. * @return {?}
  62804. */
  62805. BrowserDomAdapter.prototype.createScriptTag = /**
  62806. * @param {?} attrName
  62807. * @param {?} attrValue
  62808. * @param {?=} doc
  62809. * @return {?}
  62810. */
  62811. function (attrName, attrValue, doc) {
  62812. doc = doc || this.getDefaultDocument();
  62813. var /** @type {?} */ el = /** @type {?} */ (doc.createElement('SCRIPT'));
  62814. el.setAttribute(attrName, attrValue);
  62815. return el;
  62816. };
  62817. /**
  62818. * @param {?} css
  62819. * @param {?=} doc
  62820. * @return {?}
  62821. */
  62822. BrowserDomAdapter.prototype.createStyleElement = /**
  62823. * @param {?} css
  62824. * @param {?=} doc
  62825. * @return {?}
  62826. */
  62827. function (css, doc) {
  62828. doc = doc || this.getDefaultDocument();
  62829. var /** @type {?} */ style = /** @type {?} */ (doc.createElement('style'));
  62830. this.appendChild(style, this.createTextNode(css, doc));
  62831. return style;
  62832. };
  62833. /**
  62834. * @param {?} el
  62835. * @return {?}
  62836. */
  62837. BrowserDomAdapter.prototype.createShadowRoot = /**
  62838. * @param {?} el
  62839. * @return {?}
  62840. */
  62841. function (el) { return (/** @type {?} */ (el)).createShadowRoot(); };
  62842. /**
  62843. * @param {?} el
  62844. * @return {?}
  62845. */
  62846. BrowserDomAdapter.prototype.getShadowRoot = /**
  62847. * @param {?} el
  62848. * @return {?}
  62849. */
  62850. function (el) { return (/** @type {?} */ (el)).shadowRoot; };
  62851. /**
  62852. * @param {?} el
  62853. * @return {?}
  62854. */
  62855. BrowserDomAdapter.prototype.getHost = /**
  62856. * @param {?} el
  62857. * @return {?}
  62858. */
  62859. function (el) { return (/** @type {?} */ (el)).host; };
  62860. /**
  62861. * @param {?} node
  62862. * @return {?}
  62863. */
  62864. BrowserDomAdapter.prototype.clone = /**
  62865. * @param {?} node
  62866. * @return {?}
  62867. */
  62868. function (node) { return node.cloneNode(true); };
  62869. /**
  62870. * @param {?} element
  62871. * @param {?} name
  62872. * @return {?}
  62873. */
  62874. BrowserDomAdapter.prototype.getElementsByClassName = /**
  62875. * @param {?} element
  62876. * @param {?} name
  62877. * @return {?}
  62878. */
  62879. function (element, name) {
  62880. return element.getElementsByClassName(name);
  62881. };
  62882. /**
  62883. * @param {?} element
  62884. * @param {?} name
  62885. * @return {?}
  62886. */
  62887. BrowserDomAdapter.prototype.getElementsByTagName = /**
  62888. * @param {?} element
  62889. * @param {?} name
  62890. * @return {?}
  62891. */
  62892. function (element, name) {
  62893. return element.getElementsByTagName(name);
  62894. };
  62895. /**
  62896. * @param {?} element
  62897. * @return {?}
  62898. */
  62899. BrowserDomAdapter.prototype.classList = /**
  62900. * @param {?} element
  62901. * @return {?}
  62902. */
  62903. function (element) { return Array.prototype.slice.call(element.classList, 0); };
  62904. /**
  62905. * @param {?} element
  62906. * @param {?} className
  62907. * @return {?}
  62908. */
  62909. BrowserDomAdapter.prototype.addClass = /**
  62910. * @param {?} element
  62911. * @param {?} className
  62912. * @return {?}
  62913. */
  62914. function (element, className) { element.classList.add(className); };
  62915. /**
  62916. * @param {?} element
  62917. * @param {?} className
  62918. * @return {?}
  62919. */
  62920. BrowserDomAdapter.prototype.removeClass = /**
  62921. * @param {?} element
  62922. * @param {?} className
  62923. * @return {?}
  62924. */
  62925. function (element, className) { element.classList.remove(className); };
  62926. /**
  62927. * @param {?} element
  62928. * @param {?} className
  62929. * @return {?}
  62930. */
  62931. BrowserDomAdapter.prototype.hasClass = /**
  62932. * @param {?} element
  62933. * @param {?} className
  62934. * @return {?}
  62935. */
  62936. function (element, className) {
  62937. return element.classList.contains(className);
  62938. };
  62939. /**
  62940. * @param {?} element
  62941. * @param {?} styleName
  62942. * @param {?} styleValue
  62943. * @return {?}
  62944. */
  62945. BrowserDomAdapter.prototype.setStyle = /**
  62946. * @param {?} element
  62947. * @param {?} styleName
  62948. * @param {?} styleValue
  62949. * @return {?}
  62950. */
  62951. function (element, styleName, styleValue) {
  62952. element.style[styleName] = styleValue;
  62953. };
  62954. /**
  62955. * @param {?} element
  62956. * @param {?} stylename
  62957. * @return {?}
  62958. */
  62959. BrowserDomAdapter.prototype.removeStyle = /**
  62960. * @param {?} element
  62961. * @param {?} stylename
  62962. * @return {?}
  62963. */
  62964. function (element, stylename) {
  62965. // IE requires '' instead of null
  62966. // see https://github.com/angular/angular/issues/7916
  62967. element.style[stylename] = '';
  62968. };
  62969. /**
  62970. * @param {?} element
  62971. * @param {?} stylename
  62972. * @return {?}
  62973. */
  62974. BrowserDomAdapter.prototype.getStyle = /**
  62975. * @param {?} element
  62976. * @param {?} stylename
  62977. * @return {?}
  62978. */
  62979. function (element, stylename) { return element.style[stylename]; };
  62980. /**
  62981. * @param {?} element
  62982. * @param {?} styleName
  62983. * @param {?=} styleValue
  62984. * @return {?}
  62985. */
  62986. BrowserDomAdapter.prototype.hasStyle = /**
  62987. * @param {?} element
  62988. * @param {?} styleName
  62989. * @param {?=} styleValue
  62990. * @return {?}
  62991. */
  62992. function (element, styleName, styleValue) {
  62993. var /** @type {?} */ value = this.getStyle(element, styleName) || '';
  62994. return styleValue ? value == styleValue : value.length > 0;
  62995. };
  62996. /**
  62997. * @param {?} element
  62998. * @return {?}
  62999. */
  63000. BrowserDomAdapter.prototype.tagName = /**
  63001. * @param {?} element
  63002. * @return {?}
  63003. */
  63004. function (element) { return element.tagName; };
  63005. /**
  63006. * @param {?} element
  63007. * @return {?}
  63008. */
  63009. BrowserDomAdapter.prototype.attributeMap = /**
  63010. * @param {?} element
  63011. * @return {?}
  63012. */
  63013. function (element) {
  63014. var /** @type {?} */ res = new Map();
  63015. var /** @type {?} */ elAttrs = element.attributes;
  63016. for (var /** @type {?} */ i = 0; i < elAttrs.length; i++) {
  63017. var /** @type {?} */ attrib = elAttrs.item(i);
  63018. res.set(attrib.name, attrib.value);
  63019. }
  63020. return res;
  63021. };
  63022. /**
  63023. * @param {?} element
  63024. * @param {?} attribute
  63025. * @return {?}
  63026. */
  63027. BrowserDomAdapter.prototype.hasAttribute = /**
  63028. * @param {?} element
  63029. * @param {?} attribute
  63030. * @return {?}
  63031. */
  63032. function (element, attribute) {
  63033. return element.hasAttribute(attribute);
  63034. };
  63035. /**
  63036. * @param {?} element
  63037. * @param {?} ns
  63038. * @param {?} attribute
  63039. * @return {?}
  63040. */
  63041. BrowserDomAdapter.prototype.hasAttributeNS = /**
  63042. * @param {?} element
  63043. * @param {?} ns
  63044. * @param {?} attribute
  63045. * @return {?}
  63046. */
  63047. function (element, ns, attribute) {
  63048. return element.hasAttributeNS(ns, attribute);
  63049. };
  63050. /**
  63051. * @param {?} element
  63052. * @param {?} attribute
  63053. * @return {?}
  63054. */
  63055. BrowserDomAdapter.prototype.getAttribute = /**
  63056. * @param {?} element
  63057. * @param {?} attribute
  63058. * @return {?}
  63059. */
  63060. function (element, attribute) {
  63061. return element.getAttribute(attribute);
  63062. };
  63063. /**
  63064. * @param {?} element
  63065. * @param {?} ns
  63066. * @param {?} name
  63067. * @return {?}
  63068. */
  63069. BrowserDomAdapter.prototype.getAttributeNS = /**
  63070. * @param {?} element
  63071. * @param {?} ns
  63072. * @param {?} name
  63073. * @return {?}
  63074. */
  63075. function (element, ns, name) {
  63076. return element.getAttributeNS(ns, name);
  63077. };
  63078. /**
  63079. * @param {?} element
  63080. * @param {?} name
  63081. * @param {?} value
  63082. * @return {?}
  63083. */
  63084. BrowserDomAdapter.prototype.setAttribute = /**
  63085. * @param {?} element
  63086. * @param {?} name
  63087. * @param {?} value
  63088. * @return {?}
  63089. */
  63090. function (element, name, value) { element.setAttribute(name, value); };
  63091. /**
  63092. * @param {?} element
  63093. * @param {?} ns
  63094. * @param {?} name
  63095. * @param {?} value
  63096. * @return {?}
  63097. */
  63098. BrowserDomAdapter.prototype.setAttributeNS = /**
  63099. * @param {?} element
  63100. * @param {?} ns
  63101. * @param {?} name
  63102. * @param {?} value
  63103. * @return {?}
  63104. */
  63105. function (element, ns, name, value) {
  63106. element.setAttributeNS(ns, name, value);
  63107. };
  63108. /**
  63109. * @param {?} element
  63110. * @param {?} attribute
  63111. * @return {?}
  63112. */
  63113. BrowserDomAdapter.prototype.removeAttribute = /**
  63114. * @param {?} element
  63115. * @param {?} attribute
  63116. * @return {?}
  63117. */
  63118. function (element, attribute) { element.removeAttribute(attribute); };
  63119. /**
  63120. * @param {?} element
  63121. * @param {?} ns
  63122. * @param {?} name
  63123. * @return {?}
  63124. */
  63125. BrowserDomAdapter.prototype.removeAttributeNS = /**
  63126. * @param {?} element
  63127. * @param {?} ns
  63128. * @param {?} name
  63129. * @return {?}
  63130. */
  63131. function (element, ns, name) {
  63132. element.removeAttributeNS(ns, name);
  63133. };
  63134. /**
  63135. * @param {?} el
  63136. * @return {?}
  63137. */
  63138. BrowserDomAdapter.prototype.templateAwareRoot = /**
  63139. * @param {?} el
  63140. * @return {?}
  63141. */
  63142. function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
  63143. /**
  63144. * @return {?}
  63145. */
  63146. BrowserDomAdapter.prototype.createHtmlDocument = /**
  63147. * @return {?}
  63148. */
  63149. function () {
  63150. return document.implementation.createHTMLDocument('fakeTitle');
  63151. };
  63152. /**
  63153. * @return {?}
  63154. */
  63155. BrowserDomAdapter.prototype.getDefaultDocument = /**
  63156. * @return {?}
  63157. */
  63158. function () { return document; };
  63159. /**
  63160. * @param {?} el
  63161. * @return {?}
  63162. */
  63163. BrowserDomAdapter.prototype.getBoundingClientRect = /**
  63164. * @param {?} el
  63165. * @return {?}
  63166. */
  63167. function (el) {
  63168. try {
  63169. return el.getBoundingClientRect();
  63170. }
  63171. catch (/** @type {?} */ e) {
  63172. return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
  63173. }
  63174. };
  63175. /**
  63176. * @param {?} doc
  63177. * @return {?}
  63178. */
  63179. BrowserDomAdapter.prototype.getTitle = /**
  63180. * @param {?} doc
  63181. * @return {?}
  63182. */
  63183. function (doc) { return doc.title; };
  63184. /**
  63185. * @param {?} doc
  63186. * @param {?} newTitle
  63187. * @return {?}
  63188. */
  63189. BrowserDomAdapter.prototype.setTitle = /**
  63190. * @param {?} doc
  63191. * @param {?} newTitle
  63192. * @return {?}
  63193. */
  63194. function (doc, newTitle) { doc.title = newTitle || ''; };
  63195. /**
  63196. * @param {?} n
  63197. * @param {?} selector
  63198. * @return {?}
  63199. */
  63200. BrowserDomAdapter.prototype.elementMatches = /**
  63201. * @param {?} n
  63202. * @param {?} selector
  63203. * @return {?}
  63204. */
  63205. function (n, selector) {
  63206. if (this.isElementNode(n)) {
  63207. return n.matches && n.matches(selector) ||
  63208. n.msMatchesSelector && n.msMatchesSelector(selector) ||
  63209. n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
  63210. }
  63211. return false;
  63212. };
  63213. /**
  63214. * @param {?} el
  63215. * @return {?}
  63216. */
  63217. BrowserDomAdapter.prototype.isTemplateElement = /**
  63218. * @param {?} el
  63219. * @return {?}
  63220. */
  63221. function (el) {
  63222. return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
  63223. };
  63224. /**
  63225. * @param {?} node
  63226. * @return {?}
  63227. */
  63228. BrowserDomAdapter.prototype.isTextNode = /**
  63229. * @param {?} node
  63230. * @return {?}
  63231. */
  63232. function (node) { return node.nodeType === Node.TEXT_NODE; };
  63233. /**
  63234. * @param {?} node
  63235. * @return {?}
  63236. */
  63237. BrowserDomAdapter.prototype.isCommentNode = /**
  63238. * @param {?} node
  63239. * @return {?}
  63240. */
  63241. function (node) { return node.nodeType === Node.COMMENT_NODE; };
  63242. /**
  63243. * @param {?} node
  63244. * @return {?}
  63245. */
  63246. BrowserDomAdapter.prototype.isElementNode = /**
  63247. * @param {?} node
  63248. * @return {?}
  63249. */
  63250. function (node) { return node.nodeType === Node.ELEMENT_NODE; };
  63251. /**
  63252. * @param {?} node
  63253. * @return {?}
  63254. */
  63255. BrowserDomAdapter.prototype.hasShadowRoot = /**
  63256. * @param {?} node
  63257. * @return {?}
  63258. */
  63259. function (node) {
  63260. return node.shadowRoot != null && node instanceof HTMLElement;
  63261. };
  63262. /**
  63263. * @param {?} node
  63264. * @return {?}
  63265. */
  63266. BrowserDomAdapter.prototype.isShadowRoot = /**
  63267. * @param {?} node
  63268. * @return {?}
  63269. */
  63270. function (node) { return node instanceof DocumentFragment; };
  63271. /**
  63272. * @param {?} node
  63273. * @return {?}
  63274. */
  63275. BrowserDomAdapter.prototype.importIntoDoc = /**
  63276. * @param {?} node
  63277. * @return {?}
  63278. */
  63279. function (node) { return document.importNode(this.templateAwareRoot(node), true); };
  63280. /**
  63281. * @param {?} node
  63282. * @return {?}
  63283. */
  63284. BrowserDomAdapter.prototype.adoptNode = /**
  63285. * @param {?} node
  63286. * @return {?}
  63287. */
  63288. function (node) { return document.adoptNode(node); };
  63289. /**
  63290. * @param {?} el
  63291. * @return {?}
  63292. */
  63293. BrowserDomAdapter.prototype.getHref = /**
  63294. * @param {?} el
  63295. * @return {?}
  63296. */
  63297. function (el) { return /** @type {?} */ ((el.getAttribute('href'))); };
  63298. /**
  63299. * @param {?} event
  63300. * @return {?}
  63301. */
  63302. BrowserDomAdapter.prototype.getEventKey = /**
  63303. * @param {?} event
  63304. * @return {?}
  63305. */
  63306. function (event) {
  63307. var /** @type {?} */ key = event.key;
  63308. if (key == null) {
  63309. key = event.keyIdentifier;
  63310. // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
  63311. // Safari cf
  63312. // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
  63313. if (key == null) {
  63314. return 'Unidentified';
  63315. }
  63316. if (key.startsWith('U+')) {
  63317. key = String.fromCharCode(parseInt(key.substring(2), 16));
  63318. if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
  63319. // There is a bug in Chrome for numeric keypad keys:
  63320. // https://code.google.com/p/chromium/issues/detail?id=155654
  63321. // 1, 2, 3 ... are reported as A, B, C ...
  63322. key = (/** @type {?} */ (_chromeNumKeyPadMap))[key];
  63323. }
  63324. }
  63325. }
  63326. return _keyMap[key] || key;
  63327. };
  63328. /**
  63329. * @param {?} doc
  63330. * @param {?} target
  63331. * @return {?}
  63332. */
  63333. BrowserDomAdapter.prototype.getGlobalEventTarget = /**
  63334. * @param {?} doc
  63335. * @param {?} target
  63336. * @return {?}
  63337. */
  63338. function (doc, target) {
  63339. if (target === 'window') {
  63340. return window;
  63341. }
  63342. if (target === 'document') {
  63343. return doc;
  63344. }
  63345. if (target === 'body') {
  63346. return doc.body;
  63347. }
  63348. return null;
  63349. };
  63350. /**
  63351. * @return {?}
  63352. */
  63353. BrowserDomAdapter.prototype.getHistory = /**
  63354. * @return {?}
  63355. */
  63356. function () { return window.history; };
  63357. /**
  63358. * @return {?}
  63359. */
  63360. BrowserDomAdapter.prototype.getLocation = /**
  63361. * @return {?}
  63362. */
  63363. function () { return window.location; };
  63364. /**
  63365. * @param {?} doc
  63366. * @return {?}
  63367. */
  63368. BrowserDomAdapter.prototype.getBaseHref = /**
  63369. * @param {?} doc
  63370. * @return {?}
  63371. */
  63372. function (doc) {
  63373. var /** @type {?} */ href = getBaseElementHref();
  63374. return href == null ? null : relativePath(href);
  63375. };
  63376. /**
  63377. * @return {?}
  63378. */
  63379. BrowserDomAdapter.prototype.resetBaseElement = /**
  63380. * @return {?}
  63381. */
  63382. function () { baseElement = null; };
  63383. /**
  63384. * @return {?}
  63385. */
  63386. BrowserDomAdapter.prototype.getUserAgent = /**
  63387. * @return {?}
  63388. */
  63389. function () { return window.navigator.userAgent; };
  63390. /**
  63391. * @param {?} element
  63392. * @param {?} name
  63393. * @param {?} value
  63394. * @return {?}
  63395. */
  63396. BrowserDomAdapter.prototype.setData = /**
  63397. * @param {?} element
  63398. * @param {?} name
  63399. * @param {?} value
  63400. * @return {?}
  63401. */
  63402. function (element, name, value) {
  63403. this.setAttribute(element, 'data-' + name, value);
  63404. };
  63405. /**
  63406. * @param {?} element
  63407. * @param {?} name
  63408. * @return {?}
  63409. */
  63410. BrowserDomAdapter.prototype.getData = /**
  63411. * @param {?} element
  63412. * @param {?} name
  63413. * @return {?}
  63414. */
  63415. function (element, name) {
  63416. return this.getAttribute(element, 'data-' + name);
  63417. };
  63418. /**
  63419. * @param {?} element
  63420. * @return {?}
  63421. */
  63422. BrowserDomAdapter.prototype.getComputedStyle = /**
  63423. * @param {?} element
  63424. * @return {?}
  63425. */
  63426. function (element) { return getComputedStyle(element); };
  63427. // TODO(tbosch): move this into a separate environment class once we have it
  63428. /**
  63429. * @return {?}
  63430. */
  63431. BrowserDomAdapter.prototype.supportsWebAnimation = /**
  63432. * @return {?}
  63433. */
  63434. function () {
  63435. return typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function';
  63436. };
  63437. /**
  63438. * @return {?}
  63439. */
  63440. BrowserDomAdapter.prototype.performanceNow = /**
  63441. * @return {?}
  63442. */
  63443. function () {
  63444. // performance.now() is not available in all browsers, see
  63445. // http://caniuse.com/#search=performance.now
  63446. return window.performance && window.performance.now ? window.performance.now() :
  63447. new Date().getTime();
  63448. };
  63449. /**
  63450. * @return {?}
  63451. */
  63452. BrowserDomAdapter.prototype.supportsCookies = /**
  63453. * @return {?}
  63454. */
  63455. function () { return true; };
  63456. /**
  63457. * @param {?} name
  63458. * @return {?}
  63459. */
  63460. BrowserDomAdapter.prototype.getCookie = /**
  63461. * @param {?} name
  63462. * @return {?}
  63463. */
  63464. function (name) { return Object(__WEBPACK_IMPORTED_MODULE_0__angular_common__["e" /* ɵparseCookieValue */])(document.cookie, name); };
  63465. /**
  63466. * @param {?} name
  63467. * @param {?} value
  63468. * @return {?}
  63469. */
  63470. BrowserDomAdapter.prototype.setCookie = /**
  63471. * @param {?} name
  63472. * @param {?} value
  63473. * @return {?}
  63474. */
  63475. function (name, value) {
  63476. // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
  63477. // not clear other cookies.
  63478. document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
  63479. };
  63480. return BrowserDomAdapter;
  63481. }(GenericBrowserDomAdapter));
  63482. var baseElement = null;
  63483. /**
  63484. * @return {?}
  63485. */
  63486. function getBaseElementHref() {
  63487. if (!baseElement) {
  63488. baseElement = /** @type {?} */ ((document.querySelector('base')));
  63489. if (!baseElement) {
  63490. return null;
  63491. }
  63492. }
  63493. return baseElement.getAttribute('href');
  63494. }
  63495. // based on urlUtils.js in AngularJS 1
  63496. var urlParsingNode;
  63497. /**
  63498. * @param {?} url
  63499. * @return {?}
  63500. */
  63501. function relativePath(url) {
  63502. if (!urlParsingNode) {
  63503. urlParsingNode = document.createElement('a');
  63504. }
  63505. urlParsingNode.setAttribute('href', url);
  63506. return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
  63507. '/' + urlParsingNode.pathname;
  63508. }
  63509. /**
  63510. * @fileoverview added by tsickle
  63511. * @suppress {checkTypes} checked by tsc
  63512. */
  63513. /**
  63514. * @license
  63515. * Copyright Google Inc. All Rights Reserved.
  63516. *
  63517. * Use of this source code is governed by an MIT-style license that can be
  63518. * found in the LICENSE file at https://angular.io/license
  63519. */
  63520. /**
  63521. * A DI Token representing the main rendering context. In a browser this is the DOM Document.
  63522. *
  63523. * Note: Document might not be available in the Application Context when Application and Rendering
  63524. * Contexts are not the same (e.g. when running the application into a Web Worker).
  63525. *
  63526. * @deprecated import from `\@angular/common` instead.
  63527. */
  63528. var DOCUMENT$1 = __WEBPACK_IMPORTED_MODULE_0__angular_common__["b" /* DOCUMENT */];
  63529. /**
  63530. * @fileoverview added by tsickle
  63531. * @suppress {checkTypes} checked by tsc
  63532. */
  63533. /**
  63534. * @license
  63535. * Copyright Google Inc. All Rights Reserved.
  63536. *
  63537. * Use of this source code is governed by an MIT-style license that can be
  63538. * found in the LICENSE file at https://angular.io/license
  63539. */
  63540. /**
  63541. * @return {?}
  63542. */
  63543. function supportsState() {
  63544. return !!window.history.pushState;
  63545. }
  63546. /**
  63547. * @fileoverview added by tsickle
  63548. * @suppress {checkTypes} checked by tsc
  63549. */
  63550. /**
  63551. * @license
  63552. * Copyright Google Inc. All Rights Reserved.
  63553. *
  63554. * Use of this source code is governed by an MIT-style license that can be
  63555. * found in the LICENSE file at https://angular.io/license
  63556. */
  63557. /**
  63558. * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
  63559. * This class should not be used directly by an application developer. Instead, use
  63560. * {\@link Location}.
  63561. */
  63562. var BrowserPlatformLocation = /** @class */ (function (_super) {
  63563. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(BrowserPlatformLocation, _super);
  63564. function BrowserPlatformLocation(_doc) {
  63565. var _this = _super.call(this) || this;
  63566. _this._doc = _doc;
  63567. _this._init();
  63568. return _this;
  63569. }
  63570. // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
  63571. /** @internal */
  63572. /**
  63573. * \@internal
  63574. * @return {?}
  63575. */
  63576. BrowserPlatformLocation.prototype._init = /**
  63577. * \@internal
  63578. * @return {?}
  63579. */
  63580. function () {
  63581. (/** @type {?} */ (this)).location = getDOM().getLocation();
  63582. this._history = getDOM().getHistory();
  63583. };
  63584. /**
  63585. * @return {?}
  63586. */
  63587. BrowserPlatformLocation.prototype.getBaseHrefFromDOM = /**
  63588. * @return {?}
  63589. */
  63590. function () { return /** @type {?} */ ((getDOM().getBaseHref(this._doc))); };
  63591. /**
  63592. * @param {?} fn
  63593. * @return {?}
  63594. */
  63595. BrowserPlatformLocation.prototype.onPopState = /**
  63596. * @param {?} fn
  63597. * @return {?}
  63598. */
  63599. function (fn) {
  63600. getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
  63601. };
  63602. /**
  63603. * @param {?} fn
  63604. * @return {?}
  63605. */
  63606. BrowserPlatformLocation.prototype.onHashChange = /**
  63607. * @param {?} fn
  63608. * @return {?}
  63609. */
  63610. function (fn) {
  63611. getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
  63612. };
  63613. Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
  63614. get: /**
  63615. * @return {?}
  63616. */
  63617. function () { return this.location.pathname; },
  63618. set: /**
  63619. * @param {?} newPath
  63620. * @return {?}
  63621. */
  63622. function (newPath) { this.location.pathname = newPath; },
  63623. enumerable: true,
  63624. configurable: true
  63625. });
  63626. Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
  63627. get: /**
  63628. * @return {?}
  63629. */
  63630. function () { return this.location.search; },
  63631. enumerable: true,
  63632. configurable: true
  63633. });
  63634. Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
  63635. get: /**
  63636. * @return {?}
  63637. */
  63638. function () { return this.location.hash; },
  63639. enumerable: true,
  63640. configurable: true
  63641. });
  63642. /**
  63643. * @param {?} state
  63644. * @param {?} title
  63645. * @param {?} url
  63646. * @return {?}
  63647. */
  63648. BrowserPlatformLocation.prototype.pushState = /**
  63649. * @param {?} state
  63650. * @param {?} title
  63651. * @param {?} url
  63652. * @return {?}
  63653. */
  63654. function (state, title, url) {
  63655. if (supportsState()) {
  63656. this._history.pushState(state, title, url);
  63657. }
  63658. else {
  63659. this.location.hash = url;
  63660. }
  63661. };
  63662. /**
  63663. * @param {?} state
  63664. * @param {?} title
  63665. * @param {?} url
  63666. * @return {?}
  63667. */
  63668. BrowserPlatformLocation.prototype.replaceState = /**
  63669. * @param {?} state
  63670. * @param {?} title
  63671. * @param {?} url
  63672. * @return {?}
  63673. */
  63674. function (state, title, url) {
  63675. if (supportsState()) {
  63676. this._history.replaceState(state, title, url);
  63677. }
  63678. else {
  63679. this.location.hash = url;
  63680. }
  63681. };
  63682. /**
  63683. * @return {?}
  63684. */
  63685. BrowserPlatformLocation.prototype.forward = /**
  63686. * @return {?}
  63687. */
  63688. function () { this._history.forward(); };
  63689. /**
  63690. * @return {?}
  63691. */
  63692. BrowserPlatformLocation.prototype.back = /**
  63693. * @return {?}
  63694. */
  63695. function () { this._history.back(); };
  63696. BrowserPlatformLocation.decorators = [
  63697. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  63698. ];
  63699. /** @nocollapse */
  63700. BrowserPlatformLocation.ctorParameters = function () { return [
  63701. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  63702. ]; };
  63703. return BrowserPlatformLocation;
  63704. }(__WEBPACK_IMPORTED_MODULE_0__angular_common__["c" /* PlatformLocation */]));
  63705. /**
  63706. * @fileoverview added by tsickle
  63707. * @suppress {checkTypes} checked by tsc
  63708. */
  63709. /**
  63710. * @license
  63711. * Copyright Google Inc. All Rights Reserved.
  63712. *
  63713. * Use of this source code is governed by an MIT-style license that can be
  63714. * found in the LICENSE file at https://angular.io/license
  63715. */
  63716. /**
  63717. * A service that can be used to get and add meta tags.
  63718. *
  63719. * \@experimental
  63720. */
  63721. var Meta = /** @class */ (function () {
  63722. function Meta(_doc) {
  63723. this._doc = _doc;
  63724. this._dom = getDOM();
  63725. }
  63726. /**
  63727. * @param {?} tag
  63728. * @param {?=} forceCreation
  63729. * @return {?}
  63730. */
  63731. Meta.prototype.addTag = /**
  63732. * @param {?} tag
  63733. * @param {?=} forceCreation
  63734. * @return {?}
  63735. */
  63736. function (tag, forceCreation) {
  63737. if (forceCreation === void 0) { forceCreation = false; }
  63738. if (!tag)
  63739. return null;
  63740. return this._getOrCreateElement(tag, forceCreation);
  63741. };
  63742. /**
  63743. * @param {?} tags
  63744. * @param {?=} forceCreation
  63745. * @return {?}
  63746. */
  63747. Meta.prototype.addTags = /**
  63748. * @param {?} tags
  63749. * @param {?=} forceCreation
  63750. * @return {?}
  63751. */
  63752. function (tags, forceCreation) {
  63753. var _this = this;
  63754. if (forceCreation === void 0) { forceCreation = false; }
  63755. if (!tags)
  63756. return [];
  63757. return tags.reduce(function (result, tag) {
  63758. if (tag) {
  63759. result.push(_this._getOrCreateElement(tag, forceCreation));
  63760. }
  63761. return result;
  63762. }, []);
  63763. };
  63764. /**
  63765. * @param {?} attrSelector
  63766. * @return {?}
  63767. */
  63768. Meta.prototype.getTag = /**
  63769. * @param {?} attrSelector
  63770. * @return {?}
  63771. */
  63772. function (attrSelector) {
  63773. if (!attrSelector)
  63774. return null;
  63775. return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null;
  63776. };
  63777. /**
  63778. * @param {?} attrSelector
  63779. * @return {?}
  63780. */
  63781. Meta.prototype.getTags = /**
  63782. * @param {?} attrSelector
  63783. * @return {?}
  63784. */
  63785. function (attrSelector) {
  63786. if (!attrSelector)
  63787. return [];
  63788. var /** @type {?} */ list = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]");
  63789. return list ? [].slice.call(list) : [];
  63790. };
  63791. /**
  63792. * @param {?} tag
  63793. * @param {?=} selector
  63794. * @return {?}
  63795. */
  63796. Meta.prototype.updateTag = /**
  63797. * @param {?} tag
  63798. * @param {?=} selector
  63799. * @return {?}
  63800. */
  63801. function (tag, selector) {
  63802. if (!tag)
  63803. return null;
  63804. selector = selector || this._parseSelector(tag);
  63805. var /** @type {?} */ meta = /** @type {?} */ ((this.getTag(selector)));
  63806. if (meta) {
  63807. return this._setMetaElementAttributes(tag, meta);
  63808. }
  63809. return this._getOrCreateElement(tag, true);
  63810. };
  63811. /**
  63812. * @param {?} attrSelector
  63813. * @return {?}
  63814. */
  63815. Meta.prototype.removeTag = /**
  63816. * @param {?} attrSelector
  63817. * @return {?}
  63818. */
  63819. function (attrSelector) { this.removeTagElement(/** @type {?} */ ((this.getTag(attrSelector)))); };
  63820. /**
  63821. * @param {?} meta
  63822. * @return {?}
  63823. */
  63824. Meta.prototype.removeTagElement = /**
  63825. * @param {?} meta
  63826. * @return {?}
  63827. */
  63828. function (meta) {
  63829. if (meta) {
  63830. this._dom.remove(meta);
  63831. }
  63832. };
  63833. /**
  63834. * @param {?} meta
  63835. * @param {?=} forceCreation
  63836. * @return {?}
  63837. */
  63838. Meta.prototype._getOrCreateElement = /**
  63839. * @param {?} meta
  63840. * @param {?=} forceCreation
  63841. * @return {?}
  63842. */
  63843. function (meta, forceCreation) {
  63844. if (forceCreation === void 0) { forceCreation = false; }
  63845. if (!forceCreation) {
  63846. var /** @type {?} */ selector = this._parseSelector(meta);
  63847. var /** @type {?} */ elem = /** @type {?} */ ((this.getTag(selector)));
  63848. // It's allowed to have multiple elements with the same name so it's not enough to
  63849. // just check that element with the same name already present on the page. We also need to
  63850. // check if element has tag attributes
  63851. if (elem && this._containsAttributes(meta, elem))
  63852. return elem;
  63853. }
  63854. var /** @type {?} */ element = /** @type {?} */ (this._dom.createElement('meta'));
  63855. this._setMetaElementAttributes(meta, element);
  63856. var /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0];
  63857. this._dom.appendChild(head, element);
  63858. return element;
  63859. };
  63860. /**
  63861. * @param {?} tag
  63862. * @param {?} el
  63863. * @return {?}
  63864. */
  63865. Meta.prototype._setMetaElementAttributes = /**
  63866. * @param {?} tag
  63867. * @param {?} el
  63868. * @return {?}
  63869. */
  63870. function (tag, el) {
  63871. var _this = this;
  63872. Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); });
  63873. return el;
  63874. };
  63875. /**
  63876. * @param {?} tag
  63877. * @return {?}
  63878. */
  63879. Meta.prototype._parseSelector = /**
  63880. * @param {?} tag
  63881. * @return {?}
  63882. */
  63883. function (tag) {
  63884. var /** @type {?} */ attr = tag.name ? 'name' : 'property';
  63885. return attr + "=\"" + tag[attr] + "\"";
  63886. };
  63887. /**
  63888. * @param {?} tag
  63889. * @param {?} elem
  63890. * @return {?}
  63891. */
  63892. Meta.prototype._containsAttributes = /**
  63893. * @param {?} tag
  63894. * @param {?} elem
  63895. * @return {?}
  63896. */
  63897. function (tag, elem) {
  63898. var _this = this;
  63899. return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; });
  63900. };
  63901. Meta.decorators = [
  63902. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  63903. ];
  63904. /** @nocollapse */
  63905. Meta.ctorParameters = function () { return [
  63906. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  63907. ]; };
  63908. return Meta;
  63909. }());
  63910. /**
  63911. * @fileoverview added by tsickle
  63912. * @suppress {checkTypes} checked by tsc
  63913. */
  63914. /**
  63915. * @license
  63916. * Copyright Google Inc. All Rights Reserved.
  63917. *
  63918. * Use of this source code is governed by an MIT-style license that can be
  63919. * found in the LICENSE file at https://angular.io/license
  63920. */
  63921. /**
  63922. * An id that identifies a particular application being bootstrapped, that should
  63923. * match across the client/server boundary.
  63924. */
  63925. var TRANSITION_ID = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('TRANSITION_ID');
  63926. /**
  63927. * @param {?} transitionId
  63928. * @param {?} document
  63929. * @param {?} injector
  63930. * @return {?}
  63931. */
  63932. function appInitializerFactory(transitionId, document, injector) {
  63933. return function () {
  63934. // Wait for all application initializers to be completed before removing the styles set by
  63935. // the server.
  63936. injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["d" /* ApplicationInitStatus */]).donePromise.then(function () {
  63937. var /** @type {?} */ dom = getDOM();
  63938. var /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]"));
  63939. styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; })
  63940. .forEach(function (el) { return dom.remove(el); });
  63941. });
  63942. };
  63943. }
  63944. var SERVER_TRANSITION_PROVIDERS = [
  63945. {
  63946. provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* APP_INITIALIZER */],
  63947. useFactory: appInitializerFactory,
  63948. deps: [TRANSITION_ID, DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */]],
  63949. multi: true
  63950. },
  63951. ];
  63952. /**
  63953. * @fileoverview added by tsickle
  63954. * @suppress {checkTypes} checked by tsc
  63955. */
  63956. /**
  63957. * @license
  63958. * Copyright Google Inc. All Rights Reserved.
  63959. *
  63960. * Use of this source code is governed by an MIT-style license that can be
  63961. * found in the LICENSE file at https://angular.io/license
  63962. */
  63963. var BrowserGetTestability = /** @class */ (function () {
  63964. function BrowserGetTestability() {
  63965. }
  63966. /**
  63967. * @return {?}
  63968. */
  63969. BrowserGetTestability.init = /**
  63970. * @return {?}
  63971. */
  63972. function () { Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_10" /* setTestabilityGetter */])(new BrowserGetTestability()); };
  63973. /**
  63974. * @param {?} registry
  63975. * @return {?}
  63976. */
  63977. BrowserGetTestability.prototype.addToWindow = /**
  63978. * @param {?} registry
  63979. * @return {?}
  63980. */
  63981. function (registry) {
  63982. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAngularTestability'] = function (elem, findInAncestors) {
  63983. if (findInAncestors === void 0) { findInAncestors = true; }
  63984. var /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors);
  63985. if (testability == null) {
  63986. throw new Error('Could not find testability for element.');
  63987. }
  63988. return testability;
  63989. };
  63990. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
  63991. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
  63992. var /** @type {?} */ whenAllStable = function (callback /** TODO #9100 */) {
  63993. var /** @type {?} */ testabilities = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAllAngularTestabilities']();
  63994. var /** @type {?} */ count = testabilities.length;
  63995. var /** @type {?} */ didWork = false;
  63996. var /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) {
  63997. didWork = didWork || didWork_;
  63998. count--;
  63999. if (count == 0) {
  64000. callback(didWork);
  64001. }
  64002. };
  64003. testabilities.forEach(function (testability /** TODO #9100 */) {
  64004. testability.whenStable(decrement);
  64005. });
  64006. };
  64007. if (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['frameworkStabilizers']) {
  64008. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['frameworkStabilizers'] = [];
  64009. }
  64010. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['frameworkStabilizers'].push(whenAllStable);
  64011. };
  64012. /**
  64013. * @param {?} registry
  64014. * @param {?} elem
  64015. * @param {?} findInAncestors
  64016. * @return {?}
  64017. */
  64018. BrowserGetTestability.prototype.findTestabilityInTree = /**
  64019. * @param {?} registry
  64020. * @param {?} elem
  64021. * @param {?} findInAncestors
  64022. * @return {?}
  64023. */
  64024. function (registry, elem, findInAncestors) {
  64025. if (elem == null) {
  64026. return null;
  64027. }
  64028. var /** @type {?} */ t = registry.getTestability(elem);
  64029. if (t != null) {
  64030. return t;
  64031. }
  64032. else if (!findInAncestors) {
  64033. return null;
  64034. }
  64035. if (getDOM().isShadowRoot(elem)) {
  64036. return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
  64037. }
  64038. return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
  64039. };
  64040. return BrowserGetTestability;
  64041. }());
  64042. /**
  64043. * @fileoverview added by tsickle
  64044. * @suppress {checkTypes} checked by tsc
  64045. */
  64046. /**
  64047. * @license
  64048. * Copyright Google Inc. All Rights Reserved.
  64049. *
  64050. * Use of this source code is governed by an MIT-style license that can be
  64051. * found in the LICENSE file at https://angular.io/license
  64052. */
  64053. /**
  64054. * A service that can be used to get and set the title of a current HTML document.
  64055. *
  64056. * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
  64057. * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
  64058. * (representing the `<title>` tag). Instead, this service can be used to set and get the current
  64059. * title value.
  64060. *
  64061. * \@experimental
  64062. */
  64063. var Title = /** @class */ (function () {
  64064. function Title(_doc) {
  64065. this._doc = _doc;
  64066. }
  64067. /**
  64068. * Get the title of the current HTML document.
  64069. */
  64070. /**
  64071. * Get the title of the current HTML document.
  64072. * @return {?}
  64073. */
  64074. Title.prototype.getTitle = /**
  64075. * Get the title of the current HTML document.
  64076. * @return {?}
  64077. */
  64078. function () { return getDOM().getTitle(this._doc); };
  64079. /**
  64080. * Set the title of the current HTML document.
  64081. * @param newTitle
  64082. */
  64083. /**
  64084. * Set the title of the current HTML document.
  64085. * @param {?} newTitle
  64086. * @return {?}
  64087. */
  64088. Title.prototype.setTitle = /**
  64089. * Set the title of the current HTML document.
  64090. * @param {?} newTitle
  64091. * @return {?}
  64092. */
  64093. function (newTitle) { getDOM().setTitle(this._doc, newTitle); };
  64094. Title.decorators = [
  64095. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  64096. ];
  64097. /** @nocollapse */
  64098. Title.ctorParameters = function () { return [
  64099. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  64100. ]; };
  64101. return Title;
  64102. }());
  64103. /**
  64104. * @fileoverview added by tsickle
  64105. * @suppress {checkTypes} checked by tsc
  64106. */
  64107. /**
  64108. * @license
  64109. * Copyright Google Inc. All Rights Reserved.
  64110. *
  64111. * Use of this source code is governed by an MIT-style license that can be
  64112. * found in the LICENSE file at https://angular.io/license
  64113. */
  64114. /**
  64115. * @param {?} input
  64116. * @return {?}
  64117. */
  64118. /**
  64119. * @param {?} input
  64120. * @return {?}
  64121. */
  64122. /**
  64123. * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
  64124. * `name` is `'probe'`.
  64125. * @param {?} name Name under which it will be exported. Keep in mind this will be a property of the
  64126. * global `ng` object.
  64127. * @param {?} value The value to export.
  64128. * @return {?}
  64129. */
  64130. function exportNgVar(name, value) {
  64131. if (typeof COMPILED === 'undefined' || !COMPILED) {
  64132. // Note: we can't export `ng` when using closure enhanced optimization as:
  64133. // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
  64134. // - we can't declare a closure extern as the namespace `ng` is already used within Google
  64135. // for typings for angularJS (via `goog.provide('ng....')`).
  64136. var /** @type {?} */ ng = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['ng'] = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['ng'])) || {};
  64137. ng[name] = value;
  64138. }
  64139. }
  64140. /**
  64141. * @fileoverview added by tsickle
  64142. * @suppress {checkTypes} checked by tsc
  64143. */
  64144. /**
  64145. * @license
  64146. * Copyright Google Inc. All Rights Reserved.
  64147. *
  64148. * Use of this source code is governed by an MIT-style license that can be
  64149. * found in the LICENSE file at https://angular.io/license
  64150. */
  64151. var CORE_TOKENS = {
  64152. 'ApplicationRef': __WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ApplicationRef */],
  64153. 'NgZone': __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */],
  64154. };
  64155. var INSPECT_GLOBAL_NAME = 'probe';
  64156. var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
  64157. /**
  64158. * Returns a {\@link DebugElement} for the given native DOM element, or
  64159. * null if the given native element does not have an Angular view associated
  64160. * with it.
  64161. * @param {?} element
  64162. * @return {?}
  64163. */
  64164. function inspectNativeElement(element) {
  64165. return Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* getDebugNode */])(element);
  64166. }
  64167. /**
  64168. * @param {?} coreTokens
  64169. * @return {?}
  64170. */
  64171. function _createNgProbe(coreTokens) {
  64172. exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
  64173. exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["a" /* __assign */])({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
  64174. return function () { return inspectNativeElement; };
  64175. }
  64176. /**
  64177. * @param {?} tokens
  64178. * @return {?}
  64179. */
  64180. function _ngProbeTokensToMap(tokens) {
  64181. return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
  64182. }
  64183. /**
  64184. * Providers which support debugging Angular applications (e.g. via `ng.probe`).
  64185. */
  64186. var ELEMENT_PROBE_PROVIDERS = [
  64187. {
  64188. provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* APP_INITIALIZER */],
  64189. useFactory: _createNgProbe,
  64190. deps: [
  64191. [__WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgProbeToken */], new __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */]()],
  64192. ],
  64193. multi: true,
  64194. },
  64195. ];
  64196. /**
  64197. * @fileoverview added by tsickle
  64198. * @suppress {checkTypes} checked by tsc
  64199. */
  64200. /**
  64201. * @license
  64202. * Copyright Google Inc. All Rights Reserved.
  64203. *
  64204. * Use of this source code is governed by an MIT-style license that can be
  64205. * found in the LICENSE file at https://angular.io/license
  64206. */
  64207. /**
  64208. * \@stable
  64209. */
  64210. var EVENT_MANAGER_PLUGINS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('EventManagerPlugins');
  64211. /**
  64212. * \@stable
  64213. */
  64214. var EventManager = /** @class */ (function () {
  64215. function EventManager(plugins, _zone) {
  64216. var _this = this;
  64217. this._zone = _zone;
  64218. this._eventNameToPlugin = new Map();
  64219. plugins.forEach(function (p) { return p.manager = _this; });
  64220. this._plugins = plugins.slice().reverse();
  64221. }
  64222. /**
  64223. * @param {?} element
  64224. * @param {?} eventName
  64225. * @param {?} handler
  64226. * @return {?}
  64227. */
  64228. EventManager.prototype.addEventListener = /**
  64229. * @param {?} element
  64230. * @param {?} eventName
  64231. * @param {?} handler
  64232. * @return {?}
  64233. */
  64234. function (element, eventName, handler) {
  64235. var /** @type {?} */ plugin = this._findPluginFor(eventName);
  64236. return plugin.addEventListener(element, eventName, handler);
  64237. };
  64238. /**
  64239. * @param {?} target
  64240. * @param {?} eventName
  64241. * @param {?} handler
  64242. * @return {?}
  64243. */
  64244. EventManager.prototype.addGlobalEventListener = /**
  64245. * @param {?} target
  64246. * @param {?} eventName
  64247. * @param {?} handler
  64248. * @return {?}
  64249. */
  64250. function (target, eventName, handler) {
  64251. var /** @type {?} */ plugin = this._findPluginFor(eventName);
  64252. return plugin.addGlobalEventListener(target, eventName, handler);
  64253. };
  64254. /**
  64255. * @return {?}
  64256. */
  64257. EventManager.prototype.getZone = /**
  64258. * @return {?}
  64259. */
  64260. function () { return this._zone; };
  64261. /** @internal */
  64262. /**
  64263. * \@internal
  64264. * @param {?} eventName
  64265. * @return {?}
  64266. */
  64267. EventManager.prototype._findPluginFor = /**
  64268. * \@internal
  64269. * @param {?} eventName
  64270. * @return {?}
  64271. */
  64272. function (eventName) {
  64273. var /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName);
  64274. if (plugin) {
  64275. return plugin;
  64276. }
  64277. var /** @type {?} */ plugins = this._plugins;
  64278. for (var /** @type {?} */ i = 0; i < plugins.length; i++) {
  64279. var /** @type {?} */ plugin_1 = plugins[i];
  64280. if (plugin_1.supports(eventName)) {
  64281. this._eventNameToPlugin.set(eventName, plugin_1);
  64282. return plugin_1;
  64283. }
  64284. }
  64285. throw new Error("No event manager plugin found for event " + eventName);
  64286. };
  64287. EventManager.decorators = [
  64288. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  64289. ];
  64290. /** @nocollapse */
  64291. EventManager.ctorParameters = function () { return [
  64292. { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [EVENT_MANAGER_PLUGINS,] },] },
  64293. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */], },
  64294. ]; };
  64295. return EventManager;
  64296. }());
  64297. /**
  64298. * @abstract
  64299. */
  64300. var EventManagerPlugin = /** @class */ (function () {
  64301. function EventManagerPlugin(_doc) {
  64302. this._doc = _doc;
  64303. }
  64304. /**
  64305. * @param {?} element
  64306. * @param {?} eventName
  64307. * @param {?} handler
  64308. * @return {?}
  64309. */
  64310. EventManagerPlugin.prototype.addGlobalEventListener = /**
  64311. * @param {?} element
  64312. * @param {?} eventName
  64313. * @param {?} handler
  64314. * @return {?}
  64315. */
  64316. function (element, eventName, handler) {
  64317. var /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element);
  64318. if (!target) {
  64319. throw new Error("Unsupported event target " + target + " for event " + eventName);
  64320. }
  64321. return this.addEventListener(target, eventName, handler);
  64322. };
  64323. return EventManagerPlugin;
  64324. }());
  64325. /**
  64326. * @fileoverview added by tsickle
  64327. * @suppress {checkTypes} checked by tsc
  64328. */
  64329. /**
  64330. * @license
  64331. * Copyright Google Inc. All Rights Reserved.
  64332. *
  64333. * Use of this source code is governed by an MIT-style license that can be
  64334. * found in the LICENSE file at https://angular.io/license
  64335. */
  64336. var SharedStylesHost = /** @class */ (function () {
  64337. function SharedStylesHost() {
  64338. /**
  64339. * \@internal
  64340. */
  64341. this._stylesSet = new Set();
  64342. }
  64343. /**
  64344. * @param {?} styles
  64345. * @return {?}
  64346. */
  64347. SharedStylesHost.prototype.addStyles = /**
  64348. * @param {?} styles
  64349. * @return {?}
  64350. */
  64351. function (styles) {
  64352. var _this = this;
  64353. var /** @type {?} */ additions = new Set();
  64354. styles.forEach(function (style) {
  64355. if (!_this._stylesSet.has(style)) {
  64356. _this._stylesSet.add(style);
  64357. additions.add(style);
  64358. }
  64359. });
  64360. this.onStylesAdded(additions);
  64361. };
  64362. /**
  64363. * @param {?} additions
  64364. * @return {?}
  64365. */
  64366. SharedStylesHost.prototype.onStylesAdded = /**
  64367. * @param {?} additions
  64368. * @return {?}
  64369. */
  64370. function (additions) { };
  64371. /**
  64372. * @return {?}
  64373. */
  64374. SharedStylesHost.prototype.getAllStyles = /**
  64375. * @return {?}
  64376. */
  64377. function () { return Array.from(this._stylesSet); };
  64378. SharedStylesHost.decorators = [
  64379. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  64380. ];
  64381. /** @nocollapse */
  64382. SharedStylesHost.ctorParameters = function () { return []; };
  64383. return SharedStylesHost;
  64384. }());
  64385. var DomSharedStylesHost = /** @class */ (function (_super) {
  64386. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomSharedStylesHost, _super);
  64387. function DomSharedStylesHost(_doc) {
  64388. var _this = _super.call(this) || this;
  64389. _this._doc = _doc;
  64390. _this._hostNodes = new Set();
  64391. _this._styleNodes = new Set();
  64392. _this._hostNodes.add(_doc.head);
  64393. return _this;
  64394. }
  64395. /**
  64396. * @param {?} styles
  64397. * @param {?} host
  64398. * @return {?}
  64399. */
  64400. DomSharedStylesHost.prototype._addStylesToHost = /**
  64401. * @param {?} styles
  64402. * @param {?} host
  64403. * @return {?}
  64404. */
  64405. function (styles, host) {
  64406. var _this = this;
  64407. styles.forEach(function (style) {
  64408. var /** @type {?} */ styleEl = _this._doc.createElement('style');
  64409. styleEl.textContent = style;
  64410. _this._styleNodes.add(host.appendChild(styleEl));
  64411. });
  64412. };
  64413. /**
  64414. * @param {?} hostNode
  64415. * @return {?}
  64416. */
  64417. DomSharedStylesHost.prototype.addHost = /**
  64418. * @param {?} hostNode
  64419. * @return {?}
  64420. */
  64421. function (hostNode) {
  64422. this._addStylesToHost(this._stylesSet, hostNode);
  64423. this._hostNodes.add(hostNode);
  64424. };
  64425. /**
  64426. * @param {?} hostNode
  64427. * @return {?}
  64428. */
  64429. DomSharedStylesHost.prototype.removeHost = /**
  64430. * @param {?} hostNode
  64431. * @return {?}
  64432. */
  64433. function (hostNode) { this._hostNodes.delete(hostNode); };
  64434. /**
  64435. * @param {?} additions
  64436. * @return {?}
  64437. */
  64438. DomSharedStylesHost.prototype.onStylesAdded = /**
  64439. * @param {?} additions
  64440. * @return {?}
  64441. */
  64442. function (additions) {
  64443. var _this = this;
  64444. this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
  64445. };
  64446. /**
  64447. * @return {?}
  64448. */
  64449. DomSharedStylesHost.prototype.ngOnDestroy = /**
  64450. * @return {?}
  64451. */
  64452. function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); };
  64453. DomSharedStylesHost.decorators = [
  64454. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  64455. ];
  64456. /** @nocollapse */
  64457. DomSharedStylesHost.ctorParameters = function () { return [
  64458. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  64459. ]; };
  64460. return DomSharedStylesHost;
  64461. }(SharedStylesHost));
  64462. /**
  64463. * @fileoverview added by tsickle
  64464. * @suppress {checkTypes} checked by tsc
  64465. */
  64466. /**
  64467. * @license
  64468. * Copyright Google Inc. All Rights Reserved.
  64469. *
  64470. * Use of this source code is governed by an MIT-style license that can be
  64471. * found in the LICENSE file at https://angular.io/license
  64472. */
  64473. var NAMESPACE_URIS = {
  64474. 'svg': 'http://www.w3.org/2000/svg',
  64475. 'xhtml': 'http://www.w3.org/1999/xhtml',
  64476. 'xlink': 'http://www.w3.org/1999/xlink',
  64477. 'xml': 'http://www.w3.org/XML/1998/namespace',
  64478. 'xmlns': 'http://www.w3.org/2000/xmlns/',
  64479. };
  64480. var COMPONENT_REGEX = /%COMP%/g;
  64481. var COMPONENT_VARIABLE = '%COMP%';
  64482. var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
  64483. var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
  64484. /**
  64485. * @param {?} componentShortId
  64486. * @return {?}
  64487. */
  64488. function shimContentAttribute(componentShortId) {
  64489. return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
  64490. }
  64491. /**
  64492. * @param {?} componentShortId
  64493. * @return {?}
  64494. */
  64495. function shimHostAttribute(componentShortId) {
  64496. return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
  64497. }
  64498. /**
  64499. * @param {?} compId
  64500. * @param {?} styles
  64501. * @param {?} target
  64502. * @return {?}
  64503. */
  64504. function flattenStyles(compId, styles, target) {
  64505. for (var /** @type {?} */ i = 0; i < styles.length; i++) {
  64506. var /** @type {?} */ style = styles[i];
  64507. if (Array.isArray(style)) {
  64508. flattenStyles(compId, style, target);
  64509. }
  64510. else {
  64511. style = style.replace(COMPONENT_REGEX, compId);
  64512. target.push(style);
  64513. }
  64514. }
  64515. return target;
  64516. }
  64517. /**
  64518. * @param {?} eventHandler
  64519. * @return {?}
  64520. */
  64521. function decoratePreventDefault(eventHandler) {
  64522. return function (event) {
  64523. var /** @type {?} */ allowDefaultBehavior = eventHandler(event);
  64524. if (allowDefaultBehavior === false) {
  64525. // TODO(tbosch): move preventDefault into event plugins...
  64526. event.preventDefault();
  64527. event.returnValue = false;
  64528. }
  64529. };
  64530. }
  64531. var DomRendererFactory2 = /** @class */ (function () {
  64532. function DomRendererFactory2(eventManager, sharedStylesHost) {
  64533. this.eventManager = eventManager;
  64534. this.sharedStylesHost = sharedStylesHost;
  64535. this.rendererByCompId = new Map();
  64536. this.defaultRenderer = new DefaultDomRenderer2(eventManager);
  64537. }
  64538. /**
  64539. * @param {?} element
  64540. * @param {?} type
  64541. * @return {?}
  64542. */
  64543. DomRendererFactory2.prototype.createRenderer = /**
  64544. * @param {?} element
  64545. * @param {?} type
  64546. * @return {?}
  64547. */
  64548. function (element, type) {
  64549. if (!element || !type) {
  64550. return this.defaultRenderer;
  64551. }
  64552. switch (type.encapsulation) {
  64553. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */].Emulated: {
  64554. var /** @type {?} */ renderer = this.rendererByCompId.get(type.id);
  64555. if (!renderer) {
  64556. renderer =
  64557. new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type);
  64558. this.rendererByCompId.set(type.id, renderer);
  64559. }
  64560. (/** @type {?} */ (renderer)).applyToHost(element);
  64561. return renderer;
  64562. }
  64563. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */].Native:
  64564. return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
  64565. default: {
  64566. if (!this.rendererByCompId.has(type.id)) {
  64567. var /** @type {?} */ styles = flattenStyles(type.id, type.styles, []);
  64568. this.sharedStylesHost.addStyles(styles);
  64569. this.rendererByCompId.set(type.id, this.defaultRenderer);
  64570. }
  64571. return this.defaultRenderer;
  64572. }
  64573. }
  64574. };
  64575. /**
  64576. * @return {?}
  64577. */
  64578. DomRendererFactory2.prototype.begin = /**
  64579. * @return {?}
  64580. */
  64581. function () { };
  64582. /**
  64583. * @return {?}
  64584. */
  64585. DomRendererFactory2.prototype.end = /**
  64586. * @return {?}
  64587. */
  64588. function () { };
  64589. DomRendererFactory2.decorators = [
  64590. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  64591. ];
  64592. /** @nocollapse */
  64593. DomRendererFactory2.ctorParameters = function () { return [
  64594. { type: EventManager, },
  64595. { type: DomSharedStylesHost, },
  64596. ]; };
  64597. return DomRendererFactory2;
  64598. }());
  64599. var DefaultDomRenderer2 = /** @class */ (function () {
  64600. function DefaultDomRenderer2(eventManager) {
  64601. this.eventManager = eventManager;
  64602. this.data = Object.create(null);
  64603. }
  64604. /**
  64605. * @return {?}
  64606. */
  64607. DefaultDomRenderer2.prototype.destroy = /**
  64608. * @return {?}
  64609. */
  64610. function () { };
  64611. /**
  64612. * @param {?} name
  64613. * @param {?=} namespace
  64614. * @return {?}
  64615. */
  64616. DefaultDomRenderer2.prototype.createElement = /**
  64617. * @param {?} name
  64618. * @param {?=} namespace
  64619. * @return {?}
  64620. */
  64621. function (name, namespace) {
  64622. if (namespace) {
  64623. return document.createElementNS(NAMESPACE_URIS[namespace], name);
  64624. }
  64625. return document.createElement(name);
  64626. };
  64627. /**
  64628. * @param {?} value
  64629. * @return {?}
  64630. */
  64631. DefaultDomRenderer2.prototype.createComment = /**
  64632. * @param {?} value
  64633. * @return {?}
  64634. */
  64635. function (value) { return document.createComment(value); };
  64636. /**
  64637. * @param {?} value
  64638. * @return {?}
  64639. */
  64640. DefaultDomRenderer2.prototype.createText = /**
  64641. * @param {?} value
  64642. * @return {?}
  64643. */
  64644. function (value) { return document.createTextNode(value); };
  64645. /**
  64646. * @param {?} parent
  64647. * @param {?} newChild
  64648. * @return {?}
  64649. */
  64650. DefaultDomRenderer2.prototype.appendChild = /**
  64651. * @param {?} parent
  64652. * @param {?} newChild
  64653. * @return {?}
  64654. */
  64655. function (parent, newChild) { parent.appendChild(newChild); };
  64656. /**
  64657. * @param {?} parent
  64658. * @param {?} newChild
  64659. * @param {?} refChild
  64660. * @return {?}
  64661. */
  64662. DefaultDomRenderer2.prototype.insertBefore = /**
  64663. * @param {?} parent
  64664. * @param {?} newChild
  64665. * @param {?} refChild
  64666. * @return {?}
  64667. */
  64668. function (parent, newChild, refChild) {
  64669. if (parent) {
  64670. parent.insertBefore(newChild, refChild);
  64671. }
  64672. };
  64673. /**
  64674. * @param {?} parent
  64675. * @param {?} oldChild
  64676. * @return {?}
  64677. */
  64678. DefaultDomRenderer2.prototype.removeChild = /**
  64679. * @param {?} parent
  64680. * @param {?} oldChild
  64681. * @return {?}
  64682. */
  64683. function (parent, oldChild) {
  64684. if (parent) {
  64685. parent.removeChild(oldChild);
  64686. }
  64687. };
  64688. /**
  64689. * @param {?} selectorOrNode
  64690. * @return {?}
  64691. */
  64692. DefaultDomRenderer2.prototype.selectRootElement = /**
  64693. * @param {?} selectorOrNode
  64694. * @return {?}
  64695. */
  64696. function (selectorOrNode) {
  64697. var /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
  64698. selectorOrNode;
  64699. if (!el) {
  64700. throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
  64701. }
  64702. el.textContent = '';
  64703. return el;
  64704. };
  64705. /**
  64706. * @param {?} node
  64707. * @return {?}
  64708. */
  64709. DefaultDomRenderer2.prototype.parentNode = /**
  64710. * @param {?} node
  64711. * @return {?}
  64712. */
  64713. function (node) { return node.parentNode; };
  64714. /**
  64715. * @param {?} node
  64716. * @return {?}
  64717. */
  64718. DefaultDomRenderer2.prototype.nextSibling = /**
  64719. * @param {?} node
  64720. * @return {?}
  64721. */
  64722. function (node) { return node.nextSibling; };
  64723. /**
  64724. * @param {?} el
  64725. * @param {?} name
  64726. * @param {?} value
  64727. * @param {?=} namespace
  64728. * @return {?}
  64729. */
  64730. DefaultDomRenderer2.prototype.setAttribute = /**
  64731. * @param {?} el
  64732. * @param {?} name
  64733. * @param {?} value
  64734. * @param {?=} namespace
  64735. * @return {?}
  64736. */
  64737. function (el, name, value, namespace) {
  64738. if (namespace) {
  64739. name = namespace + ":" + name;
  64740. var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
  64741. if (namespaceUri) {
  64742. el.setAttributeNS(namespaceUri, name, value);
  64743. }
  64744. else {
  64745. el.setAttribute(name, value);
  64746. }
  64747. }
  64748. else {
  64749. el.setAttribute(name, value);
  64750. }
  64751. };
  64752. /**
  64753. * @param {?} el
  64754. * @param {?} name
  64755. * @param {?=} namespace
  64756. * @return {?}
  64757. */
  64758. DefaultDomRenderer2.prototype.removeAttribute = /**
  64759. * @param {?} el
  64760. * @param {?} name
  64761. * @param {?=} namespace
  64762. * @return {?}
  64763. */
  64764. function (el, name, namespace) {
  64765. if (namespace) {
  64766. var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
  64767. if (namespaceUri) {
  64768. el.removeAttributeNS(namespaceUri, name);
  64769. }
  64770. else {
  64771. el.removeAttribute(namespace + ":" + name);
  64772. }
  64773. }
  64774. else {
  64775. el.removeAttribute(name);
  64776. }
  64777. };
  64778. /**
  64779. * @param {?} el
  64780. * @param {?} name
  64781. * @return {?}
  64782. */
  64783. DefaultDomRenderer2.prototype.addClass = /**
  64784. * @param {?} el
  64785. * @param {?} name
  64786. * @return {?}
  64787. */
  64788. function (el, name) { el.classList.add(name); };
  64789. /**
  64790. * @param {?} el
  64791. * @param {?} name
  64792. * @return {?}
  64793. */
  64794. DefaultDomRenderer2.prototype.removeClass = /**
  64795. * @param {?} el
  64796. * @param {?} name
  64797. * @return {?}
  64798. */
  64799. function (el, name) { el.classList.remove(name); };
  64800. /**
  64801. * @param {?} el
  64802. * @param {?} style
  64803. * @param {?} value
  64804. * @param {?} flags
  64805. * @return {?}
  64806. */
  64807. DefaultDomRenderer2.prototype.setStyle = /**
  64808. * @param {?} el
  64809. * @param {?} style
  64810. * @param {?} value
  64811. * @param {?} flags
  64812. * @return {?}
  64813. */
  64814. function (el, style, value, flags) {
  64815. if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* RendererStyleFlags2 */].DashCase) {
  64816. el.style.setProperty(style, value, !!(flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* RendererStyleFlags2 */].Important) ? 'important' : '');
  64817. }
  64818. else {
  64819. el.style[style] = value;
  64820. }
  64821. };
  64822. /**
  64823. * @param {?} el
  64824. * @param {?} style
  64825. * @param {?} flags
  64826. * @return {?}
  64827. */
  64828. DefaultDomRenderer2.prototype.removeStyle = /**
  64829. * @param {?} el
  64830. * @param {?} style
  64831. * @param {?} flags
  64832. * @return {?}
  64833. */
  64834. function (el, style, flags) {
  64835. if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* RendererStyleFlags2 */].DashCase) {
  64836. el.style.removeProperty(style);
  64837. }
  64838. else {
  64839. // IE requires '' instead of null
  64840. // see https://github.com/angular/angular/issues/7916
  64841. el.style[style] = '';
  64842. }
  64843. };
  64844. /**
  64845. * @param {?} el
  64846. * @param {?} name
  64847. * @param {?} value
  64848. * @return {?}
  64849. */
  64850. DefaultDomRenderer2.prototype.setProperty = /**
  64851. * @param {?} el
  64852. * @param {?} name
  64853. * @param {?} value
  64854. * @return {?}
  64855. */
  64856. function (el, name, value) {
  64857. checkNoSyntheticProp(name, 'property');
  64858. el[name] = value;
  64859. };
  64860. /**
  64861. * @param {?} node
  64862. * @param {?} value
  64863. * @return {?}
  64864. */
  64865. DefaultDomRenderer2.prototype.setValue = /**
  64866. * @param {?} node
  64867. * @param {?} value
  64868. * @return {?}
  64869. */
  64870. function (node, value) { node.nodeValue = value; };
  64871. /**
  64872. * @param {?} target
  64873. * @param {?} event
  64874. * @param {?} callback
  64875. * @return {?}
  64876. */
  64877. DefaultDomRenderer2.prototype.listen = /**
  64878. * @param {?} target
  64879. * @param {?} event
  64880. * @param {?} callback
  64881. * @return {?}
  64882. */
  64883. function (target, event, callback) {
  64884. checkNoSyntheticProp(event, 'listener');
  64885. if (typeof target === 'string') {
  64886. return /** @type {?} */ (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback)));
  64887. }
  64888. return /** @type {?} */ ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback))));
  64889. };
  64890. return DefaultDomRenderer2;
  64891. }());
  64892. var AT_CHARCODE = '@'.charCodeAt(0);
  64893. /**
  64894. * @param {?} name
  64895. * @param {?} nameKind
  64896. * @return {?}
  64897. */
  64898. function checkNoSyntheticProp(name, nameKind) {
  64899. if (name.charCodeAt(0) === AT_CHARCODE) {
  64900. throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
  64901. }
  64902. }
  64903. var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
  64904. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(EmulatedEncapsulationDomRenderer2, _super);
  64905. function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component) {
  64906. var _this = _super.call(this, eventManager) || this;
  64907. _this.component = component;
  64908. var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
  64909. sharedStylesHost.addStyles(styles);
  64910. _this.contentAttr = shimContentAttribute(component.id);
  64911. _this.hostAttr = shimHostAttribute(component.id);
  64912. return _this;
  64913. }
  64914. /**
  64915. * @param {?} element
  64916. * @return {?}
  64917. */
  64918. EmulatedEncapsulationDomRenderer2.prototype.applyToHost = /**
  64919. * @param {?} element
  64920. * @return {?}
  64921. */
  64922. function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); };
  64923. /**
  64924. * @param {?} parent
  64925. * @param {?} name
  64926. * @return {?}
  64927. */
  64928. EmulatedEncapsulationDomRenderer2.prototype.createElement = /**
  64929. * @param {?} parent
  64930. * @param {?} name
  64931. * @return {?}
  64932. */
  64933. function (parent, name) {
  64934. var /** @type {?} */ el = _super.prototype.createElement.call(this, parent, name);
  64935. _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
  64936. return el;
  64937. };
  64938. return EmulatedEncapsulationDomRenderer2;
  64939. }(DefaultDomRenderer2));
  64940. var ShadowDomRenderer = /** @class */ (function (_super) {
  64941. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(ShadowDomRenderer, _super);
  64942. function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
  64943. var _this = _super.call(this, eventManager) || this;
  64944. _this.sharedStylesHost = sharedStylesHost;
  64945. _this.hostEl = hostEl;
  64946. _this.component = component;
  64947. _this.shadowRoot = (/** @type {?} */ (hostEl)).createShadowRoot();
  64948. _this.sharedStylesHost.addHost(_this.shadowRoot);
  64949. var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
  64950. for (var /** @type {?} */ i = 0; i < styles.length; i++) {
  64951. var /** @type {?} */ styleEl = document.createElement('style');
  64952. styleEl.textContent = styles[i];
  64953. _this.shadowRoot.appendChild(styleEl);
  64954. }
  64955. return _this;
  64956. }
  64957. /**
  64958. * @param {?} node
  64959. * @return {?}
  64960. */
  64961. ShadowDomRenderer.prototype.nodeOrShadowRoot = /**
  64962. * @param {?} node
  64963. * @return {?}
  64964. */
  64965. function (node) { return node === this.hostEl ? this.shadowRoot : node; };
  64966. /**
  64967. * @return {?}
  64968. */
  64969. ShadowDomRenderer.prototype.destroy = /**
  64970. * @return {?}
  64971. */
  64972. function () { this.sharedStylesHost.removeHost(this.shadowRoot); };
  64973. /**
  64974. * @param {?} parent
  64975. * @param {?} newChild
  64976. * @return {?}
  64977. */
  64978. ShadowDomRenderer.prototype.appendChild = /**
  64979. * @param {?} parent
  64980. * @param {?} newChild
  64981. * @return {?}
  64982. */
  64983. function (parent, newChild) {
  64984. return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
  64985. };
  64986. /**
  64987. * @param {?} parent
  64988. * @param {?} newChild
  64989. * @param {?} refChild
  64990. * @return {?}
  64991. */
  64992. ShadowDomRenderer.prototype.insertBefore = /**
  64993. * @param {?} parent
  64994. * @param {?} newChild
  64995. * @param {?} refChild
  64996. * @return {?}
  64997. */
  64998. function (parent, newChild, refChild) {
  64999. return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
  65000. };
  65001. /**
  65002. * @param {?} parent
  65003. * @param {?} oldChild
  65004. * @return {?}
  65005. */
  65006. ShadowDomRenderer.prototype.removeChild = /**
  65007. * @param {?} parent
  65008. * @param {?} oldChild
  65009. * @return {?}
  65010. */
  65011. function (parent, oldChild) {
  65012. return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
  65013. };
  65014. /**
  65015. * @param {?} node
  65016. * @return {?}
  65017. */
  65018. ShadowDomRenderer.prototype.parentNode = /**
  65019. * @param {?} node
  65020. * @return {?}
  65021. */
  65022. function (node) {
  65023. return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
  65024. };
  65025. return ShadowDomRenderer;
  65026. }(DefaultDomRenderer2));
  65027. /**
  65028. * @fileoverview added by tsickle
  65029. * @suppress {checkTypes} checked by tsc
  65030. */
  65031. /**
  65032. * @license
  65033. * Copyright Google Inc. All Rights Reserved.
  65034. *
  65035. * Use of this source code is governed by an MIT-style license that can be
  65036. * found in the LICENSE file at https://angular.io/license
  65037. */
  65038. var ɵ0 = function (v) {
  65039. return '__zone_symbol__' + v;
  65040. };
  65041. /**
  65042. * Detect if Zone is present. If it is then use simple zone aware 'addEventListener'
  65043. * since Angular can do much more
  65044. * efficient bookkeeping than Zone can, because we have additional information. This speeds up
  65045. * addEventListener by 3x.
  65046. */
  65047. var __symbol__ = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))['__symbol__'] || ɵ0;
  65048. var ADD_EVENT_LISTENER = __symbol__('addEventListener');
  65049. var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
  65050. var symbolNames = {};
  65051. var FALSE = 'FALSE';
  65052. var ANGULAR = 'ANGULAR';
  65053. var NATIVE_ADD_LISTENER = 'addEventListener';
  65054. var NATIVE_REMOVE_LISTENER = 'removeEventListener';
  65055. // use the same symbol string which is used in zone.js
  65056. var stopSymbol = '__zone_symbol__propagationStopped';
  65057. var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
  65058. var blackListedEvents = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))[__symbol__('BLACK_LISTED_EVENTS')];
  65059. var blackListedMap;
  65060. if (blackListedEvents) {
  65061. blackListedMap = {};
  65062. blackListedEvents.forEach(function (eventName) { blackListedMap[eventName] = eventName; });
  65063. }
  65064. var isBlackListedEvent = function (eventName) {
  65065. if (!blackListedMap) {
  65066. return false;
  65067. }
  65068. return blackListedMap.hasOwnProperty(eventName);
  65069. };
  65070. // a global listener to handle all dom event,
  65071. // so we do not need to create a closure everytime
  65072. var globalListener = function (event) {
  65073. var /** @type {?} */ symbolName = symbolNames[event.type];
  65074. if (!symbolName) {
  65075. return;
  65076. }
  65077. var /** @type {?} */ taskDatas = this[symbolName];
  65078. if (!taskDatas) {
  65079. return;
  65080. }
  65081. var /** @type {?} */ args = [event];
  65082. if (taskDatas.length === 1) {
  65083. // if taskDatas only have one element, just invoke it
  65084. var /** @type {?} */ taskData = taskDatas[0];
  65085. if (taskData.zone !== Zone.current) {
  65086. // only use Zone.run when Zone.current not equals to stored zone
  65087. return taskData.zone.run(taskData.handler, this, args);
  65088. }
  65089. else {
  65090. return taskData.handler.apply(this, args);
  65091. }
  65092. }
  65093. else {
  65094. // copy tasks as a snapshot to avoid event handlers remove
  65095. // itself or others
  65096. var /** @type {?} */ copiedTasks = taskDatas.slice();
  65097. for (var /** @type {?} */ i = 0; i < copiedTasks.length; i++) {
  65098. // if other listener call event.stopImmediatePropagation
  65099. // just break
  65100. if ((/** @type {?} */ (event))[stopSymbol] === true) {
  65101. break;
  65102. }
  65103. var /** @type {?} */ taskData = copiedTasks[i];
  65104. if (taskData.zone !== Zone.current) {
  65105. // only use Zone.run when Zone.current not equals to stored zone
  65106. taskData.zone.run(taskData.handler, this, args);
  65107. }
  65108. else {
  65109. taskData.handler.apply(this, args);
  65110. }
  65111. }
  65112. }
  65113. };
  65114. var DomEventsPlugin = /** @class */ (function (_super) {
  65115. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomEventsPlugin, _super);
  65116. function DomEventsPlugin(doc, ngZone) {
  65117. var _this = _super.call(this, doc) || this;
  65118. _this.ngZone = ngZone;
  65119. _this.patchEvent();
  65120. return _this;
  65121. }
  65122. /**
  65123. * @return {?}
  65124. */
  65125. DomEventsPlugin.prototype.patchEvent = /**
  65126. * @return {?}
  65127. */
  65128. function () {
  65129. if (!Event || !Event.prototype) {
  65130. return;
  65131. }
  65132. if ((/** @type {?} */ (Event.prototype))[stopMethodSymbol]) {
  65133. // already patched by zone.js
  65134. return;
  65135. }
  65136. var /** @type {?} */ delegate = (/** @type {?} */ (Event.prototype))[stopMethodSymbol] =
  65137. Event.prototype.stopImmediatePropagation;
  65138. Event.prototype.stopImmediatePropagation = function () {
  65139. if (this) {
  65140. this[stopSymbol] = true;
  65141. }
  65142. // should call native delegate in case
  65143. // in some enviroment part of the application
  65144. // will not use the patched Event
  65145. delegate && delegate.apply(this, arguments);
  65146. };
  65147. };
  65148. // This plugin should come last in the list of plugins, because it accepts all
  65149. // events.
  65150. /**
  65151. * @param {?} eventName
  65152. * @return {?}
  65153. */
  65154. DomEventsPlugin.prototype.supports = /**
  65155. * @param {?} eventName
  65156. * @return {?}
  65157. */
  65158. function (eventName) { return true; };
  65159. /**
  65160. * @param {?} element
  65161. * @param {?} eventName
  65162. * @param {?} handler
  65163. * @return {?}
  65164. */
  65165. DomEventsPlugin.prototype.addEventListener = /**
  65166. * @param {?} element
  65167. * @param {?} eventName
  65168. * @param {?} handler
  65169. * @return {?}
  65170. */
  65171. function (element, eventName, handler) {
  65172. var _this = this;
  65173. /**
  65174. * This code is about to add a listener to the DOM. If Zone.js is present, than
  65175. * `addEventListener` has been patched. The patched code adds overhead in both
  65176. * memory and speed (3x slower) than native. For this reason if we detect that
  65177. * Zone.js is present we use a simple version of zone aware addEventListener instead.
  65178. * The result is faster registration and the zone will be restored.
  65179. * But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask
  65180. * will not be invoked
  65181. * We also do manual zone restoration in element.ts renderEventHandlerClosure method.
  65182. *
  65183. * NOTE: it is possible that the element is from different iframe, and so we
  65184. * have to check before we execute the method.
  65185. */
  65186. var /** @type {?} */ self = this;
  65187. var /** @type {?} */ zoneJsLoaded = element[ADD_EVENT_LISTENER];
  65188. var /** @type {?} */ callback = /** @type {?} */ (handler);
  65189. // if zonejs is loaded and current zone is not ngZone
  65190. // we keep Zone.current on target for later restoration.
  65191. if (zoneJsLoaded && (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */].isInAngularZone() || isBlackListedEvent(eventName))) {
  65192. var /** @type {?} */ symbolName = symbolNames[eventName];
  65193. if (!symbolName) {
  65194. symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
  65195. }
  65196. var /** @type {?} */ taskDatas = (/** @type {?} */ (element))[symbolName];
  65197. var /** @type {?} */ globalListenerRegistered = taskDatas && taskDatas.length > 0;
  65198. if (!taskDatas) {
  65199. taskDatas = (/** @type {?} */ (element))[symbolName] = [];
  65200. }
  65201. var /** @type {?} */ zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
  65202. if (taskDatas.length === 0) {
  65203. taskDatas.push({ zone: zone, handler: callback });
  65204. }
  65205. else {
  65206. var /** @type {?} */ callbackRegistered = false;
  65207. for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
  65208. if (taskDatas[i].handler === callback) {
  65209. callbackRegistered = true;
  65210. break;
  65211. }
  65212. }
  65213. if (!callbackRegistered) {
  65214. taskDatas.push({ zone: zone, handler: callback });
  65215. }
  65216. }
  65217. if (!globalListenerRegistered) {
  65218. element[ADD_EVENT_LISTENER](eventName, globalListener, false);
  65219. }
  65220. }
  65221. else {
  65222. element[NATIVE_ADD_LISTENER](eventName, callback, false);
  65223. }
  65224. return function () { return _this.removeEventListener(element, eventName, callback); };
  65225. };
  65226. /**
  65227. * @param {?} target
  65228. * @param {?} eventName
  65229. * @param {?} callback
  65230. * @return {?}
  65231. */
  65232. DomEventsPlugin.prototype.removeEventListener = /**
  65233. * @param {?} target
  65234. * @param {?} eventName
  65235. * @param {?} callback
  65236. * @return {?}
  65237. */
  65238. function (target, eventName, callback) {
  65239. var /** @type {?} */ underlyingRemove = target[REMOVE_EVENT_LISTENER];
  65240. // zone.js not loaded, use native removeEventListener
  65241. if (!underlyingRemove) {
  65242. return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
  65243. }
  65244. var /** @type {?} */ symbolName = symbolNames[eventName];
  65245. var /** @type {?} */ taskDatas = symbolName && target[symbolName];
  65246. if (!taskDatas) {
  65247. // addEventListener not using patched version
  65248. // just call native removeEventListener
  65249. return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
  65250. }
  65251. // fix issue 20532, should be able to remove
  65252. // listener which was added inside of ngZone
  65253. var /** @type {?} */ found = false;
  65254. for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
  65255. // remove listener from taskDatas if the callback equals
  65256. if (taskDatas[i].handler === callback) {
  65257. found = true;
  65258. taskDatas.splice(i, 1);
  65259. break;
  65260. }
  65261. }
  65262. if (found) {
  65263. if (taskDatas.length === 0) {
  65264. // all listeners are removed, we can remove the globalListener from target
  65265. underlyingRemove.apply(target, [eventName, globalListener, false]);
  65266. }
  65267. }
  65268. else {
  65269. // not found in taskDatas, the callback may be added inside of ngZone
  65270. // use native remove listener to remove the calback
  65271. target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
  65272. }
  65273. };
  65274. DomEventsPlugin.decorators = [
  65275. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  65276. ];
  65277. /** @nocollapse */
  65278. DomEventsPlugin.ctorParameters = function () { return [
  65279. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  65280. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */], },
  65281. ]; };
  65282. return DomEventsPlugin;
  65283. }(EventManagerPlugin));
  65284. /**
  65285. * @fileoverview added by tsickle
  65286. * @suppress {checkTypes} checked by tsc
  65287. */
  65288. /**
  65289. * @license
  65290. * Copyright Google Inc. All Rights Reserved.
  65291. *
  65292. * Use of this source code is governed by an MIT-style license that can be
  65293. * found in the LICENSE file at https://angular.io/license
  65294. */
  65295. var EVENT_NAMES = {
  65296. // pan
  65297. 'pan': true,
  65298. 'panstart': true,
  65299. 'panmove': true,
  65300. 'panend': true,
  65301. 'pancancel': true,
  65302. 'panleft': true,
  65303. 'panright': true,
  65304. 'panup': true,
  65305. 'pandown': true,
  65306. // pinch
  65307. 'pinch': true,
  65308. 'pinchstart': true,
  65309. 'pinchmove': true,
  65310. 'pinchend': true,
  65311. 'pinchcancel': true,
  65312. 'pinchin': true,
  65313. 'pinchout': true,
  65314. // press
  65315. 'press': true,
  65316. 'pressup': true,
  65317. // rotate
  65318. 'rotate': true,
  65319. 'rotatestart': true,
  65320. 'rotatemove': true,
  65321. 'rotateend': true,
  65322. 'rotatecancel': true,
  65323. // swipe
  65324. 'swipe': true,
  65325. 'swipeleft': true,
  65326. 'swiperight': true,
  65327. 'swipeup': true,
  65328. 'swipedown': true,
  65329. // tap
  65330. 'tap': true,
  65331. };
  65332. /**
  65333. * A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure
  65334. * Hammer gestures.
  65335. *
  65336. * \@experimental
  65337. */
  65338. var HAMMER_GESTURE_CONFIG = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('HammerGestureConfig');
  65339. /**
  65340. * @record
  65341. */
  65342. /**
  65343. * \@experimental
  65344. */
  65345. var HammerGestureConfig = /** @class */ (function () {
  65346. function HammerGestureConfig() {
  65347. this.events = [];
  65348. this.overrides = {};
  65349. }
  65350. /**
  65351. * @param {?} element
  65352. * @return {?}
  65353. */
  65354. HammerGestureConfig.prototype.buildHammer = /**
  65355. * @param {?} element
  65356. * @return {?}
  65357. */
  65358. function (element) {
  65359. var /** @type {?} */ mc = new Hammer(element);
  65360. mc.get('pinch').set({ enable: true });
  65361. mc.get('rotate').set({ enable: true });
  65362. for (var /** @type {?} */ eventName in this.overrides) {
  65363. mc.get(eventName).set(this.overrides[eventName]);
  65364. }
  65365. return mc;
  65366. };
  65367. HammerGestureConfig.decorators = [
  65368. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  65369. ];
  65370. /** @nocollapse */
  65371. HammerGestureConfig.ctorParameters = function () { return []; };
  65372. return HammerGestureConfig;
  65373. }());
  65374. var HammerGesturesPlugin = /** @class */ (function (_super) {
  65375. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(HammerGesturesPlugin, _super);
  65376. function HammerGesturesPlugin(doc, _config) {
  65377. var _this = _super.call(this, doc) || this;
  65378. _this._config = _config;
  65379. return _this;
  65380. }
  65381. /**
  65382. * @param {?} eventName
  65383. * @return {?}
  65384. */
  65385. HammerGesturesPlugin.prototype.supports = /**
  65386. * @param {?} eventName
  65387. * @return {?}
  65388. */
  65389. function (eventName) {
  65390. if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
  65391. return false;
  65392. }
  65393. if (!(/** @type {?} */ (window)).Hammer) {
  65394. throw new Error("Hammer.js is not loaded, can not bind " + eventName + " event");
  65395. }
  65396. return true;
  65397. };
  65398. /**
  65399. * @param {?} element
  65400. * @param {?} eventName
  65401. * @param {?} handler
  65402. * @return {?}
  65403. */
  65404. HammerGesturesPlugin.prototype.addEventListener = /**
  65405. * @param {?} element
  65406. * @param {?} eventName
  65407. * @param {?} handler
  65408. * @return {?}
  65409. */
  65410. function (element, eventName, handler) {
  65411. var _this = this;
  65412. var /** @type {?} */ zone = this.manager.getZone();
  65413. eventName = eventName.toLowerCase();
  65414. return zone.runOutsideAngular(function () {
  65415. // Creating the manager bind events, must be done outside of angular
  65416. var /** @type {?} */ mc = _this._config.buildHammer(element);
  65417. var /** @type {?} */ callback = function (eventObj) {
  65418. zone.runGuarded(function () { handler(eventObj); });
  65419. };
  65420. mc.on(eventName, callback);
  65421. return function () { return mc.off(eventName, callback); };
  65422. });
  65423. };
  65424. /**
  65425. * @param {?} eventName
  65426. * @return {?}
  65427. */
  65428. HammerGesturesPlugin.prototype.isCustomEvent = /**
  65429. * @param {?} eventName
  65430. * @return {?}
  65431. */
  65432. function (eventName) { return this._config.events.indexOf(eventName) > -1; };
  65433. HammerGesturesPlugin.decorators = [
  65434. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  65435. ];
  65436. /** @nocollapse */
  65437. HammerGesturesPlugin.ctorParameters = function () { return [
  65438. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  65439. { type: HammerGestureConfig, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [HAMMER_GESTURE_CONFIG,] },] },
  65440. ]; };
  65441. return HammerGesturesPlugin;
  65442. }(EventManagerPlugin));
  65443. /**
  65444. * @fileoverview added by tsickle
  65445. * @suppress {checkTypes} checked by tsc
  65446. */
  65447. /**
  65448. * @license
  65449. * Copyright Google Inc. All Rights Reserved.
  65450. *
  65451. * Use of this source code is governed by an MIT-style license that can be
  65452. * found in the LICENSE file at https://angular.io/license
  65453. */
  65454. var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
  65455. var ɵ0$1 = function (event) { return event.altKey; };
  65456. var ɵ1$1 = function (event) { return event.ctrlKey; };
  65457. var ɵ2$1 = function (event) { return event.metaKey; };
  65458. var ɵ3 = function (event) { return event.shiftKey; };
  65459. var MODIFIER_KEY_GETTERS = {
  65460. 'alt': ɵ0$1,
  65461. 'control': ɵ1$1,
  65462. 'meta': ɵ2$1,
  65463. 'shift': ɵ3
  65464. };
  65465. /**
  65466. * \@experimental
  65467. */
  65468. var KeyEventsPlugin = /** @class */ (function (_super) {
  65469. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(KeyEventsPlugin, _super);
  65470. function KeyEventsPlugin(doc) {
  65471. return _super.call(this, doc) || this;
  65472. }
  65473. /**
  65474. * @param {?} eventName
  65475. * @return {?}
  65476. */
  65477. KeyEventsPlugin.prototype.supports = /**
  65478. * @param {?} eventName
  65479. * @return {?}
  65480. */
  65481. function (eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; };
  65482. /**
  65483. * @param {?} element
  65484. * @param {?} eventName
  65485. * @param {?} handler
  65486. * @return {?}
  65487. */
  65488. KeyEventsPlugin.prototype.addEventListener = /**
  65489. * @param {?} element
  65490. * @param {?} eventName
  65491. * @param {?} handler
  65492. * @return {?}
  65493. */
  65494. function (element, eventName, handler) {
  65495. var /** @type {?} */ parsedEvent = /** @type {?} */ ((KeyEventsPlugin.parseEventName(eventName)));
  65496. var /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
  65497. return this.manager.getZone().runOutsideAngular(function () {
  65498. return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
  65499. });
  65500. };
  65501. /**
  65502. * @param {?} eventName
  65503. * @return {?}
  65504. */
  65505. KeyEventsPlugin.parseEventName = /**
  65506. * @param {?} eventName
  65507. * @return {?}
  65508. */
  65509. function (eventName) {
  65510. var /** @type {?} */ parts = eventName.toLowerCase().split('.');
  65511. var /** @type {?} */ domEventName = parts.shift();
  65512. if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
  65513. return null;
  65514. }
  65515. var /** @type {?} */ key = KeyEventsPlugin._normalizeKey(/** @type {?} */ ((parts.pop())));
  65516. var /** @type {?} */ fullKey = '';
  65517. MODIFIER_KEYS.forEach(function (modifierName) {
  65518. var /** @type {?} */ index = parts.indexOf(modifierName);
  65519. if (index > -1) {
  65520. parts.splice(index, 1);
  65521. fullKey += modifierName + '.';
  65522. }
  65523. });
  65524. fullKey += key;
  65525. if (parts.length != 0 || key.length === 0) {
  65526. // returning null instead of throwing to let another plugin process the event
  65527. return null;
  65528. }
  65529. var /** @type {?} */ result = {};
  65530. result['domEventName'] = domEventName;
  65531. result['fullKey'] = fullKey;
  65532. return result;
  65533. };
  65534. /**
  65535. * @param {?} event
  65536. * @return {?}
  65537. */
  65538. KeyEventsPlugin.getEventFullKey = /**
  65539. * @param {?} event
  65540. * @return {?}
  65541. */
  65542. function (event) {
  65543. var /** @type {?} */ fullKey = '';
  65544. var /** @type {?} */ key = getDOM().getEventKey(event);
  65545. key = key.toLowerCase();
  65546. if (key === ' ') {
  65547. key = 'space'; // for readability
  65548. }
  65549. else if (key === '.') {
  65550. key = 'dot'; // because '.' is used as a separator in event names
  65551. }
  65552. MODIFIER_KEYS.forEach(function (modifierName) {
  65553. if (modifierName != key) {
  65554. var /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
  65555. if (modifierGetter(event)) {
  65556. fullKey += modifierName + '.';
  65557. }
  65558. }
  65559. });
  65560. fullKey += key;
  65561. return fullKey;
  65562. };
  65563. /**
  65564. * @param {?} fullKey
  65565. * @param {?} handler
  65566. * @param {?} zone
  65567. * @return {?}
  65568. */
  65569. KeyEventsPlugin.eventCallback = /**
  65570. * @param {?} fullKey
  65571. * @param {?} handler
  65572. * @param {?} zone
  65573. * @return {?}
  65574. */
  65575. function (fullKey, handler, zone) {
  65576. return function (event /** TODO #9100 */) {
  65577. if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
  65578. zone.runGuarded(function () { return handler(event); });
  65579. }
  65580. };
  65581. };
  65582. /** @internal */
  65583. /**
  65584. * \@internal
  65585. * @param {?} keyName
  65586. * @return {?}
  65587. */
  65588. KeyEventsPlugin._normalizeKey = /**
  65589. * \@internal
  65590. * @param {?} keyName
  65591. * @return {?}
  65592. */
  65593. function (keyName) {
  65594. // TODO: switch to a Map if the mapping grows too much
  65595. switch (keyName) {
  65596. case 'esc':
  65597. return 'escape';
  65598. default:
  65599. return keyName;
  65600. }
  65601. };
  65602. KeyEventsPlugin.decorators = [
  65603. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  65604. ];
  65605. /** @nocollapse */
  65606. KeyEventsPlugin.ctorParameters = function () { return [
  65607. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  65608. ]; };
  65609. return KeyEventsPlugin;
  65610. }(EventManagerPlugin));
  65611. /**
  65612. * @fileoverview added by tsickle
  65613. * @suppress {checkTypes} checked by tsc
  65614. */
  65615. /**
  65616. * @license
  65617. * Copyright Google Inc. All Rights Reserved.
  65618. *
  65619. * Use of this source code is governed by an MIT-style license that can be
  65620. * found in the LICENSE file at https://angular.io/license
  65621. */
  65622. /**
  65623. * This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML
  65624. * that needs sanitizing.
  65625. * Depending upon browser support we must use one of three strategies for doing this.
  65626. * Support: Safari 10.x -> XHR strategy
  65627. * Support: Firefox -> DomParser strategy
  65628. * Default: InertDocument strategy
  65629. */
  65630. var InertBodyHelper = /** @class */ (function () {
  65631. function InertBodyHelper(defaultDoc, DOM) {
  65632. this.defaultDoc = defaultDoc;
  65633. this.DOM = DOM;
  65634. var /** @type {?} */ inertDocument = this.DOM.createHtmlDocument();
  65635. this.inertBodyElement = inertDocument.body;
  65636. if (this.inertBodyElement == null) {
  65637. // usually there should be only one body element in the document, but IE doesn't have any, so
  65638. // we need to create one.
  65639. var /** @type {?} */ inertHtml = this.DOM.createElement('html', inertDocument);
  65640. this.inertBodyElement = this.DOM.createElement('body', inertDocument);
  65641. this.DOM.appendChild(inertHtml, this.inertBodyElement);
  65642. this.DOM.appendChild(inertDocument, inertHtml);
  65643. }
  65644. this.DOM.setInnerHTML(this.inertBodyElement, '<svg><g onload="this.parentNode.remove()"></g></svg>');
  65645. if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) {
  65646. // We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element
  65647. // so use the XHR strategy.
  65648. this.getInertBodyElement = this.getInertBodyElement_XHR;
  65649. return;
  65650. }
  65651. this.DOM.setInnerHTML(this.inertBodyElement, '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">');
  65652. if (this.inertBodyElement.querySelector && this.inertBodyElement.querySelector('svg img')) {
  65653. // We just hit the Firefox bug - which prevents the inner img JS from being sanitized
  65654. // so use the DOMParser strategy, if it is available.
  65655. // If the DOMParser is not available then we are not in Firefox (Server/WebWorker?) so we
  65656. // fall through to the default strategy below.
  65657. if (isDOMParserAvailable()) {
  65658. this.getInertBodyElement = this.getInertBodyElement_DOMParser;
  65659. return;
  65660. }
  65661. }
  65662. // None of the bugs were hit so it is safe for us to use the default InertDocument strategy
  65663. this.getInertBodyElement = this.getInertBodyElement_InertDocument;
  65664. }
  65665. /**
  65666. * Use XHR to create and fill an inert body element (on Safari 10.1)
  65667. * See
  65668. * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
  65669. * @param {?} html
  65670. * @return {?}
  65671. */
  65672. InertBodyHelper.prototype.getInertBodyElement_XHR = /**
  65673. * Use XHR to create and fill an inert body element (on Safari 10.1)
  65674. * See
  65675. * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
  65676. * @param {?} html
  65677. * @return {?}
  65678. */
  65679. function (html) {
  65680. // We add these extra elements to ensure that the rest of the content is parsed as expected
  65681. // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
  65682. // `<head>` tag.
  65683. html = '<body><remove></remove>' + html + '</body>';
  65684. try {
  65685. html = encodeURI(html);
  65686. }
  65687. catch (/** @type {?} */ e) {
  65688. return null;
  65689. }
  65690. var /** @type {?} */ xhr = new XMLHttpRequest();
  65691. xhr.responseType = 'document';
  65692. xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false);
  65693. xhr.send(null);
  65694. var /** @type {?} */ body = xhr.response.body;
  65695. body.removeChild(/** @type {?} */ ((body.firstChild)));
  65696. return body;
  65697. };
  65698. /**
  65699. * Use DOMParser to create and fill an inert body element (on Firefox)
  65700. * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
  65701. *
  65702. * @param {?} html
  65703. * @return {?}
  65704. */
  65705. InertBodyHelper.prototype.getInertBodyElement_DOMParser = /**
  65706. * Use DOMParser to create and fill an inert body element (on Firefox)
  65707. * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
  65708. *
  65709. * @param {?} html
  65710. * @return {?}
  65711. */
  65712. function (html) {
  65713. // We add these extra elements to ensure that the rest of the content is parsed as expected
  65714. // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
  65715. // `<head>` tag.
  65716. html = '<body><remove></remove>' + html + '</body>';
  65717. try {
  65718. var /** @type {?} */ body = /** @type {?} */ (new (/** @type {?} */ (window))
  65719. .DOMParser()
  65720. .parseFromString(html, 'text/html')
  65721. .body);
  65722. body.removeChild(/** @type {?} */ ((body.firstChild)));
  65723. return body;
  65724. }
  65725. catch (/** @type {?} */ e) {
  65726. return null;
  65727. }
  65728. };
  65729. /**
  65730. * Use an HTML5 `template` element, if supported, or an inert body element created via
  65731. * `createHtmlDocument` to create and fill an inert DOM element.
  65732. * This is the default sane strategy to use if the browser does not require one of the specialised
  65733. * strategies above.
  65734. * @param {?} html
  65735. * @return {?}
  65736. */
  65737. InertBodyHelper.prototype.getInertBodyElement_InertDocument = /**
  65738. * Use an HTML5 `template` element, if supported, or an inert body element created via
  65739. * `createHtmlDocument` to create and fill an inert DOM element.
  65740. * This is the default sane strategy to use if the browser does not require one of the specialised
  65741. * strategies above.
  65742. * @param {?} html
  65743. * @return {?}
  65744. */
  65745. function (html) {
  65746. // Prefer using <template> element if supported.
  65747. var /** @type {?} */ templateEl = this.DOM.createElement('template');
  65748. if ('content' in templateEl) {
  65749. this.DOM.setInnerHTML(templateEl, html);
  65750. return templateEl;
  65751. }
  65752. this.DOM.setInnerHTML(this.inertBodyElement, html);
  65753. // Support: IE 9-11 only
  65754. // strip custom-namespaced attributes on IE<=11
  65755. if (this.defaultDoc.documentMode) {
  65756. this.stripCustomNsAttrs(this.inertBodyElement);
  65757. }
  65758. return this.inertBodyElement;
  65759. };
  65760. /**
  65761. * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
  65762. * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
  65763. * 'ns1:xlink:foo').
  65764. *
  65765. * This is undesirable since we don't want to allow any of these custom attributes. This method
  65766. * strips them all.
  65767. * @param {?} el
  65768. * @return {?}
  65769. */
  65770. InertBodyHelper.prototype.stripCustomNsAttrs = /**
  65771. * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
  65772. * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
  65773. * 'ns1:xlink:foo').
  65774. *
  65775. * This is undesirable since we don't want to allow any of these custom attributes. This method
  65776. * strips them all.
  65777. * @param {?} el
  65778. * @return {?}
  65779. */
  65780. function (el) {
  65781. var _this = this;
  65782. this.DOM.attributeMap(el).forEach(function (_, attrName) {
  65783. if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
  65784. _this.DOM.removeAttribute(el, attrName);
  65785. }
  65786. });
  65787. for (var _i = 0, _a = this.DOM.childNodesAsList(el); _i < _a.length; _i++) {
  65788. var n = _a[_i];
  65789. if (this.DOM.isElementNode(n))
  65790. this.stripCustomNsAttrs(/** @type {?} */ (n));
  65791. }
  65792. };
  65793. return InertBodyHelper;
  65794. }());
  65795. /**
  65796. * We need to determine whether the DOMParser exists in the global context.
  65797. * The try-catch is because, on some browsers, trying to access this property
  65798. * on window can actually throw an error.
  65799. *
  65800. * @suppress {uselessCode}
  65801. * @return {?}
  65802. */
  65803. function isDOMParserAvailable() {
  65804. try {
  65805. return !!(/** @type {?} */ (window)).DOMParser;
  65806. }
  65807. catch (/** @type {?} */ e) {
  65808. return false;
  65809. }
  65810. }
  65811. /**
  65812. * @fileoverview added by tsickle
  65813. * @suppress {checkTypes} checked by tsc
  65814. */
  65815. /**
  65816. * @license
  65817. * Copyright Google Inc. All Rights Reserved.
  65818. *
  65819. * Use of this source code is governed by an MIT-style license that can be
  65820. * found in the LICENSE file at https://angular.io/license
  65821. */
  65822. /**
  65823. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  65824. *
  65825. * This regular expression matches a subset of URLs that will not cause script
  65826. * execution if used in URL context within a HTML document. Specifically, this
  65827. * regular expression matches if (comment from here on and regex copied from
  65828. * Soy's EscapingConventions):
  65829. * (1) Either a protocol in a whitelist (http, https, mailto or ftp).
  65830. * (2) or no protocol. A protocol must be followed by a colon. The below
  65831. * allows that by allowing colons only after one of the characters [/?#].
  65832. * A colon after a hash (#) must be in the fragment.
  65833. * Otherwise, a colon after a (?) must be in a query.
  65834. * Otherwise, a colon after a single solidus (/) must be in a path.
  65835. * Otherwise, a colon after a double solidus (//) must be in the authority
  65836. * (before port).
  65837. *
  65838. * The pattern disallows &, used in HTML entity declarations before
  65839. * one of the characters in [/?#]. This disallows HTML entities used in the
  65840. * protocol name, which should never happen, e.g. "h&#116;tp" for "http".
  65841. * It also disallows HTML entities in the first path part of a relative path,
  65842. * e.g. "foo&lt;bar/baz". Our existing escaping functions should not produce
  65843. * that. More importantly, it disallows masking of a colon,
  65844. * e.g. "javascript&#58;...".
  65845. *
  65846. * This regular expression was taken from the Closure sanitization library.
  65847. */
  65848. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  65849. /**
  65850. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  65851. */
  65852. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;
  65853. /**
  65854. * @param {?} url
  65855. * @return {?}
  65856. */
  65857. function sanitizeUrl(url) {
  65858. url = String(url);
  65859. if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
  65860. return url;
  65861. if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])()) {
  65862. getDOM().log("WARNING: sanitizing unsafe URL value " + url + " (see http://g.co/ng/security#xss)");
  65863. }
  65864. return 'unsafe:' + url;
  65865. }
  65866. /**
  65867. * @param {?} srcset
  65868. * @return {?}
  65869. */
  65870. function sanitizeSrcset(srcset) {
  65871. srcset = String(srcset);
  65872. return srcset.split(',').map(function (srcset) { return sanitizeUrl(srcset.trim()); }).join(', ');
  65873. }
  65874. /**
  65875. * @fileoverview added by tsickle
  65876. * @suppress {checkTypes} checked by tsc
  65877. */
  65878. /**
  65879. * @license
  65880. * Copyright Google Inc. All Rights Reserved.
  65881. *
  65882. * Use of this source code is governed by an MIT-style license that can be
  65883. * found in the LICENSE file at https://angular.io/license
  65884. */
  65885. /**
  65886. * @param {?} tags
  65887. * @return {?}
  65888. */
  65889. function tagSet(tags) {
  65890. var /** @type {?} */ res = {};
  65891. for (var _i = 0, _a = tags.split(','); _i < _a.length; _i++) {
  65892. var t = _a[_i];
  65893. res[t] = true;
  65894. }
  65895. return res;
  65896. }
  65897. /**
  65898. * @param {...?} sets
  65899. * @return {?}
  65900. */
  65901. function merge() {
  65902. var sets = [];
  65903. for (var _i = 0; _i < arguments.length; _i++) {
  65904. sets[_i] = arguments[_i];
  65905. }
  65906. var /** @type {?} */ res = {};
  65907. for (var _a = 0, sets_1 = sets; _a < sets_1.length; _a++) {
  65908. var s = sets_1[_a];
  65909. for (var /** @type {?} */ v in s) {
  65910. if (s.hasOwnProperty(v))
  65911. res[v] = true;
  65912. }
  65913. }
  65914. return res;
  65915. }
  65916. // Good source of info about elements and attributes
  65917. // http://dev.w3.org/html5/spec/Overview.html#semantics
  65918. // http://simon.html5.org/html-elements
  65919. // Safe Void Elements - HTML5
  65920. // http://dev.w3.org/html5/spec/Overview.html#void-elements
  65921. var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
  65922. // Elements that you can, intentionally, leave open (and which close themselves)
  65923. // http://dev.w3.org/html5/spec/Overview.html#optional-tags
  65924. var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
  65925. var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
  65926. var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
  65927. // Safe Block Elements - HTML5
  65928. var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
  65929. 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
  65930. 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
  65931. // Inline Elements - HTML5
  65932. var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
  65933. 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
  65934. 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
  65935. var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
  65936. // Attributes that have href and hence need to be sanitized
  65937. var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
  65938. // Attributes that have special href set hence need to be sanitized
  65939. var SRCSET_ATTRS = tagSet('srcset');
  65940. var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
  65941. 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
  65942. 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
  65943. 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
  65944. 'valign,value,vspace,width');
  65945. // NB: This currently consciously doesn't support SVG. SVG sanitization has had several security
  65946. // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via
  65947. // innerHTML is required, SVG attributes should be added here.
  65948. // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
  65949. // can be sanitized, but they increase security surface area without a legitimate use case, so they
  65950. // are left out here.
  65951. var VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS);
  65952. /**
  65953. * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe
  65954. * attributes.
  65955. */
  65956. var SanitizingHtmlSerializer = /** @class */ (function () {
  65957. function SanitizingHtmlSerializer() {
  65958. this.sanitizedSomething = false;
  65959. this.buf = [];
  65960. this.DOM = getDOM();
  65961. }
  65962. /**
  65963. * @param {?} el
  65964. * @return {?}
  65965. */
  65966. SanitizingHtmlSerializer.prototype.sanitizeChildren = /**
  65967. * @param {?} el
  65968. * @return {?}
  65969. */
  65970. function (el) {
  65971. // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters.
  65972. // However this code never accesses properties off of `document` before deleting its contents
  65973. // again, so it shouldn't be vulnerable to DOM clobbering.
  65974. var /** @type {?} */ current = /** @type {?} */ ((this.DOM.firstChild(el)));
  65975. while (current) {
  65976. if (this.DOM.isElementNode(current)) {
  65977. this.startElement(/** @type {?} */ (current));
  65978. }
  65979. else if (this.DOM.isTextNode(current)) {
  65980. this.chars(/** @type {?} */ ((this.DOM.nodeValue(current))));
  65981. }
  65982. else {
  65983. // Strip non-element, non-text nodes.
  65984. this.sanitizedSomething = true;
  65985. }
  65986. if (this.DOM.firstChild(current)) {
  65987. current = /** @type {?} */ ((this.DOM.firstChild(current)));
  65988. continue;
  65989. }
  65990. while (current) {
  65991. // Leaving the element. Walk up and to the right, closing tags as we go.
  65992. if (this.DOM.isElementNode(current)) {
  65993. this.endElement(/** @type {?} */ (current));
  65994. }
  65995. var /** @type {?} */ next = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.nextSibling(current))));
  65996. if (next) {
  65997. current = next;
  65998. break;
  65999. }
  66000. current = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.parentElement(current))));
  66001. }
  66002. }
  66003. return this.buf.join('');
  66004. };
  66005. /**
  66006. * @param {?} element
  66007. * @return {?}
  66008. */
  66009. SanitizingHtmlSerializer.prototype.startElement = /**
  66010. * @param {?} element
  66011. * @return {?}
  66012. */
  66013. function (element) {
  66014. var _this = this;
  66015. var /** @type {?} */ tagName = this.DOM.nodeName(element).toLowerCase();
  66016. if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
  66017. this.sanitizedSomething = true;
  66018. return;
  66019. }
  66020. this.buf.push('<');
  66021. this.buf.push(tagName);
  66022. this.DOM.attributeMap(element).forEach(function (value, attrName) {
  66023. var /** @type {?} */ lower = attrName.toLowerCase();
  66024. if (!VALID_ATTRS.hasOwnProperty(lower)) {
  66025. _this.sanitizedSomething = true;
  66026. return;
  66027. }
  66028. // TODO(martinprobst): Special case image URIs for data:image/...
  66029. if (URI_ATTRS[lower])
  66030. value = sanitizeUrl(value);
  66031. if (SRCSET_ATTRS[lower])
  66032. value = sanitizeSrcset(value);
  66033. _this.buf.push(' ');
  66034. _this.buf.push(attrName);
  66035. _this.buf.push('="');
  66036. _this.buf.push(encodeEntities(value));
  66037. _this.buf.push('"');
  66038. });
  66039. this.buf.push('>');
  66040. };
  66041. /**
  66042. * @param {?} current
  66043. * @return {?}
  66044. */
  66045. SanitizingHtmlSerializer.prototype.endElement = /**
  66046. * @param {?} current
  66047. * @return {?}
  66048. */
  66049. function (current) {
  66050. var /** @type {?} */ tagName = this.DOM.nodeName(current).toLowerCase();
  66051. if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
  66052. this.buf.push('</');
  66053. this.buf.push(tagName);
  66054. this.buf.push('>');
  66055. }
  66056. };
  66057. /**
  66058. * @param {?} chars
  66059. * @return {?}
  66060. */
  66061. SanitizingHtmlSerializer.prototype.chars = /**
  66062. * @param {?} chars
  66063. * @return {?}
  66064. */
  66065. function (chars) { this.buf.push(encodeEntities(chars)); };
  66066. /**
  66067. * @param {?} node
  66068. * @param {?} nextNode
  66069. * @return {?}
  66070. */
  66071. SanitizingHtmlSerializer.prototype.checkClobberedElement = /**
  66072. * @param {?} node
  66073. * @param {?} nextNode
  66074. * @return {?}
  66075. */
  66076. function (node, nextNode) {
  66077. if (nextNode && this.DOM.contains(node, nextNode)) {
  66078. throw new Error("Failed to sanitize html because the element is clobbered: " + this.DOM.getOuterHTML(node));
  66079. }
  66080. return nextNode;
  66081. };
  66082. return SanitizingHtmlSerializer;
  66083. }());
  66084. // Regular Expressions for parsing tags and attributes
  66085. var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  66086. // ! to ~ is the ASCII range.
  66087. var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
  66088. /**
  66089. * Escapes all potentially dangerous characters, so that the
  66090. * resulting string can be safely inserted into attribute or
  66091. * element text.
  66092. * @param {?} value
  66093. * @return {?}
  66094. */
  66095. function encodeEntities(value) {
  66096. return value.replace(/&/g, '&amp;')
  66097. .replace(SURROGATE_PAIR_REGEXP, function (match) {
  66098. var /** @type {?} */ hi = match.charCodeAt(0);
  66099. var /** @type {?} */ low = match.charCodeAt(1);
  66100. return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
  66101. })
  66102. .replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; })
  66103. .replace(/</g, '&lt;')
  66104. .replace(/>/g, '&gt;');
  66105. }
  66106. var inertBodyHelper;
  66107. /**
  66108. * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
  66109. * the DOM in a browser environment.
  66110. * @param {?} defaultDoc
  66111. * @param {?} unsafeHtmlInput
  66112. * @return {?}
  66113. */
  66114. function sanitizeHtml(defaultDoc, unsafeHtmlInput) {
  66115. var /** @type {?} */ DOM = getDOM();
  66116. var /** @type {?} */ inertBodyElement = null;
  66117. try {
  66118. inertBodyHelper = inertBodyHelper || new InertBodyHelper(defaultDoc, DOM);
  66119. // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).
  66120. var /** @type {?} */ unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
  66121. inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
  66122. // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser
  66123. // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.
  66124. var /** @type {?} */ mXSSAttempts = 5;
  66125. var /** @type {?} */ parsedHtml = unsafeHtml;
  66126. do {
  66127. if (mXSSAttempts === 0) {
  66128. throw new Error('Failed to sanitize html because the input is unstable');
  66129. }
  66130. mXSSAttempts--;
  66131. unsafeHtml = parsedHtml;
  66132. parsedHtml = DOM.getInnerHTML(inertBodyElement);
  66133. inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
  66134. } while (unsafeHtml !== parsedHtml);
  66135. var /** @type {?} */ sanitizer = new SanitizingHtmlSerializer();
  66136. var /** @type {?} */ safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(inertBodyElement) || inertBodyElement);
  66137. if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])() && sanitizer.sanitizedSomething) {
  66138. DOM.log('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).');
  66139. }
  66140. return safeHtml;
  66141. }
  66142. finally {
  66143. // In case anything goes wrong, clear out inertElement to reset the entire DOM structure.
  66144. if (inertBodyElement) {
  66145. var /** @type {?} */ parent_1 = DOM.getTemplateContent(inertBodyElement) || inertBodyElement;
  66146. for (var _i = 0, _a = DOM.childNodesAsList(parent_1); _i < _a.length; _i++) {
  66147. var child = _a[_i];
  66148. DOM.removeChild(parent_1, child);
  66149. }
  66150. }
  66151. }
  66152. }
  66153. /**
  66154. * @fileoverview added by tsickle
  66155. * @suppress {checkTypes} checked by tsc
  66156. */
  66157. /**
  66158. * @license
  66159. * Copyright Google Inc. All Rights Reserved.
  66160. *
  66161. * Use of this source code is governed by an MIT-style license that can be
  66162. * found in the LICENSE file at https://angular.io/license
  66163. */
  66164. /**
  66165. * Regular expression for safe style values.
  66166. *
  66167. * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced.
  66168. *
  66169. * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or
  66170. * font-family) and hence could allow multiple values to get injected, but that should pose no risk
  66171. * of XSS.
  66172. *
  66173. * The function expression checks only for XSS safety, not for CSS validity.
  66174. *
  66175. * This regular expression was taken from the Closure sanitization library, and augmented for
  66176. * transformation values.
  66177. */
  66178. var VALUES = '[-,."\'%_!# a-zA-Z0-9]+';
  66179. var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?';
  66180. var COLOR_FNS = '(?:rgb|hsl)a?';
  66181. var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient';
  66182. var CSS3_FNS = '(?:calc|attr)';
  66183. var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)';
  66184. var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|" +
  66185. ("(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + "|" + GRADIENTS + "|" + CSS3_FNS + ")") +
  66186. (FN_ARGS + ")$"), 'g');
  66187. /**
  66188. * Matches a `url(...)` value with an arbitrary argument as long as it does
  66189. * not contain parentheses.
  66190. *
  66191. * The URL value still needs to be sanitized separately.
  66192. *
  66193. * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted
  66194. * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g.
  66195. * by observing whether scroll bars are displayed, or character ranges used by a font face
  66196. * definition.
  66197. *
  66198. * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that
  66199. * binding a URL value without further cooperation from the page will cause an information leak, and
  66200. * if so, it is just a leak, not a full blown XSS vulnerability.
  66201. *
  66202. * Given the common use case, low likelihood of attack vector, and low impact of an attack, this
  66203. * code is permissive and allows URLs that sanitize otherwise.
  66204. */
  66205. var URL_RE = /^url\(([^)]+)\)$/;
  66206. /**
  66207. * Checks that quotes (" and ') are properly balanced inside a string. Assumes
  66208. * that neither escape (\) nor any other character that could result in
  66209. * breaking out of a string parsing context are allowed;
  66210. * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
  66211. *
  66212. * This code was taken from the Closure sanitization library.
  66213. * @param {?} value
  66214. * @return {?}
  66215. */
  66216. function hasBalancedQuotes(value) {
  66217. var /** @type {?} */ outsideSingle = true;
  66218. var /** @type {?} */ outsideDouble = true;
  66219. for (var /** @type {?} */ i = 0; i < value.length; i++) {
  66220. var /** @type {?} */ c = value.charAt(i);
  66221. if (c === '\'' && outsideDouble) {
  66222. outsideSingle = !outsideSingle;
  66223. }
  66224. else if (c === '"' && outsideSingle) {
  66225. outsideDouble = !outsideDouble;
  66226. }
  66227. }
  66228. return outsideSingle && outsideDouble;
  66229. }
  66230. /**
  66231. * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single
  66232. * value) and returns a value that is safe to use in a browser environment.
  66233. * @param {?} value
  66234. * @return {?}
  66235. */
  66236. function sanitizeStyle(value) {
  66237. value = String(value).trim(); // Make sure it's actually a string.
  66238. if (!value)
  66239. return '';
  66240. // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
  66241. // reasoning behind this.
  66242. var /** @type {?} */ urlMatch = value.match(URL_RE);
  66243. if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
  66244. value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
  66245. return value; // Safe style values.
  66246. }
  66247. if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])()) {
  66248. getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
  66249. }
  66250. return 'unsafe';
  66251. }
  66252. /**
  66253. * @fileoverview added by tsickle
  66254. * @suppress {checkTypes} checked by tsc
  66255. */
  66256. /**
  66257. * @license
  66258. * Copyright Google Inc. All Rights Reserved.
  66259. *
  66260. * Use of this source code is governed by an MIT-style license that can be
  66261. * found in the LICENSE file at https://angular.io/license
  66262. */
  66263. /**
  66264. * Marker interface for a value that's safe to use in a particular context.
  66265. *
  66266. * \@stable
  66267. * @record
  66268. */
  66269. /**
  66270. * Marker interface for a value that's safe to use as HTML.
  66271. *
  66272. * \@stable
  66273. * @record
  66274. */
  66275. /**
  66276. * Marker interface for a value that's safe to use as style (CSS).
  66277. *
  66278. * \@stable
  66279. * @record
  66280. */
  66281. /**
  66282. * Marker interface for a value that's safe to use as JavaScript.
  66283. *
  66284. * \@stable
  66285. * @record
  66286. */
  66287. /**
  66288. * Marker interface for a value that's safe to use as a URL linking to a document.
  66289. *
  66290. * \@stable
  66291. * @record
  66292. */
  66293. /**
  66294. * Marker interface for a value that's safe to use as a URL to load executable code from.
  66295. *
  66296. * \@stable
  66297. * @record
  66298. */
  66299. /**
  66300. * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
  66301. * values to be safe to use in the different DOM contexts.
  66302. *
  66303. * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
  66304. * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
  66305. * the website.
  66306. *
  66307. * In specific situations, it might be necessary to disable sanitization, for example if the
  66308. * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
  66309. * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
  66310. * methods, and then binding to that value from the template.
  66311. *
  66312. * These situations should be very rare, and extraordinary care must be taken to avoid creating a
  66313. * Cross Site Scripting (XSS) security bug!
  66314. *
  66315. * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
  66316. * close as possible to the source of the value, to make it easy to verify no security bug is
  66317. * created by its use.
  66318. *
  66319. * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
  66320. * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
  66321. * code. The sanitizer leaves safe values intact.
  66322. *
  66323. * \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
  66324. * sanitization for the value passed in. Carefully check and audit all values and code paths going
  66325. * into this call. Make sure any user data is appropriately escaped for this security context.
  66326. * For more detail, see the [Security Guide](http://g.co/ng/security).
  66327. *
  66328. * \@stable
  66329. * @abstract
  66330. */
  66331. var DomSanitizer = /** @class */ (function () {
  66332. function DomSanitizer() {
  66333. }
  66334. return DomSanitizer;
  66335. }());
  66336. var DomSanitizerImpl = /** @class */ (function (_super) {
  66337. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomSanitizerImpl, _super);
  66338. function DomSanitizerImpl(_doc) {
  66339. var _this = _super.call(this) || this;
  66340. _this._doc = _doc;
  66341. return _this;
  66342. }
  66343. /**
  66344. * @param {?} ctx
  66345. * @param {?} value
  66346. * @return {?}
  66347. */
  66348. DomSanitizerImpl.prototype.sanitize = /**
  66349. * @param {?} ctx
  66350. * @param {?} value
  66351. * @return {?}
  66352. */
  66353. function (ctx, value) {
  66354. if (value == null)
  66355. return null;
  66356. switch (ctx) {
  66357. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].NONE:
  66358. return /** @type {?} */ (value);
  66359. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].HTML:
  66360. if (value instanceof SafeHtmlImpl)
  66361. return value.changingThisBreaksApplicationSecurity;
  66362. this.checkNotSafeValue(value, 'HTML');
  66363. return sanitizeHtml(this._doc, String(value));
  66364. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].STYLE:
  66365. if (value instanceof SafeStyleImpl)
  66366. return value.changingThisBreaksApplicationSecurity;
  66367. this.checkNotSafeValue(value, 'Style');
  66368. return sanitizeStyle(/** @type {?} */ (value));
  66369. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].SCRIPT:
  66370. if (value instanceof SafeScriptImpl)
  66371. return value.changingThisBreaksApplicationSecurity;
  66372. this.checkNotSafeValue(value, 'Script');
  66373. throw new Error('unsafe value used in a script context');
  66374. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].URL:
  66375. if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) {
  66376. // Allow resource URLs in URL contexts, they are strictly more trusted.
  66377. return value.changingThisBreaksApplicationSecurity;
  66378. }
  66379. this.checkNotSafeValue(value, 'URL');
  66380. return sanitizeUrl(String(value));
  66381. case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].RESOURCE_URL:
  66382. if (value instanceof SafeResourceUrlImpl) {
  66383. return value.changingThisBreaksApplicationSecurity;
  66384. }
  66385. this.checkNotSafeValue(value, 'ResourceURL');
  66386. throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
  66387. default:
  66388. throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
  66389. }
  66390. };
  66391. /**
  66392. * @param {?} value
  66393. * @param {?} expectedType
  66394. * @return {?}
  66395. */
  66396. DomSanitizerImpl.prototype.checkNotSafeValue = /**
  66397. * @param {?} value
  66398. * @param {?} expectedType
  66399. * @return {?}
  66400. */
  66401. function (value, expectedType) {
  66402. if (value instanceof SafeValueImpl) {
  66403. throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " +
  66404. "(see http://g.co/ng/security#xss)");
  66405. }
  66406. };
  66407. /**
  66408. * @param {?} value
  66409. * @return {?}
  66410. */
  66411. DomSanitizerImpl.prototype.bypassSecurityTrustHtml = /**
  66412. * @param {?} value
  66413. * @return {?}
  66414. */
  66415. function (value) { return new SafeHtmlImpl(value); };
  66416. /**
  66417. * @param {?} value
  66418. * @return {?}
  66419. */
  66420. DomSanitizerImpl.prototype.bypassSecurityTrustStyle = /**
  66421. * @param {?} value
  66422. * @return {?}
  66423. */
  66424. function (value) { return new SafeStyleImpl(value); };
  66425. /**
  66426. * @param {?} value
  66427. * @return {?}
  66428. */
  66429. DomSanitizerImpl.prototype.bypassSecurityTrustScript = /**
  66430. * @param {?} value
  66431. * @return {?}
  66432. */
  66433. function (value) { return new SafeScriptImpl(value); };
  66434. /**
  66435. * @param {?} value
  66436. * @return {?}
  66437. */
  66438. DomSanitizerImpl.prototype.bypassSecurityTrustUrl = /**
  66439. * @param {?} value
  66440. * @return {?}
  66441. */
  66442. function (value) { return new SafeUrlImpl(value); };
  66443. /**
  66444. * @param {?} value
  66445. * @return {?}
  66446. */
  66447. DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = /**
  66448. * @param {?} value
  66449. * @return {?}
  66450. */
  66451. function (value) {
  66452. return new SafeResourceUrlImpl(value);
  66453. };
  66454. DomSanitizerImpl.decorators = [
  66455. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  66456. ];
  66457. /** @nocollapse */
  66458. DomSanitizerImpl.ctorParameters = function () { return [
  66459. { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
  66460. ]; };
  66461. return DomSanitizerImpl;
  66462. }(DomSanitizer));
  66463. /**
  66464. * @abstract
  66465. */
  66466. var SafeValueImpl = /** @class */ (function () {
  66467. function SafeValueImpl(changingThisBreaksApplicationSecurity) {
  66468. // empty
  66469. this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
  66470. }
  66471. /**
  66472. * @return {?}
  66473. */
  66474. SafeValueImpl.prototype.toString = /**
  66475. * @return {?}
  66476. */
  66477. function () {
  66478. return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity +
  66479. " (see http://g.co/ng/security#xss)";
  66480. };
  66481. return SafeValueImpl;
  66482. }());
  66483. var SafeHtmlImpl = /** @class */ (function (_super) {
  66484. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeHtmlImpl, _super);
  66485. function SafeHtmlImpl() {
  66486. return _super !== null && _super.apply(this, arguments) || this;
  66487. }
  66488. /**
  66489. * @return {?}
  66490. */
  66491. SafeHtmlImpl.prototype.getTypeName = /**
  66492. * @return {?}
  66493. */
  66494. function () { return 'HTML'; };
  66495. return SafeHtmlImpl;
  66496. }(SafeValueImpl));
  66497. var SafeStyleImpl = /** @class */ (function (_super) {
  66498. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeStyleImpl, _super);
  66499. function SafeStyleImpl() {
  66500. return _super !== null && _super.apply(this, arguments) || this;
  66501. }
  66502. /**
  66503. * @return {?}
  66504. */
  66505. SafeStyleImpl.prototype.getTypeName = /**
  66506. * @return {?}
  66507. */
  66508. function () { return 'Style'; };
  66509. return SafeStyleImpl;
  66510. }(SafeValueImpl));
  66511. var SafeScriptImpl = /** @class */ (function (_super) {
  66512. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeScriptImpl, _super);
  66513. function SafeScriptImpl() {
  66514. return _super !== null && _super.apply(this, arguments) || this;
  66515. }
  66516. /**
  66517. * @return {?}
  66518. */
  66519. SafeScriptImpl.prototype.getTypeName = /**
  66520. * @return {?}
  66521. */
  66522. function () { return 'Script'; };
  66523. return SafeScriptImpl;
  66524. }(SafeValueImpl));
  66525. var SafeUrlImpl = /** @class */ (function (_super) {
  66526. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeUrlImpl, _super);
  66527. function SafeUrlImpl() {
  66528. return _super !== null && _super.apply(this, arguments) || this;
  66529. }
  66530. /**
  66531. * @return {?}
  66532. */
  66533. SafeUrlImpl.prototype.getTypeName = /**
  66534. * @return {?}
  66535. */
  66536. function () { return 'URL'; };
  66537. return SafeUrlImpl;
  66538. }(SafeValueImpl));
  66539. var SafeResourceUrlImpl = /** @class */ (function (_super) {
  66540. Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeResourceUrlImpl, _super);
  66541. function SafeResourceUrlImpl() {
  66542. return _super !== null && _super.apply(this, arguments) || this;
  66543. }
  66544. /**
  66545. * @return {?}
  66546. */
  66547. SafeResourceUrlImpl.prototype.getTypeName = /**
  66548. * @return {?}
  66549. */
  66550. function () { return 'ResourceURL'; };
  66551. return SafeResourceUrlImpl;
  66552. }(SafeValueImpl));
  66553. /**
  66554. * @fileoverview added by tsickle
  66555. * @suppress {checkTypes} checked by tsc
  66556. */
  66557. /**
  66558. * @license
  66559. * Copyright Google Inc. All Rights Reserved.
  66560. *
  66561. * Use of this source code is governed by an MIT-style license that can be
  66562. * found in the LICENSE file at https://angular.io/license
  66563. */
  66564. var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
  66565. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* PLATFORM_ID */], useValue: __WEBPACK_IMPORTED_MODULE_0__angular_common__["d" /* ɵPLATFORM_BROWSER_ID */] },
  66566. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* PLATFORM_INITIALIZER */], useValue: initDomAdapter, multi: true },
  66567. { provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["c" /* PlatformLocation */], useClass: BrowserPlatformLocation, deps: [DOCUMENT$1] },
  66568. { provide: DOCUMENT$1, useFactory: _document, deps: [] },
  66569. ];
  66570. /**
  66571. * \@security Replacing built-in sanitization providers exposes the application to XSS risks.
  66572. * Attacker-controlled data introduced by an unsanitized provider could expose your
  66573. * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
  66574. * \@experimental
  66575. */
  66576. var BROWSER_SANITIZATION_PROVIDERS = [
  66577. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["U" /* Sanitizer */], useExisting: DomSanitizer },
  66578. { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] },
  66579. ];
  66580. /**
  66581. * \@stable
  66582. */
  66583. var platformBrowser = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* createPlatformFactory */])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_9" /* platformCore */], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
  66584. /**
  66585. * @return {?}
  66586. */
  66587. function initDomAdapter() {
  66588. BrowserDomAdapter.makeCurrent();
  66589. BrowserGetTestability.init();
  66590. }
  66591. /**
  66592. * @return {?}
  66593. */
  66594. function errorHandler() {
  66595. return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* ErrorHandler */]();
  66596. }
  66597. /**
  66598. * @return {?}
  66599. */
  66600. function _document() {
  66601. return document;
  66602. }
  66603. /**
  66604. * The ng module for the browser.
  66605. *
  66606. * \@stable
  66607. */
  66608. var BrowserModule = /** @class */ (function () {
  66609. function BrowserModule(parentModule) {
  66610. if (parentModule) {
  66611. throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
  66612. }
  66613. }
  66614. /**
  66615. * Configures a browser-based application to transition from a server-rendered app, if
  66616. * one is present on the page. The specified parameters must include an application id,
  66617. * which must match between the client and server applications.
  66618. *
  66619. * @experimental
  66620. */
  66621. /**
  66622. * Configures a browser-based application to transition from a server-rendered app, if
  66623. * one is present on the page. The specified parameters must include an application id,
  66624. * which must match between the client and server applications.
  66625. *
  66626. * \@experimental
  66627. * @param {?} params
  66628. * @return {?}
  66629. */
  66630. BrowserModule.withServerTransition = /**
  66631. * Configures a browser-based application to transition from a server-rendered app, if
  66632. * one is present on the page. The specified parameters must include an application id,
  66633. * which must match between the client and server applications.
  66634. *
  66635. * \@experimental
  66636. * @param {?} params
  66637. * @return {?}
  66638. */
  66639. function (params) {
  66640. return {
  66641. ngModule: BrowserModule,
  66642. providers: [
  66643. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */], useValue: params.appId },
  66644. { provide: TRANSITION_ID, useExisting: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */] },
  66645. SERVER_TRANSITION_PROVIDERS,
  66646. ],
  66647. };
  66648. };
  66649. BrowserModule.decorators = [
  66650. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["F" /* NgModule */], args: [{
  66651. providers: [
  66652. BROWSER_SANITIZATION_PROVIDERS,
  66653. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* ErrorHandler */], useFactory: errorHandler, deps: [] },
  66654. { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
  66655. { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
  66656. { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
  66657. { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
  66658. DomRendererFactory2,
  66659. { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["S" /* RendererFactory2 */], useExisting: DomRendererFactory2 },
  66660. { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
  66661. DomSharedStylesHost,
  66662. __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* Testability */],
  66663. EventManager,
  66664. ELEMENT_PROBE_PROVIDERS,
  66665. Meta,
  66666. Title,
  66667. ],
  66668. exports: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["a" /* CommonModule */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* ApplicationModule */]]
  66669. },] },
  66670. ];
  66671. /** @nocollapse */
  66672. BrowserModule.ctorParameters = function () { return [
  66673. { type: BrowserModule, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* SkipSelf */] },] },
  66674. ]; };
  66675. return BrowserModule;
  66676. }());
  66677. /**
  66678. * @fileoverview added by tsickle
  66679. * @suppress {checkTypes} checked by tsc
  66680. */
  66681. /**
  66682. * @license
  66683. * Copyright Google Inc. All Rights Reserved.
  66684. *
  66685. * Use of this source code is governed by an MIT-style license that can be
  66686. * found in the LICENSE file at https://angular.io/license
  66687. */
  66688. var win = typeof window !== 'undefined' && window || /** @type {?} */ ({});
  66689. /**
  66690. * @fileoverview added by tsickle
  66691. * @suppress {checkTypes} checked by tsc
  66692. */
  66693. /**
  66694. * @license
  66695. * Copyright Google Inc. All Rights Reserved.
  66696. *
  66697. * Use of this source code is governed by an MIT-style license that can be
  66698. * found in the LICENSE file at https://angular.io/license
  66699. */
  66700. var ChangeDetectionPerfRecord = /** @class */ (function () {
  66701. function ChangeDetectionPerfRecord(msPerTick, numTicks) {
  66702. this.msPerTick = msPerTick;
  66703. this.numTicks = numTicks;
  66704. }
  66705. return ChangeDetectionPerfRecord;
  66706. }());
  66707. /**
  66708. * Entry point for all Angular profiling-related debug tools. This object
  66709. * corresponds to the `ng.profiler` in the dev console.
  66710. */
  66711. var AngularProfiler = /** @class */ (function () {
  66712. function AngularProfiler(ref) {
  66713. this.appRef = ref.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ApplicationRef */]);
  66714. }
  66715. // tslint:disable:no-console
  66716. /**
  66717. * Exercises change detection in a loop and then prints the average amount of
  66718. * time in milliseconds how long a single round of change detection takes for
  66719. * the current state of the UI. It runs a minimum of 5 rounds for a minimum
  66720. * of 500 milliseconds.
  66721. *
  66722. * Optionally, a user may pass a `config` parameter containing a map of
  66723. * options. Supported options are:
  66724. *
  66725. * `record` (boolean) - causes the profiler to record a CPU profile while
  66726. * it exercises the change detector. Example:
  66727. *
  66728. * ```
  66729. * ng.profiler.timeChangeDetection({record: true})
  66730. * ```
  66731. */
  66732. /**
  66733. * Exercises change detection in a loop and then prints the average amount of
  66734. * time in milliseconds how long a single round of change detection takes for
  66735. * the current state of the UI. It runs a minimum of 5 rounds for a minimum
  66736. * of 500 milliseconds.
  66737. *
  66738. * Optionally, a user may pass a `config` parameter containing a map of
  66739. * options. Supported options are:
  66740. *
  66741. * `record` (boolean) - causes the profiler to record a CPU profile while
  66742. * it exercises the change detector. Example:
  66743. *
  66744. * ```
  66745. * ng.profiler.timeChangeDetection({record: true})
  66746. * ```
  66747. * @param {?} config
  66748. * @return {?}
  66749. */
  66750. AngularProfiler.prototype.timeChangeDetection = /**
  66751. * Exercises change detection in a loop and then prints the average amount of
  66752. * time in milliseconds how long a single round of change detection takes for
  66753. * the current state of the UI. It runs a minimum of 5 rounds for a minimum
  66754. * of 500 milliseconds.
  66755. *
  66756. * Optionally, a user may pass a `config` parameter containing a map of
  66757. * options. Supported options are:
  66758. *
  66759. * `record` (boolean) - causes the profiler to record a CPU profile while
  66760. * it exercises the change detector. Example:
  66761. *
  66762. * ```
  66763. * ng.profiler.timeChangeDetection({record: true})
  66764. * ```
  66765. * @param {?} config
  66766. * @return {?}
  66767. */
  66768. function (config) {
  66769. var /** @type {?} */ record = config && config['record'];
  66770. var /** @type {?} */ profileName = 'Change Detection';
  66771. // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
  66772. var /** @type {?} */ isProfilerAvailable = win.console.profile != null;
  66773. if (record && isProfilerAvailable) {
  66774. win.console.profile(profileName);
  66775. }
  66776. var /** @type {?} */ start = getDOM().performanceNow();
  66777. var /** @type {?} */ numTicks = 0;
  66778. while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
  66779. this.appRef.tick();
  66780. numTicks++;
  66781. }
  66782. var /** @type {?} */ end = getDOM().performanceNow();
  66783. if (record && isProfilerAvailable) {
  66784. // need to cast to <any> because type checker thinks there's no argument
  66785. // while in fact there is:
  66786. //
  66787. // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
  66788. (/** @type {?} */ (win.console.profileEnd))(profileName);
  66789. }
  66790. var /** @type {?} */ msPerTick = (end - start) / numTicks;
  66791. win.console.log("ran " + numTicks + " change detection cycles");
  66792. win.console.log(msPerTick.toFixed(2) + " ms per check");
  66793. return new ChangeDetectionPerfRecord(msPerTick, numTicks);
  66794. };
  66795. return AngularProfiler;
  66796. }());
  66797. /**
  66798. * @fileoverview added by tsickle
  66799. * @suppress {checkTypes} checked by tsc
  66800. */
  66801. /**
  66802. * @license
  66803. * Copyright Google Inc. All Rights Reserved.
  66804. *
  66805. * Use of this source code is governed by an MIT-style license that can be
  66806. * found in the LICENSE file at https://angular.io/license
  66807. */
  66808. var PROFILER_GLOBAL_NAME = 'profiler';
  66809. /**
  66810. * Enabled Angular debug tools that are accessible via your browser's
  66811. * developer console.
  66812. *
  66813. * Usage:
  66814. *
  66815. * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
  66816. * 1. Type `ng.` (usually the console will show auto-complete suggestion)
  66817. * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
  66818. * then hit Enter.
  66819. *
  66820. * \@experimental All debugging apis are currently experimental.
  66821. * @template T
  66822. * @param {?} ref
  66823. * @return {?}
  66824. */
  66825. function enableDebugTools(ref) {
  66826. exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
  66827. return ref;
  66828. }
  66829. /**
  66830. * Disables Angular tools.
  66831. *
  66832. * \@experimental All debugging apis are currently experimental.
  66833. * @return {?}
  66834. */
  66835. function disableDebugTools() {
  66836. exportNgVar(PROFILER_GLOBAL_NAME, null);
  66837. }
  66838. /**
  66839. * @fileoverview added by tsickle
  66840. * @suppress {checkTypes} checked by tsc
  66841. */
  66842. /**
  66843. * @license
  66844. * Copyright Google Inc. All Rights Reserved.
  66845. *
  66846. * Use of this source code is governed by an MIT-style license that can be
  66847. * found in the LICENSE file at https://angular.io/license
  66848. */
  66849. /**
  66850. * @param {?} text
  66851. * @return {?}
  66852. */
  66853. function escapeHtml(text) {
  66854. var /** @type {?} */ escapedText = {
  66855. '&': '&a;',
  66856. '"': '&q;',
  66857. '\'': '&s;',
  66858. '<': '&l;',
  66859. '>': '&g;',
  66860. };
  66861. return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
  66862. }
  66863. /**
  66864. * @param {?} text
  66865. * @return {?}
  66866. */
  66867. function unescapeHtml(text) {
  66868. var /** @type {?} */ unescapedText = {
  66869. '&a;': '&',
  66870. '&q;': '"',
  66871. '&s;': '\'',
  66872. '&l;': '<',
  66873. '&g;': '>',
  66874. };
  66875. return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
  66876. }
  66877. /**
  66878. * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
  66879. *
  66880. * Example:
  66881. *
  66882. * ```
  66883. * const COUNTER_KEY = makeStateKey<number>('counter');
  66884. * let value = 10;
  66885. *
  66886. * transferState.set(COUNTER_KEY, value);
  66887. * ```
  66888. *
  66889. * \@experimental
  66890. * @template T
  66891. * @param {?} key
  66892. * @return {?}
  66893. */
  66894. function makeStateKey(key) {
  66895. return /** @type {?} */ (key);
  66896. }
  66897. /**
  66898. * A key value store that is transferred from the application on the server side to the application
  66899. * on the client side.
  66900. *
  66901. * `TransferState` will be available as an injectable token. To use it import
  66902. * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
  66903. *
  66904. * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
  66905. * boolean, number, string, null and non-class objects will be serialized and deserialzied in a
  66906. * non-lossy manner.
  66907. *
  66908. * \@experimental
  66909. */
  66910. var TransferState = /** @class */ (function () {
  66911. function TransferState() {
  66912. this.store = {};
  66913. this.onSerializeCallbacks = {};
  66914. }
  66915. /** @internal */
  66916. /**
  66917. * \@internal
  66918. * @param {?} initState
  66919. * @return {?}
  66920. */
  66921. TransferState.init = /**
  66922. * \@internal
  66923. * @param {?} initState
  66924. * @return {?}
  66925. */
  66926. function (initState) {
  66927. var /** @type {?} */ transferState = new TransferState();
  66928. transferState.store = initState;
  66929. return transferState;
  66930. };
  66931. /**
  66932. * Get the value corresponding to a key. Return `defaultValue` if key is not found.
  66933. */
  66934. /**
  66935. * Get the value corresponding to a key. Return `defaultValue` if key is not found.
  66936. * @template T
  66937. * @param {?} key
  66938. * @param {?} defaultValue
  66939. * @return {?}
  66940. */
  66941. TransferState.prototype.get = /**
  66942. * Get the value corresponding to a key. Return `defaultValue` if key is not found.
  66943. * @template T
  66944. * @param {?} key
  66945. * @param {?} defaultValue
  66946. * @return {?}
  66947. */
  66948. function (key, defaultValue) {
  66949. return this.store[key] !== undefined ? /** @type {?} */ (this.store[key]) : defaultValue;
  66950. };
  66951. /**
  66952. * Set the value corresponding to a key.
  66953. */
  66954. /**
  66955. * Set the value corresponding to a key.
  66956. * @template T
  66957. * @param {?} key
  66958. * @param {?} value
  66959. * @return {?}
  66960. */
  66961. TransferState.prototype.set = /**
  66962. * Set the value corresponding to a key.
  66963. * @template T
  66964. * @param {?} key
  66965. * @param {?} value
  66966. * @return {?}
  66967. */
  66968. function (key, value) { this.store[key] = value; };
  66969. /**
  66970. * Remove a key from the store.
  66971. */
  66972. /**
  66973. * Remove a key from the store.
  66974. * @template T
  66975. * @param {?} key
  66976. * @return {?}
  66977. */
  66978. TransferState.prototype.remove = /**
  66979. * Remove a key from the store.
  66980. * @template T
  66981. * @param {?} key
  66982. * @return {?}
  66983. */
  66984. function (key) { delete this.store[key]; };
  66985. /**
  66986. * Test whether a key exists in the store.
  66987. */
  66988. /**
  66989. * Test whether a key exists in the store.
  66990. * @template T
  66991. * @param {?} key
  66992. * @return {?}
  66993. */
  66994. TransferState.prototype.hasKey = /**
  66995. * Test whether a key exists in the store.
  66996. * @template T
  66997. * @param {?} key
  66998. * @return {?}
  66999. */
  67000. function (key) { return this.store.hasOwnProperty(key); };
  67001. /**
  67002. * Register a callback to provide the value for a key when `toJson` is called.
  67003. */
  67004. /**
  67005. * Register a callback to provide the value for a key when `toJson` is called.
  67006. * @template T
  67007. * @param {?} key
  67008. * @param {?} callback
  67009. * @return {?}
  67010. */
  67011. TransferState.prototype.onSerialize = /**
  67012. * Register a callback to provide the value for a key when `toJson` is called.
  67013. * @template T
  67014. * @param {?} key
  67015. * @param {?} callback
  67016. * @return {?}
  67017. */
  67018. function (key, callback) {
  67019. this.onSerializeCallbacks[key] = callback;
  67020. };
  67021. /**
  67022. * Serialize the current state of the store to JSON.
  67023. */
  67024. /**
  67025. * Serialize the current state of the store to JSON.
  67026. * @return {?}
  67027. */
  67028. TransferState.prototype.toJson = /**
  67029. * Serialize the current state of the store to JSON.
  67030. * @return {?}
  67031. */
  67032. function () {
  67033. // Call the onSerialize callbacks and put those values into the store.
  67034. for (var /** @type {?} */ key in this.onSerializeCallbacks) {
  67035. if (this.onSerializeCallbacks.hasOwnProperty(key)) {
  67036. try {
  67037. this.store[key] = this.onSerializeCallbacks[key]();
  67038. }
  67039. catch (/** @type {?} */ e) {
  67040. console.warn('Exception in onSerialize callback: ', e);
  67041. }
  67042. }
  67043. }
  67044. return JSON.stringify(this.store);
  67045. };
  67046. TransferState.decorators = [
  67047. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
  67048. ];
  67049. /** @nocollapse */
  67050. TransferState.ctorParameters = function () { return []; };
  67051. return TransferState;
  67052. }());
  67053. /**
  67054. * @param {?} doc
  67055. * @param {?} appId
  67056. * @return {?}
  67057. */
  67058. function initTransferState(doc, appId) {
  67059. // Locate the script tag with the JSON data transferred from the server.
  67060. // The id of the script tag is set to the Angular appId + 'state'.
  67061. var /** @type {?} */ script = doc.getElementById(appId + '-state');
  67062. var /** @type {?} */ initialState = {};
  67063. if (script && script.textContent) {
  67064. try {
  67065. initialState = JSON.parse(unescapeHtml(script.textContent));
  67066. }
  67067. catch (/** @type {?} */ e) {
  67068. console.warn('Exception while restoring TransferState for app ' + appId, e);
  67069. }
  67070. }
  67071. return TransferState.init(initialState);
  67072. }
  67073. /**
  67074. * NgModule to install on the client side while using the `TransferState` to transfer state from
  67075. * server to client.
  67076. *
  67077. * \@experimental
  67078. */
  67079. var BrowserTransferStateModule = /** @class */ (function () {
  67080. function BrowserTransferStateModule() {
  67081. }
  67082. BrowserTransferStateModule.decorators = [
  67083. { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["F" /* NgModule */], args: [{
  67084. providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */]] }],
  67085. },] },
  67086. ];
  67087. /** @nocollapse */
  67088. BrowserTransferStateModule.ctorParameters = function () { return []; };
  67089. return BrowserTransferStateModule;
  67090. }());
  67091. /**
  67092. * @fileoverview added by tsickle
  67093. * @suppress {checkTypes} checked by tsc
  67094. */
  67095. /**
  67096. * @license
  67097. * Copyright Google Inc. All Rights Reserved.
  67098. *
  67099. * Use of this source code is governed by an MIT-style license that can be
  67100. * found in the LICENSE file at https://angular.io/license
  67101. */
  67102. /**
  67103. * Predicates for use with {\@link DebugElement}'s query functions.
  67104. *
  67105. * \@experimental All debugging apis are currently experimental.
  67106. */
  67107. var By = /** @class */ (function () {
  67108. function By() {
  67109. }
  67110. /**
  67111. * Match all elements.
  67112. *
  67113. * ## Example
  67114. *
  67115. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
  67116. */
  67117. /**
  67118. * Match all elements.
  67119. *
  67120. * ## Example
  67121. *
  67122. * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
  67123. * @return {?}
  67124. */
  67125. By.all = /**
  67126. * Match all elements.
  67127. *
  67128. * ## Example
  67129. *
  67130. * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
  67131. * @return {?}
  67132. */
  67133. function () { return function (debugElement) { return true; }; };
  67134. /**
  67135. * Match elements by the given CSS selector.
  67136. *
  67137. * ## Example
  67138. *
  67139. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
  67140. */
  67141. /**
  67142. * Match elements by the given CSS selector.
  67143. *
  67144. * ## Example
  67145. *
  67146. * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
  67147. * @param {?} selector
  67148. * @return {?}
  67149. */
  67150. By.css = /**
  67151. * Match elements by the given CSS selector.
  67152. *
  67153. * ## Example
  67154. *
  67155. * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
  67156. * @param {?} selector
  67157. * @return {?}
  67158. */
  67159. function (selector) {
  67160. return function (debugElement) {
  67161. return debugElement.nativeElement != null ?
  67162. getDOM().elementMatches(debugElement.nativeElement, selector) :
  67163. false;
  67164. };
  67165. };
  67166. /**
  67167. * Match elements that have the given directive present.
  67168. *
  67169. * ## Example
  67170. *
  67171. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
  67172. */
  67173. /**
  67174. * Match elements that have the given directive present.
  67175. *
  67176. * ## Example
  67177. *
  67178. * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
  67179. * @param {?} type
  67180. * @return {?}
  67181. */
  67182. By.directive = /**
  67183. * Match elements that have the given directive present.
  67184. *
  67185. * ## Example
  67186. *
  67187. * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
  67188. * @param {?} type
  67189. * @return {?}
  67190. */
  67191. function (type) {
  67192. return function (debugElement) { return ((debugElement.providerTokens)).indexOf(type) !== -1; };
  67193. };
  67194. return By;
  67195. }());
  67196. /**
  67197. * @fileoverview added by tsickle
  67198. * @suppress {checkTypes} checked by tsc
  67199. */
  67200. /**
  67201. * @license
  67202. * Copyright Google Inc. All Rights Reserved.
  67203. *
  67204. * Use of this source code is governed by an MIT-style license that can be
  67205. * found in the LICENSE file at https://angular.io/license
  67206. */
  67207. /**
  67208. * @fileoverview added by tsickle
  67209. * @suppress {checkTypes} checked by tsc
  67210. */
  67211. /**
  67212. * @license
  67213. * Copyright Google Inc. All Rights Reserved.
  67214. *
  67215. * Use of this source code is governed by an MIT-style license that can be
  67216. * found in the LICENSE file at https://angular.io/license
  67217. */
  67218. /**
  67219. * \@stable
  67220. */
  67221. var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Version */]('5.2.9');
  67222. /**
  67223. * @fileoverview added by tsickle
  67224. * @suppress {checkTypes} checked by tsc
  67225. */
  67226. /**
  67227. * @license
  67228. * Copyright Google Inc. All Rights Reserved.
  67229. *
  67230. * Use of this source code is governed by an MIT-style license that can be
  67231. * found in the LICENSE file at https://angular.io/license
  67232. */
  67233. /**
  67234. * @fileoverview added by tsickle
  67235. * @suppress {checkTypes} checked by tsc
  67236. */
  67237. /**
  67238. * @license
  67239. * Copyright Google Inc. All Rights Reserved.
  67240. *
  67241. * Use of this source code is governed by an MIT-style license that can be
  67242. * found in the LICENSE file at https://angular.io/license
  67243. */
  67244. /**
  67245. * @module
  67246. * @description
  67247. * Entry point for all public APIs of this package.
  67248. */
  67249. // This file only reexports content of the `src` folder. Keep it that way.
  67250. /**
  67251. * @fileoverview added by tsickle
  67252. * @suppress {checkTypes} checked by tsc
  67253. */
  67254. /**
  67255. * Generated bundle index. Do not edit.
  67256. */
  67257. //# sourceMappingURL=platform-browser.js.map
  67258. /***/ }),
  67259. /***/ "./node_modules/rxjs/_esm5/InnerSubscriber.js":
  67260. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67261. "use strict";
  67262. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InnerSubscriber; });
  67263. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
  67264. /** PURE_IMPORTS_START ._Subscriber PURE_IMPORTS_END */
  67265. var __extends = (this && this.__extends) || function (d, b) {
  67266. for (var p in b)
  67267. if (b.hasOwnProperty(p))
  67268. d[p] = b[p];
  67269. function __() { this.constructor = d; }
  67270. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  67271. };
  67272. /**
  67273. * We need this JSDoc comment for affecting ESDoc.
  67274. * @ignore
  67275. * @extends {Ignored}
  67276. */
  67277. var InnerSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67278. __extends(InnerSubscriber, _super);
  67279. function InnerSubscriber(parent, outerValue, outerIndex) {
  67280. _super.call(this);
  67281. this.parent = parent;
  67282. this.outerValue = outerValue;
  67283. this.outerIndex = outerIndex;
  67284. this.index = 0;
  67285. }
  67286. InnerSubscriber.prototype._next = function (value) {
  67287. this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
  67288. };
  67289. InnerSubscriber.prototype._error = function (error) {
  67290. this.parent.notifyError(error, this);
  67291. this.unsubscribe();
  67292. };
  67293. InnerSubscriber.prototype._complete = function () {
  67294. this.parent.notifyComplete(this);
  67295. this.unsubscribe();
  67296. };
  67297. return InnerSubscriber;
  67298. }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]));
  67299. //# sourceMappingURL=InnerSubscriber.js.map
  67300. /***/ }),
  67301. /***/ "./node_modules/rxjs/_esm5/Observable.js":
  67302. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67303. "use strict";
  67304. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observable; });
  67305. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
  67306. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/util/toSubscriber.js");
  67307. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__symbol_observable__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/observable.js");
  67308. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__("./node_modules/rxjs/_esm5/util/pipe.js");
  67309. /** PURE_IMPORTS_START ._util_root,._util_toSubscriber,._symbol_observable,._util_pipe PURE_IMPORTS_END */
  67310. /**
  67311. * A representation of any set of values over any amount of time. This is the most basic building block
  67312. * of RxJS.
  67313. *
  67314. * @class Observable<T>
  67315. */
  67316. var Observable = /*@__PURE__*/ (/*@__PURE__*/ function () {
  67317. /**
  67318. * @constructor
  67319. * @param {Function} subscribe the function that is called when the Observable is
  67320. * initially subscribed to. This function is given a Subscriber, to which new values
  67321. * can be `next`ed, or an `error` method can be called to raise an error, or
  67322. * `complete` can be called to notify of a successful completion.
  67323. */
  67324. function Observable(subscribe) {
  67325. this._isScalar = false;
  67326. if (subscribe) {
  67327. this._subscribe = subscribe;
  67328. }
  67329. }
  67330. /**
  67331. * Creates a new Observable, with this Observable as the source, and the passed
  67332. * operator defined as the new observable's operator.
  67333. * @method lift
  67334. * @param {Operator} operator the operator defining the operation to take on the observable
  67335. * @return {Observable} a new observable with the Operator applied
  67336. */
  67337. Observable.prototype.lift = function (operator) {
  67338. var observable = new Observable();
  67339. observable.source = this;
  67340. observable.operator = operator;
  67341. return observable;
  67342. };
  67343. /**
  67344. * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
  67345. *
  67346. * <span class="informal">Use it when you have all these Observables, but still nothing is happening.</span>
  67347. *
  67348. * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It
  67349. * might be for example a function that you passed to a {@link create} static factory, but most of the time it is
  67350. * a library implementation, which defines what and when will be emitted by an Observable. This means that calling
  67351. * `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often
  67352. * thought.
  67353. *
  67354. * Apart from starting the execution of an Observable, this method allows you to listen for values
  67355. * that an Observable emits, as well as for when it completes or errors. You can achieve this in two
  67356. * following ways.
  67357. *
  67358. * The first way is creating an object that implements {@link Observer} interface. It should have methods
  67359. * defined by that interface, but note that it should be just a regular JavaScript object, which you can create
  67360. * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do
  67361. * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also
  67362. * that your object does not have to implement all methods. If you find yourself creating a method that doesn't
  67363. * do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will
  67364. * be left uncaught.
  67365. *
  67366. * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.
  67367. * This means you can provide three functions as arguments to `subscribe`, where first function is equivalent
  67368. * of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer,
  67369. * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`,
  67370. * since `subscribe` recognizes these functions by where they were placed in function call. When it comes
  67371. * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown.
  67372. *
  67373. * Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object.
  67374. * This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean
  67375. * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback
  67376. * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.
  67377. *
  67378. * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.
  67379. * It is an Observable itself that decides when these functions will be called. For example {@link of}
  67380. * by default emits all its values synchronously. Always check documentation for how given Observable
  67381. * will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}.
  67382. *
  67383. * @example <caption>Subscribe with an Observer</caption>
  67384. * const sumObserver = {
  67385. * sum: 0,
  67386. * next(value) {
  67387. * console.log('Adding: ' + value);
  67388. * this.sum = this.sum + value;
  67389. * },
  67390. * error() { // We actually could just remove this method,
  67391. * }, // since we do not really care about errors right now.
  67392. * complete() {
  67393. * console.log('Sum equals: ' + this.sum);
  67394. * }
  67395. * };
  67396. *
  67397. * Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.
  67398. * .subscribe(sumObserver);
  67399. *
  67400. * // Logs:
  67401. * // "Adding: 1"
  67402. * // "Adding: 2"
  67403. * // "Adding: 3"
  67404. * // "Sum equals: 6"
  67405. *
  67406. *
  67407. * @example <caption>Subscribe with functions</caption>
  67408. * let sum = 0;
  67409. *
  67410. * Rx.Observable.of(1, 2, 3)
  67411. * .subscribe(
  67412. * function(value) {
  67413. * console.log('Adding: ' + value);
  67414. * sum = sum + value;
  67415. * },
  67416. * undefined,
  67417. * function() {
  67418. * console.log('Sum equals: ' + sum);
  67419. * }
  67420. * );
  67421. *
  67422. * // Logs:
  67423. * // "Adding: 1"
  67424. * // "Adding: 2"
  67425. * // "Adding: 3"
  67426. * // "Sum equals: 6"
  67427. *
  67428. *
  67429. * @example <caption>Cancel a subscription</caption>
  67430. * const subscription = Rx.Observable.interval(1000).subscribe(
  67431. * num => console.log(num),
  67432. * undefined,
  67433. * () => console.log('completed!') // Will not be called, even
  67434. * ); // when cancelling subscription
  67435. *
  67436. *
  67437. * setTimeout(() => {
  67438. * subscription.unsubscribe();
  67439. * console.log('unsubscribed!');
  67440. * }, 2500);
  67441. *
  67442. * // Logs:
  67443. * // 0 after 1s
  67444. * // 1 after 2s
  67445. * // "unsubscribed!" after 2.5s
  67446. *
  67447. *
  67448. * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,
  67449. * or the first of three possible handlers, which is the handler for each value emitted from the subscribed
  67450. * Observable.
  67451. * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,
  67452. * the error will be thrown as unhandled.
  67453. * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.
  67454. * @return {ISubscription} a subscription reference to the registered handlers
  67455. * @method subscribe
  67456. */
  67457. Observable.prototype.subscribe = function (observerOrNext, error, complete) {
  67458. var operator = this.operator;
  67459. var sink = Object(__WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__["a" /* toSubscriber */])(observerOrNext, error, complete);
  67460. if (operator) {
  67461. operator.call(sink, this.source);
  67462. }
  67463. else {
  67464. sink.add(this.source || !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink));
  67465. }
  67466. if (sink.syncErrorThrowable) {
  67467. sink.syncErrorThrowable = false;
  67468. if (sink.syncErrorThrown) {
  67469. throw sink.syncErrorValue;
  67470. }
  67471. }
  67472. return sink;
  67473. };
  67474. Observable.prototype._trySubscribe = function (sink) {
  67475. try {
  67476. return this._subscribe(sink);
  67477. }
  67478. catch (err) {
  67479. sink.syncErrorThrown = true;
  67480. sink.syncErrorValue = err;
  67481. sink.error(err);
  67482. }
  67483. };
  67484. /**
  67485. * @method forEach
  67486. * @param {Function} next a handler for each value emitted by the observable
  67487. * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise
  67488. * @return {Promise} a promise that either resolves on observable completion or
  67489. * rejects with the handled error
  67490. */
  67491. Observable.prototype.forEach = function (next, PromiseCtor) {
  67492. var _this = this;
  67493. if (!PromiseCtor) {
  67494. if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise) {
  67495. PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise;
  67496. }
  67497. else if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise) {
  67498. PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise;
  67499. }
  67500. }
  67501. if (!PromiseCtor) {
  67502. throw new Error('no Promise impl found');
  67503. }
  67504. return new PromiseCtor(function (resolve, reject) {
  67505. // Must be declared in a separate statement to avoid a RefernceError when
  67506. // accessing subscription below in the closure due to Temporal Dead Zone.
  67507. var subscription;
  67508. subscription = _this.subscribe(function (value) {
  67509. if (subscription) {
  67510. // if there is a subscription, then we can surmise
  67511. // the next handling is asynchronous. Any errors thrown
  67512. // need to be rejected explicitly and unsubscribe must be
  67513. // called manually
  67514. try {
  67515. next(value);
  67516. }
  67517. catch (err) {
  67518. reject(err);
  67519. subscription.unsubscribe();
  67520. }
  67521. }
  67522. else {
  67523. // if there is NO subscription, then we're getting a nexted
  67524. // value synchronously during subscription. We can just call it.
  67525. // If it errors, Observable's `subscribe` will ensure the
  67526. // unsubscription logic is called, then synchronously rethrow the error.
  67527. // After that, Promise will trap the error and send it
  67528. // down the rejection path.
  67529. next(value);
  67530. }
  67531. }, reject, resolve);
  67532. });
  67533. };
  67534. Observable.prototype._subscribe = function (subscriber) {
  67535. return this.source.subscribe(subscriber);
  67536. };
  67537. /**
  67538. * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable
  67539. * @method Symbol.observable
  67540. * @return {Observable} this instance of the observable
  67541. */
  67542. Observable.prototype[__WEBPACK_IMPORTED_MODULE_2__symbol_observable__["a" /* observable */]] = function () {
  67543. return this;
  67544. };
  67545. /* tslint:enable:max-line-length */
  67546. /**
  67547. * Used to stitch together functional operators into a chain.
  67548. * @method pipe
  67549. * @return {Observable} the Observable result of all of the operators having
  67550. * been called in the order they were passed in.
  67551. *
  67552. * @example
  67553. *
  67554. * import { map, filter, scan } from 'rxjs/operators';
  67555. *
  67556. * Rx.Observable.interval(1000)
  67557. * .pipe(
  67558. * filter(x => x % 2 === 0),
  67559. * map(x => x + x),
  67560. * scan((acc, x) => acc + x)
  67561. * )
  67562. * .subscribe(x => console.log(x))
  67563. */
  67564. Observable.prototype.pipe = function () {
  67565. var operations = [];
  67566. for (var _i = 0; _i < arguments.length; _i++) {
  67567. operations[_i - 0] = arguments[_i];
  67568. }
  67569. if (operations.length === 0) {
  67570. return this;
  67571. }
  67572. return Object(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["a" /* pipeFromArray */])(operations)(this);
  67573. };
  67574. /* tslint:enable:max-line-length */
  67575. Observable.prototype.toPromise = function (PromiseCtor) {
  67576. var _this = this;
  67577. if (!PromiseCtor) {
  67578. if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise) {
  67579. PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise;
  67580. }
  67581. else if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise) {
  67582. PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise;
  67583. }
  67584. }
  67585. if (!PromiseCtor) {
  67586. throw new Error('no Promise impl found');
  67587. }
  67588. return new PromiseCtor(function (resolve, reject) {
  67589. var value;
  67590. _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
  67591. });
  67592. };
  67593. // HACK: Since TypeScript inherits static properties too, we have to
  67594. // fight against TypeScript here so Subject can have a different static create signature
  67595. /**
  67596. * Creates a new cold Observable by calling the Observable constructor
  67597. * @static true
  67598. * @owner Observable
  67599. * @method create
  67600. * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
  67601. * @return {Observable} a new cold observable
  67602. */
  67603. Observable.create = function (subscribe) {
  67604. return new Observable(subscribe);
  67605. };
  67606. return Observable;
  67607. }());
  67608. //# sourceMappingURL=Observable.js.map
  67609. /***/ }),
  67610. /***/ "./node_modules/rxjs/_esm5/Observer.js":
  67611. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67612. "use strict";
  67613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return empty; });
  67614. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  67615. var empty = {
  67616. closed: true,
  67617. next: function (value) { },
  67618. error: function (err) { throw err; },
  67619. complete: function () { }
  67620. };
  67621. //# sourceMappingURL=Observer.js.map
  67622. /***/ }),
  67623. /***/ "./node_modules/rxjs/_esm5/OuterSubscriber.js":
  67624. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67625. "use strict";
  67626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OuterSubscriber; });
  67627. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
  67628. /** PURE_IMPORTS_START ._Subscriber PURE_IMPORTS_END */
  67629. var __extends = (this && this.__extends) || function (d, b) {
  67630. for (var p in b)
  67631. if (b.hasOwnProperty(p))
  67632. d[p] = b[p];
  67633. function __() { this.constructor = d; }
  67634. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  67635. };
  67636. /**
  67637. * We need this JSDoc comment for affecting ESDoc.
  67638. * @ignore
  67639. * @extends {Ignored}
  67640. */
  67641. var OuterSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67642. __extends(OuterSubscriber, _super);
  67643. function OuterSubscriber() {
  67644. _super.apply(this, arguments);
  67645. }
  67646. OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  67647. this.destination.next(innerValue);
  67648. };
  67649. OuterSubscriber.prototype.notifyError = function (error, innerSub) {
  67650. this.destination.error(error);
  67651. };
  67652. OuterSubscriber.prototype.notifyComplete = function (innerSub) {
  67653. this.destination.complete();
  67654. };
  67655. return OuterSubscriber;
  67656. }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]));
  67657. //# sourceMappingURL=OuterSubscriber.js.map
  67658. /***/ }),
  67659. /***/ "./node_modules/rxjs/_esm5/Subject.js":
  67660. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67661. "use strict";
  67662. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SubjectSubscriber; });
  67663. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subject; });
  67664. /* unused harmony export AnonymousSubject */
  67665. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  67666. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
  67667. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
  67668. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__ = __webpack_require__("./node_modules/rxjs/_esm5/util/ObjectUnsubscribedError.js");
  67669. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SubjectSubscription__ = __webpack_require__("./node_modules/rxjs/_esm5/SubjectSubscription.js");
  67670. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_rxSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/rxSubscriber.js");
  67671. /** PURE_IMPORTS_START ._Observable,._Subscriber,._Subscription,._util_ObjectUnsubscribedError,._SubjectSubscription,._symbol_rxSubscriber PURE_IMPORTS_END */
  67672. var __extends = (this && this.__extends) || function (d, b) {
  67673. for (var p in b)
  67674. if (b.hasOwnProperty(p))
  67675. d[p] = b[p];
  67676. function __() { this.constructor = d; }
  67677. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  67678. };
  67679. /**
  67680. * @class SubjectSubscriber<T>
  67681. */
  67682. var SubjectSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67683. __extends(SubjectSubscriber, _super);
  67684. function SubjectSubscriber(destination) {
  67685. _super.call(this, destination);
  67686. this.destination = destination;
  67687. }
  67688. return SubjectSubscriber;
  67689. }(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* Subscriber */]));
  67690. /**
  67691. * @class Subject<T>
  67692. */
  67693. var Subject = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67694. __extends(Subject, _super);
  67695. function Subject() {
  67696. _super.call(this);
  67697. this.observers = [];
  67698. this.closed = false;
  67699. this.isStopped = false;
  67700. this.hasError = false;
  67701. this.thrownError = null;
  67702. }
  67703. Subject.prototype[__WEBPACK_IMPORTED_MODULE_5__symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () {
  67704. return new SubjectSubscriber(this);
  67705. };
  67706. Subject.prototype.lift = function (operator) {
  67707. var subject = new AnonymousSubject(this, this);
  67708. subject.operator = operator;
  67709. return subject;
  67710. };
  67711. Subject.prototype.next = function (value) {
  67712. if (this.closed) {
  67713. throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
  67714. }
  67715. if (!this.isStopped) {
  67716. var observers = this.observers;
  67717. var len = observers.length;
  67718. var copy = observers.slice();
  67719. for (var i = 0; i < len; i++) {
  67720. copy[i].next(value);
  67721. }
  67722. }
  67723. };
  67724. Subject.prototype.error = function (err) {
  67725. if (this.closed) {
  67726. throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
  67727. }
  67728. this.hasError = true;
  67729. this.thrownError = err;
  67730. this.isStopped = true;
  67731. var observers = this.observers;
  67732. var len = observers.length;
  67733. var copy = observers.slice();
  67734. for (var i = 0; i < len; i++) {
  67735. copy[i].error(err);
  67736. }
  67737. this.observers.length = 0;
  67738. };
  67739. Subject.prototype.complete = function () {
  67740. if (this.closed) {
  67741. throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
  67742. }
  67743. this.isStopped = true;
  67744. var observers = this.observers;
  67745. var len = observers.length;
  67746. var copy = observers.slice();
  67747. for (var i = 0; i < len; i++) {
  67748. copy[i].complete();
  67749. }
  67750. this.observers.length = 0;
  67751. };
  67752. Subject.prototype.unsubscribe = function () {
  67753. this.isStopped = true;
  67754. this.closed = true;
  67755. this.observers = null;
  67756. };
  67757. Subject.prototype._trySubscribe = function (subscriber) {
  67758. if (this.closed) {
  67759. throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
  67760. }
  67761. else {
  67762. return _super.prototype._trySubscribe.call(this, subscriber);
  67763. }
  67764. };
  67765. Subject.prototype._subscribe = function (subscriber) {
  67766. if (this.closed) {
  67767. throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
  67768. }
  67769. else if (this.hasError) {
  67770. subscriber.error(this.thrownError);
  67771. return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY;
  67772. }
  67773. else if (this.isStopped) {
  67774. subscriber.complete();
  67775. return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY;
  67776. }
  67777. else {
  67778. this.observers.push(subscriber);
  67779. return new __WEBPACK_IMPORTED_MODULE_4__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber);
  67780. }
  67781. };
  67782. Subject.prototype.asObservable = function () {
  67783. var observable = new __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]();
  67784. observable.source = this;
  67785. return observable;
  67786. };
  67787. Subject.create = function (destination, source) {
  67788. return new AnonymousSubject(destination, source);
  67789. };
  67790. return Subject;
  67791. }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
  67792. /**
  67793. * @class AnonymousSubject<T>
  67794. */
  67795. var AnonymousSubject = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67796. __extends(AnonymousSubject, _super);
  67797. function AnonymousSubject(destination, source) {
  67798. _super.call(this);
  67799. this.destination = destination;
  67800. this.source = source;
  67801. }
  67802. AnonymousSubject.prototype.next = function (value) {
  67803. var destination = this.destination;
  67804. if (destination && destination.next) {
  67805. destination.next(value);
  67806. }
  67807. };
  67808. AnonymousSubject.prototype.error = function (err) {
  67809. var destination = this.destination;
  67810. if (destination && destination.error) {
  67811. this.destination.error(err);
  67812. }
  67813. };
  67814. AnonymousSubject.prototype.complete = function () {
  67815. var destination = this.destination;
  67816. if (destination && destination.complete) {
  67817. this.destination.complete();
  67818. }
  67819. };
  67820. AnonymousSubject.prototype._subscribe = function (subscriber) {
  67821. var source = this.source;
  67822. if (source) {
  67823. return this.source.subscribe(subscriber);
  67824. }
  67825. else {
  67826. return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY;
  67827. }
  67828. };
  67829. return AnonymousSubject;
  67830. }(Subject));
  67831. //# sourceMappingURL=Subject.js.map
  67832. /***/ }),
  67833. /***/ "./node_modules/rxjs/_esm5/SubjectSubscription.js":
  67834. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67835. "use strict";
  67836. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SubjectSubscription; });
  67837. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
  67838. /** PURE_IMPORTS_START ._Subscription PURE_IMPORTS_END */
  67839. var __extends = (this && this.__extends) || function (d, b) {
  67840. for (var p in b)
  67841. if (b.hasOwnProperty(p))
  67842. d[p] = b[p];
  67843. function __() { this.constructor = d; }
  67844. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  67845. };
  67846. /**
  67847. * We need this JSDoc comment for affecting ESDoc.
  67848. * @ignore
  67849. * @extends {Ignored}
  67850. */
  67851. var SubjectSubscription = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67852. __extends(SubjectSubscription, _super);
  67853. function SubjectSubscription(subject, subscriber) {
  67854. _super.call(this);
  67855. this.subject = subject;
  67856. this.subscriber = subscriber;
  67857. this.closed = false;
  67858. }
  67859. SubjectSubscription.prototype.unsubscribe = function () {
  67860. if (this.closed) {
  67861. return;
  67862. }
  67863. this.closed = true;
  67864. var subject = this.subject;
  67865. var observers = subject.observers;
  67866. this.subject = null;
  67867. if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
  67868. return;
  67869. }
  67870. var subscriberIndex = observers.indexOf(this.subscriber);
  67871. if (subscriberIndex !== -1) {
  67872. observers.splice(subscriberIndex, 1);
  67873. }
  67874. };
  67875. return SubjectSubscription;
  67876. }(__WEBPACK_IMPORTED_MODULE_0__Subscription__["a" /* Subscription */]));
  67877. //# sourceMappingURL=SubjectSubscription.js.map
  67878. /***/ }),
  67879. /***/ "./node_modules/rxjs/_esm5/Subscriber.js":
  67880. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  67881. "use strict";
  67882. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscriber; });
  67883. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isFunction__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isFunction.js");
  67884. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
  67885. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__("./node_modules/rxjs/_esm5/Observer.js");
  67886. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__symbol_rxSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/rxSubscriber.js");
  67887. /** PURE_IMPORTS_START ._util_isFunction,._Subscription,._Observer,._symbol_rxSubscriber PURE_IMPORTS_END */
  67888. var __extends = (this && this.__extends) || function (d, b) {
  67889. for (var p in b)
  67890. if (b.hasOwnProperty(p))
  67891. d[p] = b[p];
  67892. function __() { this.constructor = d; }
  67893. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  67894. };
  67895. /**
  67896. * Implements the {@link Observer} interface and extends the
  67897. * {@link Subscription} class. While the {@link Observer} is the public API for
  67898. * consuming the values of an {@link Observable}, all Observers get converted to
  67899. * a Subscriber, in order to provide Subscription-like capabilities such as
  67900. * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
  67901. * implementing operators, but it is rarely used as a public API.
  67902. *
  67903. * @class Subscriber<T>
  67904. */
  67905. var Subscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  67906. __extends(Subscriber, _super);
  67907. /**
  67908. * @param {Observer|function(value: T): void} [destinationOrNext] A partially
  67909. * defined Observer or a `next` callback function.
  67910. * @param {function(e: ?any): void} [error] The `error` callback of an
  67911. * Observer.
  67912. * @param {function(): void} [complete] The `complete` callback of an
  67913. * Observer.
  67914. */
  67915. function Subscriber(destinationOrNext, error, complete) {
  67916. _super.call(this);
  67917. this.syncErrorValue = null;
  67918. this.syncErrorThrown = false;
  67919. this.syncErrorThrowable = false;
  67920. this.isStopped = false;
  67921. switch (arguments.length) {
  67922. case 0:
  67923. this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */];
  67924. break;
  67925. case 1:
  67926. if (!destinationOrNext) {
  67927. this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */];
  67928. break;
  67929. }
  67930. if (typeof destinationOrNext === 'object') {
  67931. if (destinationOrNext instanceof Subscriber) {
  67932. this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
  67933. this.destination = destinationOrNext;
  67934. this.destination.add(this);
  67935. }
  67936. else {
  67937. this.syncErrorThrowable = true;
  67938. this.destination = new SafeSubscriber(this, destinationOrNext);
  67939. }
  67940. break;
  67941. }
  67942. default:
  67943. this.syncErrorThrowable = true;
  67944. this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
  67945. break;
  67946. }
  67947. }
  67948. Subscriber.prototype[__WEBPACK_IMPORTED_MODULE_3__symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { return this; };
  67949. /**
  67950. * A static factory for a Subscriber, given a (potentially partial) definition
  67951. * of an Observer.
  67952. * @param {function(x: ?T): void} [next] The `next` callback of an Observer.
  67953. * @param {function(e: ?any): void} [error] The `error` callback of an
  67954. * Observer.
  67955. * @param {function(): void} [complete] The `complete` callback of an
  67956. * Observer.
  67957. * @return {Subscriber<T>} A Subscriber wrapping the (partially defined)
  67958. * Observer represented by the given arguments.
  67959. */
  67960. Subscriber.create = function (next, error, complete) {
  67961. var subscriber = new Subscriber(next, error, complete);
  67962. subscriber.syncErrorThrowable = false;
  67963. return subscriber;
  67964. };
  67965. /**
  67966. * The {@link Observer} callback to receive notifications of type `next` from
  67967. * the Observable, with a value. The Observable may call this method 0 or more
  67968. * times.
  67969. * @param {T} [value] The `next` value.
  67970. * @return {void}
  67971. */
  67972. Subscriber.prototype.next = function (value) {
  67973. if (!this.isStopped) {
  67974. this._next(value);
  67975. }
  67976. };
  67977. /**
  67978. * The {@link Observer} callback to receive notifications of type `error` from
  67979. * the Observable, with an attached {@link Error}. Notifies the Observer that
  67980. * the Observable has experienced an error condition.
  67981. * @param {any} [err] The `error` exception.
  67982. * @return {void}
  67983. */
  67984. Subscriber.prototype.error = function (err) {
  67985. if (!this.isStopped) {
  67986. this.isStopped = true;
  67987. this._error(err);
  67988. }
  67989. };
  67990. /**
  67991. * The {@link Observer} callback to receive a valueless notification of type
  67992. * `complete` from the Observable. Notifies the Observer that the Observable
  67993. * has finished sending push-based notifications.
  67994. * @return {void}
  67995. */
  67996. Subscriber.prototype.complete = function () {
  67997. if (!this.isStopped) {
  67998. this.isStopped = true;
  67999. this._complete();
  68000. }
  68001. };
  68002. Subscriber.prototype.unsubscribe = function () {
  68003. if (this.closed) {
  68004. return;
  68005. }
  68006. this.isStopped = true;
  68007. _super.prototype.unsubscribe.call(this);
  68008. };
  68009. Subscriber.prototype._next = function (value) {
  68010. this.destination.next(value);
  68011. };
  68012. Subscriber.prototype._error = function (err) {
  68013. this.destination.error(err);
  68014. this.unsubscribe();
  68015. };
  68016. Subscriber.prototype._complete = function () {
  68017. this.destination.complete();
  68018. this.unsubscribe();
  68019. };
  68020. Subscriber.prototype._unsubscribeAndRecycle = function () {
  68021. var _a = this, _parent = _a._parent, _parents = _a._parents;
  68022. this._parent = null;
  68023. this._parents = null;
  68024. this.unsubscribe();
  68025. this.closed = false;
  68026. this.isStopped = false;
  68027. this._parent = _parent;
  68028. this._parents = _parents;
  68029. return this;
  68030. };
  68031. return Subscriber;
  68032. }(__WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */]));
  68033. /**
  68034. * We need this JSDoc comment for affecting ESDoc.
  68035. * @ignore
  68036. * @extends {Ignored}
  68037. */
  68038. var SafeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68039. __extends(SafeSubscriber, _super);
  68040. function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
  68041. _super.call(this);
  68042. this._parentSubscriber = _parentSubscriber;
  68043. var next;
  68044. var context = this;
  68045. if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* isFunction */])(observerOrNext)) {
  68046. next = observerOrNext;
  68047. }
  68048. else if (observerOrNext) {
  68049. next = observerOrNext.next;
  68050. error = observerOrNext.error;
  68051. complete = observerOrNext.complete;
  68052. if (observerOrNext !== __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]) {
  68053. context = Object.create(observerOrNext);
  68054. if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* isFunction */])(context.unsubscribe)) {
  68055. this.add(context.unsubscribe.bind(context));
  68056. }
  68057. context.unsubscribe = this.unsubscribe.bind(this);
  68058. }
  68059. }
  68060. this._context = context;
  68061. this._next = next;
  68062. this._error = error;
  68063. this._complete = complete;
  68064. }
  68065. SafeSubscriber.prototype.next = function (value) {
  68066. if (!this.isStopped && this._next) {
  68067. var _parentSubscriber = this._parentSubscriber;
  68068. if (!_parentSubscriber.syncErrorThrowable) {
  68069. this.__tryOrUnsub(this._next, value);
  68070. }
  68071. else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
  68072. this.unsubscribe();
  68073. }
  68074. }
  68075. };
  68076. SafeSubscriber.prototype.error = function (err) {
  68077. if (!this.isStopped) {
  68078. var _parentSubscriber = this._parentSubscriber;
  68079. if (this._error) {
  68080. if (!_parentSubscriber.syncErrorThrowable) {
  68081. this.__tryOrUnsub(this._error, err);
  68082. this.unsubscribe();
  68083. }
  68084. else {
  68085. this.__tryOrSetError(_parentSubscriber, this._error, err);
  68086. this.unsubscribe();
  68087. }
  68088. }
  68089. else if (!_parentSubscriber.syncErrorThrowable) {
  68090. this.unsubscribe();
  68091. throw err;
  68092. }
  68093. else {
  68094. _parentSubscriber.syncErrorValue = err;
  68095. _parentSubscriber.syncErrorThrown = true;
  68096. this.unsubscribe();
  68097. }
  68098. }
  68099. };
  68100. SafeSubscriber.prototype.complete = function () {
  68101. var _this = this;
  68102. if (!this.isStopped) {
  68103. var _parentSubscriber = this._parentSubscriber;
  68104. if (this._complete) {
  68105. var wrappedComplete = function () { return _this._complete.call(_this._context); };
  68106. if (!_parentSubscriber.syncErrorThrowable) {
  68107. this.__tryOrUnsub(wrappedComplete);
  68108. this.unsubscribe();
  68109. }
  68110. else {
  68111. this.__tryOrSetError(_parentSubscriber, wrappedComplete);
  68112. this.unsubscribe();
  68113. }
  68114. }
  68115. else {
  68116. this.unsubscribe();
  68117. }
  68118. }
  68119. };
  68120. SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
  68121. try {
  68122. fn.call(this._context, value);
  68123. }
  68124. catch (err) {
  68125. this.unsubscribe();
  68126. throw err;
  68127. }
  68128. };
  68129. SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
  68130. try {
  68131. fn.call(this._context, value);
  68132. }
  68133. catch (err) {
  68134. parent.syncErrorValue = err;
  68135. parent.syncErrorThrown = true;
  68136. return true;
  68137. }
  68138. return false;
  68139. };
  68140. SafeSubscriber.prototype._unsubscribe = function () {
  68141. var _parentSubscriber = this._parentSubscriber;
  68142. this._context = null;
  68143. this._parentSubscriber = null;
  68144. _parentSubscriber.unsubscribe();
  68145. };
  68146. return SafeSubscriber;
  68147. }(Subscriber));
  68148. //# sourceMappingURL=Subscriber.js.map
  68149. /***/ }),
  68150. /***/ "./node_modules/rxjs/_esm5/Subscription.js":
  68151. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68152. "use strict";
  68153. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; });
  68154. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isArray.js");
  68155. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isObject.js");
  68156. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isFunction.js");
  68157. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__("./node_modules/rxjs/_esm5/util/tryCatch.js");
  68158. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/errorObject.js");
  68159. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__("./node_modules/rxjs/_esm5/util/UnsubscriptionError.js");
  68160. /** PURE_IMPORTS_START ._util_isArray,._util_isObject,._util_isFunction,._util_tryCatch,._util_errorObject,._util_UnsubscriptionError PURE_IMPORTS_END */
  68161. /**
  68162. * Represents a disposable resource, such as the execution of an Observable. A
  68163. * Subscription has one important method, `unsubscribe`, that takes no argument
  68164. * and just disposes the resource held by the subscription.
  68165. *
  68166. * Additionally, subscriptions may be grouped together through the `add()`
  68167. * method, which will attach a child Subscription to the current Subscription.
  68168. * When a Subscription is unsubscribed, all its children (and its grandchildren)
  68169. * will be unsubscribed as well.
  68170. *
  68171. * @class Subscription
  68172. */
  68173. var Subscription = /*@__PURE__*/ (/*@__PURE__*/ function () {
  68174. /**
  68175. * @param {function(): void} [unsubscribe] A function describing how to
  68176. * perform the disposal of resources when the `unsubscribe` method is called.
  68177. */
  68178. function Subscription(unsubscribe) {
  68179. /**
  68180. * A flag to indicate whether this Subscription has already been unsubscribed.
  68181. * @type {boolean}
  68182. */
  68183. this.closed = false;
  68184. this._parent = null;
  68185. this._parents = null;
  68186. this._subscriptions = null;
  68187. if (unsubscribe) {
  68188. this._unsubscribe = unsubscribe;
  68189. }
  68190. }
  68191. /**
  68192. * Disposes the resources held by the subscription. May, for instance, cancel
  68193. * an ongoing Observable execution or cancel any other type of work that
  68194. * started when the Subscription was created.
  68195. * @return {void}
  68196. */
  68197. Subscription.prototype.unsubscribe = function () {
  68198. var hasErrors = false;
  68199. var errors;
  68200. if (this.closed) {
  68201. return;
  68202. }
  68203. var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
  68204. this.closed = true;
  68205. this._parent = null;
  68206. this._parents = null;
  68207. // null out _subscriptions first so any child subscriptions that attempt
  68208. // to remove themselves from this subscription will noop
  68209. this._subscriptions = null;
  68210. var index = -1;
  68211. var len = _parents ? _parents.length : 0;
  68212. // if this._parent is null, then so is this._parents, and we
  68213. // don't have to remove ourselves from any parent subscriptions.
  68214. while (_parent) {
  68215. _parent.remove(this);
  68216. // if this._parents is null or index >= len,
  68217. // then _parent is set to null, and the loop exits
  68218. _parent = ++index < len && _parents[index] || null;
  68219. }
  68220. if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(_unsubscribe)) {
  68221. var trial = Object(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(_unsubscribe).call(this);
  68222. if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) {
  68223. hasErrors = true;
  68224. errors = errors || (__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */] ?
  68225. flattenUnsubscriptionErrors(__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e.errors) : [__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e]);
  68226. }
  68227. }
  68228. if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(_subscriptions)) {
  68229. index = -1;
  68230. len = _subscriptions.length;
  68231. while (++index < len) {
  68232. var sub = _subscriptions[index];
  68233. if (Object(__WEBPACK_IMPORTED_MODULE_1__util_isObject__["a" /* isObject */])(sub)) {
  68234. var trial = Object(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(sub.unsubscribe).call(sub);
  68235. if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) {
  68236. hasErrors = true;
  68237. errors = errors || [];
  68238. var err = __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e;
  68239. if (err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) {
  68240. errors = errors.concat(flattenUnsubscriptionErrors(err.errors));
  68241. }
  68242. else {
  68243. errors.push(err);
  68244. }
  68245. }
  68246. }
  68247. }
  68248. }
  68249. if (hasErrors) {
  68250. throw new __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */](errors);
  68251. }
  68252. };
  68253. /**
  68254. * Adds a tear down to be called during the unsubscribe() of this
  68255. * Subscription.
  68256. *
  68257. * If the tear down being added is a subscription that is already
  68258. * unsubscribed, is the same reference `add` is being called on, or is
  68259. * `Subscription.EMPTY`, it will not be added.
  68260. *
  68261. * If this subscription is already in an `closed` state, the passed
  68262. * tear down logic will be executed immediately.
  68263. *
  68264. * @param {TeardownLogic} teardown The additional logic to execute on
  68265. * teardown.
  68266. * @return {Subscription} Returns the Subscription used or created to be
  68267. * added to the inner subscriptions list. This Subscription can be used with
  68268. * `remove()` to remove the passed teardown logic from the inner subscriptions
  68269. * list.
  68270. */
  68271. Subscription.prototype.add = function (teardown) {
  68272. if (!teardown || (teardown === Subscription.EMPTY)) {
  68273. return Subscription.EMPTY;
  68274. }
  68275. if (teardown === this) {
  68276. return this;
  68277. }
  68278. var subscription = teardown;
  68279. switch (typeof teardown) {
  68280. case 'function':
  68281. subscription = new Subscription(teardown);
  68282. case 'object':
  68283. if (subscription.closed || typeof subscription.unsubscribe !== 'function') {
  68284. return subscription;
  68285. }
  68286. else if (this.closed) {
  68287. subscription.unsubscribe();
  68288. return subscription;
  68289. }
  68290. else if (typeof subscription._addParent !== 'function' /* quack quack */) {
  68291. var tmp = subscription;
  68292. subscription = new Subscription();
  68293. subscription._subscriptions = [tmp];
  68294. }
  68295. break;
  68296. default:
  68297. throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
  68298. }
  68299. var subscriptions = this._subscriptions || (this._subscriptions = []);
  68300. subscriptions.push(subscription);
  68301. subscription._addParent(this);
  68302. return subscription;
  68303. };
  68304. /**
  68305. * Removes a Subscription from the internal list of subscriptions that will
  68306. * unsubscribe during the unsubscribe process of this Subscription.
  68307. * @param {Subscription} subscription The subscription to remove.
  68308. * @return {void}
  68309. */
  68310. Subscription.prototype.remove = function (subscription) {
  68311. var subscriptions = this._subscriptions;
  68312. if (subscriptions) {
  68313. var subscriptionIndex = subscriptions.indexOf(subscription);
  68314. if (subscriptionIndex !== -1) {
  68315. subscriptions.splice(subscriptionIndex, 1);
  68316. }
  68317. }
  68318. };
  68319. Subscription.prototype._addParent = function (parent) {
  68320. var _a = this, _parent = _a._parent, _parents = _a._parents;
  68321. if (!_parent || _parent === parent) {
  68322. // If we don't have a parent, or the new parent is the same as the
  68323. // current parent, then set this._parent to the new parent.
  68324. this._parent = parent;
  68325. }
  68326. else if (!_parents) {
  68327. // If there's already one parent, but not multiple, allocate an Array to
  68328. // store the rest of the parent Subscriptions.
  68329. this._parents = [parent];
  68330. }
  68331. else if (_parents.indexOf(parent) === -1) {
  68332. // Only add the new parent to the _parents list if it's not already there.
  68333. _parents.push(parent);
  68334. }
  68335. };
  68336. Subscription.EMPTY = (function (empty) {
  68337. empty.closed = true;
  68338. return empty;
  68339. }(new Subscription()));
  68340. return Subscription;
  68341. }());
  68342. function flattenUnsubscriptionErrors(errors) {
  68343. return errors.reduce(function (errs, err) { return errs.concat((err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) ? err.errors : err); }, []);
  68344. }
  68345. //# sourceMappingURL=Subscription.js.map
  68346. /***/ }),
  68347. /***/ "./node_modules/rxjs/_esm5/observable/ArrayObservable.js":
  68348. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68349. "use strict";
  68350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayObservable; });
  68351. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  68352. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ScalarObservable.js");
  68353. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/EmptyObservable.js");
  68354. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isScheduler__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isScheduler.js");
  68355. /** PURE_IMPORTS_START .._Observable,._ScalarObservable,._EmptyObservable,.._util_isScheduler PURE_IMPORTS_END */
  68356. var __extends = (this && this.__extends) || function (d, b) {
  68357. for (var p in b)
  68358. if (b.hasOwnProperty(p))
  68359. d[p] = b[p];
  68360. function __() { this.constructor = d; }
  68361. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  68362. };
  68363. /**
  68364. * We need this JSDoc comment for affecting ESDoc.
  68365. * @extends {Ignored}
  68366. * @hide true
  68367. */
  68368. var ArrayObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68369. __extends(ArrayObservable, _super);
  68370. function ArrayObservable(array, scheduler) {
  68371. _super.call(this);
  68372. this.array = array;
  68373. this.scheduler = scheduler;
  68374. if (!scheduler && array.length === 1) {
  68375. this._isScalar = true;
  68376. this.value = array[0];
  68377. }
  68378. }
  68379. ArrayObservable.create = function (array, scheduler) {
  68380. return new ArrayObservable(array, scheduler);
  68381. };
  68382. /**
  68383. * Creates an Observable that emits some values you specify as arguments,
  68384. * immediately one after the other, and then emits a complete notification.
  68385. *
  68386. * <span class="informal">Emits the arguments you provide, then completes.
  68387. * </span>
  68388. *
  68389. * <img src="./img/of.png" width="100%">
  68390. *
  68391. * This static operator is useful for creating a simple Observable that only
  68392. * emits the arguments given, and the complete notification thereafter. It can
  68393. * be used for composing with other Observables, such as with {@link concat}.
  68394. * By default, it uses a `null` IScheduler, which means the `next`
  68395. * notifications are sent synchronously, although with a different IScheduler
  68396. * it is possible to determine when those notifications will be delivered.
  68397. *
  68398. * @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption>
  68399. * var numbers = Rx.Observable.of(10, 20, 30);
  68400. * var letters = Rx.Observable.of('a', 'b', 'c');
  68401. * var interval = Rx.Observable.interval(1000);
  68402. * var result = numbers.concat(letters).concat(interval);
  68403. * result.subscribe(x => console.log(x));
  68404. *
  68405. * @see {@link create}
  68406. * @see {@link empty}
  68407. * @see {@link never}
  68408. * @see {@link throw}
  68409. *
  68410. * @param {...T} values Arguments that represent `next` values to be emitted.
  68411. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
  68412. * the emissions of the `next` notifications.
  68413. * @return {Observable<T>} An Observable that emits each given input value.
  68414. * @static true
  68415. * @name of
  68416. * @owner Observable
  68417. */
  68418. ArrayObservable.of = function () {
  68419. var array = [];
  68420. for (var _i = 0; _i < arguments.length; _i++) {
  68421. array[_i - 0] = arguments[_i];
  68422. }
  68423. var scheduler = array[array.length - 1];
  68424. if (Object(__WEBPACK_IMPORTED_MODULE_3__util_isScheduler__["a" /* isScheduler */])(scheduler)) {
  68425. array.pop();
  68426. }
  68427. else {
  68428. scheduler = null;
  68429. }
  68430. var len = array.length;
  68431. if (len > 1) {
  68432. return new ArrayObservable(array, scheduler);
  68433. }
  68434. else if (len === 1) {
  68435. return new __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__["a" /* ScalarObservable */](array[0], scheduler);
  68436. }
  68437. else {
  68438. return new __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__["a" /* EmptyObservable */](scheduler);
  68439. }
  68440. };
  68441. ArrayObservable.dispatch = function (state) {
  68442. var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;
  68443. if (index >= count) {
  68444. subscriber.complete();
  68445. return;
  68446. }
  68447. subscriber.next(array[index]);
  68448. if (subscriber.closed) {
  68449. return;
  68450. }
  68451. state.index = index + 1;
  68452. this.schedule(state);
  68453. };
  68454. ArrayObservable.prototype._subscribe = function (subscriber) {
  68455. var index = 0;
  68456. var array = this.array;
  68457. var count = array.length;
  68458. var scheduler = this.scheduler;
  68459. if (scheduler) {
  68460. return scheduler.schedule(ArrayObservable.dispatch, 0, {
  68461. array: array, index: index, count: count, subscriber: subscriber
  68462. });
  68463. }
  68464. else {
  68465. for (var i = 0; i < count && !subscriber.closed; i++) {
  68466. subscriber.next(array[i]);
  68467. }
  68468. subscriber.complete();
  68469. }
  68470. };
  68471. return ArrayObservable;
  68472. }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
  68473. //# sourceMappingURL=ArrayObservable.js.map
  68474. /***/ }),
  68475. /***/ "./node_modules/rxjs/_esm5/observable/ConnectableObservable.js":
  68476. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68477. "use strict";
  68478. /* unused harmony export ConnectableObservable */
  68479. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return connectableObservableDescriptor; });
  68480. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("./node_modules/rxjs/_esm5/Subject.js");
  68481. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  68482. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
  68483. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
  68484. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__operators_refCount__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/refCount.js");
  68485. /** PURE_IMPORTS_START .._Subject,.._Observable,.._Subscriber,.._Subscription,.._operators_refCount PURE_IMPORTS_END */
  68486. var __extends = (this && this.__extends) || function (d, b) {
  68487. for (var p in b)
  68488. if (b.hasOwnProperty(p))
  68489. d[p] = b[p];
  68490. function __() { this.constructor = d; }
  68491. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  68492. };
  68493. /**
  68494. * @class ConnectableObservable<T>
  68495. */
  68496. var ConnectableObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68497. __extends(ConnectableObservable, _super);
  68498. function ConnectableObservable(source, subjectFactory) {
  68499. _super.call(this);
  68500. this.source = source;
  68501. this.subjectFactory = subjectFactory;
  68502. this._refCount = 0;
  68503. this._isComplete = false;
  68504. }
  68505. ConnectableObservable.prototype._subscribe = function (subscriber) {
  68506. return this.getSubject().subscribe(subscriber);
  68507. };
  68508. ConnectableObservable.prototype.getSubject = function () {
  68509. var subject = this._subject;
  68510. if (!subject || subject.isStopped) {
  68511. this._subject = this.subjectFactory();
  68512. }
  68513. return this._subject;
  68514. };
  68515. ConnectableObservable.prototype.connect = function () {
  68516. var connection = this._connection;
  68517. if (!connection) {
  68518. this._isComplete = false;
  68519. connection = this._connection = new __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */]();
  68520. connection.add(this.source
  68521. .subscribe(new ConnectableSubscriber(this.getSubject(), this)));
  68522. if (connection.closed) {
  68523. this._connection = null;
  68524. connection = __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY;
  68525. }
  68526. else {
  68527. this._connection = connection;
  68528. }
  68529. }
  68530. return connection;
  68531. };
  68532. ConnectableObservable.prototype.refCount = function () {
  68533. return Object(__WEBPACK_IMPORTED_MODULE_4__operators_refCount__["a" /* refCount */])()(this);
  68534. };
  68535. return ConnectableObservable;
  68536. }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */]));
  68537. var connectableProto = ConnectableObservable.prototype;
  68538. var connectableObservableDescriptor = {
  68539. operator: { value: null },
  68540. _refCount: { value: 0, writable: true },
  68541. _subject: { value: null, writable: true },
  68542. _connection: { value: null, writable: true },
  68543. _subscribe: { value: connectableProto._subscribe },
  68544. _isComplete: { value: connectableProto._isComplete, writable: true },
  68545. getSubject: { value: connectableProto.getSubject },
  68546. connect: { value: connectableProto.connect },
  68547. refCount: { value: connectableProto.refCount }
  68548. };
  68549. var ConnectableSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68550. __extends(ConnectableSubscriber, _super);
  68551. function ConnectableSubscriber(destination, connectable) {
  68552. _super.call(this, destination);
  68553. this.connectable = connectable;
  68554. }
  68555. ConnectableSubscriber.prototype._error = function (err) {
  68556. this._unsubscribe();
  68557. _super.prototype._error.call(this, err);
  68558. };
  68559. ConnectableSubscriber.prototype._complete = function () {
  68560. this.connectable._isComplete = true;
  68561. this._unsubscribe();
  68562. _super.prototype._complete.call(this);
  68563. };
  68564. ConnectableSubscriber.prototype._unsubscribe = function () {
  68565. var connectable = this.connectable;
  68566. if (connectable) {
  68567. this.connectable = null;
  68568. var connection = connectable._connection;
  68569. connectable._refCount = 0;
  68570. connectable._subject = null;
  68571. connectable._connection = null;
  68572. if (connection) {
  68573. connection.unsubscribe();
  68574. }
  68575. }
  68576. };
  68577. return ConnectableSubscriber;
  68578. }(__WEBPACK_IMPORTED_MODULE_0__Subject__["b" /* SubjectSubscriber */]));
  68579. var RefCountOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  68580. function RefCountOperator(connectable) {
  68581. this.connectable = connectable;
  68582. }
  68583. RefCountOperator.prototype.call = function (subscriber, source) {
  68584. var connectable = this.connectable;
  68585. connectable._refCount++;
  68586. var refCounter = new RefCountSubscriber(subscriber, connectable);
  68587. var subscription = source.subscribe(refCounter);
  68588. if (!refCounter.closed) {
  68589. refCounter.connection = connectable.connect();
  68590. }
  68591. return subscription;
  68592. };
  68593. return RefCountOperator;
  68594. }());
  68595. var RefCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68596. __extends(RefCountSubscriber, _super);
  68597. function RefCountSubscriber(destination, connectable) {
  68598. _super.call(this, destination);
  68599. this.connectable = connectable;
  68600. }
  68601. RefCountSubscriber.prototype._unsubscribe = function () {
  68602. var connectable = this.connectable;
  68603. if (!connectable) {
  68604. this.connection = null;
  68605. return;
  68606. }
  68607. this.connectable = null;
  68608. var refCount = connectable._refCount;
  68609. if (refCount <= 0) {
  68610. this.connection = null;
  68611. return;
  68612. }
  68613. connectable._refCount = refCount - 1;
  68614. if (refCount > 1) {
  68615. this.connection = null;
  68616. return;
  68617. }
  68618. ///
  68619. // Compare the local RefCountSubscriber's connection Subscription to the
  68620. // connection Subscription on the shared ConnectableObservable. In cases
  68621. // where the ConnectableObservable source synchronously emits values, and
  68622. // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
  68623. // execution continues to here before the RefCountOperator has a chance to
  68624. // supply the RefCountSubscriber with the shared connection Subscription.
  68625. // For example:
  68626. // ```
  68627. // Observable.range(0, 10)
  68628. // .publish()
  68629. // .refCount()
  68630. // .take(5)
  68631. // .subscribe();
  68632. // ```
  68633. // In order to account for this case, RefCountSubscriber should only dispose
  68634. // the ConnectableObservable's shared connection Subscription if the
  68635. // connection Subscription exists, *and* either:
  68636. // a. RefCountSubscriber doesn't have a reference to the shared connection
  68637. // Subscription yet, or,
  68638. // b. RefCountSubscriber's connection Subscription reference is identical
  68639. // to the shared connection Subscription
  68640. ///
  68641. var connection = this.connection;
  68642. var sharedConnection = connectable._connection;
  68643. this.connection = null;
  68644. if (sharedConnection && (!connection || sharedConnection === connection)) {
  68645. sharedConnection.unsubscribe();
  68646. }
  68647. };
  68648. return RefCountSubscriber;
  68649. }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */]));
  68650. //# sourceMappingURL=ConnectableObservable.js.map
  68651. /***/ }),
  68652. /***/ "./node_modules/rxjs/_esm5/observable/EmptyObservable.js":
  68653. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68654. "use strict";
  68655. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EmptyObservable; });
  68656. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  68657. /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */
  68658. var __extends = (this && this.__extends) || function (d, b) {
  68659. for (var p in b)
  68660. if (b.hasOwnProperty(p))
  68661. d[p] = b[p];
  68662. function __() { this.constructor = d; }
  68663. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  68664. };
  68665. /**
  68666. * We need this JSDoc comment for affecting ESDoc.
  68667. * @extends {Ignored}
  68668. * @hide true
  68669. */
  68670. var EmptyObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68671. __extends(EmptyObservable, _super);
  68672. function EmptyObservable(scheduler) {
  68673. _super.call(this);
  68674. this.scheduler = scheduler;
  68675. }
  68676. /**
  68677. * Creates an Observable that emits no items to the Observer and immediately
  68678. * emits a complete notification.
  68679. *
  68680. * <span class="informal">Just emits 'complete', and nothing else.
  68681. * </span>
  68682. *
  68683. * <img src="./img/empty.png" width="100%">
  68684. *
  68685. * This static operator is useful for creating a simple Observable that only
  68686. * emits the complete notification. It can be used for composing with other
  68687. * Observables, such as in a {@link mergeMap}.
  68688. *
  68689. * @example <caption>Emit the number 7, then complete.</caption>
  68690. * var result = Rx.Observable.empty().startWith(7);
  68691. * result.subscribe(x => console.log(x));
  68692. *
  68693. * @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>
  68694. * var interval = Rx.Observable.interval(1000);
  68695. * var result = interval.mergeMap(x =>
  68696. * x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()
  68697. * );
  68698. * result.subscribe(x => console.log(x));
  68699. *
  68700. * // Results in the following to the console:
  68701. * // x is equal to the count on the interval eg(0,1,2,3,...)
  68702. * // x will occur every 1000ms
  68703. * // if x % 2 is equal to 1 print abc
  68704. * // if x % 2 is not equal to 1 nothing will be output
  68705. *
  68706. * @see {@link create}
  68707. * @see {@link never}
  68708. * @see {@link of}
  68709. * @see {@link throw}
  68710. *
  68711. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
  68712. * the emission of the complete notification.
  68713. * @return {Observable} An "empty" Observable: emits only the complete
  68714. * notification.
  68715. * @static true
  68716. * @name empty
  68717. * @owner Observable
  68718. */
  68719. EmptyObservable.create = function (scheduler) {
  68720. return new EmptyObservable(scheduler);
  68721. };
  68722. EmptyObservable.dispatch = function (arg) {
  68723. var subscriber = arg.subscriber;
  68724. subscriber.complete();
  68725. };
  68726. EmptyObservable.prototype._subscribe = function (subscriber) {
  68727. var scheduler = this.scheduler;
  68728. if (scheduler) {
  68729. return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber });
  68730. }
  68731. else {
  68732. subscriber.complete();
  68733. }
  68734. };
  68735. return EmptyObservable;
  68736. }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
  68737. //# sourceMappingURL=EmptyObservable.js.map
  68738. /***/ }),
  68739. /***/ "./node_modules/rxjs/_esm5/observable/ScalarObservable.js":
  68740. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68741. "use strict";
  68742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScalarObservable; });
  68743. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  68744. /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */
  68745. var __extends = (this && this.__extends) || function (d, b) {
  68746. for (var p in b)
  68747. if (b.hasOwnProperty(p))
  68748. d[p] = b[p];
  68749. function __() { this.constructor = d; }
  68750. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  68751. };
  68752. /**
  68753. * We need this JSDoc comment for affecting ESDoc.
  68754. * @extends {Ignored}
  68755. * @hide true
  68756. */
  68757. var ScalarObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  68758. __extends(ScalarObservable, _super);
  68759. function ScalarObservable(value, scheduler) {
  68760. _super.call(this);
  68761. this.value = value;
  68762. this.scheduler = scheduler;
  68763. this._isScalar = true;
  68764. if (scheduler) {
  68765. this._isScalar = false;
  68766. }
  68767. }
  68768. ScalarObservable.create = function (value, scheduler) {
  68769. return new ScalarObservable(value, scheduler);
  68770. };
  68771. ScalarObservable.dispatch = function (state) {
  68772. var done = state.done, value = state.value, subscriber = state.subscriber;
  68773. if (done) {
  68774. subscriber.complete();
  68775. return;
  68776. }
  68777. subscriber.next(value);
  68778. if (subscriber.closed) {
  68779. return;
  68780. }
  68781. state.done = true;
  68782. this.schedule(state);
  68783. };
  68784. ScalarObservable.prototype._subscribe = function (subscriber) {
  68785. var value = this.value;
  68786. var scheduler = this.scheduler;
  68787. if (scheduler) {
  68788. return scheduler.schedule(ScalarObservable.dispatch, 0, {
  68789. done: false, value: value, subscriber: subscriber
  68790. });
  68791. }
  68792. else {
  68793. subscriber.next(value);
  68794. if (!subscriber.closed) {
  68795. subscriber.complete();
  68796. }
  68797. }
  68798. };
  68799. return ScalarObservable;
  68800. }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
  68801. //# sourceMappingURL=ScalarObservable.js.map
  68802. /***/ }),
  68803. /***/ "./node_modules/rxjs/_esm5/observable/merge.js":
  68804. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68805. "use strict";
  68806. /* harmony export (immutable) */ __webpack_exports__["a"] = merge;
  68807. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  68808. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ArrayObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ArrayObservable.js");
  68809. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isScheduler__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isScheduler.js");
  68810. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_mergeAll__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/mergeAll.js");
  68811. /** PURE_IMPORTS_START .._Observable,._ArrayObservable,.._util_isScheduler,.._operators_mergeAll PURE_IMPORTS_END */
  68812. /* tslint:enable:max-line-length */
  68813. /**
  68814. * Creates an output Observable which concurrently emits all values from every
  68815. * given input Observable.
  68816. *
  68817. * <span class="informal">Flattens multiple Observables together by blending
  68818. * their values into one Observable.</span>
  68819. *
  68820. * <img src="./img/merge.png" width="100%">
  68821. *
  68822. * `merge` subscribes to each given input Observable (as arguments), and simply
  68823. * forwards (without doing any transformation) all the values from all the input
  68824. * Observables to the output Observable. The output Observable only completes
  68825. * once all input Observables have completed. Any error delivered by an input
  68826. * Observable will be immediately emitted on the output Observable.
  68827. *
  68828. * @example <caption>Merge together two Observables: 1s interval and clicks</caption>
  68829. * var clicks = Rx.Observable.fromEvent(document, 'click');
  68830. * var timer = Rx.Observable.interval(1000);
  68831. * var clicksOrTimer = Rx.Observable.merge(clicks, timer);
  68832. * clicksOrTimer.subscribe(x => console.log(x));
  68833. *
  68834. * // Results in the following:
  68835. * // timer will emit ascending values, one every second(1000ms) to console
  68836. * // clicks logs MouseEvents to console everytime the "document" is clicked
  68837. * // Since the two streams are merged you see these happening
  68838. * // as they occur.
  68839. *
  68840. * @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
  68841. * var timer1 = Rx.Observable.interval(1000).take(10);
  68842. * var timer2 = Rx.Observable.interval(2000).take(6);
  68843. * var timer3 = Rx.Observable.interval(500).take(10);
  68844. * var concurrent = 2; // the argument
  68845. * var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent);
  68846. * merged.subscribe(x => console.log(x));
  68847. *
  68848. * // Results in the following:
  68849. * // - First timer1 and timer2 will run concurrently
  68850. * // - timer1 will emit a value every 1000ms for 10 iterations
  68851. * // - timer2 will emit a value every 2000ms for 6 iterations
  68852. * // - after timer1 hits it's max iteration, timer2 will
  68853. * // continue, and timer3 will start to run concurrently with timer2
  68854. * // - when timer2 hits it's max iteration it terminates, and
  68855. * // timer3 will continue to emit a value every 500ms until it is complete
  68856. *
  68857. * @see {@link mergeAll}
  68858. * @see {@link mergeMap}
  68859. * @see {@link mergeMapTo}
  68860. * @see {@link mergeScan}
  68861. *
  68862. * @param {...ObservableInput} observables Input Observables to merge together.
  68863. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  68864. * Observables being subscribed to concurrently.
  68865. * @param {Scheduler} [scheduler=null] The IScheduler to use for managing
  68866. * concurrency of input Observables.
  68867. * @return {Observable} an Observable that emits items that are the result of
  68868. * every input Observable.
  68869. * @static true
  68870. * @name merge
  68871. * @owner Observable
  68872. */
  68873. function merge() {
  68874. var observables = [];
  68875. for (var _i = 0; _i < arguments.length; _i++) {
  68876. observables[_i - 0] = arguments[_i];
  68877. }
  68878. var concurrent = Number.POSITIVE_INFINITY;
  68879. var scheduler = null;
  68880. var last = observables[observables.length - 1];
  68881. if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isScheduler__["a" /* isScheduler */])(last)) {
  68882. scheduler = observables.pop();
  68883. if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
  68884. concurrent = observables.pop();
  68885. }
  68886. }
  68887. else if (typeof last === 'number') {
  68888. concurrent = observables.pop();
  68889. }
  68890. if (scheduler === null && observables.length === 1 && observables[0] instanceof __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]) {
  68891. return observables[0];
  68892. }
  68893. return Object(__WEBPACK_IMPORTED_MODULE_3__operators_mergeAll__["a" /* mergeAll */])(concurrent)(new __WEBPACK_IMPORTED_MODULE_1__ArrayObservable__["a" /* ArrayObservable */](observables, scheduler));
  68894. }
  68895. //# sourceMappingURL=merge.js.map
  68896. /***/ }),
  68897. /***/ "./node_modules/rxjs/_esm5/observable/of.js":
  68898. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68899. "use strict";
  68900. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return of; });
  68901. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ArrayObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ArrayObservable.js");
  68902. /** PURE_IMPORTS_START ._ArrayObservable PURE_IMPORTS_END */
  68903. var of = __WEBPACK_IMPORTED_MODULE_0__ArrayObservable__["a" /* ArrayObservable */].of;
  68904. //# sourceMappingURL=of.js.map
  68905. /***/ }),
  68906. /***/ "./node_modules/rxjs/_esm5/operator/share.js":
  68907. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68908. "use strict";
  68909. /* harmony export (immutable) */ __webpack_exports__["a"] = share;
  68910. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_share__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/share.js");
  68911. /** PURE_IMPORTS_START .._operators_share PURE_IMPORTS_END */
  68912. /**
  68913. * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
  68914. * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
  68915. * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
  68916. *
  68917. * This behaves similarly to .publish().refCount(), with a behavior difference when the source observable emits complete.
  68918. * .publish().refCount() will not resubscribe to the original source, however .share() will resubscribe to the original source.
  68919. * Observable.of("test").publish().refCount() will not re-emit "test" on new subscriptions, Observable.of("test").share() will
  68920. * re-emit "test" to new subscriptions.
  68921. *
  68922. * <img src="./img/share.png" width="100%">
  68923. *
  68924. * @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
  68925. * @method share
  68926. * @owner Observable
  68927. */
  68928. function share() {
  68929. return Object(__WEBPACK_IMPORTED_MODULE_0__operators_share__["a" /* share */])()(this);
  68930. }
  68931. ;
  68932. //# sourceMappingURL=share.js.map
  68933. /***/ }),
  68934. /***/ "./node_modules/rxjs/_esm5/operators/mergeAll.js":
  68935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68936. "use strict";
  68937. /* harmony export (immutable) */ __webpack_exports__["a"] = mergeAll;
  68938. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mergeMap__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/mergeMap.js");
  68939. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_identity__ = __webpack_require__("./node_modules/rxjs/_esm5/util/identity.js");
  68940. /** PURE_IMPORTS_START ._mergeMap,.._util_identity PURE_IMPORTS_END */
  68941. /**
  68942. * Converts a higher-order Observable into a first-order Observable which
  68943. * concurrently delivers all values that are emitted on the inner Observables.
  68944. *
  68945. * <span class="informal">Flattens an Observable-of-Observables.</span>
  68946. *
  68947. * <img src="./img/mergeAll.png" width="100%">
  68948. *
  68949. * `mergeAll` subscribes to an Observable that emits Observables, also known as
  68950. * a higher-order Observable. Each time it observes one of these emitted inner
  68951. * Observables, it subscribes to that and delivers all the values from the
  68952. * inner Observable on the output Observable. The output Observable only
  68953. * completes once all inner Observables have completed. Any error delivered by
  68954. * a inner Observable will be immediately emitted on the output Observable.
  68955. *
  68956. * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>
  68957. * var clicks = Rx.Observable.fromEvent(document, 'click');
  68958. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));
  68959. * var firstOrder = higherOrder.mergeAll();
  68960. * firstOrder.subscribe(x => console.log(x));
  68961. *
  68962. * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>
  68963. * var clicks = Rx.Observable.fromEvent(document, 'click');
  68964. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));
  68965. * var firstOrder = higherOrder.mergeAll(2);
  68966. * firstOrder.subscribe(x => console.log(x));
  68967. *
  68968. * @see {@link combineAll}
  68969. * @see {@link concatAll}
  68970. * @see {@link exhaust}
  68971. * @see {@link merge}
  68972. * @see {@link mergeMap}
  68973. * @see {@link mergeMapTo}
  68974. * @see {@link mergeScan}
  68975. * @see {@link switch}
  68976. * @see {@link zipAll}
  68977. *
  68978. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner
  68979. * Observables being subscribed to concurrently.
  68980. * @return {Observable} An Observable that emits values coming from all the
  68981. * inner Observables emitted by the source Observable.
  68982. * @method mergeAll
  68983. * @owner Observable
  68984. */
  68985. function mergeAll(concurrent) {
  68986. if (concurrent === void 0) {
  68987. concurrent = Number.POSITIVE_INFINITY;
  68988. }
  68989. return Object(__WEBPACK_IMPORTED_MODULE_0__mergeMap__["a" /* mergeMap */])(__WEBPACK_IMPORTED_MODULE_1__util_identity__["a" /* identity */], null, concurrent);
  68990. }
  68991. //# sourceMappingURL=mergeAll.js.map
  68992. /***/ }),
  68993. /***/ "./node_modules/rxjs/_esm5/operators/mergeMap.js":
  68994. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  68995. "use strict";
  68996. /* harmony export (immutable) */ __webpack_exports__["a"] = mergeMap;
  68997. /* unused harmony export MergeMapOperator */
  68998. /* unused harmony export MergeMapSubscriber */
  68999. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_subscribeToResult__ = __webpack_require__("./node_modules/rxjs/_esm5/util/subscribeToResult.js");
  69000. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/OuterSubscriber.js");
  69001. /** PURE_IMPORTS_START .._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */
  69002. var __extends = (this && this.__extends) || function (d, b) {
  69003. for (var p in b)
  69004. if (b.hasOwnProperty(p))
  69005. d[p] = b[p];
  69006. function __() { this.constructor = d; }
  69007. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  69008. };
  69009. /* tslint:enable:max-line-length */
  69010. /**
  69011. * Projects each source value to an Observable which is merged in the output
  69012. * Observable.
  69013. *
  69014. * <span class="informal">Maps each value to an Observable, then flattens all of
  69015. * these inner Observables using {@link mergeAll}.</span>
  69016. *
  69017. * <img src="./img/mergeMap.png" width="100%">
  69018. *
  69019. * Returns an Observable that emits items based on applying a function that you
  69020. * supply to each item emitted by the source Observable, where that function
  69021. * returns an Observable, and then merging those resulting Observables and
  69022. * emitting the results of this merger.
  69023. *
  69024. * @example <caption>Map and flatten each letter to an Observable ticking every 1 second</caption>
  69025. * var letters = Rx.Observable.of('a', 'b', 'c');
  69026. * var result = letters.mergeMap(x =>
  69027. * Rx.Observable.interval(1000).map(i => x+i)
  69028. * );
  69029. * result.subscribe(x => console.log(x));
  69030. *
  69031. * // Results in the following:
  69032. * // a0
  69033. * // b0
  69034. * // c0
  69035. * // a1
  69036. * // b1
  69037. * // c1
  69038. * // continues to list a,b,c with respective ascending integers
  69039. *
  69040. * @see {@link concatMap}
  69041. * @see {@link exhaustMap}
  69042. * @see {@link merge}
  69043. * @see {@link mergeAll}
  69044. * @see {@link mergeMapTo}
  69045. * @see {@link mergeScan}
  69046. * @see {@link switchMap}
  69047. *
  69048. * @param {function(value: T, ?index: number): ObservableInput} project A function
  69049. * that, when applied to an item emitted by the source Observable, returns an
  69050. * Observable.
  69051. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
  69052. * A function to produce the value on the output Observable based on the values
  69053. * and the indices of the source (outer) emission and the inner Observable
  69054. * emission. The arguments passed to this function are:
  69055. * - `outerValue`: the value that came from the source
  69056. * - `innerValue`: the value that came from the projected Observable
  69057. * - `outerIndex`: the "index" of the value that came from the source
  69058. * - `innerIndex`: the "index" of the value from the projected Observable
  69059. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  69060. * Observables being subscribed to concurrently.
  69061. * @return {Observable} An Observable that emits the result of applying the
  69062. * projection function (and the optional `resultSelector`) to each item emitted
  69063. * by the source Observable and merging the results of the Observables obtained
  69064. * from this transformation.
  69065. * @method mergeMap
  69066. * @owner Observable
  69067. */
  69068. function mergeMap(project, resultSelector, concurrent) {
  69069. if (concurrent === void 0) {
  69070. concurrent = Number.POSITIVE_INFINITY;
  69071. }
  69072. return function mergeMapOperatorFunction(source) {
  69073. if (typeof resultSelector === 'number') {
  69074. concurrent = resultSelector;
  69075. resultSelector = null;
  69076. }
  69077. return source.lift(new MergeMapOperator(project, resultSelector, concurrent));
  69078. };
  69079. }
  69080. var MergeMapOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  69081. function MergeMapOperator(project, resultSelector, concurrent) {
  69082. if (concurrent === void 0) {
  69083. concurrent = Number.POSITIVE_INFINITY;
  69084. }
  69085. this.project = project;
  69086. this.resultSelector = resultSelector;
  69087. this.concurrent = concurrent;
  69088. }
  69089. MergeMapOperator.prototype.call = function (observer, source) {
  69090. return source.subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent));
  69091. };
  69092. return MergeMapOperator;
  69093. }());
  69094. /**
  69095. * We need this JSDoc comment for affecting ESDoc.
  69096. * @ignore
  69097. * @extends {Ignored}
  69098. */
  69099. var MergeMapSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  69100. __extends(MergeMapSubscriber, _super);
  69101. function MergeMapSubscriber(destination, project, resultSelector, concurrent) {
  69102. if (concurrent === void 0) {
  69103. concurrent = Number.POSITIVE_INFINITY;
  69104. }
  69105. _super.call(this, destination);
  69106. this.project = project;
  69107. this.resultSelector = resultSelector;
  69108. this.concurrent = concurrent;
  69109. this.hasCompleted = false;
  69110. this.buffer = [];
  69111. this.active = 0;
  69112. this.index = 0;
  69113. }
  69114. MergeMapSubscriber.prototype._next = function (value) {
  69115. if (this.active < this.concurrent) {
  69116. this._tryNext(value);
  69117. }
  69118. else {
  69119. this.buffer.push(value);
  69120. }
  69121. };
  69122. MergeMapSubscriber.prototype._tryNext = function (value) {
  69123. var result;
  69124. var index = this.index++;
  69125. try {
  69126. result = this.project(value, index);
  69127. }
  69128. catch (err) {
  69129. this.destination.error(err);
  69130. return;
  69131. }
  69132. this.active++;
  69133. this._innerSub(result, value, index);
  69134. };
  69135. MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
  69136. this.add(Object(__WEBPACK_IMPORTED_MODULE_0__util_subscribeToResult__["a" /* subscribeToResult */])(this, ish, value, index));
  69137. };
  69138. MergeMapSubscriber.prototype._complete = function () {
  69139. this.hasCompleted = true;
  69140. if (this.active === 0 && this.buffer.length === 0) {
  69141. this.destination.complete();
  69142. }
  69143. };
  69144. MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  69145. if (this.resultSelector) {
  69146. this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex);
  69147. }
  69148. else {
  69149. this.destination.next(innerValue);
  69150. }
  69151. };
  69152. MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) {
  69153. var result;
  69154. try {
  69155. result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);
  69156. }
  69157. catch (err) {
  69158. this.destination.error(err);
  69159. return;
  69160. }
  69161. this.destination.next(result);
  69162. };
  69163. MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
  69164. var buffer = this.buffer;
  69165. this.remove(innerSub);
  69166. this.active--;
  69167. if (buffer.length > 0) {
  69168. this._next(buffer.shift());
  69169. }
  69170. else if (this.active === 0 && this.hasCompleted) {
  69171. this.destination.complete();
  69172. }
  69173. };
  69174. return MergeMapSubscriber;
  69175. }(__WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__["a" /* OuterSubscriber */]));
  69176. //# sourceMappingURL=mergeMap.js.map
  69177. /***/ }),
  69178. /***/ "./node_modules/rxjs/_esm5/operators/multicast.js":
  69179. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69180. "use strict";
  69181. /* harmony export (immutable) */ __webpack_exports__["a"] = multicast;
  69182. /* unused harmony export MulticastOperator */
  69183. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_ConnectableObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ConnectableObservable.js");
  69184. /** PURE_IMPORTS_START .._observable_ConnectableObservable PURE_IMPORTS_END */
  69185. /* tslint:enable:max-line-length */
  69186. /**
  69187. * Returns an Observable that emits the results of invoking a specified selector on items
  69188. * emitted by a ConnectableObservable that shares a single subscription to the underlying stream.
  69189. *
  69190. * <img src="./img/multicast.png" width="100%">
  69191. *
  69192. * @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through
  69193. * which the source sequence's elements will be multicast to the selector function
  69194. * or Subject to push source elements into.
  69195. * @param {Function} [selector] - Optional selector function that can use the multicasted source stream
  69196. * as many times as needed, without causing multiple subscriptions to the source stream.
  69197. * Subscribers to the given source will receive all notifications of the source from the
  69198. * time of the subscription forward.
  69199. * @return {Observable} An Observable that emits the results of invoking the selector
  69200. * on the items emitted by a `ConnectableObservable` that shares a single subscription to
  69201. * the underlying stream.
  69202. * @method multicast
  69203. * @owner Observable
  69204. */
  69205. function multicast(subjectOrSubjectFactory, selector) {
  69206. return function multicastOperatorFunction(source) {
  69207. var subjectFactory;
  69208. if (typeof subjectOrSubjectFactory === 'function') {
  69209. subjectFactory = subjectOrSubjectFactory;
  69210. }
  69211. else {
  69212. subjectFactory = function subjectFactory() {
  69213. return subjectOrSubjectFactory;
  69214. };
  69215. }
  69216. if (typeof selector === 'function') {
  69217. return source.lift(new MulticastOperator(subjectFactory, selector));
  69218. }
  69219. var connectable = Object.create(source, __WEBPACK_IMPORTED_MODULE_0__observable_ConnectableObservable__["a" /* connectableObservableDescriptor */]);
  69220. connectable.source = source;
  69221. connectable.subjectFactory = subjectFactory;
  69222. return connectable;
  69223. };
  69224. }
  69225. var MulticastOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  69226. function MulticastOperator(subjectFactory, selector) {
  69227. this.subjectFactory = subjectFactory;
  69228. this.selector = selector;
  69229. }
  69230. MulticastOperator.prototype.call = function (subscriber, source) {
  69231. var selector = this.selector;
  69232. var subject = this.subjectFactory();
  69233. var subscription = selector(subject).subscribe(subscriber);
  69234. subscription.add(source.subscribe(subject));
  69235. return subscription;
  69236. };
  69237. return MulticastOperator;
  69238. }());
  69239. //# sourceMappingURL=multicast.js.map
  69240. /***/ }),
  69241. /***/ "./node_modules/rxjs/_esm5/operators/refCount.js":
  69242. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69243. "use strict";
  69244. /* harmony export (immutable) */ __webpack_exports__["a"] = refCount;
  69245. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
  69246. /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */
  69247. var __extends = (this && this.__extends) || function (d, b) {
  69248. for (var p in b)
  69249. if (b.hasOwnProperty(p))
  69250. d[p] = b[p];
  69251. function __() { this.constructor = d; }
  69252. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  69253. };
  69254. function refCount() {
  69255. return function refCountOperatorFunction(source) {
  69256. return source.lift(new RefCountOperator(source));
  69257. };
  69258. }
  69259. var RefCountOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  69260. function RefCountOperator(connectable) {
  69261. this.connectable = connectable;
  69262. }
  69263. RefCountOperator.prototype.call = function (subscriber, source) {
  69264. var connectable = this.connectable;
  69265. connectable._refCount++;
  69266. var refCounter = new RefCountSubscriber(subscriber, connectable);
  69267. var subscription = source.subscribe(refCounter);
  69268. if (!refCounter.closed) {
  69269. refCounter.connection = connectable.connect();
  69270. }
  69271. return subscription;
  69272. };
  69273. return RefCountOperator;
  69274. }());
  69275. var RefCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  69276. __extends(RefCountSubscriber, _super);
  69277. function RefCountSubscriber(destination, connectable) {
  69278. _super.call(this, destination);
  69279. this.connectable = connectable;
  69280. }
  69281. RefCountSubscriber.prototype._unsubscribe = function () {
  69282. var connectable = this.connectable;
  69283. if (!connectable) {
  69284. this.connection = null;
  69285. return;
  69286. }
  69287. this.connectable = null;
  69288. var refCount = connectable._refCount;
  69289. if (refCount <= 0) {
  69290. this.connection = null;
  69291. return;
  69292. }
  69293. connectable._refCount = refCount - 1;
  69294. if (refCount > 1) {
  69295. this.connection = null;
  69296. return;
  69297. }
  69298. ///
  69299. // Compare the local RefCountSubscriber's connection Subscription to the
  69300. // connection Subscription on the shared ConnectableObservable. In cases
  69301. // where the ConnectableObservable source synchronously emits values, and
  69302. // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
  69303. // execution continues to here before the RefCountOperator has a chance to
  69304. // supply the RefCountSubscriber with the shared connection Subscription.
  69305. // For example:
  69306. // ```
  69307. // Observable.range(0, 10)
  69308. // .publish()
  69309. // .refCount()
  69310. // .take(5)
  69311. // .subscribe();
  69312. // ```
  69313. // In order to account for this case, RefCountSubscriber should only dispose
  69314. // the ConnectableObservable's shared connection Subscription if the
  69315. // connection Subscription exists, *and* either:
  69316. // a. RefCountSubscriber doesn't have a reference to the shared connection
  69317. // Subscription yet, or,
  69318. // b. RefCountSubscriber's connection Subscription reference is identical
  69319. // to the shared connection Subscription
  69320. ///
  69321. var connection = this.connection;
  69322. var sharedConnection = connectable._connection;
  69323. this.connection = null;
  69324. if (sharedConnection && (!connection || sharedConnection === connection)) {
  69325. sharedConnection.unsubscribe();
  69326. }
  69327. };
  69328. return RefCountSubscriber;
  69329. }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]));
  69330. //# sourceMappingURL=refCount.js.map
  69331. /***/ }),
  69332. /***/ "./node_modules/rxjs/_esm5/operators/share.js":
  69333. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69334. "use strict";
  69335. /* harmony export (immutable) */ __webpack_exports__["a"] = share;
  69336. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__multicast__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/multicast.js");
  69337. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__refCount__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/refCount.js");
  69338. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subject__ = __webpack_require__("./node_modules/rxjs/_esm5/Subject.js");
  69339. /** PURE_IMPORTS_START ._multicast,._refCount,.._Subject PURE_IMPORTS_END */
  69340. function shareSubjectFactory() {
  69341. return new __WEBPACK_IMPORTED_MODULE_2__Subject__["a" /* Subject */]();
  69342. }
  69343. /**
  69344. * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
  69345. * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
  69346. * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
  69347. * This is an alias for .multicast(() => new Subject()).refCount().
  69348. *
  69349. * <img src="./img/share.png" width="100%">
  69350. *
  69351. * @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
  69352. * @method share
  69353. * @owner Observable
  69354. */
  69355. function share() {
  69356. return function (source) { return Object(__WEBPACK_IMPORTED_MODULE_1__refCount__["a" /* refCount */])()(Object(__WEBPACK_IMPORTED_MODULE_0__multicast__["a" /* multicast */])(shareSubjectFactory)(source)); };
  69357. }
  69358. ;
  69359. //# sourceMappingURL=share.js.map
  69360. /***/ }),
  69361. /***/ "./node_modules/rxjs/_esm5/symbol/iterator.js":
  69362. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69363. "use strict";
  69364. /* unused harmony export symbolIteratorPonyfill */
  69365. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return iterator; });
  69366. /* unused harmony export $$iterator */
  69367. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
  69368. /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
  69369. function symbolIteratorPonyfill(root) {
  69370. var Symbol = root.Symbol;
  69371. if (typeof Symbol === 'function') {
  69372. if (!Symbol.iterator) {
  69373. Symbol.iterator = Symbol('iterator polyfill');
  69374. }
  69375. return Symbol.iterator;
  69376. }
  69377. else {
  69378. // [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)
  69379. var Set_1 = root.Set;
  69380. if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {
  69381. return '@@iterator';
  69382. }
  69383. var Map_1 = root.Map;
  69384. // required for compatability with es6-shim
  69385. if (Map_1) {
  69386. var keys = Object.getOwnPropertyNames(Map_1.prototype);
  69387. for (var i = 0; i < keys.length; ++i) {
  69388. var key = keys[i];
  69389. // according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.
  69390. if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {
  69391. return key;
  69392. }
  69393. }
  69394. }
  69395. return '@@iterator';
  69396. }
  69397. }
  69398. var iterator = /*@__PURE__*/ symbolIteratorPonyfill(__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */]);
  69399. /**
  69400. * @deprecated use iterator instead
  69401. */
  69402. var $$iterator = iterator;
  69403. //# sourceMappingURL=iterator.js.map
  69404. /***/ }),
  69405. /***/ "./node_modules/rxjs/_esm5/symbol/observable.js":
  69406. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69407. "use strict";
  69408. /* unused harmony export getSymbolObservable */
  69409. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return observable; });
  69410. /* unused harmony export $$observable */
  69411. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
  69412. /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
  69413. function getSymbolObservable(context) {
  69414. var $$observable;
  69415. var Symbol = context.Symbol;
  69416. if (typeof Symbol === 'function') {
  69417. if (Symbol.observable) {
  69418. $$observable = Symbol.observable;
  69419. }
  69420. else {
  69421. $$observable = Symbol('observable');
  69422. Symbol.observable = $$observable;
  69423. }
  69424. }
  69425. else {
  69426. $$observable = '@@observable';
  69427. }
  69428. return $$observable;
  69429. }
  69430. var observable = /*@__PURE__*/ getSymbolObservable(__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */]);
  69431. /**
  69432. * @deprecated use observable instead
  69433. */
  69434. var $$observable = observable;
  69435. //# sourceMappingURL=observable.js.map
  69436. /***/ }),
  69437. /***/ "./node_modules/rxjs/_esm5/symbol/rxSubscriber.js":
  69438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69439. "use strict";
  69440. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return rxSubscriber; });
  69441. /* unused harmony export $$rxSubscriber */
  69442. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
  69443. /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
  69444. var Symbol = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Symbol;
  69445. var rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?
  69446. /*@__PURE__*/ Symbol.for('rxSubscriber') : '@@rxSubscriber';
  69447. /**
  69448. * @deprecated use rxSubscriber instead
  69449. */
  69450. var $$rxSubscriber = rxSubscriber;
  69451. //# sourceMappingURL=rxSubscriber.js.map
  69452. /***/ }),
  69453. /***/ "./node_modules/rxjs/_esm5/util/ObjectUnsubscribedError.js":
  69454. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69455. "use strict";
  69456. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ObjectUnsubscribedError; });
  69457. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69458. var __extends = (this && this.__extends) || function (d, b) {
  69459. for (var p in b)
  69460. if (b.hasOwnProperty(p))
  69461. d[p] = b[p];
  69462. function __() { this.constructor = d; }
  69463. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  69464. };
  69465. /**
  69466. * An error thrown when an action is invalid because the object has been
  69467. * unsubscribed.
  69468. *
  69469. * @see {@link Subject}
  69470. * @see {@link BehaviorSubject}
  69471. *
  69472. * @class ObjectUnsubscribedError
  69473. */
  69474. var ObjectUnsubscribedError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  69475. __extends(ObjectUnsubscribedError, _super);
  69476. function ObjectUnsubscribedError() {
  69477. var err = _super.call(this, 'object unsubscribed');
  69478. this.name = err.name = 'ObjectUnsubscribedError';
  69479. this.stack = err.stack;
  69480. this.message = err.message;
  69481. }
  69482. return ObjectUnsubscribedError;
  69483. }(Error));
  69484. //# sourceMappingURL=ObjectUnsubscribedError.js.map
  69485. /***/ }),
  69486. /***/ "./node_modules/rxjs/_esm5/util/UnsubscriptionError.js":
  69487. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69488. "use strict";
  69489. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnsubscriptionError; });
  69490. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69491. var __extends = (this && this.__extends) || function (d, b) {
  69492. for (var p in b)
  69493. if (b.hasOwnProperty(p))
  69494. d[p] = b[p];
  69495. function __() { this.constructor = d; }
  69496. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  69497. };
  69498. /**
  69499. * An error thrown when one or more errors have occurred during the
  69500. * `unsubscribe` of a {@link Subscription}.
  69501. */
  69502. var UnsubscriptionError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  69503. __extends(UnsubscriptionError, _super);
  69504. function UnsubscriptionError(errors) {
  69505. _super.call(this);
  69506. this.errors = errors;
  69507. var err = Error.call(this, errors ?
  69508. errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : '');
  69509. this.name = err.name = 'UnsubscriptionError';
  69510. this.stack = err.stack;
  69511. this.message = err.message;
  69512. }
  69513. return UnsubscriptionError;
  69514. }(Error));
  69515. //# sourceMappingURL=UnsubscriptionError.js.map
  69516. /***/ }),
  69517. /***/ "./node_modules/rxjs/_esm5/util/errorObject.js":
  69518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69519. "use strict";
  69520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return errorObject; });
  69521. // typeof any so that it we don't have to cast when comparing a result to the error object
  69522. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69523. var errorObject = { e: {} };
  69524. //# sourceMappingURL=errorObject.js.map
  69525. /***/ }),
  69526. /***/ "./node_modules/rxjs/_esm5/util/identity.js":
  69527. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69528. "use strict";
  69529. /* harmony export (immutable) */ __webpack_exports__["a"] = identity;
  69530. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69531. function identity(x) {
  69532. return x;
  69533. }
  69534. //# sourceMappingURL=identity.js.map
  69535. /***/ }),
  69536. /***/ "./node_modules/rxjs/_esm5/util/isArray.js":
  69537. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69538. "use strict";
  69539. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isArray; });
  69540. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69541. var isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
  69542. //# sourceMappingURL=isArray.js.map
  69543. /***/ }),
  69544. /***/ "./node_modules/rxjs/_esm5/util/isArrayLike.js":
  69545. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69546. "use strict";
  69547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isArrayLike; });
  69548. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69549. var isArrayLike = (function (x) { return x && typeof x.length === 'number'; });
  69550. //# sourceMappingURL=isArrayLike.js.map
  69551. /***/ }),
  69552. /***/ "./node_modules/rxjs/_esm5/util/isFunction.js":
  69553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69554. "use strict";
  69555. /* harmony export (immutable) */ __webpack_exports__["a"] = isFunction;
  69556. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69557. function isFunction(x) {
  69558. return typeof x === 'function';
  69559. }
  69560. //# sourceMappingURL=isFunction.js.map
  69561. /***/ }),
  69562. /***/ "./node_modules/rxjs/_esm5/util/isObject.js":
  69563. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69564. "use strict";
  69565. /* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
  69566. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69567. function isObject(x) {
  69568. return x != null && typeof x === 'object';
  69569. }
  69570. //# sourceMappingURL=isObject.js.map
  69571. /***/ }),
  69572. /***/ "./node_modules/rxjs/_esm5/util/isPromise.js":
  69573. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69574. "use strict";
  69575. /* harmony export (immutable) */ __webpack_exports__["a"] = isPromise;
  69576. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69577. function isPromise(value) {
  69578. return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
  69579. }
  69580. //# sourceMappingURL=isPromise.js.map
  69581. /***/ }),
  69582. /***/ "./node_modules/rxjs/_esm5/util/isScheduler.js":
  69583. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69584. "use strict";
  69585. /* harmony export (immutable) */ __webpack_exports__["a"] = isScheduler;
  69586. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69587. function isScheduler(value) {
  69588. return value && typeof value.schedule === 'function';
  69589. }
  69590. //# sourceMappingURL=isScheduler.js.map
  69591. /***/ }),
  69592. /***/ "./node_modules/rxjs/_esm5/util/noop.js":
  69593. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69594. "use strict";
  69595. /* harmony export (immutable) */ __webpack_exports__["a"] = noop;
  69596. /* tslint:disable:no-empty */
  69597. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69598. function noop() { }
  69599. //# sourceMappingURL=noop.js.map
  69600. /***/ }),
  69601. /***/ "./node_modules/rxjs/_esm5/util/pipe.js":
  69602. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69603. "use strict";
  69604. /* unused harmony export pipe */
  69605. /* harmony export (immutable) */ __webpack_exports__["a"] = pipeFromArray;
  69606. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop__ = __webpack_require__("./node_modules/rxjs/_esm5/util/noop.js");
  69607. /** PURE_IMPORTS_START ._noop PURE_IMPORTS_END */
  69608. /* tslint:enable:max-line-length */
  69609. function pipe() {
  69610. var fns = [];
  69611. for (var _i = 0; _i < arguments.length; _i++) {
  69612. fns[_i - 0] = arguments[_i];
  69613. }
  69614. return pipeFromArray(fns);
  69615. }
  69616. /* @internal */
  69617. function pipeFromArray(fns) {
  69618. if (!fns) {
  69619. return __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* noop */];
  69620. }
  69621. if (fns.length === 1) {
  69622. return fns[0];
  69623. }
  69624. return function piped(input) {
  69625. return fns.reduce(function (prev, fn) { return fn(prev); }, input);
  69626. };
  69627. }
  69628. //# sourceMappingURL=pipe.js.map
  69629. /***/ }),
  69630. /***/ "./node_modules/rxjs/_esm5/util/root.js":
  69631. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69632. "use strict";
  69633. /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _root; });
  69634. // CommonJS / Node have global context exposed as "global" variable.
  69635. // We don't want to include the whole node.d.ts this this compilation unit so we'll just fake
  69636. // the global "global" var for now.
  69637. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69638. var __window = typeof window !== 'undefined' && window;
  69639. var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
  69640. self instanceof WorkerGlobalScope && self;
  69641. var __global = typeof global !== 'undefined' && global;
  69642. var _root = __window || __global || __self;
  69643. // Workaround Closure Compiler restriction: The body of a goog.module cannot use throw.
  69644. // This is needed when used with angular/tsickle which inserts a goog.module statement.
  69645. // Wrap in IIFE
  69646. /*@__PURE__*/ (function () {
  69647. if (!_root) {
  69648. throw new Error('RxJS could not find any global context (window, self, global)');
  69649. }
  69650. })();
  69651. //# sourceMappingURL=root.js.map
  69652. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js")))
  69653. /***/ }),
  69654. /***/ "./node_modules/rxjs/_esm5/util/subscribeToResult.js":
  69655. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69656. "use strict";
  69657. /* harmony export (immutable) */ __webpack_exports__["a"] = subscribeToResult;
  69658. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
  69659. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isArrayLike.js");
  69660. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isPromise__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isPromise.js");
  69661. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isObject.js");
  69662. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
  69663. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_iterator__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/iterator.js");
  69664. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/InnerSubscriber.js");
  69665. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__symbol_observable__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/observable.js");
  69666. /** PURE_IMPORTS_START ._root,._isArrayLike,._isPromise,._isObject,.._Observable,.._symbol_iterator,.._InnerSubscriber,.._symbol_observable PURE_IMPORTS_END */
  69667. function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
  69668. var destination = new __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex);
  69669. if (destination.closed) {
  69670. return null;
  69671. }
  69672. if (result instanceof __WEBPACK_IMPORTED_MODULE_4__Observable__["a" /* Observable */]) {
  69673. if (result._isScalar) {
  69674. destination.next(result.value);
  69675. destination.complete();
  69676. return null;
  69677. }
  69678. else {
  69679. destination.syncErrorThrowable = true;
  69680. return result.subscribe(destination);
  69681. }
  69682. }
  69683. else if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike__["a" /* isArrayLike */])(result)) {
  69684. for (var i = 0, len = result.length; i < len && !destination.closed; i++) {
  69685. destination.next(result[i]);
  69686. }
  69687. if (!destination.closed) {
  69688. destination.complete();
  69689. }
  69690. }
  69691. else if (Object(__WEBPACK_IMPORTED_MODULE_2__isPromise__["a" /* isPromise */])(result)) {
  69692. result.then(function (value) {
  69693. if (!destination.closed) {
  69694. destination.next(value);
  69695. destination.complete();
  69696. }
  69697. }, function (err) { return destination.error(err); })
  69698. .then(null, function (err) {
  69699. // Escaping the Promise trap: globally throw unhandled errors
  69700. __WEBPACK_IMPORTED_MODULE_0__root__["a" /* root */].setTimeout(function () { throw err; });
  69701. });
  69702. return destination;
  69703. }
  69704. else if (result && typeof result[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]] === 'function') {
  69705. var iterator = result[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]]();
  69706. do {
  69707. var item = iterator.next();
  69708. if (item.done) {
  69709. destination.complete();
  69710. break;
  69711. }
  69712. destination.next(item.value);
  69713. if (destination.closed) {
  69714. break;
  69715. }
  69716. } while (true);
  69717. }
  69718. else if (result && typeof result[__WEBPACK_IMPORTED_MODULE_7__symbol_observable__["a" /* observable */]] === 'function') {
  69719. var obs = result[__WEBPACK_IMPORTED_MODULE_7__symbol_observable__["a" /* observable */]]();
  69720. if (typeof obs.subscribe !== 'function') {
  69721. destination.error(new TypeError('Provided object does not correctly implement Symbol.observable'));
  69722. }
  69723. else {
  69724. return obs.subscribe(new __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex));
  69725. }
  69726. }
  69727. else {
  69728. var value = Object(__WEBPACK_IMPORTED_MODULE_3__isObject__["a" /* isObject */])(result) ? 'an invalid object' : "'" + result + "'";
  69729. var msg = ("You provided " + value + " where a stream was expected.")
  69730. + ' You can provide an Observable, Promise, Array, or Iterable.';
  69731. destination.error(new TypeError(msg));
  69732. }
  69733. return null;
  69734. }
  69735. //# sourceMappingURL=subscribeToResult.js.map
  69736. /***/ }),
  69737. /***/ "./node_modules/rxjs/_esm5/util/toSubscriber.js":
  69738. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69739. "use strict";
  69740. /* harmony export (immutable) */ __webpack_exports__["a"] = toSubscriber;
  69741. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
  69742. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/rxSubscriber.js");
  69743. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__("./node_modules/rxjs/_esm5/Observer.js");
  69744. /** PURE_IMPORTS_START .._Subscriber,.._symbol_rxSubscriber,.._Observer PURE_IMPORTS_END */
  69745. function toSubscriber(nextOrObserver, error, complete) {
  69746. if (nextOrObserver) {
  69747. if (nextOrObserver instanceof __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]) {
  69748. return nextOrObserver;
  69749. }
  69750. if (nextOrObserver[__WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__["a" /* rxSubscriber */]]) {
  69751. return nextOrObserver[__WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__["a" /* rxSubscriber */]]();
  69752. }
  69753. }
  69754. if (!nextOrObserver && !error && !complete) {
  69755. return new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](__WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]);
  69756. }
  69757. return new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](nextOrObserver, error, complete);
  69758. }
  69759. //# sourceMappingURL=toSubscriber.js.map
  69760. /***/ }),
  69761. /***/ "./node_modules/rxjs/_esm5/util/tryCatch.js":
  69762. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69763. "use strict";
  69764. /* harmony export (immutable) */ __webpack_exports__["a"] = tryCatch;
  69765. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__errorObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/errorObject.js");
  69766. /** PURE_IMPORTS_START ._errorObject PURE_IMPORTS_END */
  69767. var tryCatchTarget;
  69768. function tryCatcher() {
  69769. try {
  69770. return tryCatchTarget.apply(this, arguments);
  69771. }
  69772. catch (e) {
  69773. __WEBPACK_IMPORTED_MODULE_0__errorObject__["a" /* errorObject */].e = e;
  69774. return __WEBPACK_IMPORTED_MODULE_0__errorObject__["a" /* errorObject */];
  69775. }
  69776. }
  69777. function tryCatch(fn) {
  69778. tryCatchTarget = fn;
  69779. return tryCatcher;
  69780. }
  69781. ;
  69782. //# sourceMappingURL=tryCatch.js.map
  69783. /***/ }),
  69784. /***/ "./node_modules/tslib/tslib.es6.js":
  69785. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69786. "use strict";
  69787. /* harmony export (immutable) */ __webpack_exports__["b"] = __extends;
  69788. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __assign; });
  69789. /* unused harmony export __rest */
  69790. /* unused harmony export __decorate */
  69791. /* unused harmony export __param */
  69792. /* unused harmony export __metadata */
  69793. /* unused harmony export __awaiter */
  69794. /* unused harmony export __generator */
  69795. /* unused harmony export __exportStar */
  69796. /* unused harmony export __values */
  69797. /* unused harmony export __read */
  69798. /* unused harmony export __spread */
  69799. /* unused harmony export __await */
  69800. /* unused harmony export __asyncGenerator */
  69801. /* unused harmony export __asyncDelegator */
  69802. /* unused harmony export __asyncValues */
  69803. /* unused harmony export __makeTemplateObject */
  69804. /* unused harmony export __importStar */
  69805. /* unused harmony export __importDefault */
  69806. /*! *****************************************************************************
  69807. Copyright (c) Microsoft Corporation. All rights reserved.
  69808. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  69809. this file except in compliance with the License. You may obtain a copy of the
  69810. License at http://www.apache.org/licenses/LICENSE-2.0
  69811. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  69812. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  69813. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  69814. MERCHANTABLITY OR NON-INFRINGEMENT.
  69815. See the Apache Version 2.0 License for specific language governing permissions
  69816. and limitations under the License.
  69817. ***************************************************************************** */
  69818. /* global Reflect, Promise */
  69819. var extendStatics = Object.setPrototypeOf ||
  69820. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  69821. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  69822. function __extends(d, b) {
  69823. extendStatics(d, b);
  69824. function __() { this.constructor = d; }
  69825. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  69826. }
  69827. var __assign = Object.assign || function __assign(t) {
  69828. for (var s, i = 1, n = arguments.length; i < n; i++) {
  69829. s = arguments[i];
  69830. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  69831. }
  69832. return t;
  69833. }
  69834. function __rest(s, e) {
  69835. var t = {};
  69836. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  69837. t[p] = s[p];
  69838. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  69839. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
  69840. t[p[i]] = s[p[i]];
  69841. return t;
  69842. }
  69843. function __decorate(decorators, target, key, desc) {
  69844. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  69845. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  69846. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  69847. return c > 3 && r && Object.defineProperty(target, key, r), r;
  69848. }
  69849. function __param(paramIndex, decorator) {
  69850. return function (target, key) { decorator(target, key, paramIndex); }
  69851. }
  69852. function __metadata(metadataKey, metadataValue) {
  69853. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  69854. }
  69855. function __awaiter(thisArg, _arguments, P, generator) {
  69856. return new (P || (P = Promise))(function (resolve, reject) {
  69857. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  69858. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  69859. function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
  69860. step((generator = generator.apply(thisArg, _arguments || [])).next());
  69861. });
  69862. }
  69863. function __generator(thisArg, body) {
  69864. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  69865. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  69866. function verb(n) { return function (v) { return step([n, v]); }; }
  69867. function step(op) {
  69868. if (f) throw new TypeError("Generator is already executing.");
  69869. while (_) try {
  69870. if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
  69871. if (y = 0, t) op = [0, t.value];
  69872. switch (op[0]) {
  69873. case 0: case 1: t = op; break;
  69874. case 4: _.label++; return { value: op[1], done: false };
  69875. case 5: _.label++; y = op[1]; op = [0]; continue;
  69876. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  69877. default:
  69878. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  69879. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  69880. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  69881. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  69882. if (t[2]) _.ops.pop();
  69883. _.trys.pop(); continue;
  69884. }
  69885. op = body.call(thisArg, _);
  69886. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  69887. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  69888. }
  69889. }
  69890. function __exportStar(m, exports) {
  69891. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  69892. }
  69893. function __values(o) {
  69894. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  69895. if (m) return m.call(o);
  69896. return {
  69897. next: function () {
  69898. if (o && i >= o.length) o = void 0;
  69899. return { value: o && o[i++], done: !o };
  69900. }
  69901. };
  69902. }
  69903. function __read(o, n) {
  69904. var m = typeof Symbol === "function" && o[Symbol.iterator];
  69905. if (!m) return o;
  69906. var i = m.call(o), r, ar = [], e;
  69907. try {
  69908. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  69909. }
  69910. catch (error) { e = { error: error }; }
  69911. finally {
  69912. try {
  69913. if (r && !r.done && (m = i["return"])) m.call(i);
  69914. }
  69915. finally { if (e) throw e.error; }
  69916. }
  69917. return ar;
  69918. }
  69919. function __spread() {
  69920. for (var ar = [], i = 0; i < arguments.length; i++)
  69921. ar = ar.concat(__read(arguments[i]));
  69922. return ar;
  69923. }
  69924. function __await(v) {
  69925. return this instanceof __await ? (this.v = v, this) : new __await(v);
  69926. }
  69927. function __asyncGenerator(thisArg, _arguments, generator) {
  69928. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  69929. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  69930. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  69931. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  69932. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  69933. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  69934. function fulfill(value) { resume("next", value); }
  69935. function reject(value) { resume("throw", value); }
  69936. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  69937. }
  69938. function __asyncDelegator(o) {
  69939. var i, p;
  69940. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  69941. function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; }
  69942. }
  69943. function __asyncValues(o) {
  69944. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  69945. var m = o[Symbol.asyncIterator];
  69946. return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
  69947. }
  69948. function __makeTemplateObject(cooked, raw) {
  69949. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  69950. return cooked;
  69951. };
  69952. function __importStar(mod) {
  69953. if (mod && mod.__esModule) return mod;
  69954. var result = {};
  69955. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  69956. result.default = mod;
  69957. return result;
  69958. }
  69959. function __importDefault(mod) {
  69960. return (mod && mod.__esModule) ? mod : { default: mod };
  69961. }
  69962. /***/ }),
  69963. /***/ "./node_modules/webpack/buildin/global.js":
  69964. /***/ (function(module, exports) {
  69965. var g;
  69966. // This works in non-strict mode
  69967. g = (function() {
  69968. return this;
  69969. })();
  69970. try {
  69971. // This works if eval is allowed (see CSP)
  69972. g = g || Function("return this")() || (1,eval)("this");
  69973. } catch(e) {
  69974. // This works if the window reference is available
  69975. if(typeof window === "object")
  69976. g = window;
  69977. }
  69978. // g can still be undefined, but nothing to do about it...
  69979. // We return undefined, instead of nothing here, so it's
  69980. // easier to handle this case. if(!global) { ...}
  69981. module.exports = g;
  69982. /***/ })
  69983. });
  69984. //# sourceMappingURL=vendor.bundle.js.map